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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (214) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -0
  3. data/INSTALL.md +51 -22
  4. data/README.md +81 -6
  5. data/assets/hello_button-macos.png +0 -0
  6. data/assets/hello_button-msw.png +0 -0
  7. data/assets/hello_button.png +0 -0
  8. data/assets/hello_button_clicked-macos.png +0 -0
  9. data/assets/hello_button_clicked-msw.png +0 -0
  10. data/assets/hello_button_clicked.png +0 -0
  11. data/assets/hello_button_clicked_combi.png +0 -0
  12. data/assets/hello_world-macos.png +0 -0
  13. data/assets/hello_world-msw.png +0 -0
  14. data/assets/hello_world.png +0 -0
  15. data/assets/hello_world_combi.png +0 -0
  16. data/assets/repo-social-preview.png +0 -0
  17. data/ext/wxruby3/include/wxruby-runtime.h +1 -0
  18. data/ext/wxruby3/swig/memory_management.i +6 -10
  19. data/ext/wxruby3/swig/wx.i +17 -6
  20. data/lib/wx/core/art_locator.rb +2 -2
  21. data/lib/wx/core/artprovider.rb +2 -2
  22. data/lib/wx/core/bitmap.rb +6 -5
  23. data/lib/wx/core/bitmap_combobox.rb +34 -0
  24. data/lib/wx/core/brush.rb +6 -0
  25. data/lib/wx/core/controlwithitems.rb +52 -14
  26. data/lib/wx/core/cursor.rb +1 -1
  27. data/lib/wx/core/dc.rb +0 -20
  28. data/lib/wx/core/event_blocker.rb +14 -0
  29. data/lib/wx/core/evthandler.rb +48 -2
  30. data/lib/wx/core/find_replace_dialog.rb +24 -0
  31. data/lib/wx/core/font.rb +22 -14
  32. data/lib/wx/core/helpprovider.rb +2 -2
  33. data/lib/wx/core/icon.rb +1 -1
  34. data/lib/wx/core/image.rb +1 -1
  35. data/lib/wx/core/menu.rb +5 -0
  36. data/lib/wx/core/paintdc.rb +8 -0
  37. data/lib/wx/core/pen.rb +6 -0
  38. data/lib/wx/core/text_entry.rb +15 -0
  39. data/lib/wx/core/v_list_box.rb +13 -0
  40. data/lib/wx/core/window.rb +29 -2
  41. data/lib/wx/doc/app.rb +40 -0
  42. data/lib/wx/doc/brush.rb +17 -0
  43. data/lib/wx/doc/busy_info.rb +21 -0
  44. data/lib/wx/doc/client_dc.rb +28 -0
  45. data/lib/wx/doc/controlwithitems.rb +11 -0
  46. data/lib/wx/doc/dc.rb +0 -14
  47. data/lib/wx/doc/event_blocker.rb +27 -0
  48. data/lib/wx/doc/evthandler.rb +4 -0
  49. data/lib/wx/doc/extra/02_lifecycles.md +49 -0
  50. data/lib/wx/doc/extra/10_art.md +1 -1
  51. data/lib/wx/doc/extra/11_drawing_and_dc.md +62 -0
  52. data/lib/wx/doc/font.rb +27 -0
  53. data/lib/wx/doc/memory_dc.rb +75 -0
  54. data/lib/wx/doc/mirror_dc.rb +16 -0
  55. data/lib/wx/doc/pen.rb +17 -0
  56. data/lib/wx/doc/prt/printer_dc.rb +26 -0
  57. data/lib/wx/doc/radio_box.rb +20 -0
  58. data/lib/wx/doc/screen_dc.rb +10 -6
  59. data/lib/wx/doc/svg_file_dc.rb +20 -0
  60. data/lib/wx/doc/v_list_box.rb +9 -0
  61. data/lib/wx/doc/window.rb +27 -0
  62. data/lib/wx/doc/window_disabler.rb +10 -0
  63. data/lib/wx/html/keyword_defs.rb +6 -7
  64. data/lib/wx/html/require.rb +1 -0
  65. data/lib/wx/html/simple_html_listbox.rb +105 -0
  66. data/lib/wx/keyword_defs.rb +83 -75
  67. data/lib/wx/prt/keyword_defs.rb +5 -1
  68. data/lib/wx/version.rb +1 -1
  69. data/lib/wx/wxruby/cmd/test.rb +1 -1
  70. data/rakelib/install.rb +20 -7
  71. data/rakelib/lib/config/linux.rb +4 -2
  72. data/rakelib/lib/config/macosx.rb +120 -1
  73. data/rakelib/lib/config/mingw.rb +6 -1
  74. data/rakelib/lib/config/unixish.rb +26 -11
  75. data/rakelib/lib/config.rb +15 -6
  76. data/rakelib/lib/core/mapping.rb +5 -5
  77. data/rakelib/lib/core/package.rb +1 -1
  78. data/rakelib/lib/core/spec.rb +9 -5
  79. data/rakelib/lib/core/spec_helper.rb +9 -1
  80. data/rakelib/lib/director/accelerator.rb +1 -1
  81. data/rakelib/lib/director/app.rb +55 -4
  82. data/rakelib/lib/director/art_provider.rb +5 -1
  83. data/rakelib/lib/director/aui_pane_info.rb +1 -1
  84. data/rakelib/lib/director/aui_tab_ctrl.rb +1 -1
  85. data/rakelib/lib/director/aui_toolbar.rb +41 -0
  86. data/rakelib/lib/director/bitmap.rb +2 -1
  87. data/rakelib/lib/director/bitmap_combobox.rb +32 -0
  88. data/rakelib/lib/director/brush.rb +11 -1
  89. data/rakelib/lib/director/busy_info.rb +1 -1
  90. data/rakelib/lib/director/choice.rb +1 -0
  91. data/rakelib/lib/director/clipboard.rb +1 -1
  92. data/rakelib/lib/director/colour.rb +1 -0
  93. data/rakelib/lib/director/colour_picker_ctrl.rb +1 -1
  94. data/rakelib/lib/director/combobox.rb +2 -3
  95. data/rakelib/lib/director/context_help_button.rb +23 -0
  96. data/rakelib/lib/director/ctrl_with_items.rb +3 -0
  97. data/rakelib/lib/director/cursor.rb +1 -0
  98. data/rakelib/lib/director/data_object.rb +5 -7
  99. data/rakelib/lib/director/dc.rb +5 -1
  100. data/rakelib/lib/director/defs.rb +3 -0
  101. data/rakelib/lib/director/derived_dc.rb +278 -27
  102. data/rakelib/lib/director/dialog.rb +12 -3
  103. data/rakelib/lib/director/dir_picker_ctrl.rb +1 -1
  104. data/rakelib/lib/director/event.rb +3 -3
  105. data/rakelib/lib/director/event_blocker.rb +41 -0
  106. data/rakelib/lib/director/event_filter.rb +20 -0
  107. data/rakelib/lib/director/event_handler.rb +29 -2
  108. data/rakelib/lib/director/file_picker_ctrl.rb +1 -1
  109. data/rakelib/lib/director/find_replace_data.rb +1 -0
  110. data/rakelib/lib/director/font.rb +14 -4
  111. data/rakelib/lib/director/font_data.rb +1 -0
  112. data/rakelib/lib/director/font_picker_ctrl.rb +1 -1
  113. data/rakelib/lib/director/gdi_object.rb +1 -0
  114. data/rakelib/lib/director/graphics_context.rb +6 -6
  115. data/rakelib/lib/director/grid_table_message.rb +1 -1
  116. data/rakelib/lib/director/help_provider.rb +8 -10
  117. data/rakelib/lib/director/html_cell.rb +1 -1
  118. data/rakelib/lib/director/html_data_object.rb +5 -7
  119. data/rakelib/lib/director/html_listbox.rb +65 -1
  120. data/rakelib/lib/director/hyperlink_event.rb +22 -0
  121. data/rakelib/lib/director/icon.rb +2 -0
  122. data/rakelib/lib/director/listbox.rb +1 -0
  123. data/rakelib/lib/director/locale.rb +2 -1
  124. data/rakelib/lib/director/menu.rb +0 -3
  125. data/rakelib/lib/director/menu_bar.rb +3 -0
  126. data/rakelib/lib/director/palette.rb +1 -0
  127. data/rakelib/lib/director/pen.rb +12 -2
  128. data/rakelib/lib/director/pgproperties.rb +1 -1
  129. data/rakelib/lib/director/pgproperty.rb +1 -1
  130. data/rakelib/lib/director/pgvalidation_info.rb +1 -1
  131. data/rakelib/lib/director/platform_info.rb +1 -1
  132. data/rakelib/lib/director/popup_window.rb +18 -0
  133. data/rakelib/lib/director/print_data.rb +1 -1
  134. data/rakelib/lib/director/property_grid_interface.rb +1 -1
  135. data/rakelib/lib/director/property_grid_page_state.rb +1 -1
  136. data/rakelib/lib/director/radio_box.rb +15 -4
  137. data/rakelib/lib/director/region.rb +1 -0
  138. data/rakelib/lib/director/ribbon_art_provider.rb +1 -1
  139. data/rakelib/lib/director/richtext_buffer_data_object.rb +5 -7
  140. data/rakelib/lib/director/richtext_header_footer_data.rb +1 -1
  141. data/rakelib/lib/director/searchctrl.rb +25 -0
  142. data/rakelib/lib/director/sizer.rb +2 -2
  143. data/rakelib/lib/director/static_box.rb +1 -1
  144. data/rakelib/lib/director/styled_text_ctrl.rb +2 -0
  145. data/rakelib/lib/director/text_entry.rb +7 -2
  146. data/rakelib/lib/director/textctrl.rb +1 -1
  147. data/rakelib/lib/director/tree_ctrl.rb +6 -3
  148. data/rakelib/lib/director/uiaction_simulator.rb +20 -0
  149. data/rakelib/lib/director/variant.rb +1 -1
  150. data/rakelib/lib/director/vlistbox.rb +25 -0
  151. data/rakelib/lib/director/window.rb +37 -7
  152. data/rakelib/lib/director/with_images.rb +1 -1
  153. data/rakelib/lib/director/xml_node.rb +1 -1
  154. data/rakelib/lib/extractor/function.rb +5 -3
  155. data/rakelib/lib/generate/doc/about_dialog_info.yaml +46 -0
  156. data/rakelib/lib/generate/doc/accelerator.yaml +21 -0
  157. data/rakelib/lib/generate/doc/art_provider.yaml +35 -0
  158. data/rakelib/lib/generate/doc/bitmap.yaml +37 -0
  159. data/rakelib/lib/generate/doc/box_sizer.yaml +15 -0
  160. data/rakelib/lib/generate/doc/busy_info.yaml +74 -0
  161. data/rakelib/lib/generate/doc/client_dc.yaml +19 -0
  162. data/rakelib/lib/generate/doc/clipboard.yaml +43 -0
  163. data/rakelib/lib/generate/doc/collapsible_pane.yaml +21 -0
  164. data/rakelib/lib/generate/doc/colour_dialog.yaml +32 -0
  165. data/rakelib/lib/generate/doc/context_help_button.yaml +16 -0
  166. data/rakelib/lib/generate/doc/control.yaml +46 -0
  167. data/rakelib/lib/generate/doc/cursor.yaml +40 -0
  168. data/rakelib/lib/generate/doc/data_object.yaml +55 -0
  169. data/rakelib/lib/generate/doc/dc.yaml +14 -0
  170. data/rakelib/lib/generate/doc/dialog.yaml +36 -0
  171. data/rakelib/lib/generate/doc/dir_dialog.yaml +25 -0
  172. data/rakelib/lib/generate/doc/event_blocker.yaml +27 -0
  173. data/rakelib/lib/generate/doc/event_filter.yaml +47 -0
  174. data/rakelib/lib/generate/doc/events.yaml +152 -0
  175. data/rakelib/lib/generate/doc/evt_handler.yaml +63 -0
  176. data/rakelib/lib/generate/doc/file_dialog.yaml +68 -0
  177. data/rakelib/lib/generate/doc.rb +77 -14
  178. data/rakelib/lib/generate/interface.rb +22 -10
  179. data/rakelib/lib/specs/interfaces.rb +9 -5
  180. data/rakelib/lib/swig_runner.rb +3 -3
  181. data/rakelib/lib/typemap/common.rb +15 -3
  182. data/rakelib/lib/util/string.rb +1 -0
  183. data/rakelib/yard/yard/relative_markdown_links.rb +5 -1
  184. data/samples/aui/aui.rb +432 -363
  185. data/samples/bigdemo/wxArtProvider.rbw +5 -4
  186. data/samples/controls/controls.rb +2 -2
  187. data/samples/controls/htlbox.rb +411 -0
  188. data/samples/controls/tn_htlbox.png +0 -0
  189. data/samples/drawing/graphics_drawing.rb +1 -2
  190. data/samples/drawing/{svgtest.rb → image_prt.rb} +49 -18
  191. data/samples/drawing/tn_image_prt.png +0 -0
  192. data/samples/propgrid/propgrid.rb +26 -21
  193. data/samples/ribbon/ribbon.rb +47 -46
  194. data/samples/sampler/editor.rb +33 -25
  195. data/samples/sampler/sample.rb +2 -2
  196. data/samples/sampler/stc_editor.rb +4 -2
  197. data/tests/lib/item_container_tests.rb +82 -0
  198. data/tests/lib/text_entry_tests.rb +80 -0
  199. data/tests/lib/wxapp_runner.rb +15 -3
  200. data/tests/lib/wxframe_runner.rb +144 -0
  201. data/tests/test_app_event_filter.rb +74 -0
  202. data/tests/test_art_provider.rb +52 -0
  203. data/tests/test_clipboard.rb +2 -1
  204. data/tests/test_event_handling.rb +199 -16
  205. data/tests/test_events.rb +4 -11
  206. data/tests/test_ext_controls.rb +28 -0
  207. data/tests/test_font.rb +239 -0
  208. data/tests/test_gdi_object.rb +161 -0
  209. data/tests/test_intl.rb +16 -15
  210. data/tests/test_item_data.rb +33 -1
  211. data/tests/test_std_controls.rb +373 -0
  212. data/tests/test_window.rb +340 -0
  213. metadata +82 -4
  214. data/samples/drawing/tn_svgtest.png +0 -0
