wxruby3 0.9.1 → 0.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) 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/swig/common.i +1 -1
  6. data/lib/wx/aui/aui_tab_ctrl.rb +18 -0
  7. data/lib/wx/aui/auinotebook.rb +6 -2
  8. data/lib/wx/aui/require.rb +1 -0
  9. data/lib/wx/core/app.rb +2 -2
  10. data/lib/wx/core/collapsible_pane.rb +1 -1
  11. data/lib/wx/core/controlwithitems.rb +8 -6
  12. data/lib/wx/core/menu.rb +10 -0
  13. data/lib/wx/core/notebook.rb +6 -2
  14. data/lib/wx/core/sizer.rb +11 -0
  15. data/lib/wx/core/task_bar_button.rb +19 -0
  16. data/lib/wx/core/textctrl.rb +11 -1
  17. data/lib/wx/core/{treectrl.rb → tree_ctrl.rb} +31 -12
  18. data/lib/wx/core/window.rb +10 -0
  19. data/lib/wx/doc/app.rb +48 -38
  20. data/lib/wx/doc/art_locator.rb +47 -43
  21. data/lib/wx/doc/aui/auimanager.rb +16 -8
  22. data/lib/wx/doc/aui/auinotebook.rb +20 -5
  23. data/lib/wx/doc/clipboard.rb +11 -7
  24. data/lib/wx/doc/colour_dialog.rb +14 -10
  25. data/lib/wx/doc/controlwithitems.rb +17 -7
  26. data/lib/wx/doc/data_object.rb +2 -2
  27. data/lib/wx/doc/evthandler.rb +113 -108
  28. data/lib/wx/doc/font.rb +1 -0
  29. data/lib/wx/doc/gc_dc.rb +6 -1
  30. data/lib/wx/doc/graphics_context.rb +1 -0
  31. data/lib/wx/doc/grid/grid.rb +22 -1
  32. data/lib/wx/doc/help_controller.rb +11 -7
  33. data/lib/wx/doc/html/html_help_controller.rb +12 -4
  34. data/lib/wx/doc/list_ctrl.rb +33 -29
  35. data/lib/wx/doc/menu.rb +20 -0
  36. data/lib/wx/doc/notebook.rb +21 -0
  37. data/lib/wx/doc/pg/events.rb +13 -9
  38. data/lib/wx/doc/pg/pg_property.rb +18 -0
  39. data/lib/wx/doc/progress_dialog.rb +36 -32
  40. data/lib/wx/doc/prt/page_setup_dialog.rb +20 -12
  41. data/lib/wx/doc/prt/print_data.rb +13 -5
  42. data/lib/wx/doc/prt/print_dialog.rb +31 -23
  43. data/lib/wx/doc/prt/printer.rb +20 -12
  44. data/lib/wx/doc/radio_box.rb +19 -15
  45. data/lib/wx/doc/rbn/ribbon_bar.rb +13 -5
  46. data/lib/wx/doc/rbn/ribbon_button_bar.rb +13 -5
  47. data/lib/wx/doc/rbn/ribbon_gallery.rb +13 -5
  48. data/lib/wx/doc/rbn/ribbon_tool_bar.rb +13 -5
  49. data/lib/wx/doc/region_iterator.rb +32 -28
  50. data/lib/wx/doc/rtc/rich_text_composite_object.rb +24 -0
  51. data/lib/wx/doc/rtc/rich_text_ctrl.rb +24 -0
  52. data/lib/wx/doc/rtc/rich_text_paragraph.rb +24 -0
  53. data/lib/wx/doc/rtc/richtext_buffer.rb +27 -19
  54. data/lib/wx/doc/rtc/richtext_printing.rb +17 -9
  55. data/lib/wx/doc/rtc/richtext_style_sheet.rb +17 -9
  56. data/lib/wx/doc/sizer.rb +20 -0
  57. data/lib/wx/doc/stc/styled_text_ctrl.rb +24 -0
  58. data/lib/wx/doc/stream.rb +39 -35
  59. data/lib/wx/doc/system_settings.rb +30 -26
  60. data/lib/wx/doc/text_validator.rb +12 -8
  61. data/lib/wx/doc/textctrl.rb +16 -0
  62. data/lib/wx/doc/tree_ctrl.rb +95 -0
  63. data/lib/wx/doc/treebook.rb +9 -5
  64. data/lib/wx/doc/v_list_box.rb +9 -5
  65. data/lib/wx/doc/variant.rb +164 -160
  66. data/lib/wx/doc/window.rb +57 -47
  67. data/lib/wx/doc/window_disabler.rb +10 -6
  68. data/lib/wx/grid/grid.rb +27 -4
  69. data/lib/wx/pg/pg_property.rb +22 -0
  70. data/lib/wx/rtc/require.rb +3 -0
  71. data/lib/wx/rtc/rich_text_composite_object.rb +25 -0
  72. data/lib/wx/rtc/rich_text_ctrl.rb +25 -0
  73. data/lib/wx/rtc/rich_text_paragraph.rb +25 -0
  74. data/lib/wx/stc/require.rb +1 -0
  75. data/lib/wx/stc/styled_text_ctrl.rb +25 -0
  76. data/lib/wx/version.rb +1 -1
  77. data/rakelib/lib/config/linux.rb +0 -3
  78. data/rakelib/lib/config/macosx.rb +2 -2
  79. data/rakelib/lib/config/mingw.rb +1 -1
  80. data/rakelib/lib/config/unixish.rb +1 -1
  81. data/rakelib/lib/config.rb +14 -4
  82. data/rakelib/lib/core/package.rb +14 -7
  83. data/rakelib/lib/core/spec.rb +6 -1
  84. data/rakelib/lib/director/accelerator.rb +2 -3
  85. data/rakelib/lib/director/accessible.rb +47 -0
  86. data/rakelib/lib/director/app.rb +12 -319
  87. data/rakelib/lib/director/app_traits.rb +10 -12
  88. data/rakelib/lib/director/ctrl_with_items.rb +17 -5
  89. data/rakelib/lib/director/data_format.rb +1 -1
  90. data/rakelib/lib/director/derived_dc.rb +1 -1
  91. data/rakelib/lib/director/dialog.rb +1 -0
  92. data/rakelib/lib/director/drag_image.rb +2 -3
  93. data/rakelib/lib/director/event.rb +2 -2
  94. data/rakelib/lib/director/frame.rb +1 -3
  95. data/rakelib/lib/director/gdicommon.rb +8 -10
  96. data/rakelib/lib/director/graphics_context.rb +2 -4
  97. data/rakelib/lib/director/grid_ctrl.rb +34 -3
  98. data/rakelib/lib/director/icon.rb +5 -2
  99. data/rakelib/lib/director/list_ctrl.rb +5 -6
  100. data/rakelib/lib/director/locale.rb +1 -3
  101. data/rakelib/lib/director/log.rb +1 -4
  102. data/rakelib/lib/director/media_ctrl.rb +54 -0
  103. data/rakelib/lib/director/menu.rb +16 -1
  104. data/rakelib/lib/director/menu_item.rb +2 -2
  105. data/rakelib/lib/director/pgproperties.rb +1 -1
  106. data/rakelib/lib/director/pgproperty.rb +24 -1
  107. data/rakelib/lib/director/property_grid_interface.rb +5 -10
  108. data/rakelib/lib/director/richtext_composite_object.rb +25 -0
  109. data/rakelib/lib/director/richtext_ctrl.rb +14 -4
  110. data/rakelib/lib/director/richtext_formatting_dialog.rb +7 -5
  111. data/rakelib/lib/director/richtext_paragraph_layout_box.rb +9 -7
  112. data/rakelib/lib/director/sizer.rb +15 -0
  113. data/rakelib/lib/director/static_box.rb +4 -5
  114. data/rakelib/lib/director/styled_text_ctrl.rb +12 -0
  115. data/rakelib/lib/director/task_bar_button.rb +30 -0
  116. data/rakelib/lib/director/task_bar_icon.rb +5 -13
  117. data/rakelib/lib/director/textctrl.rb +12 -1
  118. data/rakelib/lib/director/tool_tip.rb +1 -1
  119. data/rakelib/lib/director/top_level_window.rb +4 -5
  120. data/rakelib/lib/director/tree_ctrl.rb +5 -6
  121. data/rakelib/lib/director/variant.rb +1 -1
  122. data/rakelib/lib/director/window.rb +24 -5
  123. data/rakelib/lib/director.rb +4 -4
  124. data/rakelib/lib/extractor/function.rb +6 -6
  125. data/rakelib/lib/extractor.rb +34 -5
  126. data/rakelib/lib/generate/analyzer.rb +8 -3
  127. data/rakelib/lib/generate/doc/busy_info.yaml +0 -2
  128. data/rakelib/lib/generate/doc/clipboard.yaml +0 -2
  129. data/rakelib/lib/generate/doc/cursor.yaml +0 -2
  130. data/rakelib/lib/generate/doc/panel.yaml +7 -0
  131. data/rakelib/lib/generate/doc.rb +76 -14
  132. data/rakelib/lib/specs/interfaces.rb +161 -160
  133. data/rakelib/lib/typemap/common.rb +30 -1
  134. data/rakelib/yard/templates/default/fulldoc/html/css/wxruby3.css +74 -2
  135. data/rakelib/yard/templates/default/fulldoc/html/full_list.erb +38 -0
  136. data/rakelib/yard/templates/default/fulldoc/html/setup.rb +39 -0
  137. data/rakelib/yard/templates/default/tags/html/wxrb_require.erb +10 -0
  138. data/rakelib/yard/templates/default/tags/setup.rb +16 -0
  139. data/rakelib/yard/yard-custom-templates.rb +3 -0
  140. data/samples/treectrl/treectrl.rb +1 -1
  141. data/tests/media/beep_lo.wav +0 -0
  142. data/tests/test_list_ctrl.rb +1 -1
  143. data/tests/test_media_ctrl.rb +38 -0
  144. data/tests/test_menu.rb +69 -0
  145. data/tests/test_pg.rb +27 -0
  146. data/tests/test_richtext.rb +45 -0
  147. data/tests/test_sizer.rb +16 -0
  148. data/tests/test_std_controls.rb +42 -1
  149. data/tests/test_styled_text_ctrl.rb +46 -0
  150. data/tests/test_tree_ctrl.rb +138 -0
  151. data/tests/test_window.rb +12 -0
  152. data/tests/testapp_noframe.rb +1 -1
  153. metadata +31 -3
