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
@@ -51,7 +51,7 @@ module WXRuby3
51
51
  int res = SWIG_ConvertPtr(rb_ary_entry($input, 0), &ptr, SWIGTYPE_p_wxWindow, 0 | 0);
52
52
  if (!SWIG_IsOK(res))
53
53
  {
54
- Swig::DirectorTypeMismatchException::raise(SWIG_ErrorType(SWIG_ArgError(res)), "in primary output value of type 'wxWindow *'");
54
+ Swig::DirectorTypeMismatchException::raise(swig_get_self(), "$symname", SWIG_ErrorType(SWIG_ArgError(res)), "in primary output value of type 'wxWindow *'");
55
55
  }
56
56
  $result = wxPGWindowList(static_cast<wxWindow*>(ptr));
57
57
  if (RARRAY_LEN($input) > 1)
@@ -59,7 +59,7 @@ module WXRuby3
59
59
  res = SWIG_ConvertPtr(rb_ary_entry($input, 1), &ptr, SWIGTYPE_p_wxWindow, 0 | 0);
60
60
  if (!SWIG_IsOK(res))
61
61
  {
62
- Swig::DirectorTypeMismatchException::raise(SWIG_ErrorType(SWIG_ArgError(res)), "in secundary output value of type 'wxWindow *'");
62
+ Swig::DirectorTypeMismatchException::raise(swig_get_self(), "$symname", SWIG_ErrorType(SWIG_ArgError(res)), "in secundary output value of type 'wxWindow *'");
63
63
  }
64
64
  $result.SetSecondary(static_cast<wxWindow*>(ptr));
65
65
  }
@@ -141,7 +141,7 @@ module WXRuby3
141
141
  spec.map_apply 'int * OUTPUT' => 'int* pIndex'
142
142
  end
143
143
  # for UIntProperty and IntProperty
144
- if Config.instance.features_set?('wxUSE_LONGLONG')
144
+ if Config.instance.features_set?('USE_LONGLONG')
145
145
  # wxLongLong mapping to be considered before considering 'long' (see typecheck precedence)
146
146
  spec.map 'const wxLongLong&' => 'Integer' do
147
147
  map_in temp: 'wxLongLong tmp', code: <<~__CODE
@@ -174,7 +174,7 @@ module WXRuby3
174
174
  void* argp$argnum = NULL;
175
175
  if ( TYPE($input) == T_DATA )
176
176
  {
177
- if (SWIG_IsOK(SWIG_ConvertPtr($input, &argp$argnum, $1_descriptor, $argnum-1)) && argp$argnum)
177
+ if (SWIG_IsOK(SWIG_ConvertPtr($input, &argp$argnum, $1_descriptor, 0)) && argp$argnum)
178
178
  {
179
179
  $1 = reinterpret_cast< $1_basetype * >(argp$argnum);
180
180
  }
@@ -200,7 +200,7 @@ module WXRuby3
200
200
  }
201
201
  else
202
202
  {
203
- Swig::DirectorTypeMismatchException::raise(rb_eTypeError,
203
+ Swig::DirectorTypeMismatchException::raise(swig_get_self(), "$symname", rb_eTypeError,
204
204
  "on_custom_string_edit should return a string, or nil");
205
205
  }
206
206
  }
@@ -54,7 +54,30 @@ module WXRuby3
54
54
  {
55
55
  return (*self)[idx];
56
56
  }
57
- __HEREDOC
57
+
58
+ VALUE each_label()
59
+ {
60
+ VALUE rc = Qnil;
61
+ for (unsigned int i=0; i<$self->GetCount() ;++i)
62
+ {
63
+ VALUE rb_lbl = WXSTR_TO_RSTR($self->GetLabel(i));
64
+ rc = rb_yield(rb_lbl);
65
+ }
66
+ return rc;
67
+ }
68
+
69
+ VALUE each_entry()
70
+ {
71
+ VALUE rc = Qnil;
72
+ for (unsigned int i=0; i<$self->GetCount() ;++i)
73
+ {
74
+ wxPGChoiceEntry *entry = &($self->Item(i));
75
+ VALUE rb_entry = SWIG_NewPointerObj(SWIG_as_voidptr(entry), SWIGTYPE_p_wxPGChoiceEntry, 0);
76
+ rc = rb_yield(rb_entry);
77
+ }
78
+ return rc;
79
+ }
80
+ __HEREDOC
58
81
  # for GetIndicesForStrings
59
82
  spec.map 'wxArrayString *unmatched' => 'Array,nil' do
60
83
 
