wxruby3 1.3.1 → 1.5.0

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 (127) hide show
  1. checksums.yaml +4 -4
  2. data/INSTALL.md +16 -12
  3. data/README.md +4 -3
  4. data/ext/wxruby3/include/wxRubyApp.h +9 -9
  5. data/ext/wxruby3/swig/mark_free_impl.i +47 -11
  6. data/ext/wxruby3/swig/wx.i +30 -12
  7. data/lib/wx/aui/auifloatframe.rb +1 -1
  8. data/lib/wx/aui/auimanager.rb +5 -16
  9. data/lib/wx/aui/auinotebook.rb +1 -1
  10. data/lib/wx/aui/require.rb +0 -2
  11. data/lib/wx/core/acceleratortable.rb +1 -1
  12. data/lib/wx/core/animation.rb +2 -2
  13. data/lib/wx/core/app.rb +1 -1
  14. data/lib/wx/core/artprovider.rb +4 -4
  15. data/lib/wx/core/bitmap.rb +1 -1
  16. data/lib/wx/core/bitmap_combobox.rb +2 -2
  17. data/lib/wx/core/clientdc.rb +1 -1
  18. data/lib/wx/core/clipboard.rb +4 -4
  19. data/lib/wx/core/colour.rb +1 -1
  20. data/lib/wx/core/combobox.rb +1 -1
  21. data/lib/wx/core/config.rb +7 -7
  22. data/lib/wx/core/controlwithitems.rb +3 -3
  23. data/lib/wx/core/data_object.rb +4 -4
  24. data/lib/wx/core/dataformat.rb +9 -3
  25. data/lib/wx/core/dialog.rb +3 -2
  26. data/lib/wx/core/event.rb +3 -3
  27. data/lib/wx/core/evthandler.rb +325 -289
  28. data/lib/wx/core/file_dialog.rb +1 -1
  29. data/lib/wx/core/find_replace_dialog.rb +2 -2
  30. data/lib/wx/core/functions.rb +1 -1
  31. data/lib/wx/core/genericdirctrl.rb +1 -1
  32. data/lib/wx/core/geometry.rb +2 -2
  33. data/lib/wx/core/graphics_pen_info.rb +1 -1
  34. data/lib/wx/core/helpprovider.rb +1 -1
  35. data/lib/wx/core/icon.rb +1 -1
  36. data/lib/wx/core/image.rb +2 -2
  37. data/lib/wx/core/imagelist.rb +1 -1
  38. data/lib/wx/core/locale.rb +5 -5
  39. data/lib/wx/core/log.rb +8 -8
  40. data/lib/wx/core/menu.rb +3 -3
  41. data/lib/wx/core/module_ext.rb +16 -0
  42. data/lib/wx/core/owner_drawn_combobox.rb +3 -3
  43. data/lib/wx/core/pen_info.rb +1 -1
  44. data/lib/wx/core/persistence_manager.rb +2 -2
  45. data/lib/wx/core/rect.rb +1 -1
  46. data/lib/wx/core/secret_store.rb +1 -1
  47. data/lib/wx/core/simplehelpprovider.rb +1 -1
  48. data/lib/wx/core/sizer.rb +8 -8
  49. data/lib/wx/core/splash_screen.rb +1 -1
  50. data/lib/wx/core/standard_paths.rb +1 -1
  51. data/lib/wx/core/task_bar_button.rb +1 -1
  52. data/lib/wx/core/text_entry.rb +1 -1
  53. data/lib/wx/core/textctrl.rb +2 -2
  54. data/lib/wx/core/timer.rb +2 -2
  55. data/lib/wx/core/tree_ctrl.rb +1 -1
  56. data/lib/wx/core/v_list_box.rb +1 -1
  57. data/lib/wx/core/validator.rb +2 -2
  58. data/lib/wx/core/variant.rb +2 -2
  59. data/lib/wx/core/window.rb +48 -2
  60. data/lib/wx/core/xmlresource.rb +4 -4
  61. data/lib/wx/core.rb +2 -0
  62. data/lib/wx/doc/evthandler.rb +1 -23
  63. data/lib/wx/doc/tip_window.rb +22 -0
  64. data/lib/wx/grid/grid.rb +3 -3
  65. data/lib/wx/grid/require.rb +0 -2
  66. data/lib/wx/html/htmlhelpcontroller.rb +1 -1
  67. data/lib/wx/html/htmlwindow.rb +1 -1
  68. data/lib/wx/html/require.rb +0 -2
  69. data/lib/wx/html/simple_html_listbox.rb +3 -3
  70. data/lib/wx/keyword_ctors.rb +14 -7
  71. data/lib/wx/keyword_defs.rb +7 -7
  72. data/lib/wx/pg/pg_properties.rb +1 -1
  73. data/lib/wx/pg/pg_property.rb +3 -3
  74. data/lib/wx/pg/property_grid.rb +2 -2
  75. data/lib/wx/pg/property_grid_interface.rb +2 -2
  76. data/lib/wx/pg/require.rb +0 -2
  77. data/lib/wx/prt/previewframe.rb +1 -1
  78. data/lib/wx/prt/require.rb +0 -2
  79. data/lib/wx/rbn/ribbon_control.rb +1 -1
  80. data/lib/wx/rbn/ribbon_page.rb +1 -1
  81. data/lib/wx/rbn/ribbon_panel.rb +1 -1
  82. data/lib/wx/rtc/require.rb +0 -2
  83. data/lib/wx/rtc/rich_text_composite_object.rb +1 -1
  84. data/lib/wx/rtc/rich_text_ctrl.rb +1 -1
  85. data/lib/wx/rtc/rich_text_paragraph.rb +1 -1
  86. data/lib/wx/rtc/richtext_buffer.rb +3 -3
  87. data/lib/wx/rtc/richtext_formatting_dialog.rb +2 -2
  88. data/lib/wx/rtc/richtext_style_organiser_dialog.rb +1 -1
  89. data/lib/wx/rtc/symbol_picker_dialog.rb +1 -1
  90. data/lib/wx/stc/require.rb +0 -2
  91. data/lib/wx/stc/styled_text_ctrl.rb +1 -1
  92. data/lib/wx/version.rb +1 -1
  93. data/lib/wx/wxruby/base.rb +8 -2
  94. data/lib/wx/wxruby/cmd/setup.rb +61 -37
  95. data/rakelib/gem.rb +8 -4
  96. data/rakelib/lib/config/macosx.rb +31 -4
  97. data/rakelib/lib/config/mingw.rb +1 -1
  98. data/rakelib/lib/config/pkgman/linux.rb +9 -1
  99. data/rakelib/lib/core/package.rb +68 -49
  100. data/rakelib/lib/director/about_dialog_info.rb +1 -0
  101. data/rakelib/lib/director/aui_manager.rb +63 -57
  102. data/rakelib/lib/director/aui_notebook.rb +7 -0
  103. data/rakelib/lib/director/colour.rb +1 -1
  104. data/rakelib/lib/director/data_format.rb +1 -1
  105. data/rakelib/lib/director/event.rb +1 -0
  106. data/rakelib/lib/director/event_handler.rb +82 -46
  107. data/rakelib/lib/director/events.rb +5 -3
  108. data/rakelib/lib/director/functions.rb +0 -3
  109. data/rakelib/lib/director/grid_ctrl.rb +24 -0
  110. data/rakelib/lib/director/html_printout.rb +2 -0
  111. data/rakelib/lib/director/list_ctrl.rb +14 -10
  112. data/rakelib/lib/director/locale.rb +2 -0
  113. data/rakelib/lib/director/num_validator.rb +7 -0
  114. data/rakelib/lib/director/print_data.rb +7 -0
  115. data/rakelib/lib/director/printer.rb +2 -0
  116. data/rakelib/lib/director/richtext_printing.rb +2 -0
  117. data/rakelib/lib/director/splitter_window.rb +17 -0
  118. data/rakelib/lib/director/textctrl.rb +21 -4
  119. data/rakelib/lib/director/tip_window.rb +34 -0
  120. data/rakelib/lib/director/window.rb +9 -1
  121. data/rakelib/lib/director.rb +0 -1
  122. data/rakelib/lib/generate/doc/evt_handler.yaml +31 -12
  123. data/rakelib/lib/specs/interfaces.rb +9 -0
  124. data/rakelib/lib/typemap/print_page_range.rb +97 -0
  125. data/tests/test_combo_ctrl.rb +1 -0
  126. data/tests/test_event_handling.rb +158 -31
  127. metadata +7 -5
