wxruby3 0.9.0 → 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (205) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -0
  3. data/ext/wxruby3/include/wxRubyApp.h +338 -0
  4. data/ext/wxruby3/include/wxruby-Config.h +6 -6
  5. data/ext/wxruby3/include/wxruby-runtime.h +3 -0
  6. data/ext/wxruby3/swig/common.i +22 -0
  7. data/ext/wxruby3/swig/custom/director.swg +296 -0
  8. data/ext/wxruby3/swig/custom/rubyapi.swg +19 -0
  9. data/ext/wxruby3/swig/custom/rubyerrors.swg +45 -0
  10. data/ext/wxruby3/swig/custom/rubyhead.swg +192 -0
  11. data/ext/wxruby3/swig/custom/rubyrun.swg +187 -0
  12. data/ext/wxruby3/swig/custom/swigrun.swg +363 -0
  13. data/ext/wxruby3/swig/custom/typemaps/swigtypemaps.swg +173 -0
  14. data/ext/wxruby3/swig/wx.i +50 -30
  15. data/lib/wx/aui/aui_tab_ctrl.rb +18 -0
  16. data/lib/wx/aui/auinotebook.rb +6 -2
  17. data/lib/wx/aui/require.rb +1 -0
  18. data/lib/wx/core/app.rb +2 -2
  19. data/lib/wx/core/collapsible_pane.rb +1 -1
  20. data/lib/wx/core/const.rb +83 -0
  21. data/lib/wx/core/controlwithitems.rb +8 -6
  22. data/lib/wx/core/menu.rb +10 -0
  23. data/lib/wx/core/notebook.rb +6 -2
  24. data/lib/wx/core/sizer.rb +11 -0
  25. data/lib/wx/core/task_bar_button.rb +19 -0
  26. data/lib/wx/core/textctrl.rb +11 -1
  27. data/lib/wx/core/{treectrl.rb → tree_ctrl.rb} +31 -12
  28. data/lib/wx/core/window.rb +10 -0
  29. data/lib/wx/doc/app.rb +48 -38
  30. data/lib/wx/doc/art_locator.rb +47 -43
  31. data/lib/wx/doc/aui/auimanager.rb +16 -8
  32. data/lib/wx/doc/aui/auinotebook.rb +20 -5
  33. data/lib/wx/doc/clipboard.rb +11 -7
  34. data/lib/wx/doc/colour_dialog.rb +14 -10
  35. data/lib/wx/doc/const.rb +66 -66
  36. data/lib/wx/doc/controlwithitems.rb +17 -7
  37. data/lib/wx/doc/data_object.rb +2 -2
  38. data/lib/wx/doc/event.rb +0 -6
  39. data/lib/wx/doc/evthandler.rb +113 -108
  40. data/lib/wx/doc/font.rb +1 -0
  41. data/lib/wx/doc/functions.rb +9 -9
  42. data/lib/wx/doc/gc_dc.rb +6 -1
  43. data/lib/wx/doc/graphics_context.rb +1 -0
  44. data/lib/wx/doc/grid/grid.rb +22 -1
  45. data/lib/wx/doc/help_controller.rb +11 -7
  46. data/lib/wx/doc/html/html_help_controller.rb +12 -4
  47. data/lib/wx/doc/list_ctrl.rb +33 -29
  48. data/lib/wx/doc/menu.rb +20 -0
  49. data/lib/wx/doc/notebook.rb +21 -0
  50. data/lib/wx/doc/pg/events.rb +13 -9
  51. data/lib/wx/doc/pg/pg_property.rb +18 -0
  52. data/lib/wx/doc/progress_dialog.rb +36 -32
  53. data/lib/wx/doc/prt/page_setup_dialog.rb +20 -12
  54. data/lib/wx/doc/prt/print_data.rb +13 -5
  55. data/lib/wx/doc/prt/print_dialog.rb +31 -23
  56. data/lib/wx/doc/prt/printer.rb +20 -12
  57. data/lib/wx/doc/radio_box.rb +19 -15
  58. data/lib/wx/doc/rbn/ribbon_bar.rb +13 -5
  59. data/lib/wx/doc/rbn/ribbon_button_bar.rb +13 -5
  60. data/lib/wx/doc/rbn/ribbon_gallery.rb +13 -5
  61. data/lib/wx/doc/rbn/ribbon_tool_bar.rb +13 -5
  62. data/lib/wx/doc/region_iterator.rb +32 -28
  63. data/lib/wx/doc/rtc/rich_text_composite_object.rb +24 -0
  64. data/lib/wx/doc/rtc/rich_text_ctrl.rb +24 -0
  65. data/lib/wx/doc/rtc/rich_text_paragraph.rb +24 -0
  66. data/lib/wx/doc/rtc/richtext_buffer.rb +27 -19
  67. data/lib/wx/doc/rtc/richtext_printing.rb +17 -9
  68. data/lib/wx/doc/rtc/richtext_style_sheet.rb +17 -9
  69. data/lib/wx/doc/sizer.rb +20 -0
  70. data/lib/wx/doc/stc/styled_text_ctrl.rb +24 -0
  71. data/lib/wx/doc/stream.rb +39 -35
  72. data/lib/wx/doc/system_settings.rb +30 -26
  73. data/lib/wx/doc/text_validator.rb +12 -8
  74. data/lib/wx/doc/textctrl.rb +16 -0
  75. data/lib/wx/doc/tree_ctrl.rb +95 -0
  76. data/lib/wx/doc/treebook.rb +9 -5
  77. data/lib/wx/doc/v_list_box.rb +9 -5
  78. data/lib/wx/doc/variant.rb +164 -160
  79. data/lib/wx/doc/window.rb +57 -42
  80. data/lib/wx/doc/window_disabler.rb +10 -6
  81. data/lib/wx/grid/grid.rb +27 -4
  82. data/lib/wx/keyword_defs.rb +43 -6
  83. data/lib/wx/pg/pg_property.rb +22 -0
  84. data/lib/wx/rtc/require.rb +3 -0
  85. data/lib/wx/rtc/rich_text_composite_object.rb +25 -0
  86. data/lib/wx/rtc/rich_text_ctrl.rb +25 -0
  87. data/lib/wx/rtc/rich_text_paragraph.rb +25 -0
  88. data/lib/wx/stc/require.rb +1 -0
  89. data/lib/wx/stc/styled_text_ctrl.rb +25 -0
  90. data/lib/wx/version.rb +1 -1
  91. data/rakelib/lib/config/linux.rb +0 -3
  92. data/rakelib/lib/config/macosx.rb +1 -1
  93. data/rakelib/lib/config/mingw.rb +1 -1
  94. data/rakelib/lib/config/unixish.rb +1 -1
  95. data/rakelib/lib/config.rb +14 -4
  96. data/rakelib/lib/core/include/funcall.inc +33 -14
  97. data/rakelib/lib/core/include/swigdirector.inc +384 -0
  98. data/rakelib/lib/core/include/swigrubyerrors.inc +161 -0
  99. data/{ext/wxruby3/swig/custom/swig4/rubyrun.swg → rakelib/lib/core/include/swigrubyrun.inc} +245 -120
  100. data/rakelib/lib/core/include/swigrun.inc +700 -0
  101. data/rakelib/lib/core/package.rb +19 -9
  102. data/rakelib/lib/core/parameter.rb +3 -0
  103. data/rakelib/lib/core/spec.rb +6 -1
  104. data/rakelib/lib/director/accelerator.rb +3 -4
  105. data/rakelib/lib/director/accessible.rb +47 -0
  106. data/rakelib/lib/director/animation.rb +1 -1
  107. data/rakelib/lib/director/animation_ctrl.rb +20 -0
  108. data/rakelib/lib/director/app.rb +15 -304
  109. data/rakelib/lib/director/app_traits.rb +10 -12
  110. data/rakelib/lib/director/art_provider.rb +1 -1
  111. data/rakelib/lib/director/ctrl_with_items.rb +17 -5
  112. data/rakelib/lib/director/data_format.rb +1 -1
  113. data/rakelib/lib/director/data_object_simple_base.rb +1 -2
  114. data/rakelib/lib/director/derived_dc.rb +1 -1
  115. data/rakelib/lib/director/dialog.rb +6 -0
  116. data/rakelib/lib/director/dialup_event.rb +44 -0
  117. data/rakelib/lib/director/dialup_manager.rb +45 -0
  118. data/rakelib/lib/director/drag_image.rb +2 -3
  119. data/rakelib/lib/director/event.rb +22 -4
  120. data/rakelib/lib/director/file_ctrl.rb +35 -0
  121. data/rakelib/lib/director/file_ctrl_event.rb +26 -0
  122. data/rakelib/lib/director/frame.rb +1 -3
  123. data/rakelib/lib/director/gdicommon.rb +27 -11
  124. data/rakelib/lib/director/graphics_context.rb +2 -4
  125. data/rakelib/lib/director/grid_cell_editor.rb +6 -6
  126. data/rakelib/lib/director/grid_ctrl.rb +34 -3
  127. data/rakelib/lib/director/help_controller.rb +1 -1
  128. data/rakelib/lib/director/icon.rb +5 -2
  129. data/rakelib/lib/director/list_ctrl.rb +5 -6
  130. data/rakelib/lib/director/locale.rb +1 -3
  131. data/rakelib/lib/director/log.rb +1 -4
  132. data/rakelib/lib/director/media_ctrl.rb +54 -0
  133. data/rakelib/lib/director/menu.rb +16 -1
  134. data/rakelib/lib/director/menu_item.rb +2 -2
  135. data/rakelib/lib/director/pgarray_editor_dialog.rb +0 -6
  136. data/rakelib/lib/director/pgeditor.rb +2 -2
  137. data/rakelib/lib/director/pgproperties.rb +3 -3
  138. data/rakelib/lib/director/pgproperty.rb +24 -1
  139. data/rakelib/lib/director/property_grid_interface.rb +5 -10
  140. data/rakelib/lib/director/richtext_buffer.rb +1 -1
  141. data/rakelib/lib/director/richtext_composite_object.rb +25 -0
  142. data/rakelib/lib/director/richtext_ctrl.rb +15 -5
  143. data/rakelib/lib/director/richtext_formatting_dialog.rb +7 -5
  144. data/rakelib/lib/director/richtext_paragraph_layout_box.rb +9 -7
  145. data/rakelib/lib/director/sash_event.rb +42 -0
  146. data/rakelib/lib/director/sizer.rb +79 -1
  147. data/rakelib/lib/director/sizer_item.rb +22 -0
  148. data/rakelib/lib/director/static_box.rb +4 -5
  149. data/rakelib/lib/director/styled_text_ctrl.rb +12 -0
  150. data/rakelib/lib/director/task_bar_button.rb +30 -0
  151. data/rakelib/lib/director/task_bar_icon.rb +6 -14
  152. data/rakelib/lib/director/textctrl.rb +12 -1
  153. data/rakelib/lib/director/tool_tip.rb +1 -1
  154. data/rakelib/lib/director/top_level_window.rb +4 -5
  155. data/rakelib/lib/director/tree_ctrl.rb +24 -50
  156. data/rakelib/lib/director/variant.rb +1 -1
  157. data/rakelib/lib/director/window.rb +24 -5
  158. data/rakelib/lib/director.rb +4 -4
  159. data/rakelib/lib/extractor/function.rb +6 -6
  160. data/rakelib/lib/extractor.rb +34 -5
  161. data/rakelib/lib/generate/analyzer.rb +8 -3
  162. data/rakelib/lib/generate/doc/animation_ctrl.yaml +15 -0
  163. data/rakelib/lib/generate/doc/busy_info.yaml +0 -2
  164. data/rakelib/lib/generate/doc/clipboard.yaml +0 -2
  165. data/rakelib/lib/generate/doc/cursor.yaml +0 -2
  166. data/rakelib/lib/generate/doc/events.yaml +10 -4
  167. data/rakelib/lib/generate/doc/panel.yaml +7 -0
  168. data/rakelib/lib/generate/doc/static_box.yaml +8 -0
  169. data/rakelib/lib/generate/doc/xml_resource.yaml +3 -0
  170. data/rakelib/lib/generate/doc.rb +89 -16
  171. data/rakelib/lib/generate/interface.rb +4 -3
  172. data/rakelib/lib/specs/interfaces.rb +161 -156
  173. data/rakelib/lib/swig_runner.rb +4 -50
  174. data/rakelib/lib/typemap/common.rb +54 -10
  175. data/rakelib/lib/typemap/data_format.rb +1 -1
  176. data/rakelib/lib/typemap/data_object_data.rb +2 -2
  177. data/rakelib/lib/typemap/pgprop_arg.rb +7 -2
  178. data/rakelib/lib/typemap/points_list.rb +5 -7
  179. data/rakelib/lib/util/string.rb +10 -8
  180. data/rakelib/yard/templates/default/fulldoc/html/css/wxruby3.css +74 -2
  181. data/rakelib/yard/templates/default/fulldoc/html/full_list.erb +38 -0
  182. data/rakelib/yard/templates/default/fulldoc/html/setup.rb +39 -0
  183. data/rakelib/yard/templates/default/tags/html/wxrb_require.erb +10 -0
  184. data/rakelib/yard/templates/default/tags/setup.rb +16 -0
  185. data/rakelib/yard/yard-custom-templates.rb +3 -0
  186. data/samples/text/richtext.rb +0 -30
  187. data/samples/treectrl/treectrl.rb +1 -1
  188. data/tests/media/beep_lo.wav +0 -0
  189. data/tests/test_app_exit_exception.rb +36 -0
  190. data/tests/test_app_init_exception.rb +20 -0
  191. data/tests/test_book_controls.rb +29 -0
  192. data/tests/test_exceptions.rb +41 -0
  193. data/tests/test_list_ctrl.rb +1 -1
  194. data/tests/test_media_ctrl.rb +38 -0
  195. data/tests/test_menu.rb +69 -0
  196. data/tests/test_pg.rb +27 -0
  197. data/tests/test_richtext.rb +45 -0
  198. data/tests/test_sizer.rb +59 -0
  199. data/tests/test_std_controls.rb +78 -1
  200. data/tests/test_styled_text_ctrl.rb +46 -0
  201. data/tests/test_tree_ctrl.rb +138 -0
  202. data/tests/test_window.rb +12 -0
  203. data/tests/testapp_noframe.rb +1 -1
  204. metadata +54 -5
  205. data/ext/wxruby3/swig/custom/swig3/rubyrun.swg +0 -456