@@ -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,25 @@
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' => 'wxTextEntryBase' }
18
+ spec.suppress_warning(473, 'wxSearchCtrl::GetMenu')
19
+ spec.override_inheritance_chain('wxSearchCtrl', %w[wxControl wxWindow wxEvtHandler wxObject])
20
+ end
21
+ end # class SearchCtrl
22
+
23
+ end # class Director
24
+
25
+ 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
@@ -13,7 +13,7 @@ module WXRuby3
13
13
 
14
14
  def setup
15
15
  super
16
- if Config.instance.wx_port == :wxQT
16
+ if Config.instance.wx_port == :wxQT || Config.platform == :macosx
17
17
  # missing from implementation currently
18
18
  spec.ignore 'wxStaticBox::wxStaticBox(wxWindow *, wxWindowID, wxWindow *, const wxPoint &, const wxSize &, long, const wxString &)',
19
19
  'wxStaticBox::Create(wxWindow *, wxWindowID, wxWindow *, const wxPoint &, const wxSize &, long, const wxString &)'
@@ -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' => 'wxTextEntryBase' }
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,10 +12,15 @@ 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
+ # !!NOTE!!
20
+ # This is not very nice but it is the easiest way to work around the problem that
21
+ # what we actually want as native type is wxTextEntryBase (because of some bad implementation decisions in wxw)
22
+ # and what is documented is wxTextEntry.
23
+ spec.add_header_code '#define wxTextEntry wxTextEntryBase'
19
24
  spec.disown 'wxTextCompleter *completer' # managed by wxWidgets after passing in