@@ -29,45 +29,21 @@ module WXRuby3
29
29
  # have TryBefore and TryAfter to handle this much cleaner
30
30
  spec.no_proxy 'wxEvtHandler::ProcessEvent'
31
31
  spec.regard('wxEvtHandler::ProcessEvent', regard_doc: false) # we provide customized docs
32
+ # Do not see much use for allowing overrides for these either as wxWidgets do not either
33
+ spec.no_proxy 'wxEvtHandler::QueueEvent',
34
+ 'wxEvtHandler::AddPendingEvent'
35
+ # Do not see much point in allowing/supporting these to be overridden
36
+ spec.no_proxy 'wxEvtHandler::SetNextHandler',
37
+ 'wxEvtHandler::SetPreviousHandler'
38
+ # no doc for set_previous_handler
39
+ spec.regard('wxEvtHandler::SetPreviousHandler', regard_doc: false)
32
40
  # make SWIG aware of these
33
41
  spec.regard 'wxEvtHandler::TryBefore', 'wxEvtHandler::TryAfter'
34
42
  # Special type mapping for wxEvtHandler::QueueEvent which assumes ownership of the C++ event.
35
- # We need to create a shallow copy of the Ruby event instance (copying it's Ruby members if any),
36
- # pass linkage of the C++ event to the copy and remove it from the original (input) Ruby
37
- # instance (so it can not delete/or reference it anymore); also start tracking the copy
38
- # (which effectively removes the tracking for the original).
39
- # Queued (pending) events are cleaned up (deleted) by wxWidgets after (failing) handling
40
- # which will automatically unlink and un-track them releasing the Ruby instance to be GC-ed.
41
- spec.map 'wxEvent *event' => 'Wx::Event' do
42
- map_in code: <<~__CODE
43
- // get the wrapped wxEvent*
44
- wxEvent *wx_ev = (wxEvent*)DATA_PTR($input);
45
- // check if this a user defined event
46
- if ( wx_ev->GetEventType() > wxEVT_USER_FIRST )
47
- {
48
- // we need to preserve the Ruby state
49
- // create a shallow copy of the Ruby object
50
- VALUE r_evt_copy = rb_obj_clone($input);
51
- // pass the wxEvent* over to the copy
52
- DATA_PTR(r_evt_copy) = wx_ev;
53
- // unlink the input
54
- DATA_PTR($input) = 0;
55
- // track the copy (this overwrites the record for the
56
- // original, effectively untracking it)
57
- wxRuby_AddTracking( (void*)wx_ev, r_evt_copy);
58
- }
59
- else
60
- {
61
- // std wx event; no need to preserve the Ruby state
62
- // simply untrack and unlink the input
63
- wxRuby_RemoveTracking( (void*)wx_ev);
64
- DATA_PTR($input) = 0;
65
- // and just pass on the C++ event
66
- }
67
- // Queue the C++ event
68
- $1 = wx_ev;
69
- __CODE
70
- end
43
+ # We need to disown Ruby with respect to the C++ event object but remain tracking the pair to keep
44
+ # the Ruby event object alive.
45
+ spec.disown 'wxEvent *event'
46
+
71
47
  # add special mapping for event filters so we can accept the app instance as well
