wxruby3 0.9.0.pre.beta.14 → 0.9.0.pre.rc.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (164) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -0
  3. data/README.md +47 -4
  4. data/assets/hello_button.png +0 -0
  5. data/assets/hello_button_clicked.png +0 -0
  6. data/assets/hello_world.png +0 -0
  7. data/assets/repo-social-preview.png +0 -0
  8. data/ext/wxruby3/include/wxruby-runtime.h +1 -0
  9. data/ext/wxruby3/swig/memory_management.i +6 -10
  10. data/ext/wxruby3/swig/wx.i +17 -6
  11. data/lib/wx/core/art_locator.rb +2 -2
  12. data/lib/wx/core/artprovider.rb +2 -2
  13. data/lib/wx/core/bitmap.rb +6 -5
  14. data/lib/wx/core/bitmap_combobox.rb +34 -0
  15. data/lib/wx/core/controlwithitems.rb +52 -14
  16. data/lib/wx/core/cursor.rb +1 -1
  17. data/lib/wx/core/dc.rb +0 -20
  18. data/lib/wx/core/event_blocker.rb +14 -0
  19. data/lib/wx/core/evthandler.rb +36 -0
  20. data/lib/wx/core/find_replace_dialog.rb +24 -0
  21. data/lib/wx/core/icon.rb +1 -1
  22. data/lib/wx/core/image.rb +1 -1
  23. data/lib/wx/core/paintdc.rb +8 -0
  24. data/lib/wx/core/text_entry.rb +15 -0
  25. data/lib/wx/core/v_list_box.rb +13 -0
  26. data/lib/wx/core/window.rb +1 -1
  27. data/lib/wx/doc/busy_info.rb +21 -0
  28. data/lib/wx/doc/client_dc.rb +28 -0
  29. data/lib/wx/doc/controlwithitems.rb +11 -0
  30. data/lib/wx/doc/dc.rb +0 -14
  31. data/lib/wx/doc/event_blocker.rb +27 -0
  32. data/lib/wx/doc/evthandler.rb +4 -0
  33. data/lib/wx/doc/extra/02_lifecycles.md +49 -0
  34. data/lib/wx/doc/extra/10_art.md +1 -1
  35. data/lib/wx/doc/extra/11_drawing_and_dc.md +62 -0
  36. data/lib/wx/doc/memory_dc.rb +75 -0
  37. data/lib/wx/doc/mirror_dc.rb +16 -0
  38. data/lib/wx/doc/prt/printer_dc.rb +26 -0
  39. data/lib/wx/doc/screen_dc.rb +10 -6
  40. data/lib/wx/doc/svg_file_dc.rb +20 -0
  41. data/lib/wx/doc/v_list_box.rb +9 -0
  42. data/lib/wx/doc/window_disabler.rb +10 -0
  43. data/lib/wx/html/keyword_defs.rb +6 -7
  44. data/lib/wx/html/require.rb +1 -0
  45. data/lib/wx/html/simple_html_listbox.rb +105 -0
  46. data/lib/wx/keyword_defs.rb +7 -0
  47. data/lib/wx/version.rb +1 -1
  48. data/lib/wx/wxruby/cmd/test.rb +1 -1
  49. data/rakelib/install.rb +3 -1
  50. data/rakelib/lib/core/mapping.rb +5 -5
  51. data/rakelib/lib/core/spec.rb +7 -3
  52. data/rakelib/lib/core/spec_helper.rb +9 -1
  53. data/rakelib/lib/director/accelerator.rb +1 -1
  54. data/rakelib/lib/director/app.rb +25 -3
  55. data/rakelib/lib/director/art_provider.rb +5 -1
  56. data/rakelib/lib/director/aui_pane_info.rb +1 -1
  57. data/rakelib/lib/director/aui_tab_ctrl.rb +1 -1
  58. data/rakelib/lib/director/bitmap.rb +2 -1
  59. data/rakelib/lib/director/bitmap_combobox.rb +32 -0
  60. data/rakelib/lib/director/brush.rb +1 -0
  61. data/rakelib/lib/director/busy_info.rb +1 -1
  62. data/rakelib/lib/director/choice.rb +1 -0
  63. data/rakelib/lib/director/clipboard.rb +1 -1
  64. data/rakelib/lib/director/colour.rb +1 -0
  65. data/rakelib/lib/director/colour_picker_ctrl.rb +1 -1
  66. data/rakelib/lib/director/combobox.rb +1 -2
  67. data/rakelib/lib/director/ctrl_with_items.rb +3 -0
  68. data/rakelib/lib/director/cursor.rb +1 -0
  69. data/rakelib/lib/director/data_object.rb +5 -7
  70. data/rakelib/lib/director/dc.rb +5 -1
  71. data/rakelib/lib/director/defs.rb +3 -0
  72. data/rakelib/lib/director/derived_dc.rb +278 -27
  73. data/rakelib/lib/director/dialog.rb +4 -1
  74. data/rakelib/lib/director/dir_picker_ctrl.rb +1 -1
  75. data/rakelib/lib/director/event.rb +3 -3
  76. data/rakelib/lib/director/event_blocker.rb +41 -0
  77. data/rakelib/lib/director/event_filter.rb +20 -0
  78. data/rakelib/lib/director/event_handler.rb +29 -2
  79. data/rakelib/lib/director/file_picker_ctrl.rb +1 -1
  80. data/rakelib/lib/director/find_replace_data.rb +1 -0
  81. data/rakelib/lib/director/font.rb +2 -1
  82. data/rakelib/lib/director/font_data.rb +1 -0
  83. data/rakelib/lib/director/font_picker_ctrl.rb +1 -1
  84. data/rakelib/lib/director/gdi_object.rb +1 -0
  85. data/rakelib/lib/director/graphics_context.rb +6 -6
  86. data/rakelib/lib/director/grid_table_message.rb +1 -1
  87. data/rakelib/lib/director/html_cell.rb +1 -1
  88. data/rakelib/lib/director/html_data_object.rb +5 -7
  89. data/rakelib/lib/director/html_listbox.rb +65 -1
  90. data/rakelib/lib/director/icon.rb +2 -0
  91. data/rakelib/lib/director/listbox.rb +1 -0
  92. data/rakelib/lib/director/locale.rb +2 -1
  93. data/rakelib/lib/director/palette.rb +1 -0
  94. data/rakelib/lib/director/pen.rb +2 -1
  95. data/rakelib/lib/director/pgproperties.rb +1 -1
  96. data/rakelib/lib/director/pgproperty.rb +1 -1
  97. data/rakelib/lib/director/pgvalidation_info.rb +1 -1
  98. data/rakelib/lib/director/platform_info.rb +1 -1
  99. data/rakelib/lib/director/print_data.rb +1 -1
  100. data/rakelib/lib/director/property_grid_interface.rb +1 -1
  101. data/rakelib/lib/director/property_grid_page_state.rb +1 -1
  102. data/rakelib/lib/director/region.rb +1 -0
  103. data/rakelib/lib/director/ribbon_art_provider.rb +1 -1
  104. data/rakelib/lib/director/richtext_buffer_data_object.rb +5 -7
  105. data/rakelib/lib/director/richtext_header_footer_data.rb +1 -1
  106. data/rakelib/lib/director/searchctrl.rb +24 -0
  107. data/rakelib/lib/director/sizer.rb +2 -2
  108. data/rakelib/lib/director/styled_text_ctrl.rb +2 -0
  109. data/rakelib/lib/director/text_entry.rb +2 -2
  110. data/rakelib/lib/director/tree_ctrl.rb +6 -3
  111. data/rakelib/lib/director/uiaction_simulator.rb +20 -0
  112. data/rakelib/lib/director/variant.rb +1 -1
  113. data/rakelib/lib/director/vlistbox.rb +25 -0
  114. data/rakelib/lib/director/window.rb +0 -6
  115. data/rakelib/lib/director/with_images.rb +1 -1
  116. data/rakelib/lib/director/xml_node.rb +1 -1
  117. data/rakelib/lib/extractor/function.rb +5 -3
  118. data/rakelib/lib/generate/doc/about_dialog_info.yaml +46 -0
  119. data/rakelib/lib/generate/doc/accelerator.yaml +21 -0
  120. data/rakelib/lib/generate/doc/art_provider.yaml +35 -0
  121. data/rakelib/lib/generate/doc/bitmap.yaml +37 -0
  122. data/rakelib/lib/generate/doc/box_sizer.yaml +15 -0
  123. data/rakelib/lib/generate/doc/busy_info.yaml +74 -0
  124. data/rakelib/lib/generate/doc/client_dc.yaml +19 -0
  125. data/rakelib/lib/generate/doc/clipboard.yaml +43 -0
  126. data/rakelib/lib/generate/doc/collapsible_pane.yaml +21 -0
  127. data/rakelib/lib/generate/doc/colour_dialog.yaml +32 -0
  128. data/rakelib/lib/generate/doc/control.yaml +46 -0
  129. data/rakelib/lib/generate/doc/cursor.yaml +40 -0
  130. data/rakelib/lib/generate/doc/data_object.yaml +55 -0
  131. data/rakelib/lib/generate/doc/dc.yaml +14 -0
  132. data/rakelib/lib/generate/doc/dialog.yaml +36 -0
  133. data/rakelib/lib/generate/doc/dir_dialog.yaml +25 -0
  134. data/rakelib/lib/generate/doc/events.yaml +152 -0
  135. data/rakelib/lib/generate/doc/evt_handler.yaml +63 -0
  136. data/rakelib/lib/generate/doc.rb +76 -13
  137. data/rakelib/lib/generate/interface.rb +11 -0
  138. data/rakelib/lib/specs/interfaces.rb +5 -4
  139. data/rakelib/lib/swig_runner.rb +3 -3
  140. data/rakelib/lib/typemap/common.rb +15 -3
  141. data/rakelib/lib/util/string.rb +1 -0
  142. data/rakelib/yard/yard/relative_markdown_links.rb +5 -1
  143. data/samples/bigdemo/wxArtProvider.rbw +5 -4
  144. data/samples/controls/controls.rb +2 -2
  145. data/samples/controls/htlbox.rb +411 -0
  146. data/samples/controls/tn_htlbox.png +0 -0
  147. data/samples/drawing/graphics_drawing.rb +1 -2
  148. data/samples/drawing/{svgtest.rb → image_prt.rb} +49 -18
  149. data/samples/drawing/tn_image_prt.png +0 -0
  150. data/samples/propgrid/propgrid.rb +23 -21
  151. data/samples/ribbon/ribbon.rb +47 -46
  152. data/tests/lib/wxapp_runner.rb +3 -3
  153. data/tests/lib/wxframe_runner.rb +59 -0
  154. data/tests/test_app_event_filter.rb +74 -0
  155. data/tests/test_art_provider.rb +52 -0
  156. data/tests/test_clipboard.rb +2 -1
  157. data/tests/test_event_handling.rb +199 -16
  158. data/tests/test_events.rb +4 -11
  159. data/tests/test_gdi_object.rb +161 -0
  160. data/tests/test_intl.rb +11 -14
  161. data/tests/test_item_data.rb +33 -1
  162. data/tests/test_std_controls.rb +147 -0
  163. metadata +56 -4
  164. data/samples/drawing/tn_svgtest.png +0 -0