20
25
  spec.map_apply 'long * OUTPUT' => 'long *' # for GetSelection
21
26
  end
@@ -14,7 +14,7 @@ module WXRuby3
14
14
  def setup
15
15
  super
16
16
  # mixin TextEntry
17
- spec.include_mixin 'wxTextCtrl', 'Wx::TextEntry'
17
+ spec.include_mixin 'wxTextCtrl', { 'Wx::TextEntry' => 'wxTextEntryBase' }
18
18
  spec.override_inheritance_chain('wxTextCtrl', %w[wxControl wxWindow wxEvtHandler wxObject])
19
19
  spec.ignore 'wxTextCtrl::HitTest(const wxPoint &,long *)'
20
20
  if Config.instance.wx_port == :wxQT
@@ -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
 
@@ -132,8 +132,28 @@ module WXRuby3
132
132
  'wxWindow::GetTextExtent(const wxString &,int *,int *,int *,int *,const wxFont *)',
133
133
  'wxWindow::SendIdleEvents',
134
134
  'wxWindow::ClientToScreen(int*,int*)', # no need; prefer the wxPoint version
135
- 'wxWindow::ScreenToClient(int*,int*)' # no need; prefer the wxPoint version
135
+ 'wxWindow::ScreenToClient(int*,int*)', # no need; prefer the wxPoint version
136
136
  ]