72
48
  # although Wx::App is not derived from Wx::EventFilter in wxRuby (no multiple inheritance)
73
49
  spec.map 'wxEventFilter*' => 'Wx::EventFilter,Wx::App' do
@@ -225,6 +201,10 @@ module WXRuby3
225
201
  }
226
202
  __HEREDOC
227
203
  spec.add_header_code <<~__HEREDOC
204
+ static VALUE WxRuby_GetAsyncProcCallEvent_Class();
205
+ static void GC_mark_AsyncMethodCallEvent(void *ptr);
206
+ static void free_AsyncMethodCallEvent(void *ptr);
207
+
228
208
  class RbAsyncProcCallEvent : public wxAsyncMethodCallEvent
229
209
  {
230
210
  public:
@@ -245,7 +225,14 @@ module WXRuby3
245
225
 
246
226
  virtual wxEvent *Clone() const wxOVERRIDE
247
227
  {
248
- return new RbAsyncProcCallEvent(*this);
228
+ RbAsyncProcCallEvent* wx_ev = new RbAsyncProcCallEvent(*this);
229
+ // Create a new Ruby event object (owned)
230
+ VALUE rb_evt = Data_Wrap_Struct(WxRuby_GetAsyncProcCallEvent_Class(),
231
+ VOIDFUNC(GC_mark_AsyncMethodCallEvent),
232
+ VOIDFUNC(free_AsyncMethodCallEvent),
233
+ wx_ev);
234
+ wxRuby_AddTracking( (void*)wx_ev, rb_evt);
235
+ return wx_ev;
249
236
  }
250
237
 
251
238
  virtual void Execute() wxOVERRIDE
@@ -257,12 +244,22 @@ module WXRuby3
257
244
  if (TYPE(m_rb_call) == T_ARRAY)
258
245
  {
259
246
  VALUE proc = rb_ary_entry(m_rb_call, 0);
260
- VALUE args = rb_ary_subseq(m_rb_call, 1, RARRAY_LEN(m_rb_call)-1);
261
- rc = wxRuby_Funcall(ex_caught, proc, call_id(), args);
247
+ if (RARRAY_LEN(m_rb_call) > 1)
248
+ {
249
+ VALUE args = rb_ary_subseq(m_rb_call, 1, RARRAY_LEN(m_rb_call)-1);
250
+ rc = wxRuby_Funcall(ex_caught, proc, call_id(), args);
251
+ }
252
+ else
253
+ {
254
+ rc = wxRuby_Funcall(ex_caught, proc, call_id(), (int)0);
255
+ }
262
256
  }
263
257
  else
264
258
  {
265
- rc = wxRuby_Funcall(ex_caught, m_rb_call, call_id(), (int)0);
259
+ // should never happen
260
+ VALUE ex = rb_eval_string("x = RuntimeError.new('UNEXPECTED ERROR: Asynchronous Proc Event has invalid call spec!'); x.set_backtrace(caller); x");
261
+ wxRuby_PrintException(ex);
262
+ exit(1);
266
263
  }
267
264
  if (ex_caught)
268
265
  {
@@ -276,9 +273,39 @@ module WXRuby3
276
273
  }
277
274
  }
278
275
 
276
+ void GC_Mark()
277
+ {
278
+ rb_gc_mark(m_rb_call);
279
+ }
280
+
279
281
  private:
280
282
  VALUE m_rb_call;
281
283
  };