@@ -12,14 +12,16 @@ module WXRuby3
12
12
  def setup
13
13
  super
14
14
  spec.disable_proxies
15
- # these static creators require a running app
16
- spec.require_app 'wxGraphicsContext::Create',
17
- 'wxGraphicsContext::CreateFromUnknownDC'
15
+ # do not track GraphicContext objects as that causes problems probably for similar
16
+ # reasons as for DC objects
17
+ spec.gc_as_untracked
18
+ # ignore all these; wxRuby only supports the ::draw_on methods
18
19
  spec.ignore 'wxGraphicsContext::CreateFromNative',
19
20
  'wxGraphicsContext::CreateFromNativeWindow',
20
21
  'wxGraphicsContext::CreateFromNativeHDC',
22
+ 'wxGraphicsContext::CreateFromUnknownDC',
21
23
  'wxGraphicsContext::GetNativeContext',
22
- 'wxGraphicsContext::Create(const wxEnhMetaFileDC &)'
24
+ 'wxGraphicsContext::Create'
23
25
  # type mappings
24
26
  # Typemap to fix GraphicsContext#get_text_extent
25
27
  spec.map_apply 'double *OUTPUT' => [ 'wxDouble* width', 'wxDouble* height',
@@ -135,8 +137,6 @@ module WXRuby3
135
137
  }