@@ -16,11 +16,10 @@ module WXRuby3
16
16
 
17
17
  def setup
18
18
  super
19
- if Config.instance.wx_port == :wxqt || Config.platform == :macosx
20
- # missing from implementation currently
21
- spec.ignore 'wxStaticBox::wxStaticBox(wxWindow *, wxWindowID, wxWindow *, const wxPoint &, const wxSize &, long, const wxString &)',
22
- 'wxStaticBox::Create(wxWindow *, wxWindowID, wxWindow *, const wxPoint &, const wxSize &, long, const wxString &)'
23
- end
19
+ # missing from implementation currently for WXOSX (and WXQT)
20
+ spec.ignore_unless(Config::AnyOf.new(*%w[WXMSW WXGTK]),
21
+ 'wxStaticBox::wxStaticBox(wxWindow *, wxWindowID, wxWindow *, const wxPoint &, const wxSize &, long, const wxString &)',
22
+ 'wxStaticBox::Create(wxWindow *, wxWindowID, wxWindow *, const wxPoint &, const wxSize &, long, const wxString &)')
24
23
  end
25
24
  end # class StaticBox
26
25
 
@@ -87,6 +87,18 @@ module WXRuby3
87
87
  # TODO : these will need some sort of stream solution to be useful
88
88
  spec.ignore 'wxStyledTextCtrl::GetCharacterPointer',