284
+
285
+ static void GC_mark_AsyncMethodCallEvent(void *ptr)
286
+ {
287
+ if (ptr)
288
+ {
289
+ RbAsyncProcCallEvent* evt = (RbAsyncProcCallEvent*)ptr;
290
+ evt->GC_Mark();
291
+ }
292
+ }
293
+
294
+ static void free_AsyncMethodCallEvent(void *ptr)
295
+ {
296
+ RbAsyncProcCallEvent *wx_evt = (RbAsyncProcCallEvent *)ptr;
297
+ delete wx_evt;
298
+ }
299
+
300
+ static VALUE WxRuby_GetAsyncProcCallEvent_Class()
301
+ {
302
+ static VALUE WxRuby_cAsyncProcCallEvent = Qnil;
303
+ if (WxRuby_cAsyncProcCallEvent == Qnil)
304
+ {
305
+ WxRuby_cAsyncProcCallEvent = rb_eval_string("Wx::AsyncProcCallEvent");
306
+ }
307
+ return WxRuby_cAsyncProcCallEvent;
308
+ }
282
309
  __HEREDOC
283
310
  spec.add_extend_code 'wxEvtHandler', <<~__HEREDOC
284
311
  // This provides the public Ruby 'connect' method
@@ -333,18 +360,23 @@ module WXRuby3
333
360
  void call_after(VALUE call)
334
361
  {
335
362
  // valid call object?
336
- VALUE proc;
337
- if (TYPE(call) == T_ARRAY &&
338
- (rb_obj_is_kind_of(proc = rb_ary_entry(call, 0), rb_cProc)
363
+ VALUE proc = TYPE(call) == T_ARRAY ? rb_ary_entry(call, 0) : Qnil;
364
+ if (!NIL_P(proc) &&
365
+ (rb_obj_is_kind_of(proc, rb_cProc)
339
366
  ||
340
367
  rb_obj_is_kind_of(proc, rb_cMethod)))
341
368
  {
342
369
  // create C++ event
343
370
  RbAsyncProcCallEvent * evt = new RbAsyncProcCallEvent(self, call);
371
+ // Create a new Ruby event object (leave ownership to wxWidgets C++)
372
+ VALUE rb_evt = Data_Wrap_Struct(WxRuby_GetAsyncProcCallEvent_Class(),
373
+ VOIDFUNC(GC_mark_AsyncMethodCallEvent),
374
+ 0,
375
+ evt);
344
376
  // track it and the call object
345
- wxRuby_AddTracking( (void*)evt, call);
346
- // queue it
347
- self->QueueEvent(evt);
377
+ wxRuby_AddTracking( (void*)evt, rb_evt);
378
+ // queue it (wxWidgets takes ownership of C++ event object)
379
+ self->wxEvtHandler::QueueEvent(evt);
348
380
  }
349
381
  }
350
382
  __HEREDOC
@@ -371,6 +403,10 @@ module WXRuby3
371
403
  def_item = defmod.find_item(citem)
372
404
  if Extractor::ClassDef === def_item && spec.is_derived_from?(def_item, 'wxEvtHandler')
373
405
  spec.no_proxy "#{spec.class_name(citem)}::ProcessEvent"
406
+ spec.no_proxy "#{spec.class_name(citem)}::QueueEvent"
407
+ spec.no_proxy "#{spec.class_name(citem)}::AddPendingEvent"
408
+ spec.no_proxy "#{spec.class_name(citem)}::SetNextHandler"
409
+ spec.no_proxy "#{spec.class_name(citem)}::SetPreviousHandler"
374
410
  is_evt_handler = true
375
411
  end
376
412
  end
@@ -23,10 +23,12 @@ module WXRuby3
23
23
  wxSizeEvent wxMoveEvent wxPaintEvent wxEraseEvent wxFocusEvent wxActivateEvent
24
24
  wxInitDialogEvent wxMenuEvent wxCloseEvent wxShowEvent wxIconizeEvent wxMaximizeEvent
25
25
  wxFullScreenEvent wxJoystickEvent wxDropFilesEvent wxUpdateUIEvent wxSysColourChangedEvent
26
- wxMouseCaptureChangedEvent wxMouseCaptureLostEvent wxDisplayChangedEvent wxDPIChangedEvent
27
- wxPaletteChangedEvent wxQueryNewPaletteEvent wxNavigationKeyEvent wxWindowCreateEvent
28
- wxWindowDestroyEvent wxHelpEvent wxClipboardTextEvent wxContextMenuEvent wxChildFocusEvent
26
+ wxDPIChangedEvent wxPaletteChangedEvent wxQueryNewPaletteEvent wxNavigationKeyEvent
27
+ wxWindowCreateEvent wxWindowDestroyEvent wxHelpEvent wxClipboardTextEvent wxContextMenuEvent wxChildFocusEvent
29
28
  ])
29
+ if Config.instance.features_set?('WXMSW')
30
+ spec.items.concat %w[wxMouseCaptureChangedEvent wxMouseCaptureLostEvent wxDisplayChangedEvent]
31
+ end
30
32
  spec.fold_bases('wxMouseEvent' => %w[wxMouseState wxKeyboardState], 'wxKeyEvent' => 'wxKeyboardState')