136
138
  __CODE
137
139
  end
138
- spec.new_object 'wxGraphicsContext::Create',
139
- 'wxGraphicsContext::CreateFromUnknownDC'
140
140
  # add convenience method providing efficient gc memory management
141
141
  spec.add_extend_code 'wxGraphicsContext', <<~__HEREDOC
142
142
  static VALUE draw_on(wxWindow* win)
@@ -11,7 +11,7 @@ module WXRuby3
11
11
 
12
12
  def setup
13
13
  super
14
- spec.gc_as_temporary
14
+ spec.gc_as_untracked
15
15
  end
16
16
  end # class GridTableMessage
17
17
 
@@ -20,7 +20,7 @@ module WXRuby3
20
20
  spec.make_abstract 'wxHtmlCell'
21
21
  spec.make_abstract 'wxHtmlLinkInfo'
22
22
  spec.make_abstract 'wxHtmlContainerCell'
23
- spec.gc_as_temporary 'wxHtmlLinkInfo' # no tracking
23
+ spec.gc_as_untracked 'wxHtmlLinkInfo' # no tracking
24
24
  spec.ignore 'wxHtmlCell::Find'
25
25
  # not useful for wxRuby as we do not support customizing these
26
26
  spec.ignore 'wxHtmlCell::AdjustPagebreak',
@@ -20,13 +20,11 @@ module WXRuby3
20
20
  # we only allow Ruby derivatives from wxDataObject but not of any of the C++ implemented
21
21
  # specializations
22
22
  spec.no_proxy 'wxHTMLDataObject'
23
- spec.add_swig_code <<~__HEREDOC
24
- // SWIG gets confused and doesn't realise that various virtual methods
25
- // from wxDataObject are implemented fully in this subclass, and so,
26
- // believing it to be abstract doesn't provide an allocator for this
27
- // class. This undocumented feature overrides this.
28
- %feature("notabstract") wxHTMLDataObject;
29
- __HEREDOC
23
+ # SWIG gets confused and doesn't realise that various virtual methods
24
+ # from wxDataObject are implemented fully in this subclass, and so,
25
+ # believing it to be abstract doesn't provide an allocator for this
26
+ # class. This overrides this.
27
+ spec.make_concrete 'wxHTMLDataObject'
30
28
 
31
29
  end
32
30
 
@@ -12,7 +12,7 @@ module WXRuby3
12
12
  class HtmlListBox < Window
13
13
 
14
14
  def setup
15
- spec.items << 'wxSimpleHtmlListBox'
15
+ spec.items << 'wxSimpleHtmlListBox' << 'wxItemContainer'
16
16
  super
17
17
  spec.override_inheritance_chain('wxHtmlListBox', %w[wxVListBox wxVScrolledWindow wxPanel wxWindow wxEvtHandler wxObject])
18
18
  spec.make_abstract 'wxHtmlListBox'
@@ -44,8 +44,72 @@ module WXRuby3
44
44
  $self->GetFileSystem().ChangePathTo(location, is_dir);
45
45
  }
46
46
  __HEREDOC