89
89
  'wxStyledTextCtrl::GetRangePointer'
90
+ spec.add_extend_code 'wxStyledTextCtrl', <<~__HEREDOC
91
+ VALUE each_line()
92
+ {
93
+ VALUE rc = Qnil;
94
+ for (int i=0; i<$self->GetNumberOfLines() ;++i)
95
+ {
96
+ VALUE rb_ln = WXSTR_TO_RSTR($self->GetLineText(i));
97
+ rc = rb_yield(rb_ln);
98
+ }
99
+ return rc;
100
+ }
101
+ __HEREDOC
90
102
  spec.do_not_generate(:variables, :enums, :defines, :functions)
91
103
  end
92
104
  end # class StyledTextCtrl
@@ -0,0 +1,30 @@
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
+ module WXRuby3
10
+
11
+ class Director
12
+
13
+ class TaskBarButton < Director
14
+
15
+ def setup
16
+ super
17
+ spec.items << 'wxThumbBarButton'
18
+ spec.no_proxy 'wxTaskBarButton'
19
+ spec.gc_as_untracked 'wxTaskBarButton', 'wxThumbBarButton'
20
+ spec.disown 'wxThumbBarButton *button'
21
+ # superfluous and causing trouble for disown policy (re-implemented in pure Ruby)
22
+ spec.ignore 'wxTaskBarButton::RemoveThumbBarButton(wxThumbBarButton*)', ignore_doc: false
23
+ spec.new_object 'wxTaskBarButton::RemoveThumbBarButton(int)'
24
+ end
25
+
26
+ end
27
+
28
+ end
29
+
30
+ end
@@ -16,7 +16,7 @@ module WXRuby3
16
16
 