31
33
  spec.ignore 'wxShowEvent::GetShow', 'wxIconizeEvent::Iconized'
32
34
  spec.ignore 'wxKeyEvent::GetPosition(wxCoord *,wxCoord *) const'
@@ -204,9 +204,6 @@ module WXRuby3
204
204
  spec.add_interface_code <<~__HEREDOC
205
205
  bool wxSafeYield(wxWindow* win = NULL, bool onlyIfNeeded = false);
206
206
 
207
- // Mouse / keyboard information
208
- wxWindow * wxGetActiveWindow();
209
-
210
207
  // Dialog shortcuts
211
208
  wxString wxFileSelector (const wxString &message,
212
209
  const wxString &default_path=wxEmptyString,
@@ -554,9 +554,33 @@ module WXRuby3
554
554
  '%constant char* wxGRID_VALUE_DATE = "date";',
555
555
  '%constant char* wxGRID_VALUE_TEXT = "string";',
556
556
  '%constant char* wxGRID_VALUE_LONG = "long";'
557
+ # fix naming mismatch with #evt_grid_cmd_col_size
558
+ spec.add_swig_code '%constant int EVT_GRID_CMD_COL_SIZE = wxEVT_GRID_COL_SIZE;',
559
+ '%constant int EVT_GRID_CMD_ROW_SIZE = wxEVT_GRID_ROW_SIZE;',
560
+ '%constant int EVT_GRID_CMD_EDITOR_CREATED = wxEVT_GRID_EDITOR_CREATED;',
561
+ '%constant int EVT_GRID_CMD_RANGE_SELECTING = wxEVT_GRID_RANGE_SELECTING;',
562
+ '%constant int EVT_GRID_CMD_RANGE_SELECTED = wxEVT_GRID_RANGE_SELECTED;'
563
+ end
564
+
565
+ def doc_generator
566
+ GridCtrlDocGenerator.new(self)
557
567
  end
558
568
  end # class GridCtrl
559
569
 
560
570
  end # class Director
561
571
 
572
+ class GridCtrlDocGenerator < DocGenerator
573
+
574
+ protected def gen_constants_doc(fdoc)
575
+ super
576
+ xref_table = package.all_modules.reduce(DocGenerator.constants_db) { |db, mod| db[mod] }
577
+ gen_constant_doc(fdoc, 'EVT_GRID_CMD_COL_SIZE', xref_table['EVT_GRID_COL_SIZE'], 'wxRuby specific alias for Wx::EVT_GRID_COL_SIZE')
578
+ gen_constant_doc(fdoc, 'EVT_GRID_CMD_ROW_SIZE', xref_table['EVT_GRID_ROW_SIZE'], 'wxRuby specific alias for Wx::EVT_GRID_ROW_SIZE')
579
+ gen_constant_doc(fdoc, 'EVT_GRID_CMD_EDITOR_CREATED', xref_table['EVT_GRID_EDITOR_CREATED'], 'wxRuby specific alias for Wx::EVT_GRID_EDITOR_CREATED')
580
+ gen_constant_doc(fdoc, 'EVT_GRID_CMD_RANGE_SELECTING', xref_table['EVT_GRID_RANGE_SELECTING'], 'wxRuby specific alias for Wx::wxEVT_GRID_RANGE_SELECTING')
581
+ gen_constant_doc(fdoc, 'EVT_GRID_CMD_RANGE_SELECTED', xref_table['EVT_GRID_RANGE_SELECTED'], 'wxRuby specific alias for Wx::wxEVT_GRID_RANGE_SELECTED')
582
+ end
583
+
584
+ end
585
+
562
586
  end # module WXRuby3
@@ -12,6 +12,8 @@ module WXRuby3
12
12
 
13
13
  class HtmlPrintout < Director
14
14
 
15
+ include Typemap::PrintPageRange
16
+
15
17
  def setup
16
18
  super
17
19
  spec.override_inheritance_chain('wxHtmlPrintout', {'wxPrintout' => 'wxPrinter'}, 'wxObject')
@@ -148,7 +148,7 @@ module WXRuby3
148
148
 
149
149
  wxListCtrl* wx_lc = (wxListCtrl*) ptr;
150
150
 
151
- // First check if there's ImageLists and mark if found
151
+ // First check if there are ImageLists and mark if found
152
152
  wxImageList* img_list;
153
153
  img_list= wx_lc->GetImageList(wxIMAGE_LIST_NORMAL);
154
154
  if ( img_list ) rb_gc_mark(SWIG_RubyInstanceFor(img_list));
@@ -161,18 +161,22 @@ module WXRuby3
161
161
  if ( wx_lc->GetWindowStyle() & wxLC_VIRTUAL )
162
162
  return;
163
163
 
164
- int count = wx_lc->GetItemCount();
165
- if ( count == 0 ) return;
166
-
167
- for (int i = 0; i < count; ++i)
164
+ // only mark items if window fully created
165
+ if (wx_lc->GetId() != wxID_ANY)
168
166
  {
169
- wxUIntPtr data = wx_lc->GetItemData(i);
170
- VALUE object = reinterpret_cast<VALUE> (data);
171
- if ( object && object != Qnil )
167
+ int count = wx_lc->GetItemCount();
168
+ if ( count == 0 ) return;
169
+
170
+ for (int i = 0; i < count; ++i)
172
171
  {
173
- rb_gc_mark(object);
172
+ wxUIntPtr data = wx_lc->GetItemData(i);
173
+ VALUE object = reinterpret_cast<VALUE> (data);
174
+ if ( object && object != Qnil )
175
+ {
176
+ rb_gc_mark(object);
177
+ }
174
178
  }
175
- }
179
+ }
176
180
  }