47
+ # make sure protected methods are included
48
+ spec.regard 'wxHtmlListBox::OnGetItem',
49
+ 'wxHtmlListBox::OnGetItemMarkup',
50
+ 'wxHtmlListBox::GetSelectedTextColour',
51
+ 'wxHtmlListBox::GetSelectedTextBgColour',
52
+ 'wxHtmlListBox::OnLinkClicked'
53
+ # add missing protected overloads
54
+ spec.extend_interface 'wxHtmlListBox',
55
+ 'virtual void OnDrawItem(wxDC &dc, const wxRect &rect, size_t n) const',
56
+ 'virtual wxCoord OnMeasureItem(size_t n) const',
57
+ 'virtual void OnDrawBackground(wxDC &dc, const wxRect &rect, size_t n) const',
58
+ 'virtual void OnDrawSeparator(wxDC& dc, wxRect& rect, size_t n) const',
59
+ visibility: 'protected'
60
+
47
61
  # override inheritance chain
48
62
  spec.override_inheritance_chain('wxSimpleHtmlListBox', %w[wxHtmlListBox wxVListBox wxVScrolledWindow wxPanel wxWindow wxEvtHandler wxObject])
63
+ spec.fold_bases('wxSimpleHtmlListBox' => %w[wxItemContainer])
64
+ # override SWIG's confusion
65
+ spec.make_concrete 'wxSimpleHtmlListBox'
66
+ # not useful overload
67
+ spec.ignore 'wxSimpleHtmlListBox::wxSimpleHtmlListBox(wxWindow *, wxWindowID, const wxPoint &, const wxSize &, int, const wxString[], long, const wxValidator &, const wxString &)'
68
+ # add missing overloads
69
+ spec.extend_interface 'wxSimpleHtmlListBox',
70
+ 'virtual wxString GetString(unsigned int n) const',
71
+ 'virtual void SetString(unsigned int n, const wxString &string)'
72
+ spec.ignore([ 'wxItemContainer::Append(const wxString &, wxClientData *)',
73
+ 'wxItemContainer::Append(const std::vector< wxString > &)',
74
+ 'wxItemContainer::Append(const wxArrayString &, wxClientData **)',
75
+ 'wxItemContainer::Append(unsigned int, const wxString *)',
76
+ 'wxItemContainer::Append(unsigned int, const wxString *, void **)',
77
+ 'wxItemContainer::Append(unsigned int, const wxString *, wxClientData **)',
78
+ 'wxItemContainer::Insert(const wxString &, unsigned int, wxClientData *)',
79
+ 'wxItemContainer::Insert(const std::vector< wxString > &)',
80
+ 'wxItemContainer::Insert(const wxArrayString &, unsigned int, wxClientData **)',
81
+ 'wxItemContainer::Insert(unsigned int, const wxString *, unsigned int)',
82
+ 'wxItemContainer::Insert(unsigned int, const wxString *, unsigned int, void **)',
83
+ 'wxItemContainer::Insert(unsigned int, const wxString *, unsigned int, wxClientData **)',
84
+ 'wxItemContainer::Set(const std::vector< wxString > &)',
85
+ 'wxItemContainer::Set(const wxArrayString &, wxClientData **)',
86
+ 'wxItemContainer::Set(unsigned int, const wxString *)',
87
+ 'wxItemContainer::Set(unsigned int, const wxString *, void **)',
88
+ 'wxItemContainer::Set(unsigned int, const wxString *, wxClientData **)',
89
+ 'wxItemContainer::DetachClientObject',
90
+ 'wxItemContainer::HasClientObjectData',
91
+ 'wxItemContainer::GetClientObject',
92
+ 'wxItemContainer::SetClientObject',
93
+ 'wxItemContainer::HasClientUntypedData',
94
+ 'wxItemContainer::Clear'])
95
+ spec.ignore([ 'wxItemContainer::Append(const wxArrayString &, void **)',
96
+ 'wxItemContainer::Insert(const wxArrayString &, unsigned int, void **)',
97
+ 'wxItemContainer::Set(const wxArrayString &, void **)'], ignore_doc: false)
98
+ # for doc only
99
+ spec.map 'void** clientData' => 'Array', swig: false do
100
+ map_in code: ''
101
+ end
102
+ spec.ignore(%w[wxItemContainer::GetClientData wxItemContainer::SetClientData], ignore_doc: false) # keep docs
103
+ # Replace the old Wx definition of this method (which segfaults)
104
+ # Only need the setter as we cache data in Ruby and the getter
105
+ # therefor can be pure Ruby
106
+ spec.add_extend_code('wxSimpleHtmlListBox', <<~__HEREDOC
107
+ VALUE set_client_data(int n, VALUE item_data) {
108
+ self->SetClientData(n, (void *)item_data);
109
+ return item_data;
110
+ }
111
+ __HEREDOC
112
+ )
49
113
  end
50
114
  end # class HtmlListBox
51
115
 
@@ -13,6 +13,8 @@ module WXRuby3
13
13
 
14
14
  def setup
15
15
  spec.items << 'wxIconBundle'
16
+ spec.gc_as_untracked 'wxIcon'
17
+ spec.gc_as_untracked 'wxIconBundle'
16
18
  spec.disable_proxies
17
19
  spec.require_app 'wxIcon', 'wxIconBundle'
18
20
  # disable as there is no way to distinguish char*/[] from wxString in Ruby
@@ -23,6 +23,7 @@ module WXRuby3
23
23
  wxEvtHandler
24
24
  wxObject])
25
25
  spec.ignore('wxListBox::InsertItems(unsigned int,const wxString *,unsigned int)')
26
+ spec.ignore('wxListBox::IsSorted') # provided by ControlWithItems
26
27
  end