@@ -39,16 +39,11 @@ module WXRuby3
39
39
  spec.extend_interface 'wxPropertyGridInterface',
40
40
  'void SetPropertyValues(const wxVariant &list, const wxPGPropArgCls& defaultCategory = 0)'
41
41
  # optionals
42
- unless Config.instance.features_set?('wxUSE_LONGLONG')
43
- spec.ignore 'wxPropertyGridInterface::GetPropertyValueAsLongLong',
44
- 'wxPropertyGridInterface::GetPropertyValueAsULongLong'
45
- end
46
- unless Config.instance.features_set?('wxUSE_DATETIME')
47
- spec.ignore 'wxPropertyGridInterface::GetPropertyValueAsDateTime'
48
- end
49
- unless Config.instance.features_set?('wxUSE_VALIDATORS')
50
- spec.ignore 'wxPropertyGridInterface::GetPropertyValidator'
51
- end
42
+ spec.ignore_unless 'USE_LONGLONG',
43
+ 'wxPropertyGridInterface::GetPropertyValueAsLongLong',
44
+ 'wxPropertyGridInterface::GetPropertyValueAsULongLong'
45
+ spec.ignore_unless 'USE_DATETIME', 'wxPropertyGridInterface::GetPropertyValueAsDateTime'
46
+ spec.ignore_unless 'USE_VALIDATORS', 'wxPropertyGridInterface::GetPropertyValidator'
52
47
  # fix incorrect XML documentation
53
48
  spec.ignore 'wxPropertyGridInterface::SetPropertyImage', ignore_doc: false # ignore non-const BitmapBundle arg decl
54
49
  # and add correct decl
@@ -224,7 +224,7 @@ module WXRuby3
224
224
  int res = SWIG_ConvertPtr(rb_ary_entry(rb_int_arr, i), &ptr,SWIGTYPE_p_wxRichTextAttr, 0);
225
225
  if (!SWIG_IsOK(res))
226
226
  {
227
- Swig::DirectorTypeMismatchException::raise(SWIG_ErrorType(SWIG_ArgError(res)), "in output value of type '""Wx::RTC::RichTextAttr""'");
227
+ Swig::DirectorTypeMismatchException::raise(swig_get_self(), "$symname", SWIG_ErrorType(SWIG_ArgError(res)), "in output value of type '""Wx::RTC::RichTextAttr""'");
228
228
  }
229
229
  wxRichTextAttr* wx_att = static_cast< wxRichTextAttr* >(ptr);
230
230
  $1.Add(*wx_att);
@@ -45,6 +45,17 @@ module WXRuby3
45
45
  }
46
46
  return rc;
47
47
  }
48
+
49
+ VALUE each_child()
50
+ {
51
+ VALUE rc = Qnil;
52
+ for (size_t i=0; i<$self->GetChildCount() ;++i)
53
+ {
54
+ wxRichTextObject *rto = $self->GetChild(i);
55
+ rc = rb_yield(wxRuby_RichTextObject2Ruby(rto, 0));
56
+ }
57
+ return rc;
58
+ }
48
59
  __HEREDOC
49
60
 
50
61
  spec.new_object 'wxRichTextLine::Clone'
@@ -161,6 +172,20 @@ module WXRuby3
161
172
  }
162
173
  $self->MoveFromList(wx_lst);
163
174
  }
175
+
176
+ VALUE each_line()
177
+ {
178
+ VALUE rc = Qnil;
179
+ const wxRichTextLineVector &lines = $self->GetLines();
180
+ int lnr = 0;
181
+ for (const wxRichTextLine* line : lines)
182
+ {
183
+ VALUE rb_ln = SWIG_NewPointerObj(SWIG_as_voidptr(const_cast<wxRichTextLine*> (line)), SWIGTYPE_p_wxRichTextLine, 0);
184
+ rc = rb_yield(rb_ln);
185
+ ++lnr;
186
+ }
187
+ return rc;
188
+ }
164
189
  __CODE
165
190
 
166
191
  spec.do_not_generate(:typedefs, :variables, :enums, :defines, :functions)
@@ -15,7 +15,7 @@ module WXRuby3
15
15
  class RichTextCtrl < Window
16
16
 
17
17
  include Typemap::RichText
18
- if Config.instance.features_set?('wxUSE_DATETIME')
18
+ if Config.instance.features_set?('USE_DATETIME')
19
19
  include Typemap::DateTime
20
20
  end
21
21
 
@@ -117,9 +117,7 @@ module WXRuby3
117
117
  wxRichTextCtrl::ProcessMouseMovement
118
118
  wxRichTextCtrl::ProcessBackKey