137
+ # redefine these so a nil parent is accepted
138
+ spec.ignore %w[wxWindow::FindWindowById wxWindow::FindWindowByLabel wxWindow::FindWindowByName], ignore_doc: false
139
+ # overrule common typemap to allow default NULL
140
+ spec.map 'wxWindow* find_from_parent' do
141
+ map_check code: ''
142
+ end
143
+ spec.add_extend_code 'wxWindow', <<~__HEREDOC
144
+ static wxWindow* find_window_by_id(long id, const wxWindow *find_from_parent=0)
145
+ {
146
+ return wxWindow::FindWindowById(id, find_from_parent);
147
+ }
148
+ static wxWindow* find_window_by_label(const wxString &label, const wxWindow *find_from_parent=0)
149
+ {
150
+ return wxWindow::FindWindowByLabel(label, find_from_parent);
151
+ }
152
+ static wxWindow* find_window_by_name(const wxString &name, const wxWindow *find_from_parent=0)
153
+ {
154
+ return wxWindow::FindWindowByName(name, find_from_parent);
155
+ }
156
+ __HEREDOC
137
157
  if Config.instance.wx_port == :wxQT
138
158
  # protected for wxQT; ignore for now
139
159
  spec.ignore 'wxWindow::EnableTouchEvents'