177
181
  __HEREDOC
178
182
  spec.add_extend_code 'wxListCtrl', <<~__HEREDOC
@@ -29,6 +29,8 @@ module WXRuby3
29
29
  wxLanguageInfo::LayoutDirection
30
30
  ]
31
31
  spec.ignore_unless('WXMSW', 'wxLanguageInfo::WinLang', 'wxLanguageInfo::WinSublang')
32
+ # implemented in Ruby
33
+ spec.ignore 'wxLocale::GetSystemEncodingName'
32
34
  end
33
35
  end # class Locale
34
36
 
@@ -370,6 +370,13 @@ module WXRuby3
370
370
  spec.new_object 'WXIntegerValidator::Clone',
371
371
  'WXUnsignedValidator::Clone',
372
372
  'WXFloatValidator::Clone'
373
+ %w[WXIntegerValidator WXUnsignedValidator WXFloatValidator].each do |klass|
374
+ spec.no_proxy "#{klass}::ProcessEvent"
375
+ spec.no_proxy "#{klass}::QueueEvent"
376
+ spec.no_proxy "#{klass}::AddPendingEvent"
377
+ spec.no_proxy "#{klass}::SetNextHandler"
378
+ spec.no_proxy "#{klass}::SetPreviousHandler"
379
+ end
373
380
  spec.suppress_warning(473,
374
381
  'WXIntegerValidator::Clone',
375
382
  'WXUnsignedValidator::Clone',
@@ -12,6 +12,8 @@ module WXRuby3
12
12
 
13
13
  class PrintData < Director
14
14
 
15
+ include Typemap::PrintPageRange
16
+
15
17
  def setup
16
18
  super
17
19
  spec.gc_as_untracked
@@ -21,6 +23,11 @@ module WXRuby3
21
23
  # only keep the const version
22
24
  spec.ignore 'wxPageSetupDialogData::GetPrintData'
23
25
  spec.regard 'wxPageSetupDialogData::GetPrintData() const'
26
+ if Config.instance.wx_version >= '3.3.0'
27
+ # new since 3.3.0
28
+ spec.items << 'wxPrintPageRange'
29
+ spec.regard 'wxPrintPageRange::fromPage', 'wxPrintPageRange::toPage' # include public attributes
30
+ end
24
31
  # for GetPrintData methods
25
32
  spec.map 'wxPrintData&' => 'Wx::PrintData' do
26
33
  map_out code: '$result = SWIG_NewPointerObj(SWIG_as_voidptr(new wxPrintData(*$1)), SWIGTYPE_p_wxPrintData, SWIG_POINTER_OWN);'
@@ -12,6 +12,8 @@ module WXRuby3
12
12
 
13
13
  class Printer < Director
14
14
 
15
+ include Typemap::PrintPageRange
16
+
15
17
  def setup
16
18
  super
17
19
  spec.items << 'wxPrintout' << 'wxPrintPreview'
@@ -12,6 +12,8 @@ module WXRuby3
12
12
 
13
13
  class RichTextPrinting < Director
14
14
 
15
+ include Typemap::PrintPageRange
16
+
15
17
  def setup
16
18
  spec.items << 'wxRichTextPrintout'
17
19
  super
@@ -20,9 +20,26 @@ module WXRuby3
20
20
  # is missing from the XML docs
21
21
  spec.extend_interface('wxSplitterWindow', 'virtual void OnInternalIdle()')
22
22
  super
23
+ # fix naming mismatch with #evt_splitter_dclick
24
+ spec.add_swig_code '%constant int EVT_SPLITTER_DCLICK = wxEVT_SPLITTER_DOUBLECLICKED;'
23
25
  end
26
+
27
+ def doc_generator
28
+ SplitterWindowDocGenerator.new(self)
29
+ end
30
+
24
31
  end # class SplitterWindow
25
32
 
26
33
  end # class Director
27
34
 
35
+ class SplitterWindowDocGenerator < DocGenerator
36
+
37
+ protected def gen_constants_doc(fdoc)
38
+ super
39
+ xref_table = package.all_modules.reduce(DocGenerator.constants_db) { |db, mod| db[mod] }
40
+ gen_constant_doc(fdoc, 'EVT_SPLITTER_DCLICK', xref_table['EVT_SPLITTER_DOUBLECLICKED'], 'wxRuby specific alias for Wx::EVT_SPLITTER_DOUBLECLICKED')
41
+ end
42
+
43
+ end
44
+
28
45
  end # module WXRuby3
@@ -24,11 +24,28 @@ module WXRuby3
24
24
  spec.ignore 'wxTextCtrl::GTKGetTextBuffer',
25
25
  'wxTextCtrl::GTKGetEditable'
26
26
  end
27
- if Config.instance.wx_version >= '3.3.0' && Config.instance.wx_port == :wxmsw
27
+ if Config.instance.wx_version >= '3.3.0'
28
28
  spec.items << 'wxTextSearch' << 'wxTextSearchResult'
29
- spec.regard 'wxTextSearchResult::m_start', 'wxTextSearchResult::m_end'
30
- spec.make_readonly 'wxTextSearchResult::m_start', 'wxTextSearchResult::m_end'
31
- spec.rename_for_ruby 'start' => 'wxTextSearchResult::m_start',
29
+ spec.regard 'wxTextSearch::m_searchValue',
30
+ 'wxTextSearch::m_startingPosition',
31
+ 'wxTextSearch::m_matchCase',
32
+ 'wxTextSearch::m_wholeWord',
33
+ 'wxTextSearch::m_direction',
34
+ 'wxTextSearchResult::m_start',
35
+ 'wxTextSearchResult::m_end'
36
+ spec.make_readonly 'wxTextSearch::m_searchValue',
37
+ 'wxTextSearch::m_startingPosition',
38
+ 'wxTextSearch::m_matchCase',
39
+ 'wxTextSearch::m_wholeWord',
40
+ 'wxTextSearch::m_direction',
41
+ 'wxTextSearchResult::m_start',
42
+ 'wxTextSearchResult::m_end'
43
+ spec.rename_for_ruby 'get_search_value' => 'wxTextSearch::m_searchValue',
44
+ 'get_starting_position' => 'wxTextSearch::m_startingPosition',
45
+ 'match_case?' => 'wxTextSearch::m_matchCase',
46
+ 'whole_word?' => 'wxTextSearch::m_wholeWord',
47
+ 'get_direction' => 'wxTextSearch::m_direction',
48
+ 'start' => 'wxTextSearchResult::m_start',
32
49
  'end' => 'wxTextSearchResult::m_end'
33
50
  end
34
51
  if Config.instance.wx_port == :wxqt
@@ -0,0 +1,34 @@
1
+ # Copyright (c) 2023 M.J.N. Corino, The Netherlands
2
+ #
3
+ # This software is released under the MIT license.
4
+
5
+ ###
6
+ # wxRuby3 wxWidgets interface director
7
+ ###
8
+
9
+ require_relative './window'
10
+
11
+ module WXRuby3
12
+
13
+ class Director
14
+
15
+ class TipWindow < Window
16
+
17
+ def setup
18
+ super
19
+ spec.disable_proxies
20
+ spec.ignore 'wxTipWindow::SetTipWindowPtr'
21
+ spec.ignore 'wxTipWindow::wxTipWindow'
22
+ spec.add_extend_code 'wxTipWindow', <<~__HEREDOC
23
+ wxTipWindow(wxWindow* parent, const wxString& text, wxCoord maxLength = 100)
24
+ {
25
+ return new wxTipWindow(parent, text, maxLength);
26
+ }
27
+ __HEREDOC
28
+ end
29
+
30
+ end
31
+
32
+ end
33
+
34
+ end
@@ -66,7 +66,6 @@ module WXRuby3
66
66
  __CODE
67
67
  end
68
68
  spec.ignore [
69
- 'wxWindow::PopEventHandler',
70
69
  'wxWindow::SetConstraints',
71
70
  'wxWindow::GetHandle',
72
71
  'wxWindow::GetSize(int *,int *) const', # no need; prefer the wxSize version
@@ -83,6 +82,15 @@ module WXRuby3
83
82
  'wxWindow::Raise',
84
83
  'wxWindow::Lower'
85
84
  ]
85
+
86
+ # Event handler chaining methods; pushed handlers always remain owned by Ruby
87
+ # wxRuby3 will automatically pop any remaining handlers when windows get deleted
88
+ # also ignore this
89
+ spec.ignore 'wxWindow::PopEventHandler', ignore_doc: false
90
+ # and instead add an argument-less version (will use default argument of C++ impl)
91
+ # as we do want C++ side to delete any popped handler
92
+ spec.extend_interface 'wxWindow', 'wxEvtHandler *PopEventHandler()'
93
+
86
94
  # no real docs and can't find actual examples of usage; ignore
87
95
  spec.ignore 'wxWindow::GetConstraints', 'wxWindow::SetConstraints'
88
96
  # redefine these so a nil parent is accepted
@@ -6,7 +6,6 @@
6
6
  # wxRuby3 interface Director class
7
7
  ###
8
8
 
9
- require 'ostruct'
10
9
  require 'set'
11
10
  require 'pathname'
12
11
  require 'tempfile'
@@ -6,23 +6,42 @@
6
6
  - :pattern: !ruby/regexp /.*/
7
7
  :replace: ''
8
8
  :post:
9
- - :pattern: !ruby/regexp /This\s+implies\s+that\s+the\s+event\s+should\s+be\s+allocated\s+on\s+the\s+heap\s+and/
10
- :subst: 'This implies'
11
- - :pattern: !ruby/regexp /\{Wx::EvtHandler#queue_event\}.*For\s+example:/
9
+ - :pattern: !ruby/regexp /\,\s+i\.e\.\s+it\s+will\s+delete\s+it\s+itself/
12
10
  :subst: ''
13
- - :pattern: !ruby/regexp /Note.*problem:/
11
+ - :pattern: !ruby/regexp /This\s+implies\s+that\s+the\s+event\s+should\s+be\s+allocated.*deleted\s+at\s+any\s+moment\)/
12
+ :subst: "This implies that the event (or any of it's member objects) should not be used/changed after the function returns (as it can be handled and subsequently discarded at any moment)"
13
+ - :pattern: !ruby/regexp /\{Wx::EvtHandler#queue_event\}.*not\s+used\s+by\s+the\s+calling\s+thread\s+any\s+more\./
14
+ :subst: ''
15
+ - :pattern: !ruby/regexp /Care\s+should\s+still\s+be\s+taken\s+to\s+avoid\s+that\s+some\s+fields.*/
16
+ :subst: ''
17
+ - :pattern: !ruby/regexp /Example:/
18
+ :subst: ''
19
+ - :pattern: !ruby/regexp /Note\s+that\s+if\s+you\s+want\s+to\s+pass\s+more\s+data.*/
20
+ :subst: ''
21
+ - :pattern: !ruby/regexp /Reimplemented\s+in.*/
22
+ :subst: ''
23
+ :wxEvtHandler.AddPendingEvent:
24
+ :detail:
25
+ :post:
26
+ - :pattern: !ruby/regexp /This\s+function\s+is\s+similar\s+to\s+\{Wx::EvtHandler#queue_event\}.*/
27
+ :subst: 'This function is similar to {Wx::EvtHandler#queue_event}.'
28
+ - :pattern: !ruby/regexp /A\s+copy\s+of\s+event\s+is\s+made\s+by\s+the\s+function,.*/
29
+ :subst: 'Other than {Wx::EvtHandler#queue_event} this method creates a (shallow) copy of event before queueing the copied event. In case (user defined) event classes require deep copying of Ruby member object these classes should override the #initialize_clone method (**NOT** #clone as wxRuby3 does not currently support overriding event class #clone methods).'
30
+ - :pattern: !ruby/regexp /Reimplemented\s+in.*/
14
31
  :subst: ''
15
32
  :wxEvtHandler.SetNextHandler:
33
+ :brief:
34
+ :post:
35
+ - :pattern: !ruby/regexp /Sets\s+the\s+pointer\s+to\s+the\s+next\s+handler\./
36
+ :subst: 'Inserts the given handler as the next handler in the chain.'
16
37
  :detail:
17
38
  :pre:
18
- :programlisting:
19
- - :pattern: !ruby/regexp /.*/
20
- :replace: |
21
-
22
- ```ruby
23
- handlerA.set_next_handler(handlerB)
24
- handlerB.set_previous_handler(handlerA)
25
- ```
39
+ :para:
40
+ - :pattern: !ruby/regexp /See.*ProcessEvent\(\)/
41
+ :replace: |
42
+ In wxRuby this fully handles double linking, i.e. wxRuby will take care of pointing the handler given
43
+ back to this handler as well. There is no need to call set_previous_handler so this method is not supported
44
+ in wxRuby3.
26
45
  :wxEvtHandler.TryBefore:
27
46
  :detail:
28
47
  :pre:
@@ -8,6 +8,14 @@
8
8
 
9
9
  module WXRuby3
10
10
 
11
+ Director::Package.ignored_event_handlers.merge(%w[
12
+ EVT_SCROLL
13
+ EVT_COMMAND_SCROLL
14
+ EVT_SCROLLWIN
15
+ EVT_MOUSE_EVENTS
16
+ EVT_JOYSTICK_EVENTS
17
+ ])
18
+
11
19
  Director.Package('Wx') { |pkg|
12
20
  Director.Spec(pkg, 'wxDefs')
13
21
  Director.Spec(pkg, 'wxFunctions')
@@ -201,6 +209,7 @@ module WXRuby3
201
209
  Director.Spec(pkg, 'wxDragDrop', requirements: %w[USE_DRAG_AND_DROP])
202
210
  Director.Spec(pkg, 'wxContextHelpButton', requirements: %w[USE_HELP])
203
211
  Director.Spec(pkg, 'wxHelpProvider', requirements: %w[USE_HELP])
212
+ Director.Spec(pkg, 'wxTipWindow', requirements: %w[USE_HELP])
204
213
  Director.Spec(pkg, 'wxHelpController', requirements: %w[USE_HELP])
205
214
  Director.Spec(pkg, 'wxExtHelpController', director: Director::HelpController, requirements: %w[USE_HELP])
206
215
  Director.Spec(pkg, 'wxTaskBarIconEvent', director: Director::Event, requirements: %w[USE_TASKBARICON])