119
119
  ]
120
- unless Config.instance.features_set?('wxUSE_DATETIME')
121
- spec.ignore %w[wxRichTextCtrl::GetDragStartTime wxRichTextCtrl::SetDragStartTime]
122
- end
120
+ spec.ignore_unless 'USE_DATETIME', %w[wxRichTextCtrl::GetDragStartTime wxRichTextCtrl::SetDragStartTime]
123
121
  spec.add_header_code 'extern VALUE wxRuby_RichTextObject2Ruby(const wxRichTextObject *wx_rto, int own);'
124
122
  spec.swig_import('swig/classes/include/wxTextAttr.h',
125
123
  'swig/classes/include/wxRichTextObject.h',
@@ -153,7 +151,7 @@ module WXRuby3
153
151
  }
154
152
  else
155
153
  {
156
- Swig::DirectorTypeMismatchException::raise(rb_eTypeError,
154
+ Swig::DirectorTypeMismatchException::raise(swig_get_self(), "$symname", rb_eTypeError,
157
155
  "expected an Integer, or nil on failure");
158
156
  }
159
157
  }
@@ -208,6 +206,18 @@ module WXRuby3
208
206
  __CODE
209
207
 
210
208
  end
209
+ spec.add_extend_code 'wxRichTextCtrl', <<~__HEREDOC
210
+ VALUE each_line()
211
+ {
212
+ VALUE rc = Qnil;
213
+ for (int i=0; i<$self->GetNumberOfLines() ;++i)
214
+ {
215
+ VALUE rb_ln = WXSTR_TO_RSTR($self->GetLineText(i));
216
+ rc = rb_yield(rb_ln);
217
+ }
218
+ return rc;
219
+ }
220
+ __HEREDOC
211
221
  end
212
222
  end # class RichTextCtrl
213
223
 
@@ -27,11 +27,13 @@ module WXRuby3
27
27
  wxRichTextFormattingDialog::SetStyle
28
28
  wxRichTextFormattingDialog::SetStyleDefinition
29
29
  ]
30
- # add undocumented methods
31
- spec.extend_interface 'wxRichTextFormattingDialog',
32
- 'wxRichTextObject* GetObject() const',
33
- 'void SetObject(wxRichTextObject* obj)',
34
- 'virtual bool ApplyStyle(wxRichTextCtrl* ctrl, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO)'
30
+ if Config.instance.wx_version < '3.3.0'
31
+ # add undocumented methods
32
+ spec.extend_interface 'wxRichTextFormattingDialog',
33
+ 'wxRichTextObject* GetObject() const',
34
+ 'void SetObject(wxRichTextObject* obj)',
35
+ 'virtual bool ApplyStyle(wxRichTextCtrl* ctrl, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO)'
36
+ end
35
37
  spec.add_header_code 'extern VALUE wxRuby_RichTextObject2Ruby(const wxRichTextObject *wx_rto, int own);'
36
38
  spec.disown 'wxRichTextFormattingDialogFactory *factory'
37
39
  spec.suppress_warning(473, 'wxRichTextFormattingDialogFactory::CreatePage')
@@ -83,13 +83,15 @@ module WXRuby3
83
83
  return rb_rtsd;
84
84
  }
85
85
  __HEREDOC
86
- # add undocumented convenience method
87
- spec.extend_interface 'wxRichTextListStyleDefinition',
88
- 'void SetAttributes(int i, int leftIndent, int leftSubIndent, int bulletStyle, const wxString& bulletSymbol = wxEmptyString)'
89
- # undocumented methods
90
- spec.extend_interface 'wxRichTextStyleSheet',
91
- 'wxRichTextStyleSheet(const wxRichTextStyleSheet& sheet)',
92
- 'void Copy(const wxRichTextStyleSheet& sheet)'
86
+ if Config.instance.wx_version < '3.3.0'
87
+ # add undocumented convenience method
88
+ spec.extend_interface 'wxRichTextListStyleDefinition',
89
+ 'void SetAttributes(int i, int leftIndent, int leftSubIndent, int bulletStyle, const wxString& bulletSymbol = wxEmptyString)'
90
+ # undocumented methods
91
+ spec.extend_interface 'wxRichTextStyleSheet',
92
+ 'wxRichTextStyleSheet(const wxRichTextStyleSheet& sheet)',
93
+ 'void Copy(const wxRichTextStyleSheet& sheet)'
94
+ end
93
95
  # redefine these since we need to be able to selectively specify 'disown'
94
96
  spec.ignore 'wxRichTextStyleSheet::AddCharacterStyle',