17
17
  def setup
18
18
  super
19
- spec.gc_never
19
+ spec.gc_as_object
20
20
  # need a custom implementation to handle event handler proc cleanup
21
21
  spec.add_header_code <<~__HEREDOC
22
22
  class WXRubyTaskBarIcon : public wxTaskBarIcon
@@ -26,9 +26,11 @@ module WXRuby3
26
26
  virtual ~WXRubyTaskBarIcon()
27
27
  {
28
28
  wxRuby_ReleaseEvtHandlerProcs(this);
29
- }
29
+ SWIG_RubyUnlinkObjects(this);
30
+ SWIG_RubyRemoveTracking(this);
31
+ }
30
32
  };
31
- __HEREDOC
33
+ __HEREDOC
32
34
  spec.use_class_implementation 'wxTaskBarIcon', 'WXRubyTaskBarIcon'
33
35
  # this one is protected so ignored by default but we want it here
34
36
  # (we do not want GetPopupMenu available for override in Ruby)
@@ -61,16 +63,6 @@ module WXRuby3
61
63
  }
62
64
  __CODE
63
65
  end
64
- spec.add_extend_code 'wxTaskBarIcon', <<~__HEREDOC
65
- // Explicitly dispose of a TaskBarIcon; needed for clean exits on
66
- // Windows.
67
- VALUE destroy()
68
- {
69
- delete $self;
70
- return Qnil;
71
- }
72
- __HEREDOC
73
- # already generated with TaskBarIconEvent
74
66
  spec.do_not_generate :variables, :enums, :defines, :functions
75
67
  end
76
68
  end # class TaskBarIcon
@@ -32,7 +32,7 @@ module WXRuby3
32
32
  # we will not wrap it but create a simplified interface when USE_SPELLCHECK is enabled which
33
33
  # we will complement in pure Ruby to provide Wx::TextProofOptions class
34
34
  spec.ignore('wxTextCtrl::EnableProofCheck', 'wxTextCtrl::GetProofCheckOptions')
35
- if Config.instance.features_set?('wxUSE_SPELLCHECK')
35
+ if Config.instance.features_set?('USE_SPELLCHECK')
36
36
  spec.add_extend_code 'wxTextCtrl', <<~__HEREDOC
37
37
  VALUE DoEnableProofCheck(bool spelling, bool grammar, const wxString& language)
38
38
  {
@@ -99,6 +99,17 @@ module WXRuby3
99
99
  else if(TYPE(value)==T_FLOAT)
100
100
  *self << (double)(RFLOAT_VALUE(value));
101
101
  }
102
+
103
+ VALUE each_line()
104
+ {
105
+ VALUE rc = Qnil;
106
+ for (int i=0; i<$self->GetNumberOfLines() ;++i)
107
+ {
108
+ VALUE rb_ln = WXSTR_TO_RSTR($self->GetLineText(i));
109
+ rc = rb_yield(rb_ln);
110
+ }
111
+ return rc;
112
+ }
102
113
  __HEREDOC
103
114
  spec.swig_import 'swig/classes/include/wxTextAttr.h'
104
115
  end
@@ -13,7 +13,7 @@ module WXRuby3
13
13
  class ToolTip < Director
14
14
 
15
15
  def setup
16
- spec.ignore('wxToolTip::SetMaxWidth') unless Config.instance.features_set?('__WXMSW__')
16
+ spec.ignore_unless('WXMSW', 'wxToolTip::SetMaxWidth')
17
17
  super
18
18
  end
19
19
  end # class ToolTip
@@ -41,15 +41,14 @@ module WXRuby3
41
41
  wxTopLevelWindow::RestoreToGeometry
42
42
  wxTopLevelWindow::GeometrySerializer
