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
@@ -17,13 +17,31 @@ module WXRuby3
17
17
  include Typemap::TreeItemId
18
18
 
19
19
  def setup
20
- spec.post_processors << :fixtreectrl
21
20
  spec.items.replace %w[wxTreeCtrl treebase.h]
22
21
  spec.override_inheritance_chain('wxTreeCtrl', %w[wxControl wxWindow wxEvtHandler wxObject])
23
22
  # mixin WithImages
24
23
  spec.include_mixin 'wxTreeCtrl', 'Wx::WithImages'
25
24
  spec.ignore('operator!=', 'operator==')
26
25
  spec.include 'wx/dirctrl.h'
26
+ # Use a custom interface class to work around the wxTreeCtrl::SortItems/OnCompareItems issue
27
+ # without having to patch the SWIG director class
28
+ spec.add_header_code <<~__HEREDOC
29
+ class WxRubyTreeCtrl : public wxTreeCtrl
30
+ {
31
+ public:
32
+ WxRubyTreeCtrl() : wxTreeCtrl() {}
33
+ WxRubyTreeCtrl(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition,
34
+ const wxSize& size = wxDefaultSize, long style = wxTR_DEFAULT_STYLE,
35
+ const wxValidator& validator = wxDefaultValidator, const wxString& name = wxTreeCtrlNameStr)
36
+ : wxTreeCtrl(parent, id, pos, size, style, validator, name)
37
+ {}
38
+ virtual ~WxRubyTreeCtrl() {}
39
+ private:
40
+ DECLARE_DYNAMIC_CLASS(WxRubyTreeCtrl);
41
+ };
42
+ IMPLEMENT_DYNAMIC_CLASS(WxRubyTreeCtrl, wxTreeCtrl);
43
+ __HEREDOC
44
+ spec.use_class_implementation('wxTreeCtrl', 'WxRubyTreeCtrl')
27
45
  # These only differ from SetXXXList in the way memory ownership is
28
46
  # transferred. So only support the version that won't leak on wxRuby.
29
47
  spec.ignore %w[
@@ -57,7 +75,7 @@ module WXRuby3
57
75
  wxTreeCtrl::GetFocusedItem
58
76
  wxTreeCtrl::GetSelection
59
77
  ]
60
- if Config.instance.features_set?('wxHAS_LAST_VISIBLE')
78
+ if Config.instance.features_set?('HAS_LAST_VISIBLE')
61
79
  spec.no_proxy 'wxTreeCtrl::GetLastVisible'
62
80
  end
63
81
  # simply a nuisance to support
@@ -66,7 +84,7 @@ module WXRuby3
66
84
  wxTreeCtrl::EndEditLabel
67
85
  ]
68
86
  # for now, ignore this version as the added customization features
69
- # do not work as yet and may cause us more trouble than it's worth
87
+ # work only on WXMSW as yet and may cause us more trouble than it's worth
70
88
  spec.ignore 'wxTreeCtrl::EditLabel'
71
89
  # add simplified non-virtual version
72
90
  spec.add_extend_code 'wxTreeCtrl', <<~__HEREDOC
@@ -76,10 +94,9 @@ module WXRuby3
76
94
  (void)self->EditLabel(item);
77
95
  }
78
96
  __HEREDOC
79
- if [:wxmsw, :wxqt].include?(Config.instance.wx_port)
80
- spec.ignore('wxTreeCtrl::SetButtonsImageList')
81
- spec.ignore('wxTreeCtrl::GetButtonsImageList')
82
- end
97
+ spec.ignore_unless(Config::AnyOf.new(*%w[WXGTK WXOSX]),
98
+ 'wxTreeCtrl::SetButtonsImageList',
99
+ 'wxTreeCtrl::GetButtonsImageList')
83
100
  # these reimplemented window base methods need to be properly wrapped but
84
101
  # are missing from the XML docs