27
28
 
28
29
  end # class ListBox
@@ -14,7 +14,8 @@ module WXRuby3
14
14
  spec.disable_proxies
15
15
  spec.items << 'wxLanguageInfo' << 'language.h'
16
16
  spec.gc_as_object('wxLocale')
17
- spec.gc_as_temporary('wxLanguageInfo')
17
+ spec.gc_as_untracked('wxLanguageInfo')
18
+ spec.make_concrete 'wxLanguageInfo'
18
19
  spec.regard %w[
19
20
  wxLanguageInfo::Language
20
21
  wxLanguageInfo::LocaleTag
@@ -12,6 +12,7 @@ module WXRuby3
12
12
  def setup
13
13
  super
14
14
  spec.disable_proxies
15
+ spec.gc_as_untracked 'wxPalette'
15
16
  if Config.instance.wx_port == :wxQT
16
17
  # mismatched implementation which does nothing anyway
17
18
  spec.ignore 'wxPalette::wxPalette(int, const unsigned char *, const unsigned char *, const unsigned char *)'
@@ -12,7 +12,8 @@ module WXRuby3
12
12
  def setup
13
13
  super
14
14
  spec.items << 'wxPenInfo'
15
- spec.gc_as_temporary 'wxPenInfo'
15
+ spec.gc_as_untracked 'wxPenInfo'
16
+ spec.gc_as_untracked 'wxPen'
16
17
  spec.disable_proxies
17
18
  spec.add_header_code <<~__HEREDOC
18
19
  // special free funcs are needed to clean up Dashes array if it has been
@@ -26,7 +26,7 @@ module WXRuby3
26
26
  'wxEnumProperty::wxEnumProperty(const wxString &, const wxString &, const wxChar *const *, const long *, wxPGChoices *, int)'
27
27
  spec.ignore 'wxEditEnumProperty::wxEditEnumProperty(const wxString &, const wxString &, const wxChar *const *, const long *, const wxString&)',
28
28
  'wxEditEnumProperty::wxEditEnumProperty(const wxString &, const wxString &, const wxChar *const *, const long *, wxPGChoices *, const wxString&)'
29
- spec.gc_as_temporary 'wxColourPropertyValue'
29
+ spec.gc_as_untracked 'wxColourPropertyValue'
30
30
  spec.regard 'wxColourPropertyValue::m_type',
31
31
  'wxColourPropertyValue::m_colour'
32
32
  spec.regard 'wxSystemColourProperty::Init',
@@ -29,7 +29,7 @@ module WXRuby3
29
29
  'drawn_height' => 'wxPGPaintData::m_drawnHeight'
30
30
  # wxPGChoices are always returned by value and never transfer ownership
31
31
  # so we do not need tracking or special free function
32
- spec.gc_as_temporary 'wxPGChoices'
32
+ spec.gc_as_untracked 'wxPGChoices'
33
33
  # prevent exposure of wxPGChoicesData; not of any real use in wxRuby
34
34
  spec.ignore 'wxPGChoices::wxPGChoices(wxPGChoicesData*)',
35
35
  'wxPGChoices::AssignData',
@@ -12,7 +12,7 @@ module WXRuby3
12
12
  def setup
13
13
  super
14
14
  spec.items << 'propgrid/propgrid.h'
15
- spec.gc_as_temporary 'wxPGValidationInfo'
15
+ spec.gc_as_untracked 'wxPGValidationInfo'
16
16
  if Config.instance.wx_version < '3.3.0'
17
17
  spec.ignore 'wxPGVFBFlags' # not a constant but a rather a clumsy typedef
18
18
  end
@@ -11,7 +11,7 @@ module WXRuby3
11
11
 
12
12
  def setup
13
13
  super
14
- spec.gc_as_temporary
14
+ spec.gc_as_untracked
15
15
  spec.make_abstract('wxPlatformInfo')
16
16
  spec.ignore 'wxPlatformInfo::wxPlatformInfo',
17
17
  'wxPlatformInfo::operator==',
@@ -11,7 +11,7 @@ module WXRuby3
11
11
 
12
12
  def setup
13
13
  super
14
- spec.gc_as_temporary
14
+ spec.gc_as_untracked
15
15
  spec.disable_proxies # fixed and final data structures
16
16
  spec.items << 'wxPrintDialogData' << 'wxPageSetupDialogData'
17
17
  spec.ignore 'wxPrintDialogData::SetSetupDialog' # deprecated since 2.5.4
@@ -19,7 +19,7 @@ module WXRuby3
19
19
 
20
20
  def setup
21
21
  super
22
- spec.gc_as_temporary 'wxPropertyGridInterface' # actually no GC control necessary as this is a mixin only
22
+ spec.gc_as_untracked 'wxPropertyGridInterface' # actually no GC control necessary as this is a mixin only
23
23
  # turn wxPropertyGridInterface into a mixin module
24
24
  spec.make_mixin 'wxPropertyGridInterface'
25
25
  # add typedef to work around flaky define in wxWidgets
@@ -13,7 +13,7 @@ module WXRuby3
13
13
  super
14
14
  spec.items << 'wxPropertyGridHitTestResult'
15
15
  spec.gc_never 'wxPropertyGridPageState'
16
- spec.gc_as_temporary 'wxPropertyGridHitTestResult'
16
+ spec.gc_as_untracked 'wxPropertyGridHitTestResult'
17
17
  spec.make_abstract 'wxPropertyGridPageState'
18
18
  spec.disable_proxies
19
19
  spec.ignore 'wxPropertyGridPageState::DoDelete',
@@ -15,6 +15,7 @@ module WXRuby3
15
15
  super
16
16
  spec.require_app 'wxRegion'
17
17
  spec.disable_proxies
18
+ spec.gc_as_untracked
18
19
  spec.ignore 'wxNullRegion' # does not exist in code
19
20
  spec.map_apply 'int n, wxPoint points[]' => [ 'size_t, const wxPoint *']
20
21
  end
@@ -13,7 +13,7 @@ module WXRuby3
13
13
  spec.items << 'wxRibbonPageTabInfo' << 'wxRibbonMSWArtProvider' << 'wxRibbonAUIArtProvider'
14
14
  super
15
15
  spec.gc_as_object 'wxRibbonArtProvider'
16
- spec.gc_as_temporary 'wxRibbonPageTabInfo'
16
+ spec.gc_as_untracked 'wxRibbonPageTabInfo'
17
17
  spec.suppress_warning(473,
18
18
  'wxRibbonArtProvider::Clone',
19
19
  'wxRibbonMSWArtProvider::Clone',
@@ -20,13 +20,11 @@ module WXRuby3
20
20
  # we only allow Ruby derivatives from wxDataObject but not of any of the C++ implemented
21
21
  # specializations
22
22
  spec.no_proxy 'wxRichTextBufferDataObject'
23
- spec.add_swig_code <<~__HEREDOC
24
- // SWIG gets confused and doesn't realise that various virtual methods
25
- // from wxDataObject are implemented fully in this subclass, and so,
26
- // believing it to be abstract doesn't provide an allocator for this
27
- // class. This undocumented feature overrides this.
28
- %feature("notabstract") wxRichTextBufferDataObject;
29
- __HEREDOC
23
+ # SWIG gets confused and doesn't realise that various virtual methods
24
+ # from wxDataObject are implemented fully in this subclass, and so,
25
+ # believing it to be abstract doesn't provide an allocator for this
26
+ # class. This overrides this.
27
+ spec.make_concrete 'wxRichTextBufferDataObject'
30
28
 
31
29
  # ignore overrrides (will be available through base class)
32
30
  spec.ignore 'wxRichTextBufferDataObject::GetPreferredFormat'
@@ -11,7 +11,7 @@ module WXRuby3
11
11
 
12
12
  def setup
13
13
  super
14
- spec.gc_as_temporary
14
+ spec.gc_as_untracked 'wxRichTextHeaderFooterData'
15
15
  spec.disable_proxies # fixed and final data structures
16
16
  end
17
17
  end # class RichTextHeaderFooterData
@@ -0,0 +1,24 @@
1
+ ###
2
+ # wxRuby3 wxWidgets interface director
3
+ # Copyright (c) M.J.N. Corino, The Netherlands
4
+ ###
5
+
6
+ require_relative './window'
7
+
8
+ module WXRuby3
9
+
10
+ class Director
11
+
12
+ class SearchCtrl < Window
13
+
14
+ def setup
15
+ super
16
+ # mixin TextEntry
17
+ spec.include_mixin 'wxSearchCtrl', 'Wx::TextEntry'
18
+ spec.override_inheritance_chain('wxSearchCtrl', %w[wxControl wxWindow wxEvtHandler wxObject])
19
+ end
20
+ end # class SearchCtrl
21
+
22
+ end # class Director
23
+
24
+ end # module WXRuby3
@@ -15,7 +15,7 @@ module WXRuby3
15
15
  case spec.module_name
16
16
  when 'wxSizer'
17
17
  spec.items << 'wxSizerFlags'
18
- spec.gc_as_temporary('wxSizerFlags')
18
+ spec.gc_as_untracked('wxSizerFlags')
19
19
  spec.make_abstract('wxSizer')
20
20
  spec.ignore %w[wxSizer::IsShown wxSizer::SetVirtualSizeHints]
21
21
  # cannot use these with wxRuby
@@ -44,7 +44,7 @@ module WXRuby3
44
44
  spec.suppress_warning(517, 'wxSizer')
45
45
  when 'wxGridBagSizer'
46
46
  spec.items << 'wxGBSpan' << 'wxGBPosition'
47
- spec.gc_as_temporary 'wxGBSpan', 'wxGBPosition'
47
+ spec.gc_as_untracked 'wxGBSpan', 'wxGBPosition'
48
48
  # cannot use this with wxRuby
49
49
  spec.ignore 'wxGridBagSizer::Add(wxGBSizerItem *)'
50
50
  end
@@ -14,6 +14,8 @@ module WXRuby3
14
14
  def setup
15
15
  super
16
16
  spec.override_inheritance_chain('wxStyledTextCtrl', %w[wxControl wxWindow wxEvtHandler wxObject])
17
+ # mixin TextEntry
18
+ spec.include_mixin 'wxStyledTextCtrl', 'Wx::TextEntry'
17
19
  spec.map 'int *', 'long *', as: 'Integer' do
18
20
  map_in ignore: true, temp: '$*1_ltype a', code: '$1 = &a;'
19
21
  map_argout code: <<~__CODE
@@ -12,8 +12,8 @@ module WXRuby3
12
12
  def setup
13
13
  super
14
14
  spec.items << 'wxTextCompleter' << 'wxTextCompleterSimple'
15
- spec.gc_as_temporary 'wxTextCompleter', 'wxTextCompleterSimple'
16
- spec.gc_as_temporary 'wxTextEntry' # actually no GC control necessary as this is a mixin only
15
+ spec.gc_as_untracked 'wxTextCompleter', 'wxTextCompleterSimple'
16
+ spec.gc_as_untracked 'wxTextEntry' # actually no GC control necessary as this is a mixin only
17
17
  # turn wxTextEntry into a mixin module
18
18
  spec.make_mixin 'wxTextEntry'
19
19
  spec.disown 'wxTextCompleter *completer' # managed by wxWidgets after passing in
@@ -194,10 +194,13 @@ module WXRuby3
194
194
  else // Find the top-left most item, then recurse over it and siblings
195
195
  {
196
196
  wxTreeItemId base_id = FindFirstRoot(tree_ctrl);
197
- // now do recursion
198
- RecurseOverTreeIds(tree_ctrl, base_id, *rec_func);
199
- while ((base_id = tree_ctrl->GetNextSibling(base_id)).IsOk())
197
+ if (base_id.IsOk())
198
+ {
199
+ // now do recursion
200
200
  RecurseOverTreeIds(tree_ctrl, base_id, *rec_func);
201
+ while ((base_id = tree_ctrl->GetNextSibling(base_id)).IsOk())
202
+ RecurseOverTreeIds(tree_ctrl, base_id, *rec_func);
203
+ }
201
204
  return;
202
205
  }
203
206
  }
@@ -0,0 +1,20 @@
1
+ ###
2
+ # wxRuby3 wxWidgets interface director
3
+ # Copyright (c) M.J.N. Corino, The Netherlands
4
+ ###
5
+
6
+ module WXRuby3
7
+
8
+ class Director
9
+
10
+ class UIActionSimulator < Director
11
+
12
+ def setup
13
+ super
14
+ spec.gc_as_untracked # no tracking
15
+ end
16
+ end # class UIActionSimulator
17
+
18
+ end # class Director
19
+
20
+ end # module WXRuby3
@@ -15,7 +15,7 @@ module WXRuby3
15
15
  super
16
16
  # variants are (almost) always returned by value and never transfer ownership
17
17
  # so we do not need tracking or special free function
18
- spec.gc_as_temporary 'wxVariant'
18
+ spec.gc_as_untracked 'wxVariant'
19
19
  spec.disable_proxies
20
20
  # add custom wxVariant extensions so to be
21
21
  # able to handle all PGProperty specific value types
@@ -38,6 +38,31 @@ module WXRuby3
38
38
  __HEREDOC
39
39
  # make Ruby director and wrappers use custom implementation
40
40
  spec.use_class_implementation('wxVListBox', 'wxRubyVListBox')
41
+ # make sure protected methods are included
42
+ spec.regard 'wxVListBox::OnDrawItem',
43
+ 'wxVListBox::OnMeasureItem',
44
+ 'wxVListBox::OnDrawSeparator',
45
+ 'wxVListBox::OnDrawBackground'
46
+ # ignore these very un-Ruby methods
47
+ spec.ignore 'wxVListBox::GetFirstSelected',
48
+ 'wxVListBox::GetNextSelected'
49
+ # add rubified API (finish in pure Ruby)
50
+ spec.add_extend_code 'wxVListBox', <<~__HEREDOC
51
+ VALUE each_selected()
52
+ {
53
+ VALUE rc = Qnil;
54
+ if (rb_block_given_p())
55
+ {
56
+ unsigned long cookie;
57
+ int sel = $self->GetFirstSelected(cookie);
58
+ for (; sel != wxNOT_FOUND ;sel = $self->GetNextSelected(cookie))
59
+ {
60
+ rc = rb_yield (INT2NUM(sel));
61
+ }
62
+ }
63
+ return rc;
64
+ }
65
+ __HEREDOC
41
66
  end
42
67
  end # class VListBox
43
68
 
@@ -172,8 +172,6 @@ module WXRuby3
172
172
  swig_type_info* swig_type = wxRuby_GetSwigTypeForClass(r_class);
173
173
  VALUE rb_dc = SWIG_NewPointerObj(SWIG_as_voidptr(ptr_dc), swig_type, 0);
174
174
  rc = rb_yield(rb_dc);
175
- SWIG_RubyRemoveTracking((void *)ptr_dc);
176
- DATA_PTR(rb_dc) = NULL;
177
175
 
178
176
  return rc;
179
177
  }