43
43
  }
44
- unless Config.instance.features_set?('__WXUNIVERSAL__')
45
- spec.ignore %w{
44
+ # #ignore_unless if wxRuby one day supports 'WXUNIVERSAL'
45
+ spec.ignore %w{
46
46
  wxTopLevelWindow::IsUsingNativeDecorations
47
47
  wxTopLevelWindow::UseNativeDecorations
48
48
  wxTopLevelWindow::UseNativeDecorationsByDefault
49
49
  }
50
- end
51
- spec.ignore('wxTopLevelWindow::MSWGetSystemMenu') unless Config.instance.features_set?('__WXMSW__')
52
- spec.ignore('wxTopLevelWindow::OSXSetModified','wxTopLevelWindow::OSXIsModified') unless Config.instance.features_set?('__WXOSX__')
50
+ spec.ignore_unless('WXMSW', 'wxTopLevelWindow::MSWGetSystemMenu')
51
+ spec.ignore_unless('WXOSX', 'wxTopLevelWindow::OSXSetModified','wxTopLevelWindow::OSXIsModified')
53
52
  spec.swig_import 'swig/classes/include/wxDefs.h'
54
53
  # incorrectly documented here
55
54
  spec.override_events 'wxTopLevelWindow',
@@ -75,7 +75,7 @@ module WXRuby3
75
75
  wxTreeCtrl::GetFocusedItem
76
76
  wxTreeCtrl::GetSelection
77
77
  ]
78
- if Config.instance.features_set?('wxHAS_LAST_VISIBLE')
78
+ if Config.instance.features_set?('HAS_LAST_VISIBLE')
79
79
  spec.no_proxy 'wxTreeCtrl::GetLastVisible'
80
80
  end
81
81
  # simply a nuisance to support
@@ -84,7 +84,7 @@ module WXRuby3
84
84
  wxTreeCtrl::EndEditLabel
85
85
  ]
86
86
  # for now, ignore this version as the added customization features
87
- # 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
88
88
  spec.ignore 'wxTreeCtrl::EditLabel'
89
89
  # add simplified non-virtual version
90
90
  spec.add_extend_code 'wxTreeCtrl', <<~__HEREDOC
@@ -94,10 +94,9 @@ module WXRuby3
94
94
  (void)self->EditLabel(item);
95
95
  }
96
96
  __HEREDOC
97
- if [:wxmsw, :wxqt].include?(Config.instance.wx_port)
98
- spec.ignore('wxTreeCtrl::SetButtonsImageList')
99
- spec.ignore('wxTreeCtrl::GetButtonsImageList')
100
- end
97
+ spec.ignore_unless(Config::AnyOf.new(*%w[WXGTK WXOSX]),
98
+ 'wxTreeCtrl::SetButtonsImageList',
99
+ 'wxTreeCtrl::GetButtonsImageList')
101
100
  # these reimplemented window base methods need to be properly wrapped but
102
101
  # are missing from the XML docs
103
102
  spec.extend_interface('wxTreeCtrl',
@@ -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)
@@ -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}
@@ -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: ''
@@ -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', '')
@@ -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 wxMac].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)
@@ -402,14 +426,15 @@ module WXRuby3
402
426
 
403
427
  # transform all titles
404
428
  def title_to_doc(node)
405
- "== #{node.text}\n"
429
+ "## #{node.text}\n"
406
430
  end
407
431
 
408
432
  def heading_to_doc(node)
409
433
  lvl = 1+(node['level'] || '1').to_i
410
434
  txt = node_to_doc(node)
411
435
  event_section(/Events emitted by this class|Events using this class/i =~ txt)
412
- "#{'=' * lvl} #{txt}"
436
+ txt.strip!
437
+ txt.empty? ? txt : "#{'#' * lvl} #{txt}"
413
438
  end
414
439
 
415
440
  # transform all itemizedlist
@@ -682,6 +707,36 @@ module WXRuby3
682
707
 
683
708
  protected
684
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
+
685
740
  def get_constant_doc(const)
686
741
  @xml_trans.to_doc(const.brief_doc, item: const)
687
742
  end
@@ -718,6 +773,7 @@ module WXRuby3
718
773
 
719
774
  def gen_enum_doc(fdoc, enumname, enumdef, enum_table)
720
775
  fdoc.doc.puts get_enum_doc(enumdef)