95
97
  'wxRichTextStyleSheet::AddListStyle',
@@ -0,0 +1,42 @@
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 SashEvent < Event
16
+
17
+ def setup
18
+ super
19
+ spec.disable_proxies
20
+ # missing from interface docs
21
+ spec.add_swig_code '%constant int EVT_SASH_DRAGGED_RANGE = wxEVT_SASH_DRAGGED;'
22
+ end
23
+
24
+ def doc_generator
25
+ SashEventDocGenerator.new(self)
26
+ end
27
+
28
+ end # class SashEvent
29
+
30
+ end # class Director
31
+
32
+ class SashEventDocGenerator < DocGenerator
33
+
34
+ protected def gen_constants_doc(fdoc)
35
+ super
36
+ xref_table = package.all_modules.reduce(DocGenerator.constants_db) { |db, mod| db[mod] }
37
+ gen_constant_doc(fdoc, 'EVT_SASH_DRAGGED_RANGE', xref_table['EVT_SASH_DRAGGED'], '')
38
+ end
39
+
40
+ end
41
+
42
+ end # module WXRuby3
@@ -14,7 +14,6 @@ module WXRuby3
14
14
 
15
15
  def setup
16
16
  # Any nested sizers passed to Add() in are owned by C++, not GC'd by Ruby
17
- spec.disown 'wxSizer* sizer'
18
17
  case spec.module_name
19
18
  when 'wxSizer'
20
19
  spec.items << 'wxSizerFlags'
@@ -26,6 +25,79 @@ module WXRuby3
26
25
  'wxSizer::Insert(size_t, wxSizerItem *)',
27
26
  'wxSizer::Prepend(wxSizerItem *)'
28
27
  spec.ignore 'wxSizer::Remove(wxWindow *)' # long time deprecated
28
+ # need to adjust sizer arg name to apply disown specs
29
+ spec.ignore 'wxSizer::Add(wxSizer *, const wxSizerFlags &)',
30
+ 'wxSizer::Add(wxSizer *, int, int, int, wxObject *)',
31
+ 'wxSizer::Insert(size_t, wxSizer *, const wxSizerFlags &)',
32
+ 'wxSizer::Insert(size_t, wxSizer *, int, int, int, wxObject *)',
33
+ 'wxSizer::Prepend(wxSizer *, const wxSizerFlags &)',
34
+ 'wxSizer::Prepend(wxSizer *, int, int, int, wxObject *)',
35
+ ignore_doc: false
36
+ spec.extend_interface 'wxSizer',
37
+ 'wxSizerItem* Add(wxSizer *sizer_disown, const wxSizerFlags &flags)',
38
+ 'wxSizerItem* Add(wxSizer *sizer_disown, int proportion=0, int flag=0, int border=0, wxObject *userData=NULL)',
39
+ 'wxSizerItem* Insert(size_t index, wxSizer *sizer_disown, const wxSizerFlags &flags)',
40
+ 'wxSizerItem* Insert(size_t index, wxSizer *sizer_disown, int proportion=0, int flag=0, int border=0, wxObject *userData=NULL)',
41
+ 'wxSizerItem* Prepend(wxSizer *sizer_disown, const wxSizerFlags &flags)',
42
+ 'wxSizerItem* Prepend(wxSizer *sizer_disown, int proportion=0, int flag=0, int border=0, wxObject *userData=NULL)'
43
+ spec.disown 'wxSizer* sizer_disown'
44
+ # needs custom impl to transfer ownership of detached items
45
+ spec.ignore 'wxSizer::Detach(wxSizer*)',
46
+ 'wxSizer::Detach(int)', ignore_doc: false
47
+ spec.add_extend_code 'wxSizer', <<~__HEREDOC
48
+ bool detach(wxSizer* szr)
49
+ {
50
+ if ($self->Detach(szr))
51
+ {
52
+ VALUE rb_szr = SWIG_RubyInstanceFor(szr);
53
+ if (rb_szr && !NIL_P(rb_szr))
54
+ {
55
+ // transfer ownership to Ruby
56
+ RDATA(rb_szr)->dfree = GcSizerFreeFunc;
57
+ }
58
+ return true;
59
+ }
60
+ return false;
61
+ }
62
+
63
+ bool detach(int itm_nr)
64
+ {
65
+ wxSizerItem* itm = $self->GetItem(itm_nr);
66
+ if (itm)
67
+ {
68
+ VALUE rb_szr = Qnil;
69
+ if (itm->IsSizer())
70
+ {
71
+ rb_szr = SWIG_RubyInstanceFor(itm->GetSizer());
72
+ }
73
+ if ($self->Detach(itm_nr))
74
+ {
75
+ if (rb_szr && !NIL_P(rb_szr))
76
+ {
77
+ // transfer ownership to Ruby
78
+ RDATA(rb_szr)->dfree = GcSizerFreeFunc;
79
+ }
80
+ return true;
81
+ }
82
+ }
83
+ return false;
84
+ }
85
+
86
+ VALUE each_child()
87
+ {
88
+ const wxSizerItemList& child_list = self->GetChildren();
89
+ VALUE rc = Qnil;
90
+ wxSizerItemList::compatibility_iterator node = child_list.GetFirst();
91
+ while (node)
92
+ {
93
+ wxSizerItem *wx_si = node->GetData();
94
+ VALUE rb_si = SWIG_NewPointerObj(wx_si, SWIGTYPE_p_wxSizerItem, 0);
95
+ rc = rb_yield(rb_si);
96
+ node = node->GetNext();
97
+ }
98
+ return rc;
99
+ }
100
+ __HEREDOC
29
101
  # Typemap for GetChildren - convert to array of Sizer items