@@ -201,16 +199,12 @@ module WXRuby3
201
199
  wxPaintDC dc(ptr);
202
200
  VALUE dcVal = SWIG_NewPointerObj((void *) &dc,SWIGTYPE_p_wxPaintDC, 0);
203
201
  rc = rb_yield(dcVal);
204
- SWIG_RubyRemoveTracking((void *) &dc);
205
- DATA_PTR(dcVal) = NULL;
206
202
  }
207
203
  else // supply a ClientDC
208
204
  {
209
205
  wxClientDC dc(ptr);
210
206
  VALUE dcVal = SWIG_NewPointerObj((void *) &dc,SWIGTYPE_p_wxClientDC, 0);
211
207
  rc = rb_yield(dcVal);
212
- SWIG_RubyRemoveTracking((void *) &dc);
213
- DATA_PTR(dcVal) = NULL;
214
208
  }
215
209
 
216
210
  return rc;
@@ -11,7 +11,7 @@ module WXRuby3
11
11
 
12
12
  def setup
13
13
  super
14
- spec.gc_as_temporary 'wxWithImages' # actually no GC control necessary as this is a mixin only
14
+ spec.gc_as_untracked 'wxWithImages' # actually no GC control necessary as this is a mixin only
15
15
  # turn wxWithImages into a mixin module