85
102
  spec.extend_interface('wxTreeCtrl',
@@ -371,47 +388,4 @@ module WXRuby3
371
388
 
372
389
  end # class Director
373
390
 
374
- module SwigRunner
375
- class Processor
376
-
377
- # special post-processor for TreeCtrl
378
- class Fixtreectrl < Processor
379
-
380
- def run
381
- director_found = false
382
- update_source do |line|
383
- # Ugly: special fixes for TreeCtrl - these macros and extra funcs
384
- # are needed to allow user-defined sorting to work
385
- # default ctor needed for Swig::Director
386
- if line["Director(VALUE self) : swig_self(self), swig_disown_flag(false)"]
387
- line = " Director() { } // added by fixmodule.rb \n" + line
388
- end
389
- if line["SwigDirector_wxTreeCtrl::SwigDirector_wxTreeCtrl(VALUE self)"]
390
- line = "IMPLEMENT_DYNAMIC_CLASS(SwigDirector_wxTreeCtrl, wxTreeCtrl);\n" + line
391
- director_found = true
392
- end
393
-
394
- line
395
- end
396
- if director_found
397
- # We also need to tweak the header file
398
- update_header do |line|
399
- if line.strip == 'public:'
400
- line << "\nSwigDirector_wxTreeCtrl() {};"
401
- elsif /\A};/ =~ line
402
- line = <<~__HEREDOC
403
- private:
404
- DECLARE_DYNAMIC_CLASS(SwigDirector_wxTreeCtrl);
405
- };
406
- __HEREDOC
407
- end
408
- line
409
- end
410
- end
411
- end
412
- end # class Fixtreectrl
413
-
414
- end
415
- end
416
-
417
391
  end # module WXRuby3
@@ -227,7 +227,7 @@ module WXRuby3
227
227
  $1 = rb_obj_is_kind_of($input, rb_const_get(mWxPG, var_ColourPropertyValue_id()));
228
228
  __CODE
229
229
  end
230
- if Config.instance.features_set?('wxUSE_LONGLONG')
230
+ if Config.instance.features_set?('USE_LONGLONG')
231
231
  # wxLongLong mapping to be considered before considering 'long' (see typecheck precedence)
232
232
  spec.map 'wxLongLong' => 'Integer' do
233
233
  map_in code: <<~__CODE