@@ -172,8 +192,6 @@ module WXRuby3
172
192
  swig_type_info* swig_type = wxRuby_GetSwigTypeForClass(r_class);
173
193
  VALUE rb_dc = SWIG_NewPointerObj(SWIG_as_voidptr(ptr_dc), swig_type, 0);
174
194
  rc = rb_yield(rb_dc);
175
- SWIG_RubyRemoveTracking((void *)ptr_dc);
176
- DATA_PTR(rb_dc) = NULL;
177
195
 
178
196
  return rc;
179
197
  }
@@ -201,16 +219,12 @@ module WXRuby3
201
219
  wxPaintDC dc(ptr);
202
220
  VALUE dcVal = SWIG_NewPointerObj((void *) &dc,SWIGTYPE_p_wxPaintDC, 0);
203
221
  rc = rb_yield(dcVal);
204
- SWIG_RubyRemoveTracking((void *) &dc);
205
- DATA_PTR(dcVal) = NULL;
206
222
  }
207
223
  else // supply a ClientDC
208
224
  {
209
225
  wxClientDC dc(ptr);
210
226
  VALUE dcVal = SWIG_NewPointerObj((void *) &dc,SWIGTYPE_p_wxClientDC, 0);
211
227
  rc = rb_yield(dcVal);
212
- SWIG_RubyRemoveTracking((void *) &dc);
213
- DATA_PTR(dcVal) = NULL;
214
228
  }