30
102
  spec.map 'wxSizerItemList&' => 'Array<Wx::SizerItem>' do
31
103
  map_out code: <<~__CODE
@@ -50,6 +122,12 @@ module WXRuby3
50
122
  spec.gc_as_untracked 'wxGBSpan', 'wxGBPosition'
51
123
  # cannot use this with wxRuby
52
124
  spec.ignore 'wxGridBagSizer::Add(wxGBSizerItem *)'
125
+ # need to adjust sizer arg name to apply disown specs
126
+ spec.ignore 'wxGridBagSizer::Add(wxSizer *, const wxGBPosition &, const wxGBSpan &, int, int, wxObject *)',
127
+ ignore_doc: false
128
+ spec.extend_interface 'wxGridBagSizer',
129
+ 'wxSizerItem *Add(wxSizer *sizer_disown, const wxGBPosition &pos, const wxGBSpan &span=wxDefaultSpan, int flag=0, int border=0, wxObject *userData=NULL)'
130
+ spec.disown 'wxSizer* sizer_disown'
53
131
  end
54
132
  # no real use for allowing these to be overloaded but a whole lot of grieve
55
133
  # if we do allow it
@@ -22,6 +22,28 @@ module WXRuby3
22
22
  # ignore constructors
23
23
  spec.ignore 'wxSizerItem::wxSizerItem'
24
24
  spec.ignore(%w[wxSizerItem::SetSizer wxSizerItem::SetSpacer wxSizerItem::SetWindow])
25
+ # need to adjust sizer arg name to apply disown specs
26
+ spec.ignore 'wxSizerItem::AssignSizer(wxSizer *)', ignore_doc: false
27
+ spec.extend_interface 'wxSizerItem',
28
+ 'void AssignSizer(wxSizer *sizer_disown)'
29
+ spec.disown 'wxSizer *sizer_disown'
30
+ # needs custom impl to properly transfer ownership to Ruby
31
+ spec.ignore 'wxSizerItem::DetachSizer', ignore_doc: false
32
+ spec.add_extend_code 'wxSizerItem', <<~__HEREDOC
33
+ void detach_sizer()
34
+ {
35
+ if ($self->IsSizer())
36
+ {
37
+ VALUE rb_szr = SWIG_RubyInstanceFor($self->GetSizer());
38
+ if (rb_szr && !NIL_P(rb_szr))
39
+ {
40
+ // transfer ownership to Ruby
41
+ RDATA(rb_szr)->dfree = GcSizerFreeFunc;
42
+ }
43
+ $self->DetachSizer();
44
+ }
45
+ }
46
+ __HEREDOC
25
47
  when 'wxGBSizerItem'
26
48
  spec.make_abstract 'wxGBSizerItem'
27
49
  # ignore constructors
@@ -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)
@@ -54,23 +56,13 @@ module WXRuby3
54
56
  int swig_res = SWIG_ConvertPtr(result, &ptr, $1_descriptor, 0 | SWIG_POINTER_DISOWN);
55
57
  if (!SWIG_IsOK(swig_res))
56
58
  {
57
- Swig::DirectorTypeMismatchException::raise(rb_eTypeError,
59
+ Swig::DirectorTypeMismatchException::raise(swig_get_self(), "$symname", rb_eTypeError,
58
60
  "create_popup_menu must return a Wx::Menu, or nil");
59
61
  }
60
62
  $result = reinterpret_cast < wxMenu * > (ptr);
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',