776
+ gen_class_requirements(fdoc)
721
777
  fdoc.puts "class #{enumname} < Wx::Enum"
722
778
  fdoc.puts
723
779
  fdoc.indent do
@@ -734,7 +790,7 @@ module WXRuby3
734
790
 
735
791
  def gen_constants_doc(fdoc)
736
792
  xref_table = package.all_modules.reduce(DocGenerator.constants_db) { |db, mod| db[mod] }
737
- 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|
738
794
  case item
739
795
  when Extractor::GlobalVarDef
740
796
  unless no_gen?(:variables)
@@ -773,22 +829,24 @@ module WXRuby3
773
829
  end
774
830
 
775
831
  def get_function_doc(func)
776
- func.rb_doc(@xml_trans, type_maps)
832
+ func.rb_doc(@xml_trans, type_maps, Director::Package.full_docs?)
777
833
  end
778
834
 
779
835
  def gen_functions_doc(fdoc)
780
- def_items.select {|itm| !itm.docs_ignored }.each do |item|
781
- 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
782
838
  get_method_doc(item).each_pair do |name, docs|
783
839
  if docs.size>1 # method with overloads?
784
- docs.each do |params, ovl_doc|
840
+ docs.each do |ovl, params, ovl_doc|
785
841
  fdoc.doc.puts "@overload #{name}(#{params})"
786
842
  fdoc.doc.indent { fdoc.doc.puts ovl_doc }
843
+ fdoc.doc.indent { gen_item_requirements(fdoc, ovl) }
787
844
  end
788
845
  fdoc.puts "def #{name}(*args) end"
789
846
  else
790
- params, doc = docs.shift
847
+ mtd, params, doc = docs.shift
791
848
  fdoc.doc.puts doc
849
+ gen_item_requirements(fdoc, mtd)
792
850
  if params.empty?
793
851
  fdoc.puts "def #{name}; end"
794
852
  else
@@ -808,7 +866,7 @@ module WXRuby3
808
866
  end
809
867
 
810
868
  def get_method_doc(mtd)
811
- mtd.rb_doc(@xml_trans, type_maps)
869
+ mtd.rb_doc(@xml_trans, type_maps, Director::Package.full_docs?)
812
870
  end
813
871
 
814
872
  def get_method_head(clsdef, mtdef)
@@ -836,14 +894,16 @@ module WXRuby3
836
894
  mtd_head = get_method_head(clsdef, cm)
837
895
  get_method_doc(mtd_head).each_pair do |name, docs|
838
896
  if docs.size>1 # method with overloads?
839
- docs.each do |params, ovl_doc|
897
+ docs.each do |ovl, params, ovl_doc|
840
898
  fdoc.doc.puts "@overload #{name}(#{params})"
841
899
  fdoc.doc.indent { fdoc.doc.puts ovl_doc }
900
+ fdoc.doc.indent { gen_item_requirements(fdoc, ovl) }
842
901
  end
843
902
  fdoc.puts "def #{name}(*args) end"
844
903
  else
845
- params, doc = docs.shift
904
+ mtd, params, doc = docs.shift
846
905
  fdoc.doc.puts doc
906
+ gen_item_requirements(fdoc, mtd)
847
907
  if params.empty?
848
908
  fdoc.puts "def #{name}; end"
849
909
  else
@@ -898,7 +958,7 @@ module WXRuby3
898
958
 
899
959
  def gen_class_doc(fdoc)
900
960
  const_table = package.all_modules.reduce(DocGenerator.constants_db) { |db, mod| db[mod] }
901
- 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|
902
962
  if !item.is_template? || template_as_class?(item.name)
903
963
  @xml_trans.for_class(item) do
904
964
  intf_class_name = if (item.is_template? && template_as_class?(item.name))
@@ -911,9 +971,11 @@ module WXRuby3
911
971
  fdoc.doc.puts get_class_doc(item)
912
972
  if is_mixin?(item)
913
973
  fdoc.doc.puts "\n@note In wxRuby this is a mixin module instead of a (base) class."
974
+ gen_class_requirements(fdoc)
914
975
  fdoc.puts "module #{clsnm}"
915
976
  else
916
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)
917
979
  basecls = ifspec.classdef_name(base_class(item, doc: true))
918
980
  fdoc.puts "class #{clsnm} < #{basecls ? basecls.sub(/\Awx/, '') : '::Object'}"
919
981
  end