16
16
  spec.make_mixin 'wxWithImages'
17
17
  # Avoid premature deletion of ImageList providing icons for notebook
@@ -12,7 +12,7 @@ module WXRuby3
12
12
  def setup
13
13
  super
14
14
  spec.disable_proxies
15
- spec.gc_as_temporary
15
+ spec.gc_as_untracked
16
16
  spec.disown 'wxXmlNode *child'
17
17
  # ignore this; only allow adding child node by explicitly calling Add/Insert-child methods (easier on the GC handling and avoids wxXmlAttribute)
18
18
  spec.ignore 'wxXmlNode::wxXmlNode(wxXmlNode *, wxXmlNodeType, const wxString &, const wxString &, wxXmlAttribute *, wxXmlNode *, int)'
@@ -91,9 +91,9 @@ module WXRuby3
91
91
  # unlink params_doc if any
92
92
  params_doc.unlink if params_doc
93
93
  # get brief doc
94
- doc = xml_trans.to_doc(@brief_doc)
94
+ doc = xml_trans.to_doc(@brief_doc, item: self)
95
95
  # add detailed doc text without params doc
96
- doc << xml_trans.to_doc(@detailed_doc)
96
+ doc << xml_trans.to_doc(@detailed_doc, item: self, desc: :detail)
97
97
  # get mapped ruby parameter list