@@ -68,7 +68,6 @@ module WXRuby3
68
68
  spec.ignore [
69
69
  'wxWindow::TransferDataFromWindow',
70
70
  'wxWindow::TransferDataToWindow',
71
- 'wxWindow::GetAccessible',
72
71
  'wxWindow::PopEventHandler',
73
72
  'wxWindow::SetConstraints',
74
73
  'wxWindow::GetHandle',
@@ -110,10 +109,15 @@ module WXRuby3
110
109
  spec.ignore 'wxWindow::EnableTouchEvents'
111
110
  end
112
111
  if Config.instance.wx_version >= '3.3.0'
113
- spec.ignore('wxWindow::MSWDisableComposited') unless Config.instance.features_set?('__WXMSW__')
112
+ spec.ignore_unless('WXMSW', 'wxWindow::MSWDisableComposited')
114
113
  end
115
- spec.ignore('wxWindow::SetAccessible') unless Config.instance.features_set?('wxUSE_ACCESSIBILITY')
116
- spec.ignore(%w[wxWindow::RegisterHotKey wxWindow::UnregisterHotKey]) unless Config.instance.features_set?('wxUSE_HOTKEY')
114
+ if Config.instance.features_set?('USE_ACCESSIBILITY')
115
+ spec.disown 'wxAccessible *accessible'
116
+ else
117
+ spec.ignore('wxWindow::SetAccessible',
118
+ 'wxWindow::GetAccessible')
119
+ end
120
+ spec.ignore_unless('USE_HOTKEY', %w[wxWindow::RegisterHotKey wxWindow::UnregisterHotKey])
117
121
  spec.ignore('wxWindow::SetSize(int, int)') # not useful as the wxSize variant will also accept an array
118
122
  spec.swig_import %w{
119
123
  swig/classes/include/wxObject.h
@@ -189,7 +193,22 @@ module WXRuby3
189
193
 
190
194
  return do_paint_buffered(self);
191
195
  }
192
- __HEREDOC
196
+
197
+ VALUE each_child()
198
+ {
199
+ const wxWindowList& child_list = self->GetChildren();
200
+ VALUE rc = Qnil;
201
+ wxWindowList::compatibility_iterator node = child_list.GetFirst();
202
+ while (node)
203
+ {
204
+ wxObject *child = node->GetData();
205
+ VALUE rb_child = wxRuby_WrapWxObjectInRuby(child);
206
+ rc = rb_yield(rb_child);
207
+ node = node->GetNext();
208
+ }
209
+ return rc;
210
+ }
211
+ __HEREDOC
193
212
  spec.override_events 'wxWindow', 'EVT_ACTIVATE' => ['EVT_ACTIVATE', 0, 'wxActivateEvent']
194
213
  when 'wxNonOwnedWindow'
195
214
  spec.no_proxy('wxNonOwnedWindow')
@@ -94,7 +94,7 @@ module WXRuby3
94
94
 
95
95
  def each_package(&block)
96
96
  packages.each_value do |pkg|
97
- pkg.each_package(&block) if Config.instance.features_set?(*pkg.required_features)
97
+ pkg.each_package(&block) if Package.full_docs? || Config.instance.features_set?(*pkg.required_features)
98
98
  end
99
99
  end
100
100
 
@@ -269,7 +269,7 @@ module WXRuby3
269
269
  end
270
270
 
271
271
  def handle_item_ignore(defmod, fullname, ignore, ignoredoc)
272
- action = ignore ? 'ignore' : 'regard'
272
+ action = (ignore==false) ? 'regard' : 'ignore'
273
273
  # find the item
274
274
  item = defmod.find_item(fullname)
275
275
  if item
@@ -361,8 +361,8 @@ module WXRuby3
361
361
  # extract the module definitions
362
362
  defmod = Extractor.extract_module(spec.package, spec.module_name, spec.name, spec.items, gendoc: gendoc)
363
363
  # handle ignores
364
- spec.ignores.each_pair do |fullname, ignoredoc|
365
- handle_item_ignore(defmod, fullname, true, ignoredoc)
364
+ spec.ignores.each_pair do |fullname, ignore_spec|
365
+ handle_item_ignore(defmod, fullname, ignore_spec[:ignore], ignore_spec[:ignore_doc])
366
366
  end
367
367
  # handle regards
368
368
  spec.regards.each_pair do |fullname, regarddoc|
@@ -75,14 +75,14 @@ module WXRuby3
75
75
  "self.#{rb_method_name(rb_name || name)}"
76
76
  end
77
77
 
78
- def rb_doc(xml_trans, type_maps)
79
- ovls = all.select {|m| !m.docs_ignored && !m.deprecated }
80
- ovl_docs = ovls.collect { |mo| mo.rb_doc_decl(xml_trans, type_maps) }
81
- ovl_docs.inject({}) do |docs, (name, params, doc)|
78
+ def rb_doc(xml_trans, type_maps, fulldocs=false)
79
+ ovls = all.select {|m| !m.docs_ignored(fulldocs) && !m.deprecated }
80
+ ovl_docs = ovls.collect { |mo| [mo]+mo.rb_doc_decl(xml_trans, type_maps) }
81
+ ovl_docs.inject({}) do |docs, (movl, name, params, doc)|
82
82
  if docs.has_key?(name)
83
- docs[name] << [params, doc]
83
+ docs[name] << [movl, params, doc]
84
84
  else
85
- docs[name] = [[params, doc]]
85
+ docs[name] = [[movl, params, doc]]
86
86
  end
87
87
  docs
88
88
  end
@@ -182,7 +182,7 @@ module WXRuby3
182
182
  extract(element) if element
183
183
  end
184
184
 
185
- attr_accessor :name, :rb_name, :ignored, :docs_ignored, :brief_doc, :detailed_doc, :deprecated, :only_for, :items
185
+ attr_accessor :name, :rb_name, :brief_doc, :detailed_doc, :deprecated, :only_for, :items
186
186
 
187
187
  def extra_attributes
188
188
  @extra_attributes ||= {}
@@ -221,8 +221,10 @@ module WXRuby3
221
221
  @detailed_doc = element.xpath('detaileddescription')
222
222
  if (el = @detailed_doc.at_xpath('para/onlyfor'))
223
223
  @only_for = el.text.strip.split(',').collect { |s| s.downcase }
224
- @ignored = @only_for.none? { |s| Config.instance.wx_port == s.to_sym }
225
- @docs_ignored = @ignored
224
+ unless @only_for.empty?
225
+ @ignored = [Config::AnyOf.new(*@only_for.collect { |s| s.upcase })] # transform to feature ids like 'WXGTK'
226
+ @docs_ignored = @ignored
227
+ end
226
228
  end
227
229
  end
228
230
  end
@@ -256,12 +258,39 @@ module WXRuby3
256
258
  end
257
259
  end
258
260
 
261
+ def get_ignore_val(val)
262
+ if val.is_a?(::Array)
263
+ val
264
+ elsif val.is_a?(Config::AnyOf) || val.is_a?(::String)
265
+ [val]
266
+ else
267
+ !!val
268
+ end
269
+ end
270
+ private :get_ignore_val
271
+
259
272
  def ignore(val = true, ignore_doc: nil)
260
- @ignored = !!val
261
- @docs_ignored = ignore_doc.nil? ? @ignored : ignore_doc
273
+ @ignored = get_ignore_val(val)
274
+ @docs_ignored = if ignore_doc.nil?
275
+ @ignored
276
+ else
277
+ get_ignore_val(ignore_doc)
278
+ end
262
279
  self
263
280
  end
264
281
 
282
+ def ignored
283
+ @ignored == true || (@ignored.is_a?(::Array) && !Config.instance.features_set?(*@ignored))
284
+ end
285
+
286
+ def docs_ignored(fulldocs)
287
+ @docs_ignored == true || (!fulldocs && @docs_ignored.is_a?(::Array) && !Config.instance.features_set?(*@docs_ignored))
288
+ end
289
+
290
+ def required_features_doc
291
+ @docs_ignored.is_a?(::Array) ? @docs_ignored : nil
292
+ end
293
+
265
294
  def find(name)
266
295
  # Locate and return an item within this item that has a matching name.
267
296
  # The name string can use a dotted notation to continue the search
@@ -87,7 +87,7 @@ module WXRuby3
87
87
  attr_reader :director, :classdef, :class_spec_name, :class_registry
88
88
 
89
89
  def item_ignored?(item)
90
- @doc_gen ? item.docs_ignored : item.ignored
90
+ @doc_gen ? item.docs_ignored(Director::Package.full_docs?) : item.ignored
91
91
  end
92
92
  private :item_ignored?
93
93
 
@@ -482,12 +482,17 @@ module WXRuby3
482
482
  end
483
483
  end
484
484
 
485
+ def item_ignored(item, doc_gen)
486
+ doc_gen ? item.docs_ignored(Director::Package.full_docs?) : item.ignored
487
+ end
488
+ private :item_ignored
489
+
485
490
  def preprocess(enum_maps, doc_gen = false)
486
491
  STDERR.puts "** Preprocessing #{module_name}" if Director.trace?
487
492
  def_items.each do |item|
488
493
  case item
489
494
  when Extractor::ClassDef
490
- if !(doc_gen ? item.docs_ignored : item.ignored) &&
495
+ if !item_ignored(item, doc_gen) &&
491
496
  (!item.is_template? || template_as_class?(item.name)) &&
492
497
  !is_folded_base?(item.name)
493
498
  clsproc = ClassProcessor.new(director, item, doc_gen)
@@ -536,7 +541,7 @@ module WXRuby3
536
541
  errors = []
537
542
  warnings = []
538
543
  def_items.each do |item|
539
- if Extractor::ClassDef === item && !(doc_gen ? item.docs_ignored : item.ignored) &&
544
+ if Extractor::ClassDef === item && !item_ignored(item, doc_gen) &&
540
545
  (!item.is_template? || template_as_class?(item.name)) &&
541
546
  !is_folded_base?(item.name)
542
547
  intf_class_name = if item.is_template? || template_as_class?(item.name)
@@ -0,0 +1,15 @@
1
+ ---
2
+ :wxAnimationBundle:
3
+ :detail:
4
+ :pre:
5
+ :programlisting:
6
+ - :pattern: !ruby/regexp /.*/
7
+ :replace: |
8
+
9
+ ```ruby
10
+ animationCtrl = Wx::AnimationCtrl.new(parent, Wx::ID_ANY)
11
+ animations = Wx::AnimationBundle.new
12
+ animations.add("throbber.gif")
13
+ animations.add("throbber_2x.gif")
14
+ animationCtrl.play if animationCtrl.set_animation(animations)
15
+ ```
@@ -47,8 +47,6 @@
47
47
 
48
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
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
50
 
53
51
  Category: Common Dialogs
54
52
 
@@ -37,7 +37,5 @@
37
37
  clipboard managers will automatically flush the clipboard after each new piece of data is added, while others
38
38
  will not. The {Wx::Clipboard#flush} function will force the clipboard manager to flush the data.
39
39
 
40
- ===
41
-
42
40
  Category: Clipboard and Drag & Drop
43
41
  @see Wx::DataObject
@@ -13,8 +13,6 @@
13
13
  the cursor for a window, as in X, rather than to set it globally as in MS Windows, although a global
14
14
  {set_cursor} function is also available for MS Windows use.
15
15
 
16
- ===
17
-
18
16
  Category: Graphics Device Interface (GDI)
19
17
  Predefined objects/pointers:
20
18
  - {Wx::NULL_CURSOR}
@@ -57,6 +57,16 @@
57
57
  if event.get_modifiers == Wx::KeyModifier::MOD_CONTROL
58
58
  # ... handle Ctrl-XXX ...
59
59
  ```
60
+ :wxKeyEvent.GetRawKeyCode:
61
+ :detail:
62
+ :post:
63
+ - :pattern: !ruby/regexp /,\s+use\s+\#ifdef\s+\{Wx::HAS_RAW_KEY_CODES\}.*available\./
64
+ :subst: '.'
65
+ :wxKeyEvent.GetRawKeyFlags:
66
+ :detail:
67
+ :post:
68
+ - :pattern: !ruby/regexp /,\s+use\s+\#ifdef\s+\{Wx::HAS_RAW_KEY_CODES\}.*available\./
69
+ :subst: '.'
60
70
  :wxMouseEvent.GetModifiers:
61
71
  :detail:
62
72
  :pre:
@@ -114,10 +124,6 @@
114
124
  vb_pt = get_view_start # Top left corner of client
115
125
 
116
126
  Wx::RegionIterator.for_region(get_update_region) do |region_it|
117
-
118
- int vX,vY,vW,vH
119
- wxRegionIterator upd(GetUpdateRegion()) # get the update rect list
120
-
121
127
  region_it.each do |rct|
122
128
  # rct == Dimensions of client area to repaint in pixels
123
129
 
@@ -0,0 +1,7 @@
1
+ ---
2
+ :wxPanel:
3
+ :detail:
4
+ :pre:
5
+ :simplesect:
6
+ - :pattern: !ruby/regexp /Tab\s+traversal\s+is\s+implemented.*/
7
+ :replace: ''
@@ -18,6 +18,14 @@
18
18
 
19
19
  end
20
20
  ```
21
+ :post:
22
+ - :pattern: !ruby/regexp /,\s+use\s+\{Wx::HAS_WINDOW_LABEL_IN_STATIC_BOX\}.*compile-time\./
23
+ :subst: '.'
24
+ :wxStaticBox.Create:
25
+ :detail:
26
+ :post:
27
+ - :pattern: !ruby/regexp /,\s+use\s+\{Wx::HAS_WINDOW_LABEL_IN_STATIC_BOX\}.*compile-time\./
28
+ :subst: '.'
21
29
  :wxStaticBox.Enable:
22
30
  :detail:
23
31
  :pre:
@@ -11,6 +11,9 @@
11
11
  Wx.log_error("Couldn't load resources!")
12
12
  end
13
13
  ```
14
+ :post:
15
+ - :pattern: !ruby/regexp /If\s+\{Wx::USE_FILESYS\}.*\)\./
16
+ :subst: 'If {Wx::Setup::USE_FILESYSTEM} is enabled, this method understands {Wx::FileSystem} URLs.'
14
17
  :wxXmlResource.LoadDialog:
15
18
  :detail:
16
19
  :pre:
@@ -151,8 +151,10 @@ module WXRuby3
151
151
  def text_to_doc(node)
152
152
  text = node.text
153
153
  # handle left-over doxygen tags
154
+ text.gsub!(/#(\w)/, '\#\1')
154
155
  text.gsub!(/@(end)?code/, '')
155
- text.gsub!('@subsection', '==')
156
+ text.gsub!('@subsection', '##')
157
+ text = '' if text.strip == '##' # no empty headings
156
158
  text.gsub!('@remarks', '')
157
159
  text.gsub!(/@see.*\n/, '')
158
160
  text.gsub!('@ref', '')
@@ -172,7 +174,7 @@ module WXRuby3
172
174
  end
173
175
  end
174
176
  end
175
- text.gsub!(/WX(K_[A-Z]+)/) { "{Wx::#{$1}}"}
177
+ text.gsub!(/WX(K_[A-Z]+)/) { "{Wx::KeyCode::#{$1}}"}
176
178
  end
177
179
  if event_section?
178
180
  case text
@@ -224,6 +226,10 @@ module WXRuby3
224
226
  end
225
227
  end
226
228
 
229
+ def onlyfor_to_doc(node)
230
+ '' # handled elsewhere
231
+ end
232
+
227
233
  def simplesect_to_doc(node)
228
234
  case node['kind']
229
235
  when 'since' # get rid of 'Since' notes
@@ -233,6 +239,22 @@ module WXRuby3
233
239
  @see_list.concat node_to_doc(node).split(',')
234
240
  end
235
241
  ''
242
+ when 'note'
243
+ <<~__NOTE
244
+
245
+ <div class="wxrb-note">
246
+ <b>Note:</b>
247
+ <p>#{node_to_doc(node)}</p>
248
+ </div>
249
+ __NOTE
250
+ when 'remark'
251
+ <<~__NOTE
252
+
253
+ <div class="wxrb-remark">
254
+ <b>Remark:</b>
255
+ <p>#{node_to_doc(node)}</p>
256
+ </div>>
257
+ __NOTE
236
258
  else
237
259
  node_to_doc(node)
238
260
  end
@@ -280,7 +302,9 @@ module WXRuby3
280
302
 
281
303
  def _ident_str_to_doc(s, ref_scope = nil)
282
304
  return s if no_idents?
283
- return s if %w[wxRuby wxMSW wxOSX wxGTK wxX11].any? { |w| s.start_with?(w) }
305
+ return s if s.start_with?('wxRuby')
306
+ return 'WXOSX' if s.start_with?('wxMac')
307
+ return s.sub(/\Awx/, 'WX') if %w[wxMSW wxOSX wxGTK wxX11 wxUNIVERSAL].any? { |w| s.start_with?(w) }
284
308
  nmlist = s.split('::')
285
309
  nm_str = nmlist.shift.to_s
286
310
  constnm = rb_wx_name(nm_str)
@@ -343,6 +367,7 @@ module WXRuby3
343
367
  mtd = $1
344
368
  args = _arglist_to_doc($2)
345
369
  end
370
+ # transform the scope prefix
346
371
  if DocGenerator.constants_xref_db.has_key?(constnm)
347
372
  constnm = "#{DocGenerator.constants_xref_db[constnm]['mod']}::#{constnm}"
348
373
  elsif DocGenerator.constants_xref_db.has_key?(rb_constant_name(nm_str))
@@ -355,8 +380,18 @@ module WXRuby3
355
380
  known = false
356
381
  constnm = "Wx::#{constnm}"
357
382
  end
383
+ # transform and append the element id
358
384
  if mtd.nil?
359
- if DocGenerator.constants_xref_db.has_key?(rb_wx_name(itmnm)) || !_is_method?(itmnm, nm_str)
385
+ if DocGenerator.constants_xref_db.has_key?(rb_wx_name(itmnm))
386
+ itmnm = rb_wx_name(itmnm)
387
+ # in case of enum constants the documented scope most likely omits the enum class
388
+ # which we want for correct linking for wxRuby
389
+ if DocGenerator.constants_xref_db[itmnm]['mod'].start_with?("#{constnm}::")
390
+ ["#{DocGenerator.constants_xref_db[itmnm]['mod']}::#{rb_wx_name(itmnm)}", known]
391
+ else
392
+ ["#{constnm}::#{rb_wx_name(itmnm)}", known]
393
+ end
394
+ elsif !_is_method?(itmnm, nm_str)
360
395
  ["#{constnm}::#{rb_wx_name(itmnm)}", known]
361
396
  else
362
397
  sep = _is_static_method?(nm_str, itmnm) ? '.' : '#'
@@ -391,14 +426,15 @@ module WXRuby3
391
426
 
392
427
  # transform all titles
393
428
  def title_to_doc(node)
394
- "== #{node.text}\n"
429
+ "## #{node.text}\n"
395
430
  end
396
431
 
397
432
  def heading_to_doc(node)
398
433
  lvl = 1+(node['level'] || '1').to_i
399
434
  txt = node_to_doc(node)
400
435
  event_section(/Events emitted by this class|Events using this class/i =~ txt)
401
- "#{'=' * lvl} #{txt}"
436
+ txt.strip!
437
+ txt.empty? ? txt : "#{'#' * lvl} #{txt}"
402
438
  end
403
439
 
404
440
  # transform all itemizedlist
@@ -671,6 +707,36 @@ module WXRuby3
671
707
 
672
708
  protected
673
709
 
710
+ def to_feature_text(feat)
711
+ if Config::AnyOf === feat
712
+ feat.features.collect { |f| f.is_a?(::Array) ? f.join('&') : f }.join('|')
713
+ else
714
+ feat
715
+ end
716
+ end
717
+ private :to_feature_text
718
+
719
+ def gen_item_requirements(fdoc, item)
720
+ if item.required_features_doc
721
+ fdoc.doc.puts '@wxrb_require ' + item.required_features_doc.collect(&->(feat){ to_feature_text(feat) }).join(',')
722
+ end
723
+ end
724
+
725
+ def has_class_requirements?
726
+ !(ifspec.requirements.empty? && ifspec.package.required_features.empty?)
727
+ end
728
+
729
+ def get_class_requirements
730
+ ifspec.requirements + ifspec.package.required_features.to_a
731
+ end
732
+ private :get_class_requirements
733
+
734
+ def gen_class_requirements(fdoc)
735
+ if has_class_requirements?
736
+ fdoc.doc.puts '@wxrb_require ' + get_class_requirements.collect(&->(feat){ to_feature_text(feat) }).join(',')
737
+ end
738
+ end
739
+
674
740
  def get_constant_doc(const)
675
741
  @xml_trans.to_doc(const.brief_doc, item: const)
676
742
  end
@@ -707,6 +773,7 @@ module WXRuby3
707
773
 
708
774
  def gen_enum_doc(fdoc, enumname, enumdef, enum_table)
709
775
  fdoc.doc.puts get_enum_doc(enumdef)
776
+ gen_class_requirements(fdoc)
710
777
  fdoc.puts "class #{enumname} < Wx::Enum"
711
778
  fdoc.puts
712
779
  fdoc.indent do
@@ -723,7 +790,7 @@ module WXRuby3
723
790
 
724
791
  def gen_constants_doc(fdoc)
725
792
  xref_table = package.all_modules.reduce(DocGenerator.constants_db) { |db, mod| db[mod] }
726
- def_items.select {|itm| !itm.docs_ignored }.each do |item|
793
+ def_items.select {|itm| !itm.docs_ignored(Director::Package.full_docs?) }.each do |item|
727
794
  case item
728
795
  when Extractor::GlobalVarDef
729
796
  unless no_gen?(:variables)
@@ -762,22 +829,24 @@ module WXRuby3
762
829
  end
763
830
 
764
831
  def get_function_doc(func)
765
- func.rb_doc(@xml_trans, type_maps)
832
+ func.rb_doc(@xml_trans, type_maps, Director::Package.full_docs?)
766
833
  end
767
834
 
768
835
  def gen_functions_doc(fdoc)
769
- def_items.select {|itm| !itm.docs_ignored }.each do |item|
770
- if Extractor::FunctionDef === item && !item.docs_ignored
836
+ def_items.select {|itm| !itm.docs_ignored(Director::Package.full_docs?) }.each do |item|
837
+ if Extractor::FunctionDef === item
771
838
  get_method_doc(item).each_pair do |name, docs|
772
839
  if docs.size>1 # method with overloads?
773
- docs.each do |params, ovl_doc|
840
+ docs.each do |ovl, params, ovl_doc|
774
841
  fdoc.doc.puts "@overload #{name}(#{params})"
775
842
  fdoc.doc.indent { fdoc.doc.puts ovl_doc }
843
+ fdoc.doc.indent { gen_item_requirements(fdoc, ovl) }
776
844
  end
777
845
  fdoc.puts "def #{name}(*args) end"
778
846
  else
779
- params, doc = docs.shift
847
+ mtd, params, doc = docs.shift
780
848
  fdoc.doc.puts doc
849
+ gen_item_requirements(fdoc, mtd)
781
850
  if params.empty?
782
851
  fdoc.puts "def #{name}; end"
783
852
  else
@@ -797,7 +866,7 @@ module WXRuby3
797
866
  end
798
867
 
799
868
  def get_method_doc(mtd)
800
- mtd.rb_doc(@xml_trans, type_maps)
869
+ mtd.rb_doc(@xml_trans, type_maps, Director::Package.full_docs?)
801
870
  end
802
871
 
803
872
  def get_method_head(clsdef, mtdef)
@@ -825,14 +894,16 @@ module WXRuby3
825
894
  mtd_head = get_method_head(clsdef, cm)
826
895
  get_method_doc(mtd_head).each_pair do |name, docs|
827
896
  if docs.size>1 # method with overloads?
828
- docs.each do |params, ovl_doc|
897
+ docs.each do |ovl, params, ovl_doc|
829
898
  fdoc.doc.puts "@overload #{name}(#{params})"
830
899
  fdoc.doc.indent { fdoc.doc.puts ovl_doc }
900
+ fdoc.doc.indent { gen_item_requirements(fdoc, ovl) }
831
901
  end
832
902
  fdoc.puts "def #{name}(*args) end"
833
903
  else
834
- params, doc = docs.shift
904
+ mtd, params, doc = docs.shift
835
905
  fdoc.doc.puts doc
906
+ gen_item_requirements(fdoc, mtd)
836
907
  if params.empty?
837
908
  fdoc.puts "def #{name}; end"
838
909
  else
@@ -887,7 +958,7 @@ module WXRuby3
887
958
 
888
959
  def gen_class_doc(fdoc)
889
960
  const_table = package.all_modules.reduce(DocGenerator.constants_db) { |db, mod| db[mod] }
890
- def_items.select {|itm| !itm.docs_ignored && Extractor::ClassDef === itm && !is_folded_base?(itm.name) }.each do |item|
961
+ def_items.select {|itm| !itm.docs_ignored(Director::Package.full_docs?) && Extractor::ClassDef === itm && !is_folded_base?(itm.name) }.each do |item|
891
962
  if !item.is_template? || template_as_class?(item.name)
892
963
  @xml_trans.for_class(item) do
893
964
  intf_class_name = if (item.is_template? && template_as_class?(item.name))
@@ -900,9 +971,11 @@ module WXRuby3
900
971
  fdoc.doc.puts get_class_doc(item)
901
972
  if is_mixin?(item)
902
973
  fdoc.doc.puts "\n@note In wxRuby this is a mixin module instead of a (base) class."
974
+ gen_class_requirements(fdoc)
903
975
  fdoc.puts "module #{clsnm}"
904
976
  else
905
977
  fdoc.doc.puts "\n@note This class is <b>untracked</b> and should not be derived from nor instances extended!" unless is_tracked?(item)
978
+ gen_class_requirements(fdoc)
906
979
  basecls = ifspec.classdef_name(base_class(item, doc: true))
907
980
  fdoc.puts "class #{clsnm} < #{basecls ? basecls.sub(/\Awx/, '') : '::Object'}"
908
981
  end