@@ -105,8 +105,7 @@ module WXRuby3
105
105
  }
106
106
  else
107
107
  {
108
- Swig::DirectorTypeMismatchException::raise(rb_eTypeError,
109
- "get_data_here should return a string, or nil on failure");
108
+ Swig::DirectorTypeMismatchException::raise(swig_get_self(), "$symname", rb_eTypeError, "get_data_here should return a string, or nil on failure");
110
109
  }
111
110
  }
112
111
  else
@@ -278,7 +278,7 @@ module WXRuby3
278
278
  # like all DC this should best always be a temporary stack object
279
279
  # we do not allow creation in Ruby but rather provide class
280
280
  # methods for block execution on a temp dc
281
- unless Config.platform == :linux
281
+ if Config.instance.features_set?('USE_PRINTING_ARCHITECTURE', Director.AnyOf(*%w[WXMSW WXOSX USE_GTKPRINT]))
282
282
  spec.add_extend_code 'wxGCDC', <<~__HEREDOC
283
283
  static VALUE draw_on(const wxPrinterDC& dc)
284
284
  {
@@ -24,6 +24,7 @@ module WXRuby3
24
24
  when 'wxDialog'
25
25
  spec.items << 'wxDialogLayoutAdapter'
26
26
  spec.gc_as_object 'wxDialogLayoutAdapter'
27
+ spec.suppress_warning(514, 'wxDialogLayoutAdapter')
27
28
  spec.disown 'wxDialogLayoutAdapter* adapter'
28
29
  spec.new_object 'wxDialog::SetLayoutAdapter'
29
30
  spec.ignore('wxDialog::GetContentWindow',
@@ -87,6 +88,11 @@ module WXRuby3
87
88
  end
88
89
  spec.do_not_generate :functions
89
90
  when 'wxPropertySheetDialog'
91
+ # need to adjust sizer arg name to apply disown specs
92
+ spec.ignore 'wxPropertySheetDialog::SetInnerSizer(wxSizer *)', ignore_doc: false
93
+ spec.extend_interface 'wxPropertySheetDialog',
94
+ 'void SetInnerSizer(wxSizer *sizer_disown)'
95
+ spec.disown 'wxSizer *sizer_disown'
90
96
  spec.ignore 'wxPropertySheetDialog::GetContentWindow'
91
97
  # In Ruby a derived class with customized '#initialize' is far easier
92
98
  spec.ignore 'wxPropertySheetDialog::CreateBookCtrl'
@@ -0,0 +1,44 @@
1
+ # Copyright (c) 2023 M.J.N. Corino, The Netherlands
2
+ #
3
+ # This software is released under the MIT license.
4
+
5
+ ###
6
+ # wxRuby3 wxWidgets interface director
7
+ ###
8
+
9
+ require_relative './event'
10
+
11
+ module WXRuby3
12
+
13
+ class Director
14
+
15
+ class DialUpEvent < Event
16
+
17
+ def setup
18
+ super
19
+ spec.disable_proxies
20
+ # missing from interface docs
21
+ spec.add_swig_code '%constant int EVT_DIALUP_CONNECTED = wxEVT_DIALUP_CONNECTED;'
22
+ spec.add_swig_code '%constant int EVT_DIALUP_DISCONNECTED = wxEVT_DIALUP_DISCONNECTED;'
23
+ end
24
+
25
+ def doc_generator
26
+ DialUpEventDocGenerator.new(self)
27
+ end
28
+
29
+ end # class DialupEvent
30
+
31
+ end # class Director
32
+
33
+ class DialUpEventDocGenerator < DocGenerator
34
+
35
+ protected def gen_constants_doc(fdoc)
36
+ super
37
+ xref_table = package.all_modules.reduce(DocGenerator.constants_db) { |db, mod| db[mod] }
38
+ gen_constant_doc(fdoc, 'EVT_DIALUP_CONNECTED', xref_table['EVT_DIALUP_CONNECTED'], 'connected event')
39
+ gen_constant_doc(fdoc, 'EVT_DIALUP_DISCONNECTED', xref_table['EVT_DIALUP_DISCONNECTED'], 'disconnected event')
40
+ end
41
+
42
+ end
43
+
44
+ end # module WXRuby3
@@ -0,0 +1,45 @@
1
+ # Copyright (c) 2023 M.J.N. Corino, The Netherlands
2
+ #
3
+ # This software is released under the MIT license.
4
+
5
+ ###
6
+ # wxRuby3 Defs director
7
+ ###
8
+
9
+ module WXRuby3
10
+
11
+ class Director
12
+
13
+ class DialUpManager < Director
14
+
15
+ def setup
16
+ super
17
+ spec.gc_as_untracked
18
+ spec.make_abstract 'wxDialUpManager'
19
+ spec.disable_proxies
20
+ spec.ignore 'wxDialUpManager::GetISPNames', ignore_doc: false
21
+ spec.add_extend_code 'wxDialUpManager', <<~__HEREDOC
22
+ VALUE get_isp_names() const
23
+ {
24
+ VALUE rb_isps = rb_ary_new();
25
+ wxArrayString isps;
26
+ size_t n_isps = $self->GetISPNames(isps);
27
+ for (size_t i=0; i<n_isps ;++i)
28
+ {
29
+ rb_ary_push(rb_isps, WXSTR_TO_RSTR(isps.Item(i)));
30
+ }
31
+ return rb_isps;
32
+ }
33
+ __HEREDOC
34
+ spec.map 'wxArrayString& names', swig: false do
35
+ map_in ignore: true, code: ''
36
+ map_out ignore: 'size_t'
37
+ map_argout as: 'Array<String>'
38
+ end
39
+ end
40
+
41
+ end
42
+
43
+ end
44
+
45
+ end
@@ -15,9 +15,8 @@ module WXRuby3
15
15
  include Typemap::TreeItemId
16
16
 
17
17
  def setup
18
- unless Config.instance.features_set?('__WXUNIVERSAL__')
19
- spec.ignore('wxDragImage::DoDrawImage', 'wxDragImage::GetImageRect', 'wxDragImage::UpdateBackingFromWindow')
20
- end
18
+ # If wxRuby ever supports WXUNIVERSAL this should change to #ignore_unless
19
+ spec.ignore('wxDragImage::DoDrawImage', 'wxDragImage::GetImageRect', 'wxDragImage::UpdateBackingFromWindow')
21
20
  super
22
21
  end
23
22
  end # class DragImage
@@ -195,14 +195,12 @@ module WXRuby3
195
195
  }
196
196
  __HEREDOC
197
197
  spec.ignore 'wxQueueEvent'
198
- spec.ignore('wxEVT_HOTKEY') unless Config.instance.features_set?('wxUSE_HOTKEY')
199
- spec.ignore('wxEVT_MOUSE_CAPTURE_CHANGED', 'wxEVT_MOUSE_CAPTURE_LOST', 'wxEVT_DISPLAY_CHANGED') unless Config.instance.features_set?('__WXMSW__')
198
+ spec.ignore_unless('USE_HOTKEY', 'wxEVT_HOTKEY')
199
+ spec.ignore_unless('WXMSW', 'wxEVT_MOUSE_CAPTURE_CHANGED', 'wxEVT_MOUSE_CAPTURE_LOST', 'wxEVT_DISPLAY_CHANGED')
200
200
  # make sure this event constant definition exists
201
201
  spec.add_swig_code %Q{%constant wxEventType wxEVT_MENU_HIGHLIGHT_ALL = wxEVT_MENU_HIGHLIGHT;}
202
202
  # add event type constant missing from interface defs
203
203
  spec.add_swig_code %Q{%constant wxEventType wxEVT_NC_PAINT = wxEVT_NC_PAINT;}
204
- # add undocumented global function
205
- spec.add_swig_code 'wxWindow* wxFindFocusDescendant(wxWindow* ancestor);'
206
204
  end
207
205
  super
208
206
  end
@@ -237,8 +235,28 @@ module WXRuby3
237
235
  end
238
236
  defmod
239
237
  end
238
+
239
+ def doc_generator
240
+ if spec.module_name == 'wxEvent'
241
+ EventDocGenerator.new(self)
242
+ else
243
+ super
244
+ end
245
+ end
246
+
240
247
  end # class Event
241
248
 
242
249
  end # class Director
243
250
 
251
+ class EventDocGenerator < DocGenerator
252
+
253
+ protected def gen_constants_doc(fdoc)
254
+ super
255
+ xref_table = package.all_modules.reduce(DocGenerator.constants_db) { |db, mod| db[mod] }
256
+ gen_constant_doc(fdoc, 'EVT_MENU_HIGHLIGHT_ALL', xref_table['EVT_MENU_HIGHLIGHT'], '')
257
+ gen_constant_doc(fdoc, 'EVT_NC_PAINT', xref_table['EVT_NC_PAINT'], '')
258
+ end
259
+
260
+ end
261
+
244
262
  end # module WXRuby3
@@ -0,0 +1,35 @@
1
+ # Copyright (c) 2023 M.J.N. Corino, The Netherlands
2
+ #
3
+ # This software is released under the MIT license.
4
+
5
+ ###
6
+ # wxRuby3 wxWidgets interface director
7
+ ###
8
+
9
+ require_relative './window'
10
+
11
+ module WXRuby3
12
+
13
+ class Director
14
+
15
+ class FileCtrl < Window
16
+
17
+ def setup
18
+ super
19
+ # for GetFileNames and GetPaths
20
+ spec.map 'wxArrayString &filenames', 'wxArrayString &paths', as: 'Array<String>' do
21
+ map_in ignore: true, temp: 'wxArrayString tmp', code: '$1 = &tmp;'
22
+ map_argout code: <<~__HEREDOC
23
+ $result = rb_ary_new();
24
+ for (size_t i=0; i<tmp$argnum.Count() ;++i)
25
+ {
26
+ rb_ary_push($result, WXSTR_TO_RSTR(tmp$argnum.Item(i)));
27
+ }
28
+ __HEREDOC
29
+ end
30
+ end
31
+ end # class FileCtrl
32
+
33
+ end # class Director
34
+
35
+ end # module WXRuby3
@@ -0,0 +1,26 @@
1
+ # Copyright (c) 2023 M.J.N. Corino, The Netherlands
2
+ #
3
+ # This software is released under the MIT license.
4
+
5
+ ###
6
+ # wxRuby3 wxWidgets interface director
7
+ ###
8
+
9
+ require_relative './event'
10
+
11
+ module WXRuby3
12
+
13
+ class Director
14
+
15
+ class FileCtrlEvent < Event
16
+
17
+ def setup
18
+ super
19
+ spec.disable_proxies
20
+ spec.do_not_generate(:variables, :defines, :enums, :functions) # with FileCtrl
21
+ end
22
+ end # class FileCtrlEvent
23
+
24
+ end # class Director
25
+
26
+ end # module WXRuby3
@@ -21,9 +21,7 @@ module WXRuby3
21
21
  when 'wxFrame'
22
22
  spec.ignore %w[
23
23
  wxFrame::OnCreateStatusBar wxFrame::OnCreateToolBar]
24
- unless Config.instance.features_set?(*%w[__WXMSW__ wxUSE_TASKBARBUTTON])
25
- spec.ignore('wxFrame::MSWGetTaskBarButton')
26
- end
24
+ spec.ignore_unless(%w[WXMSW USE_TASKBARBUTTON], 'wxFrame::MSWGetTaskBarButton')
27
25
  # this reimplemented window base method need to be properly wrapped but
28
26
  # is missing from the XML docs
29
27
  spec.extend_interface('wxFrame', 'virtual void OnInternalIdle()')
@@ -22,6 +22,24 @@ module WXRuby3
22
22
  spec.ignore %w{
23
23
  wxTheColourDatabase
24
24
  }
25
+ if Config.instance.wx_version >= '3.3.0'
26
+ spec.ignore 'wxColourDatabase::GetAllNames', ignore_doc: false
27
+ spec.add_extend_code 'wxColourDatabase', <<~__HEREDOC
28
+ VALUE get_all_names() const
29
+ {
30
+ wxVector<wxString> nms = $self->GetAllNames();
31
+ VALUE rb_nms = rb_ary_new();
32
+ for (const wxString& nm : nms)
33
+ {
34
+ rb_ary_push(rb_nms, WXSTR_TO_RSTR(nm));
35
+ }
36
+ return rb_nms;
37
+ }
38
+ __HEREDOC
39
+ spec.map 'wxVector<wxString>' => 'Array<String>', swig: false do
40
+ map_out code: ''
41
+ end
42
+ end
25
43
  spec.ignore [
26
44
  'wxClientDisplayRect(int *,int *,int *,int *)',
27
45
  'wxDisplaySize(int *,int *)',
@@ -38,7 +56,7 @@ module WXRuby3
38
56
  if ( TYPE($input) == T_DATA )
39
57
  {
40
58
  void* argp$argnum;
41
- SWIG_ConvertPtr($input, &argp$argnum, $1_descriptor, 1 );
59
+ SWIG_ConvertPtr($input, &argp$argnum, $1_descriptor, 0);
42
60
  $1 = reinterpret_cast< $1_basetype * >(argp$argnum);
43
61
  }
44
62
  else
@@ -60,16 +78,14 @@ module WXRuby3
60
78
  wxPoint::x wxPoint::y
61
79
  wxRealPoint::x wxRealPoint::y
62
80
  ]
63
- spec.ignore('wxStockCursor.wxCURSOR_DEFAULT') unless Config.instance.features_set?('__WXGTK__')
64
- unless Config.instance.features_set?('__X__')
65
- spec.ignore %w{
66
- wxStockCursor.wxCURSOR_CROSS_REVERSE
67
- wxStockCursor.wxCURSOR_DOUBLE_ARROW
68
- wxStockCursor.wxCURSOR_BASED_ARROW_UP
69
- wxStockCursor.wxCURSOR_BASED_ARROW_DOWN
70
- }
71
- end
72
- spec.ignore('wxStockCursor.wxCURSOR_COPY_ARROW') unless Config.instance.features_set?('__WXOSX__')
81
+ spec.ignore_unless('WXGTK', 'wxStockCursor.wxCURSOR_DEFAULT')
82
+ spec.ignore_unless 'WXX11', %w{
83
+ wxStockCursor.wxCURSOR_CROSS_REVERSE
84
+ wxStockCursor.wxCURSOR_DOUBLE_ARROW
85
+ wxStockCursor.wxCURSOR_BASED_ARROW_UP
86
+ wxStockCursor.wxCURSOR_BASED_ARROW_DOWN
87
+ }
88
+ spec.ignore_unless('WXOSX', 'wxStockCursor.wxCURSOR_COPY_ARROW')
73
89
  spec.add_extend_code 'wxRect', <<~__HEREDOC
74
90
  wxRect add(const wxRect &rect) const {
75
91
  return (*(const wxRect*)$self) + rect;
@@ -34,9 +34,7 @@ module WXRuby3
34
34
  'wxGraphicsContext::DrawLines(size_t, const wxPoint2DDouble *, wxPolygonFillMode)',
35
35
  'wxGraphicsContext::StrokeLines(size_t, const wxPoint2DDouble *)',
36
36
  'wxGraphicsContext::StrokeLines (size_t, const wxPoint2DDouble *, const wxPoint2DDouble *)'
37
- if Config.platform == :linux
38
- spec.ignore 'wxGraphicsContext::Create(const wxPrinterDC &)'
39
- end
37
+ spec.ignore_unless(Config::AnyOf.new('WXMSW', 'WXOSX', 'USE_GTKPRINT'), 'wxGraphicsContext::Create(const wxPrinterDC &)')
40
38
  spec.add_header_code <<~__HEREDOC
41
39
  // special free funcs are needed to clean up Dashes array if it has been
42
40
  // set; wxWidgets does not do this automatically so will leak if not
@@ -229,7 +227,7 @@ module WXRuby3
229
227
  __CODE
230
228
  end
231
229
  # add convenience method providing efficient gc memory management
232
- unless Config.platform == :linux
230
+ if Config.instance.features_set?('USE_PRINTING_ARCHITECTURE', Director.AnyOf(*%w[WXMSW WXOSX USE_GTKPRINT]))
233
231
  spec.add_extend_code 'wxGraphicsContext', <<~__HEREDOC
234
232
  static VALUE draw_on(const wxPrinterDC& dc)
235
233
  {
@@ -182,12 +182,12 @@ module WXRuby3
182
182
  static WxRuby_ID ga_mouse_id("mouse");
183
183
 
184
184
  inline wxGridActivationResult
185
- array_to_wxGridActivationResult(VALUE rbarr)
185
+ array_to_wxGridActivationResult(VALUE self, const char* method, VALUE rbarr)
186
186
  {
187
187
  if (rbarr == Qnil ||
188
188
  !(TYPE(rbarr) == T_ARRAY || TYPE(rbarr) == T_SYMBOL))
189
189
  {
190
- Swig::DirectorTypeMismatchException::raise(SWIG_ErrorType(SWIG_ArgError(SWIG_ERROR)),
190
+ Swig::DirectorTypeMismatchException::raise(self, method, SWIG_ErrorType(SWIG_ArgError(SWIG_ERROR)),
191
191
  "in output value of type 'wxGridActivationResult'");
192
192
  }
193
193
  if (TYPE(rbarr) == T_SYMBOL)
@@ -197,7 +197,7 @@ module WXRuby3
197
197
  else if (SYM2ID(rbarr) == ga_show_editor_id())
198
198
  return wxGridActivationResult::DoEdit();
199
199
  else
200
- Swig::DirectorTypeMismatchException::raise(SWIG_ErrorType(SWIG_ArgError(SWIG_ERROR)),
200
+ Swig::DirectorTypeMismatchException::raise(self, method, SWIG_ErrorType(SWIG_ArgError(SWIG_ERROR)),
201
201
  "in output value of type 'wxGridActivationResult'");
202
202
  }
203
203
  else
@@ -206,7 +206,7 @@ module WXRuby3
206
206
  VALUE rbStr = rb_ary_shift(rbarr); // could be nil
207
207
  if (rbAction == Qnil || TYPE(rbAction) != T_SYMBOL)
208
208
  {
209
- Swig::DirectorTypeMismatchException::raise(SWIG_ErrorType(SWIG_ArgError(SWIG_ERROR)),
209
+ Swig::DirectorTypeMismatchException::raise(self, method, SWIG_ErrorType(SWIG_ArgError(SWIG_ERROR)),
210
210
  "in output value of type 'wxGridActivationResult'");
211
211
  }
212
212
  else if (SYM2ID(rbAction) == ga_change_id() && rbStr != Qnil)
@@ -220,7 +220,7 @@ module WXRuby3
220
220
  else if (SYM2ID(rbAction) == ga_show_editor_id())
221
221
  return wxGridActivationResult::DoEdit();
222
222
  else
223
- Swig::DirectorTypeMismatchException::raise(SWIG_ErrorType(SWIG_ArgError(SWIG_ERROR)),
223
+ Swig::DirectorTypeMismatchException::raise(self, method, SWIG_ErrorType(SWIG_ArgError(SWIG_ERROR)),
224
224
  "in output value of type 'wxGridActivationResult'");
225
225
  }
226
226
  }
@@ -366,7 +366,7 @@ module WXRuby3
366
366
  obj2 = SWIG_NewPointerObj(SWIG_as_voidptr(grid), SWIGTYPE_p_wxGrid, 0 );
367
367
  obj3 = wxGridActivationSource_to_array(actSource);
368
368
  result = rb_funcall(swig_get_self(), try_activate_id(), 4,obj0,obj1,obj2,obj3);
369
- return array_to_wxGridActivationResult(result);
369
+ return array_to_wxGridActivationResult(swig_get_self(), "try_activate", result);
370
370
  __METHOD__
371
371
  elsif !helpers_added && line["SwigDirector_#{module_name}::SwigDirector_#{module_name}(VALUE self"]
372
372
  # insert helper methods
@@ -87,10 +87,13 @@ module WXRuby3
87
87
  __CODE
88
88
  end
89
89
 
90
- spec.ignore 'wxGrid::GetSelectedBlocks' # ignore
90
+ spec.ignore 'wxGrid::GetSelectedBlocks', ignore_doc: false # ignore
91
+ spec.map 'wxGridBlocks' => 'Array<Wx::GRID::GridBlockCoords>', swig: false do
92
+ map_out code: ''
93
+ end
91
94
  # add rubified API (finish in pure Ruby)
92
95
  spec.add_extend_code 'wxGrid', <<~__HEREDOC
93
- VALUE selected_blocks()
96
+ VALUE each_selected_block()
94
97
  {
95
98
  VALUE rc = Qnil;
96
99
  if (rb_block_given_p())
@@ -103,6 +106,34 @@ module WXRuby3
103
106
  }
104
107
  return rc;
105
108
  }
109
+
110
+ VALUE each_selected_row_block()
111
+ {
112
+ VALUE rc = Qnil;
113
+ if (rb_block_given_p())
114
+ {
115
+ wxGridBlockCoordsVector sel = $self->GetSelectedRowBlocks();
116
+ for (const wxGridBlockCoords& gbc : sel)
117
+ {
118
+ rc = rb_yield (SWIG_NewPointerObj(new wxGridBlockCoords(gbc), SWIGTYPE_p_wxGridBlockCoords, SWIG_POINTER_OWN));
119
+ }
120
+ }
121
+ return rc;
122
+ }
123
+
124
+ VALUE each_selected_col_block()
125
+ {
126
+ VALUE rc = Qnil;
127
+ if (rb_block_given_p())
128
+ {
129
+ wxGridBlockCoordsVector sel = $self->GetSelectedColBlocks();
130
+ for (const wxGridBlockCoords& gbc : sel)
131
+ {
132
+ rc = rb_yield (SWIG_NewPointerObj(new wxGridBlockCoords(gbc), SWIGTYPE_p_wxGridBlockCoords, SWIG_POINTER_OWN));
133
+ }
134
+ }
135
+ return rc;
136
+ }
106
137
  __HEREDOC
107
138
 
108
139
  spec.ignore 'wxGrid::GetGridWindowOffset(const wxGridWindow *, int &, int &) const'
@@ -113,7 +144,7 @@ module WXRuby3
113
144
  typedef wxGrid::TabBehaviour TabBehaviour;
114
145
  __HEREDOC
115
146
 
116
- spec.map 'wxGridBlockCoordsVector' => 'Array<Wx::GRID::GridBlockCoords' do
147
+ spec.map 'wxGridBlockCoordsVector' => 'Array<Wx::GRID::GridBlockCoords>' do
117
148
  map_out code: <<~__CODE
118
149
  $result = rb_ary_new();
119
150
  for (const wxGridBlockCoords& gbc: $1)
@@ -16,7 +16,7 @@ module WXRuby3
16
16
 
17
17
  def setup
18
18
  super
19
- spec.items << 'wxHelpControllerBase'
19
+ spec.items << 'wxHelpControllerBase' << 'helpfrm.h'
20
20
  spec.fold_bases(spec.module_name => 'wxHelpControllerBase')
21
21
  spec.rename_for_ruby('Init' => "#{spec.module_name}::Initialize")
22
22
  # ignore these (pure virtual) decls
@@ -25,9 +25,12 @@ module WXRuby3
25
25
  spec.ignore('wxIcon::wxIcon(const char *const *)', 'wxIcon::wxIcon(const char[],int,int)')
26
26
  # xml specs incorrectly list this method for MWS while it does not exist anymore
27
27
  spec.ignore('wxIcon::ConvertToDisabled')
28
- unless Config.platform == :mingw
28
+ if Config.platform == :mingw
29
+ spec.ignore 'wxIconBundle::wxIconBundle(const wxString &, WXHINSTANCE)',
30
+ 'wxIconBundle::AddIcon(const wxString&,WXHINSTANCE)',
31
+ 'wxIcon::CreateFromHICON'
32
+ else
29
33
  spec.override_inheritance_chain('wxIcon', %w[wxBitmap wxGDIObject wxObject])
30
- spec.ignore 'wxIconBundle::wxIconBundle(const wxString &, WXHINSTANCE)'
31
34
  end
32
35
  super
33
36
  end
@@ -55,12 +55,11 @@ module WXRuby3
55
55
  (void)self->EditLabel(item);
56
56
  }
57
57
  __HEREDOC
58
- unless Config.instance.features_set?('wxHAS_LISTCTRL_COLUMN_ORDER')
59
- spec.ignore %w[wxListCtrl::GetColumnIndexFromOrder
60
- wxListCtrl::GetColumnOrder
61
- wxListCtrl::GetColumnsOrder
62
- wxListCtrl::SetColumnsOrder]
63
- end
58
+ spec.ignore_unless 'HAS_LISTCTRL_COLUMN_ORDER',
59
+ %w[wxListCtrl::GetColumnIndexFromOrder
60
+ wxListCtrl::GetColumnOrder
61
+ wxListCtrl::GetColumnsOrder
62
+ wxListCtrl::SetColumnsOrder]
64
63
  # these are protected so ignored by default but we want them here
65
64
  spec.regard %w[
66
65
  wxListCtrl::OnGetItemAttr
@@ -28,9 +28,7 @@ module WXRuby3
28
28
  wxLanguageInfo::DescriptionNative
29
29
  wxLanguageInfo::LayoutDirection
30
30
  ]
31
- if Config.instance.features_set?('__WXMSW__')
32
- spec.regard('wxLanguageInfo::WinLang', 'wxLanguageInfo::WinSublang')
33
- end
31
+ spec.ignore_unless('WXMSW', 'wxLanguageInfo::WinLang', 'wxLanguageInfo::WinSublang')
34
32
  end
35
33
  end # class Locale
36
34
 
@@ -14,16 +14,13 @@ module WXRuby3
14
14
 
15
15
  def setup
16
16
  spec.gc_as_object %w[wxLog wxLogChain wxLogInterposer wxLogWindow]
17
- spec.items.concat(%w[wxLogBuffer wxLogChain wxLogGui wxLogStderr wxLogStream wxLogTextCtrl wxLogInterposer wxLogWindow wxLogNull wxLogRecordInfo])
17
+ spec.items.concat(%w[wxLogBuffer wxLogChain wxLogGui wxLogStderr wxLogTextCtrl wxLogInterposer wxLogWindow wxLogNull wxLogRecordInfo])
18
18
  spec.no_proxy(%w[wxLogBuffer wxLogGui wxLogStderr wxLogTextCtrl wxLogWindow])
19
19
  spec.force_proxy(%w[wxLogInterposer])
20
20
  spec.ignore 'wxLog::SetFormatter'
21
21
  spec.regard %w[wxLog::DoLogRecord wxLog::DoLogTextAtLevel wxLog::DoLogText]
22
22
  spec.ignore 'wxLogBuffer::Flush'
23
23
  spec.ignore 'wxLogGui::Flush'
24
- if Config.instance.features_set?('wxUSE_STD_IOSTREAM')
25
- spec.ignore 'wxLogStream'
26
- end
27
24
  # wxLogStderr
28
25
  spec.ignore 'wxLogStderr::wxLogStderr'
29
26
  spec.add_extend_code 'wxLogStderr', <<~__HEREDOC
@@ -16,6 +16,60 @@ module WXRuby3
16
16
 
17
17
  def setup
18
18
  super
19
+ spec.map 'const wxURI&' => 'URI' do
20
+ add_header <<~__CODE
21
+ static VALUE wxRuby_GetRubyURIClass()
22
+ {
23
+ static VALUE rb_cURI = Qnil;
24
+ if (NIL_P(rb_cURI))
25
+ {
26
+ rb_require("uri");
27
+ rb_cURI = rb_const_get(rb_cObject, rb_intern("URI"));
28
+ }
29
+ return rb_cURI;
30
+ }
31
+ static WxRuby_ID to_s_id("to_s");
32
+ __CODE
33
+ map_in temp: 'wxURI tmp', code: <<~__CODE
34
+ if (rb_obj_is_kind_of($input, wxRuby_GetRubyURIClass()))
35
+ {
36
+ VALUE s = rb_funcall($input, to_s_id(), 0);
37
+ tmp = wxURI(RSTR_TO_WXSTR(s));
38
+ $1 = &tmp;
39
+ }
40
+ else
41
+ {
42
+ rb_raise(rb_eArgError, "expected URI for %d", $argnum-1);
43
+ }
44
+ __CODE
45
+ map_typecheck precedence: 'POINTER', code: '$1 = rb_obj_is_kind_of($input, wxRuby_GetRubyURIClass());'
46
+ end
47
+ spec.map 'wxFileOffset' => 'Integer' do
48
+ # we need these inline methods here as we do not want SWIG to preprocess the code
49
+ # as it will do in the type mapping code sections
50
+ add_header_code <<~__CODE
51
+ inline wxFileOffset __ruby2wxFileOffset(VALUE num)
52
+ {
53
+ #ifdef wxHAS_HUGE_FILES
54
+ return static_cast<wxFileOffset> (NUM2LL(num));
55
+ #else
56
+ return static_cast<wxFileOffset> (NUM2LONG(num));
57
+ #endif
58
+ }
59
+ inline VALUE __wxFileOffset2ruby(wxFileOffset offs)
60
+ {
61
+ #ifdef wxHAS_HUGE_FILES
62
+ return LL2NUM(offs);
63
+ #else
64
+ return LONG2NUM(offs);
65
+ #endif
66
+ }
67
+ __CODE
68
+
69
+ map_in code: '$1 = __ruby2wxFileOffset($input);'
70
+ map_out code: '$result = __wxFileOffset2ruby($1);'
71
+ map_typecheck code: '$1 = TYPE($input) == T_FIXNUM;'
72
+ end
19
73
  spec.do_not_generate :variables, :enums, :defines, :functions
20
74
  end
21
75
  end # class MediaCtrl
@@ -85,6 +85,8 @@ module WXRuby3
85
85
  spec.add_swig_code <<~__HEREDOC
86
86
  %markfunc wxMenu "mark_wxMenu";
87
87
  __HEREDOC
88
+ # ignore MSW specific method
89
+ spec.ignore 'wxMenu::MSWCommand'
88
90
  # fix SWIG's problems with const& return value
89
91
  spec.ignore('wxMenu::GetTitle', ignore_doc: false) # keep doc
90
92
  spec.add_extend_code 'wxMenu', <<~__HEREDOC
@@ -92,7 +94,20 @@ module WXRuby3
92
94
  wxString const& title = $self->GetTitle();
93
95
  return &const_cast<wxString&> (title);
94
96
  }
95
- __HEREDOC
97
+
98
+ VALUE each_item()
99
+ {
100
+ VALUE rc = Qnil;
101
+ for (size_t i=0; i<$self->GetMenuItemCount(); ++i)
102
+ {
103
+ wxMenuItem *wx_menu_item = $self->FindItemByPosition(i);
104
+ VALUE rb_menu_item = SWIG_NewPointerObj(SWIG_as_voidptr(wx_menu_item),
105
+ SWIGTYPE_p_wxMenuItem, 0);
106
+ rc = rb_yield(rb_menu_item);
107
+ }
108
+ return rc;
109
+ }
110
+ __HEREDOC
96
111
  super
97
112
  end
98
113
  end # class Menu
@@ -21,11 +21,11 @@ module WXRuby3
21
21
  spec.ignore(%w[wxMenuItem::GetLabel wxMenuItem::GetName wxMenuItem::GetText wxMenuItem::SetText wxMenuItem::GetLabelFromText])
22
22
  # ignore this as there is no implementation anymore
23
23
  spec.ignore 'wxMenuItem::GetAccelFromString'
24
- spec.ignore('wxMenuItem::GetAccel') unless Config.instance.features_set?('wxUSE_ACCEL')
24
+ spec.ignore_unless('USE_ACCEL', 'wxMenuItem::GetAccel')
25
25
  spec.no_proxy 'wxMenuItem::GetAccel'
26
26
  spec.ignore 'wxMenuItem::GetBitmap(bool)' # not portable
27
27
  if Config.instance.wx_version >= '3.3.0'
28
- spec.ignore('wxMenuItem::SetBackgroundColour','wxMenuItem::SetFont','wxMenuItem::SetTextColour') unless Config.instance.features_set?('__WXMSW__')
28
+ spec.ignore_unless('WXMSW', 'wxMenuItem::SetBackgroundColour','wxMenuItem::SetFont','wxMenuItem::SetTextColour')
29
29
  end
30
30
  super
31
31
  end
@@ -53,12 +53,6 @@ module WXRuby3
53
53
  spec.suppress_warning(473, 'wxPGArrayEditorDialog::GetTextCtrlValidator')
54
54
  # make sure SWIG knows this type is an enum
55
55
  spec.add_swig_code 'enum wxPGPropertyFlags;'
56
- if Config.instance.wx_version >= '3.3.0'
57
- # internal use only
58
- spec.ignore 'wxPG_PROP_PASSWORD',
59
- 'wxPG_PROP_USE_CHECKBOX',
60
- 'wxPG_PROP_USE_DCC'
61
- end
62
56
  end
63
57
  end # class PGArrayEditorDialog
64
58