98
98
  params = []
99
99
  mapped_ret_args = nil
@@ -130,7 +130,9 @@ module WXRuby3
130
130
  # look up matching mapped param entry
131
131
  if (param = params.detect { |p| p[:name] == pinm })
132
132
  # add doc
133
- param[:doc] = xml_trans.to_doc(pi.xpath('parameterdescription')).lstrip
133
+ param[:doc] = xml_trans.to_doc(pi.xpath('parameterdescription'),
134
+ item: "#{name}.#{param[:name]}",
135
+ desc: :brief).lstrip
134
136
  end
135
137
  end
136
138
  end if params_doc
@@ -0,0 +1,46 @@
1
+ ---
2
+ :wxAboutBox:
3
+ :detail:
4
+ :pre:
5
+ :para:
6
+ - :pattern: !ruby/regexp /<programlisting>.*MyFrame::ShowSimpleAboutDialog/
7
+ :replace: |
8
+ ```ruby
9
+ def show_simple_about_dialog(event)
10
+ info = Wx::AboutDialogInfo.new
11
+ info.name = 'My Program'
12
+ info.version = '1.2.3 Beta'
13
+ info.description = 'This program does something great.'
14
+ info.copyright = '(C) 2007 Me <my@email.addre.ss>'
15
+
16
+ Wx.about_box(info)
17
+ end
18
+ ```
19
+
20
+ :wxAboutDialogInfo:
21
+ :detail:
22
+ :pre:
23
+ :para:
24
+ - :pattern: !ruby/regexp /Example of usage:/
25
+ :replace: |
26
+
27
+ Example of usage:
28
+
29
+ ```ruby
30
+ def on_about(event)
31
+ info = Wx::AboutDialogInfo.new
32
+ info.name = 'MyApp'
33
+ info.version = MY_APP_VERSION_STRING
34
+ info.description = 'My wxWidgets-based application!'
35
+ info.copyright = '(C) 1992-2023'
36
+ info.add_developer('My Self')
37
+
38
+ Wx.about_box(info)
39
+ end
40
+ ```
41
+
42
+ :post:
43
+ - :pattern: !ruby/regexp /Example of appearance of a simple about dialog:(.|\s)+\<\/table>\<\/div>/
44
+ :subst: ''
45
+ - :pattern: !ruby/regexp /And that of a dialog using a web site link,(.|\s)+\<\/table>\<\/div>/
46
+ :subst: ''
@@ -0,0 +1,21 @@
1
+ ---
2
+ :wxAcceleratorTable:
3
+ :detail:
4
+ :pre:
5
+ :para:
6
+ - :pattern: !ruby/regexp /<programlisting>.*/
7
+ :replace: |
8
+ ```ruby
9
+ entries = [
10
+ Wx::AcceleratorEntry.new(Wx::ACCEL_CTRL, 'N', ID_NEW_WINDOW),
11
+ Wx::AcceleratorEntry.new(Wx::ACCEL_CTRL, 'X', Wx::ID_EXIT),
12
+ Wx::AcceleratorEntry.new(Wx::ACCEL_CTRL, 'A', Wx::ID_ABOUT),
13
+ Wx::AcceleratorEntry.new(Wx::ACCEL_CTRL, 'N', Wx::ID_CUT)
14
+ ]
15
+ frame.accelerator_table = Wx::AcceleratorTable[entries]
16
+ ```
17
+ :wxAcceleratorEntry.wxAcceleratorEntry.keyCode:
18
+ :brief:
19
+ :post:
20
+ - :pattern: !ruby/regexp /The\s+keycode\s+to\s+be\s+detected/
21
+ :subst: 'The keycode (or character) to be detected'