215
229
 
216
230
  return rc;
@@ -263,6 +277,22 @@ module WXRuby3
263
277
  # update generated code for all windows
264
278
  spec.post_processors << :update_window
265
279
  end
280
+
281
+ def process(gendoc: false)
282
+ defmod = super
283
+ if spec.module_name == 'wxWindow'
284
+ # special processing to ignore the non-static versions of methods FromDIP,ToDIP,FromPhys,ToPhys
285
+ # as SWIG cannot handle identically named static & non-static methods
286
+ # will handle that in pure Ruby
287
+ %w[FromDIP ToDIP FromPhys ToPhys].each do |mtd|
288
+ if (item = defmod.find("wxWindow::#{mtd}"))
289
+ item.all.each { |ovl| ovl.ignore(true, ignore_doc: false) unless ovl.is_static }
290
+ end
291
+ end
292
+ end
293
+ defmod
294
+ end
295
+
266
296
  end # class Window
267
297
 
268
298
  end # class Director
@@ -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'
@@ -0,0 +1,35 @@
1
+ ---
2
+ :wxArtProvider:
3
+ :detail:
4
+ :pre:
5
+ :para:
6
+ - :pattern: !ruby/regexp /<programlisting>.*MyProvider/
7
+ :replace: |
8
+
9
+ Example:
10
+
11
+ ```ruby
12
+ class MyArtProvider < Wx::ArtProvider
13
+
14
+ def create_bitmap(id, client, size)
15
+ # ... create and return bitmap
16
+ end
17
+
18
+ end
19
+
20
+ Wx::ArtProvider.push(MyArtProvider.new)
21
+ ```
22
+
23
+ - :pattern: !ruby/regexp /Note\s+that,\s+as\s+usual\s+in\s+wxWidgets\s+API.*/
24
+ :replace: ''
25
+ - :pattern: !ruby/regexp /wxNO_IMPLICIT_WXSTRING_ENCODING/
26
+ :replace: ''
27
+ :programlisting:
28
+ - :pattern: !ruby/regexp /ifdef.*__WXGTK__/
29
+ :replace: |
30
+
31
+ ```ruby
32
+ if Wx::PLATFORM == 'WXGTK'
33
+ bmp = Wx::ArtProvider.get_bitmap("gtk-cdrom", Wx::ART_MENU)
34
+ end
35
+ ```
@@ -0,0 +1,37 @@
1
+ ---
2
+ :wxBitmap.wxBitmap:
3
+ :detail:
4
+ :pre:
5
+ :para:
6
+ - :pattern: !ruby/regexp /<programlisting>.*GetSubBitmap/
7
+ :replace: |
8
+ ```ruby
9
+ newBitmap = oldBitmap.get_sub_bitmap(
10
+ Wx::Rect.new(0, 0, oldBitmap.width, oldBitmap.height))
11
+ ```
12
+ :wxBitmapBundle:
13
+ :detail:
14
+ :pre:
15
+ :para:
16
+ - :pattern: !ruby/regexp /<programlisting>.*MyFrame::MyFrame/
17
+ :replace: |
18
+ ```ruby
19
+ class MyFrame < Wx::Frame
20
+
21
+ def initialize
22
+ super(nil, Wx::ID_ANY, "My frame")
23
+ # ...
24
+ tool_bar = create_toolBar
25
+
26
+ bitmaps = [
27
+ Wx::Bitmap(:open_32x32, Wx::BitmapType::BITMAP_TYPE_PNG),
28
+ Wx::Bitmap(:open_48x48, Wx::BitmapType::BITMAP_TYPE_PNG),
29
+ Wx::Bitmap(:open_64x64, Wx::BitmapType::BITMAP_TYPE_PNG)
30
+ ]
31
+
32
+ tool_bar.add_tool(Wx::ID_OPEN, "Open", Wx::BitmapBundle.from_bitmaps(bitmaps))
33
+ end
34
+ ```
35
+
36
+ - :pattern: !ruby/regexp /For\s+the\s+platforms\s+with\s+resources\s+support/
37
+ :replace: ''
@@ -0,0 +1,15 @@
1
+ ---
2
+ :wxBoxSizer.AddSpacer:
3
+ :detail:
4
+ :pre:
5
+ :programlisting:
6
+ - :pattern: !ruby/regexp /wxBoxSizer::IsVertical/
7
+ :replace: |
8
+
9
+ ```ruby
10
+ if box_sizer.vertical?
11
+ box_sizer.add(0, size, 0)
12
+ else
13
+ box_size.add(size, 0, 0)
14
+ end
15
+ ```
@@ -0,0 +1,74 @@
1
+ ---
2
+ :wxBusyInfo:
3
+ :detail:
4
+ :pre:
5
+ :detaileddescription:
6
+ - :pattern: !ruby/regexp /.*/
7
+ :replace: |
8
+ Normally the main thread should always return to the main loop to continue dispatching events as quickly as possible,
9
+ hence this class shouldn't be needed. However if the main thread does need to block, this class provides a simple
10
+ way to at least show this to the user: just call {Wx::BusyInfo.busy} with a block and for the duration of the
11
+ execution of the block a message window will be shown.
12
+ For example:
13
+ ```ruby
14
+ BusyInfo.busy('Working, please wait...') do
15
+ 100000.times { do_a_calculation }
16
+ end
17
+ ```
18
+
19
+ The displayed window is rather plain by default but can be customized by passing {Wx::BusyInfo.busy} an object of
20
+ {Wx::BusyInfoFlags} class instead of a simple message. Here is an example:
21
+
22
+ ```ruby
23
+ Wx::BusyInfo.busy(
24
+ Wx::BusyInfoFlags.new
25
+ .parent(self)
26
+ .icon(Wx::ArtProvider.get_icon(Wx::ART_PRINT,Wx::ART_OTHER, [128, 128]))
27
+ .title("<b>Printing your document</b>")
28
+ .text("Please wait...")
29
+ .foreground(Wx::WHITE)
30
+ .background(Wx::BLACK)
31
+ .transparency(4*Wx::ALPHA_OPAQUE/5)) do |bi|
32
+ end
33
+ ```
34
+
35
+ This shows that separate title and text can be set, and that simple markup ({Wx::Control#set_label_markup}) can be used in them, and that it's also possible to add an icon and customize the colours and transparency of the window.
36
+ You may also want to call `Wx.get_app.yield` to refresh the window periodically (in case it had been obscured by other windows, for example) like this:
37
+ ```ruby
38
+ Wx::WindowDisabler.disable do
39
+ BusyInfo.busy('Working, please wait...') do
40
+ 100000.times do |i|
41
+ do_a_calculation }
42
+ Wx.get_app.yield if (i % 1000) == 0
43
+ end
44
+ end
45
+ end
46
+ ```
47
+
48
+ but take care to not cause undesirable re-entrance when doing it (see {Wx::App#yield} for more details). The simplest way to do it is to use {Wx::WindowDisabler} class as illustrated in the above example.
49
+ Note that a {Wx::BusyInfo} is always built with the {Wx::STAY_ON_TOP} window style (see {Wx::Frame} window styles for more info).
50
+
51
+ ===
52
+
53
+ Category: Common Dialogs
54
+
55
+
56
+ :wxBusyInfoFlags:
57
+ :detail:
58
+ :pre:
59
+ :programlisting:
60
+ - :pattern: !ruby/regexp /.*/
61
+ :replace: |
62
+
63
+ ```ruby
64
+ Wx::BusyInfo.busy(
65
+ Wx::BusyInfoFlags.new
66
+ .parent(self)
67
+ .icon(Wx::ArtProvider.get_icon(Wx::ART_PRINT,Wx::ART_OTHER, [128, 128]))
68
+ .title("<b>Printing your document</b>")
69
+ .text("Please wait...")
70
+ .foreground(Wx::WHITE)
71
+ .background(Wx::BLACK)
72
+ .transparency(4*Wx::ALPHA_OPAQUE/5)) do |bi|
73
+ end
74
+ ```
@@ -0,0 +1,19 @@
1
+ ---
2
+ :wxClientDC:
3
+ :detail:
4
+ :pre:
5
+ :programlisting:
6
+ - :pattern: !ruby/regexp /.*/
7
+ :replace: |
8
+
9
+ ```ruby
10
+ # Create the initially empty label with the size big enough to show
11
+ # the given string.
12
+ text = Wx::ClientDC.draw_on(self) do |dc|
13
+ Wx::StaticText.new(
14
+ self, Wx::ID_ANY, "",
15
+ Wx::Point.new,
16
+ dc.get_text_extent("String of max length"),
17
+ Wx::ST_NO_AUTORESIZE)
18
+ end
19
+ ```
@@ -0,0 +1,43 @@
1
+ ---
2
+ :wxClipboard:
3
+ :detail:
4
+ :pre:
5
+ :detaileddescription:
6
+ - :pattern: !ruby/regexp /.*/
7
+ :replace: |
8
+ To use the clipboard, you call member functions of the global {Wx::Clipboard} object passed to the block for {Wx::Clipboard.open}.
9
+ See the {Wx::DataObject} Overview for further information.
10
+ Call {Wx::Clipboard.open} to get ownership of the (global) clipboard and execute the given block. You now
11
+ own the clipboard passed to the given block. Call {Wx::Clipboard#set_data} to put data on the clipboard, or
12
+ {Wx::Clipboard#get_data} to retrieve data from the clipboard. The clipboard is closed and ownership
13
+ relinquished when the block returns. You should keep the clipboard open only momentarily.
14
+ For example:
15
+
16
+ ```ruby
17
+ # Write some text to the clipboard
18
+ Wx::Clipboard.open do |clip|
19
+ # This data object is held by the clipboard
20
+ clip.place(Wx::TextDataObject.new("Some text"))
21
+ # or alternatively
22
+ # clip.set_data(Wx::TextDataObject.new("Some text"))
23
+ end
24
+
25
+ # Read some text
26
+ data = Wx::TextDataObject.new
27
+ Wx::Clipboard.open do |clip|
28
+ if clip.supported?(Wx::DF_TEXT)
29
+ clip.fetch(data) # or clip.get_data(data)
30
+ end
31
+ end
32
+ Wx.message_box(data.get_text)
33
+ ```
34
+
35
+ On GTK, the clipboard behavior can vary depending on the configuration of the end-user's machine. In order
36
+ for the clipboard data to persist after the window closes, a clipboard manager must be installed. Some
37
+ clipboard managers will automatically flush the clipboard after each new piece of data is added, while others
38
+ will not. The {Wx::Clipboard#flush} function will force the clipboard manager to flush the data.
39
+
40
+ ===
41
+
42
+ Category: Clipboard and Drag & Drop
43
+ @see Wx::DataObject
@@ -0,0 +1,21 @@
1
+ ---
2
+ :wxCollapsiblePane:
3
+ :detail:
4
+ :pre:
5
+ :programlisting:
6
+ - :pattern: !ruby/regexp /.*/
7
+ :replace: |
8
+
9
+ ```ruby
10
+ collpane = Wx::CollapsiblePane.new(self, Wx::ID_ANY, "Details:")
11
+
12
+ # add the pane with a zero proportion value to the 'sz' sizer which contains it
13
+ sz.add(collpane, 0, Wx::GROW|Wx::ALL, 5)
14
+
15
+ #/ now add a test label in the collapsible pane using a sizer to layout it:
16
+ win = collpane.get_pane
17
+ pane_sz = Wx::VBoxSizer
18
+ pane_sz.add(Wx::StaticText.new(win, Wx::ID_ANY, "test!"), 1, Wx::GROW|Wx::ALL, 2)
19
+ win.set_sizer(pane_sz)
20
+ pane_sz.set_size_hints(win)
21
+ ```