wxruby3 1.8.1 → 2.0.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 (113) hide show
  1. checksums.yaml +4 -4
  2. data/INSTALL.md +20 -10
  3. data/README.md +3 -3
  4. data/ext/wxruby3/include/wxRubyApp.h +49 -3
  5. data/ext/wxruby3/include/wxruby-ComboPopup.h +17 -32
  6. data/ext/wxruby3/include/wxruby-Config.h +34 -11
  7. data/ext/wxruby3/include/wxruby-GCTracking.h +23 -5
  8. data/ext/wxruby3/include/wxruby-SharedEventHandler.h +7 -7
  9. data/ext/wxruby3/include/wxruby-runtime.h +65 -0
  10. data/ext/wxruby3/swig/common.i +6 -0
  11. data/ext/wxruby3/swig/custom/typed_data/rubyhead.swg +220 -0
  12. data/ext/wxruby3/swig/custom/typed_data/rubyprimtypes.swg +265 -0
  13. data/ext/wxruby3/swig/custom/typed_data/rubyrun.swg +243 -0
  14. data/ext/wxruby3/swig/custom/typed_data/swigrun.swg +689 -0
  15. data/ext/wxruby3/swig/custom/{rubyprimtypes.swg → untyped_data/rubyprimtypes.swg} +8 -0
  16. data/ext/wxruby3/swig/mark_free_impl.i +2 -2
  17. data/ext/wxruby3/swig/memory_management.i +1 -0
  18. data/ext/wxruby3/swig/wx.i +19 -6
  19. data/lib/wx/core/file_dialog.rb +3 -10
  20. data/lib/wx/doc/rbn/events.rb +32 -0
  21. data/lib/wx/doc/rbn/ribbon_backstage_mrulist.rb +25 -0
  22. data/lib/wx/keyword_ctors.rb +3 -13
  23. data/lib/wx/rbn/events.rb +18 -0
  24. data/lib/wx/rbn/require.rb +1 -0
  25. data/lib/wx/rbn/ribbon_backstage_mrulist.rb +39 -0
  26. data/lib/wx/version.rb +1 -1
  27. data/rakelib/lib/config.rb +3 -3
  28. data/rakelib/lib/core/include/typed_data/swigrubyrun.inc +629 -0
  29. data/rakelib/lib/core/include/typed_data/swigrun.inc +870 -0
  30. data/rakelib/lib/core/package.rb +2 -2
  31. data/rakelib/lib/director/app.rb +16 -0
  32. data/rakelib/lib/director/art_provider.rb +3 -3
  33. data/rakelib/lib/director/aui_mdi_child_frame.rb +24 -0
  34. data/rakelib/lib/director/aui_mdi_parent_frame.rb +0 -2
  35. data/rakelib/lib/director/aui_tab_ctrl.rb +3 -3
  36. data/rakelib/lib/director/comboctrl.rb +35 -2
  37. data/rakelib/lib/director/config_base.rb +79 -33
  38. data/rakelib/lib/director/data_object.rb +1 -1
  39. data/rakelib/lib/director/date_event.rb +10 -3
  40. data/rakelib/lib/director/event.rb +16 -7
  41. data/rakelib/lib/director/event_handler.rb +48 -10
  42. data/rakelib/lib/director/events.rb +4 -2
  43. data/rakelib/lib/director/file_history.rb +46 -0
  44. data/rakelib/lib/director/frame.rb +29 -0
  45. data/rakelib/lib/director/fs_file.rb +2 -4
  46. data/rakelib/lib/director/functions.rb +2 -2
  47. data/rakelib/lib/director/graphics_context.rb +6 -6
  48. data/rakelib/lib/director/grid_cell_editor.rb +1 -1
  49. data/rakelib/lib/director/grid_cell_renderer.rb +1 -1
  50. data/rakelib/lib/director/grid_ctrl.rb +39 -12
  51. data/rakelib/lib/director/help_controller.rb +17 -0
  52. data/rakelib/lib/director/html_help_data.rb +20 -2
  53. data/rakelib/lib/director/icon.rb +3 -0
  54. data/rakelib/lib/director/log.rb +25 -1
  55. data/rakelib/lib/director/menu.rb +38 -106
  56. data/rakelib/lib/director/menu_bar.rb +36 -70
  57. data/rakelib/lib/director/num_validator.rb +3 -3
  58. data/rakelib/lib/director/numeric_property_validator.rb +1 -1
  59. data/rakelib/lib/director/page_setup_dialog.rb +18 -1
  60. data/rakelib/lib/director/pgeditor.rb +1 -1
  61. data/rakelib/lib/director/pgvalidation_info.rb +1 -0
  62. data/rakelib/lib/director/popup_window.rb +7 -0
  63. data/rakelib/lib/director/preview_frame.rb +8 -1
  64. data/rakelib/lib/director/print_dialog.rb +17 -0
  65. data/rakelib/lib/director/printer.rb +1 -1
  66. data/rakelib/lib/director/property_grid_page.rb +2 -0
  67. data/rakelib/lib/director/region_iterator.rb +1 -1
  68. data/rakelib/lib/director/ribbon_backstage.rb +28 -0
  69. data/rakelib/lib/director/ribbon_backstage_button.rb +25 -0
  70. data/rakelib/lib/director/ribbon_backstage_callout.rb +26 -0
  71. data/rakelib/lib/director/ribbon_backstage_heading.rb +26 -0
  72. data/rakelib/lib/director/ribbon_backstage_itemlist.rb +27 -0
  73. data/rakelib/lib/director/ribbon_backstage_mrulist.rb +112 -0
  74. data/rakelib/lib/director/ribbon_bar.rb +14 -0
  75. data/rakelib/lib/director/ribbon_gallery.rb +6 -2
  76. data/rakelib/lib/director/ribbon_tool_bar.rb +6 -4
  77. data/rakelib/lib/director/richtext_composite_object.rb +4 -4
  78. data/rakelib/lib/director/richtext_paragraph_layout_box.rb +1 -1
  79. data/rakelib/lib/director/scrolled_t.rb +1 -1
  80. data/rakelib/lib/director/sizer.rb +7 -0
  81. data/rakelib/lib/director/sizer_item.rb +4 -1
  82. data/rakelib/lib/director/splitter_event.rb +2 -2
  83. data/rakelib/lib/director/task_bar_icon.rb +4 -1
  84. data/rakelib/lib/director/text_validator.rb +1 -1
  85. data/rakelib/lib/director/tree_event.rb +3 -3
  86. data/rakelib/lib/director/validator.rb +1 -1
  87. data/rakelib/lib/director/variant.rb +2 -2
  88. data/rakelib/lib/director/window.rb +27 -5
  89. data/rakelib/lib/director/window_disabler.rb +1 -1
  90. data/rakelib/lib/director/xml_resource.rb +33 -8
  91. data/rakelib/lib/extractor/class.rb +2 -1
  92. data/rakelib/lib/extractor.rb +3 -2
  93. data/rakelib/lib/generate/interface.rb +2 -3
  94. data/rakelib/lib/specs/interfaces.rb +7 -0
  95. data/rakelib/lib/swig_runner.rb +14 -3
  96. data/rakelib/lib/typemap/common.rb +2 -36
  97. data/rakelib/lib/typemap/config.rb +22 -0
  98. data/samples/ribbon/ribbon.rb +277 -20
  99. data/tests/test_shared_event_handler.rb +3 -3
  100. metadata +32 -16
  101. /data/ext/wxruby3/swig/custom/{director.swg → common/director.swg} +0 -0
  102. /data/ext/wxruby3/swig/custom/{rubyapi.swg → common/rubyapi.swg} +0 -0
  103. /data/ext/wxruby3/swig/custom/{rubyerrors.swg → common/rubyerrors.swg} +0 -0
  104. /data/ext/wxruby3/swig/custom/{rubytracking.swg → common/rubytracking.swg} +0 -0
  105. /data/ext/wxruby3/swig/custom/{swiglabels.swg → common/swiglabels.swg} +0 -0
  106. /data/ext/wxruby3/swig/custom/{typemaps → common/typemaps}/swigtypemaps.swg +0 -0
  107. /data/ext/wxruby3/swig/custom/{wx_ruby_shared_ptr.i → common/wx_ruby_shared_ptr.i} +0 -0
  108. /data/ext/wxruby3/swig/custom/{wx_shared_ptr.i → common/wx_shared_ptr.i} +0 -0
  109. /data/ext/wxruby3/swig/custom/{rubyhead.swg → untyped_data/rubyhead.swg} +0 -0
  110. /data/ext/wxruby3/swig/custom/{rubyrun.swg → untyped_data/rubyrun.swg} +0 -0
  111. /data/ext/wxruby3/swig/custom/{swigrun.swg → untyped_data/swigrun.swg} +0 -0
  112. /data/rakelib/lib/core/include/{swigrubyrun.inc → untyped_data/swigrubyrun.inc} +0 -0
  113. /data/rakelib/lib/core/include/{swigrun.inc → untyped_data/swigrun.inc} +0 -0
@@ -16,119 +16,85 @@ module WXRuby3
16
16
 
17
17
  def setup
18
18
  super
19
- spec.gc_as_marked # not a typical window
19
+ spec.gc_as_object # not a typical window
20
+ spec.add_swig_code '%markfunc wxMenuBar "GC_mark_wxMenuBar";'
20
21
  spec.no_proxy('wxMenuBar::FindItem',
21
22
  'wxMenuBar::Remove',
22
23
  'wxMenuBar::Replace')
23
24
  spec.ignore('wxMenuBar::wxMenuBar(size_t,wxMenu *[],const wxString[],long)',
24
- 'wxMenuBar::GetLabelTop',
25
- 'wxMenuBar::SetLabelTop',
26
25
  'wxMenuBar::Refresh')
27
- spec.disown 'wxMenu *'
26
+ if Config.instance.wx_version_check('3.3.4') < 0
27
+ spec.ignore('wxMenuBar::GetLabelTop',
28
+ 'wxMenuBar::SetLabelTop')
29
+ end
30
+ # menu handling
31
+ spec.ignore %w[wxMenuBar::Append wxMenuBar::Insert wxMenuBar::Replace], ignore_doc: false
32
+ spec.extend_interface 'wxMenuBar',
33
+ 'virtual bool Append(wxMenu *new_menu, const wxString &title)',
34
+ 'virtual bool Insert(size_t pos, wxMenu *new_menu, const wxString &title)',
35
+ 'virtual wxMenu * Replace(size_t pos, wxMenu *new_menu, const wxString &title)'
36
+ spec.disown 'wxMenu *new_menu'
28
37
  spec.new_object 'wxMenuBar::Remove', 'wxMenuBar::Replace'
29
38
  # for FindItem
30
39
  spec.map 'wxMenu **' => 'Wx::Menu' do
31
- add_header_code 'WXRUBY_EXPORT VALUE wxRuby_WrapWxMenuInRuby(wxMenu* wx_menu);'
32
40
  map_in ignore: true, temp: 'wxMenu *tmp', code: '$1 = &tmp;'
33
41
  map_argout code: <<~__CODE
34
- $result = SWIG_Ruby_AppendOutput($result, wxRuby_WrapWxMenuInRuby(tmp$argnum));
42
+ VALUE rb_menu = SWIG_NewPointerObj(SWIG_as_voidptr(tmp$argnum),
43
+ SWIGTYPE_p_wxMenu, 0);
44
+ $result = SWIG_Ruby_AppendOutput($result, rb_menu);
35
45
  __CODE
36
46
  end
37
47
  spec.add_header_code <<~__HEREDOC
38
- static void GC_mark_wxMenuBar(const TGCTrackingValueMap& values);
48
+ static void GC_mark_wxMenuBar(void *);
39
49
 
40
50
  // Custom subclass implementation.
41
51
  // Provides support for monitored tracking and GC handling.
42
52
  class wxRubyMenuBar : public wxMenuBar
43
53
  {
44
54
  public:
45
- static const std::string TRACKING_CAT;
46
-
47
55
  wxRubyMenuBar(long style=0) : wxMenuBar(style) {}
48
56
  virtual ~wxRubyMenuBar()
49
57
  {
50
58
  wxRuby_ReleaseEvtHandlerProcs(this);
51
- wxruby_unregister();
52
- }
53
-
54
- void wxruby_register(VALUE rb_menubar)
55
- {
56
- if (!is_registered_)
59
+ VALUE rb_menubar = SWIG_RubyInstanceFor(this);
60
+ if (!RB_NIL_P(rb_menubar))
57
61
  {
58
- wxRuby_RegisterTrackingCategory(TRACKING_CAT, GC_mark_wxMenuBar, true);
59
- is_registered_ = true;
62
+ // delete from C++ code as the Ruby GC free func removes tracking before delete
63
+
64
+ // make sure to unlink and remove any tracked Ruby wrapper
65
+ SWIG_RubyUnlinkObjects(this);
66
+ SWIG_RubyRemoveTracking(this);
60
67
  }
61
- if (RB_NIL_P(wxRuby_FindCategoryValue(TRACKING_CAT, this)))
62
- wxRuby_RegisterCategoryValue(TRACKING_CAT, this, rb_menubar);
63
- }
64
- private:
65
- static bool is_registered_;
66
- void wxruby_unregister()
67
- {
68
- wxRuby_UnregisterCategoryValue(TRACKING_CAT, this);
69
68
  }
70
69
  };
71
70
 
72
- const std::string wxRubyMenuBar::TRACKING_CAT = { "WXRUBY_MENU_BAR" };
73
- bool wxRubyMenuBar::is_registered_ {};
74
-
75
71
  WXRUBY_TRACE_GUARD(WxRubyTraceMarkMenubar, "GC_MARK_MENUBAR")
76
72
 
77
- // Mark Function for unattached menu bars
78
- // Need to protect Menu and MenuItems which are included in the MenuBar
79
- static void GC_mark_wxMenuBar(const TGCTrackingValueMap& values)
73
+ // Mark Function for attached menu bars
74
+ static void GC_mark_wxMenuBar(void *ptr)
80
75
  {
81
76
  WXRUBY_TRACE_IF(WxRubyTraceMarkMenubar, 2)
82
77
  WXRUBY_TRACE("> GC_mark_wxMenuBar")
83
78
  WXRUBY_TRACE_END
84
79
 
85
- for (const auto& ti : values)
86
- {
87
- rb_gc_mark(ti.second);
80
+ if (GC_IsWindowDeleted(ptr)) return;
88
81
 
89
- // Menu bars are also a subclass of wxWindow, so must do all the marking
90
- // of sizers and carets associated with that class
91
- GC_mark_wxWindow(ti.first);
82
+ // Menu bars are also a subclass of wxWindow, so must do all the marking
83
+ // of sizers and carets associated with that class
84
+ GC_mark_wxWindow(ptr);
92
85
 
93
- // no need to mark anything else as menus are tracked themselves separately
86
+ // always mark the menus managed by the menubar
87
+ wxMenuBar* wx_menu_bar = reinterpret_cast<wxMenuBar*> (ptr);
88
+ for (size_t ix=0; ix < wx_menu_bar->GetMenuCount(); ++ix)
89
+ {
90
+ wxMenu* wx_menu = wx_menu_bar->GetMenu(ix);
91
+ rb_gc_mark(SWIG_RubyInstanceFor(wx_menu));
94
92
  }
95
93
 
96
94
  WXRUBY_TRACE_IF(WxRubyTraceMarkMenubar, 2)
97
95
  WXRUBY_TRACE("< GC_mark_wxMenuBar")
98
96
  WXRUBY_TRACE_END
99
97
  }
100
-
101
- WXRUBY_EXPORT VALUE wxRuby_WrapWxMenuBarInRuby(wxMenuBar* wx_menubar)
102
- {
103
- VALUE rb_menubar = Qnil;
104
- if (wx_menubar)
105
- {
106
- rb_menubar = wxRuby_FindCategoryValue(wxRubyMenuBar::TRACKING_CAT, wx_menubar); // check for already registered instance
107
- if (NIL_P(rb_menubar))
108
- {
109
- // newly created
110
- wxRubyMenuBar* wxrb_mb = dynamic_cast<wxRubyMenuBar*> (wx_menubar);
111
- if (wxrb_mb)
112
- {
113
- // convert and own
114
- rb_menubar = SWIG_NewPointerObj(SWIG_as_voidptr(wxrb_mb), SWIGTYPE_p_wxMenuBar, SWIG_POINTER_OWN);
115
- wxrb_mb->wxruby_register(rb_menubar);
116
- }
117
- else
118
- {
119
- // created internally by wxWidgets; no tracking and no ownership
120
- rb_menubar = SWIG_NewPointerObj(SWIG_as_voidptr(wx_menubar), SWIGTYPE_p_wxMenuBar, 0);
121
- }
122
- }
123
- }
124
- return rb_menubar;
125
- }
126
-
127
- WXRUBY_EXPORT void wxRuby_RegisterWxMenuBar(wxMenuBar* wx_menubar, VALUE rb_menubar)
128
- {
129
- wxRubyMenuBar* wxrb_mb = dynamic_cast<wxRubyMenuBar*> (wx_menubar);
130
- if (wxrb_mb) wxrb_mb->wxruby_register(rb_menubar);
131
- }
132
98
  __HEREDOC
133
99
  # make Ruby director and wrappers use custom implementation
134
100
  spec.use_class_implementation('wxMenuBar', 'wxRubyMenuBar')
@@ -78,7 +78,7 @@ module WXRuby3
78
78
  this->wxIntegerValidator::SetWindow(win);
79
79
  VALUE self = get_self();
80
80
  // make sure Ruby does not own this validator instance anymore
81
- RDATA(self)->dfree = SWIG_RubyRemoveTracking;
81
+ WXRUBY_WRAPPER_DATA_DFREE_SET(self, SWIG_RubyRemoveTracking);
82
82
  }
83
83
 
84
84
  virtual bool TransferFromWindow () override
@@ -196,7 +196,7 @@ module WXRuby3
196
196
  this->wxIntegerValidator::SetWindow(win);
197
197
  VALUE self = get_self();
198
198
  // make sure Ruby does not own this validator instance anymore
199
- RDATA(self)->dfree = SWIG_RubyRemoveTracking;
199
+ WXRUBY_WRAPPER_DATA_DFREE_SET(self, SWIG_RubyRemoveTracking);
200
200
  }
201
201
 
202
202
  virtual bool TransferFromWindow () override
@@ -312,7 +312,7 @@ module WXRuby3
312
312
  this->wxFloatingPointValidator::SetWindow(win);
313
313
  VALUE self = get_self();
314
314
  // make sure Ruby does not own this validator instance anymore
315
- RDATA(self)->dfree = SWIG_RubyRemoveTracking;
315
+ WXRUBY_WRAPPER_DATA_DFREE_SET(self, SWIG_RubyRemoveTracking);
316
316
  }
317
317
 
318
318
  virtual bool TransferFromWindow () override
@@ -58,7 +58,7 @@ module WXRuby3
58
58
  this->wxNumericPropertyValidator::SetWindow(win);
59
59
  VALUE self = get_self();
60
60
  // make sure Ruby does not own this validator instance anymore
61
- RDATA(self)->dfree = SWIG_RubyRemoveTracking;
61
+ WXRUBY_WRAPPER_DATA_DFREE_SET(self, SWIG_RubyRemoveTracking);
62
62
  }
63
63
 
64
64
  virtual bool TransferFromWindow () override
@@ -12,11 +12,28 @@ module WXRuby3
12
12
 
13
13
  class Director
14
14
 
15
- class PageSetupDialog < Director::Dialog
15
+ class PageSetupDialog < Director
16
16
 
17
17
  def setup
18
18
  super
19
19
  # make PageSetupDialog GC-safe
20
+ spec.add_header_code <<~__HEREDOC
21
+ static void wxRuby_delete_wxPageSetupDialog(void *self)
22
+ {
23
+ wxPageSetupDialog *arg1 = (wxPageSetupDialog *)self;
24
+ SWIG_RubyRemoveTracking(arg1);
25
+ delete arg1;
26
+ }
27
+
28
+ static void GC_free_wxPageSetupDialog(void* object)
29
+ {
30
+ wxRuby_RegisterDeferredObjectDestroy(object, wxRuby_delete_wxPageSetupDialog);
31
+ }
32
+ __HEREDOC
33
+ # wxPageSetupDialog is not actually a dialog, just a platform independent wrapper derived from wxObject,
34
+ # so it is not caught by the generic wxWindow post-processor but still needs a deferred destroy as
35
+ # destroying it will also destroy the wrapped actual dialog.
36
+ spec.add_swig_code '%feature("freefunc") wxPageSetupDialog "GC_free_wxPageSetupDialog";'
20
37
  spec.ignore 'wxPageSetupDialog::GetPageSetupData'
21
38
  spec.add_extend_code 'wxPageSetupDialog', <<~__HEREDOC
22
39
  wxPageSetupDialogData* GetPageSetupData()
@@ -78,7 +78,7 @@ module WXRuby3
78
78
 
79
79
  # Thin and trusting wrapping to bypass SWIG's normal mechanisms; we
80
80
  # don't want SWIG changing ownership or typechecking these.
81
- map_in code: '$1 = (wxEvent*)DATA_PTR($input);'
81
+ map_in code: '$1 = (wxEvent*)WXRUBY_WRAPPER_DATA_PTR($input);'
82
82
  end
83
83
  # add method for correctly wrapping PGEditor output references
84
84
  spec.add_header_code <<~__CODE
@@ -24,6 +24,7 @@ module WXRuby3
24
24
  end
25
25
  else # from 3.3.0 this is an enum but docs are still missing
26
26
  end
27
+ spec.do_not_generate :typedefs
27
28
  end
28
29
  end # class PGValidationInfo
29
30
 
@@ -37,6 +37,13 @@ module WXRuby3
37
37
  'virtual bool Show(bool show = true) override')
38
38
  spec.extend_interface('wxPopupTransientWindow',
39
39
  'virtual bool Destroy() override')
40
+ # OSX defines this override on the wxNonOwnedWindow class but since we declared that 'no_proxy'
41
+ # we have to the override on it's descendants wxPopupWindow and wxTopLevelWindow (the last one
42
+ # having the override itself also on all platforms)
43
+ if Config.instance.features_set?('WXOSX')
44
+ spec.extend_interface('wxNonOwnedWindow',
45
+ 'virtual bool Destroy() override')
46
+ end
40
47
  # For ProcessLeftDown
41
48
  spec.map 'wxMouseEvent &' => 'Wx::MouseEvent' do
42
49
  map_directorin code: <<~__CODE
@@ -79,7 +79,6 @@ module WXRuby3
79
79
  }
80
80
  __HEREDOC
81
81
  spec.use_class_implementation 'wxPreviewFrame', 'WxRubyPreviewFrame'
82
- spec.add_swig_code '%markfunc wxPreviewFrame "GC_mark_wxPreviewFrame";'
83
82
  spec.rename_for_ruby('init' => 'wxPreviewFrame::Initialize')
84
83
  # We do not wrap the (undocumented) wxPrintPreviewBase so map this to wxPrintPreview what
85
84
  # in all cases will be the actual base being used.
@@ -99,6 +98,14 @@ module WXRuby3
99
98
  spec.ignore 'wxPreviewFrame::OnCloseWindow' # not useful for public use
100
99
  spec.do_not_generate(:variables, :defines, :enums, :functions) # with PrintAbortDialog
101
100
  end
101
+
102
+
103
+ def process(gendoc: false)
104
+ defmod = super
105
+ # make sure to overrule the mark func set by the Frame director's #process
106
+ spec.add_swig_code '%markfunc wxPreviewFrame "GC_mark_wxPreviewFrame";'
107
+ defmod
108
+ end
102
109
  end # class PreviewFrame
103
110
 
104
111
  end # class Director
@@ -17,6 +17,23 @@ module WXRuby3
17
17
  spec.no_proxy 'wxPrintDialog::GetPrintDC' # do not think this is really useful
18
18
  spec.new_object 'wxPrintDialog::GetPrintDC'
19
19
  # make PrintDialog GC-safe
20
+ spec.add_header_code <<~__HEREDOC
21
+ static void wxRuby_delete_wxPrintDialog(void *self)
22
+ {
23
+ wxPrintDialog *arg1 = (wxPrintDialog *)self;
24
+ SWIG_RubyRemoveTracking(arg1);
25
+ delete arg1;
26
+ }
27
+
28
+ static void GC_free_wxPrintDialog(void* object)
29
+ {
30
+ wxRuby_RegisterDeferredObjectDestroy(object, wxRuby_delete_wxPrintDialog);
31
+ }
32
+ __HEREDOC
33
+ # wxPrintDialog is not actually a dialog, just a platform independent wrapper derived from wxObject,
34
+ # so it is not caught by the generic wxWindow post-processor but still needs a deferred destroy as
35
+ # destroying it will also destroy the wrapped actual dialog.
36
+ spec.add_swig_code '%feature("freefunc") wxPrintDialog "GC_free_wxPrintDialog";'
20
37
  spec.ignore 'wxPrintDialog::GetPrintData',
21
38
  'wxPrintDialog::GetPrintDialogData'
22
39
  spec.add_extend_code 'wxPrintDialog', <<~__HEREDOC
@@ -81,7 +81,7 @@ module WXRuby3
81
81
 
82
82
  VALUE rb_pp = SWIG_RubyInstanceFor(ptr);
83
83
  // if this is still an instance 'owned' by Ruby
84
- if (!RB_NIL_P(rb_pp) && RDATA(rb_pp)->dfree==free_wxPrintPreview)
84
+ if (!RB_NIL_P(rb_pp) && WXRUBY_WRAPPER_DATA_DFREE(rb_pp)==free_wxPrintPreview)
85
85
  {
86
86
  WxRuby_mark_wxPrintPreview(ptr);
87
87
  }
@@ -81,6 +81,8 @@ module WXRuby3
81
81
  WXRUBY_TRACE("> WXRuby_GC_mark_wxPropertyGridPage : " << wx_pgp)
82
82
  WXRUBY_TRACE_END
83
83
 
84
+ if (!wx_pgp) return;
85
+
84
86
  #ifdef __WXRB_DEBUG__
85
87
  long l = 0, n = 0;
86
88
  #endif
@@ -38,7 +38,7 @@ module WXRuby3
38
38
  VALUE rb_region_it = SWIG_NewPointerObj(SWIG_as_voidptr(p_region_it), SWIGTYPE_p_wxRegionIterator, 0);
39
39
  rb_yield(rb_region_it);
40
40
  SWIG_RubyRemoveTracking((void *)p_region_it);
41
- DATA_PTR(rb_region_it) = NULL;
41
+ WXRUBY_WRAPPER_DATA_PTR_RESET(rb_region_it);
42
42
  }
43
43
  }
44
44
  __HEREDOC
@@ -0,0 +1,28 @@
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 Backstage < Window
16
+
17
+ def setup
18
+ super
19
+ spec.no_proxy('wxBackstage', 'wxBackstagePage')
20
+ spec.items << 'wxBackstagePage'
21
+ spec.gc_as_window 'wxBackstagePage'
22
+ spec.override_inheritance_chain('wxBackstagePage', %w[wxScrolledWindow wxPanel wxWindow wxEvtHandler wxObject])
23
+ end
24
+ end # class Backstage
25
+
26
+ end # class Director
27
+
28
+ end # module WXRuby3
@@ -0,0 +1,25 @@
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 BackstageButton < Window
16
+
17
+ def setup
18
+ super
19
+ spec.no_proxy('wxBackstageButton')
20
+ end
21
+ end # class BackstageButton
22
+
23
+ end # class Director
24
+
25
+ end # module WXRuby3
@@ -0,0 +1,26 @@
1
+ # Copyright (c) 2023 M.J.N. Corino, The Netherlands
2
+ #
3
+ # This software is released under the MIT license.
4
+
5
+ ###
6
+ # wxRuby3 wxWidgets interface director
7
+ ###
8
+
9
+ require_relative './window'
10
+
11
+ module WXRuby3
12
+
13
+ class Director
14
+
15
+ class BackstageCallout < Window
16
+
17
+ def setup
18
+ super
19
+ spec.no_proxy('wxBackstageCallout')
20
+ spec.do_not_generate :variables, :enums, :defines, :functions, :typedefs
21
+ end
22
+ end # class BackstageCallout
23
+
24
+ end # class Director
25
+
26
+ end # module WXRuby3
@@ -0,0 +1,26 @@
1
+ # Copyright (c) 2023 M.J.N. Corino, The Netherlands
2
+ #
3
+ # This software is released under the MIT license.
4
+
5
+ ###
6
+ # wxRuby3 wxWidgets interface director
7
+ ###
8
+
9
+ require_relative './window'
10
+
11
+ module WXRuby3
12
+
13
+ class Director
14
+
15
+ class BackstageHeading < Window
16
+
17
+ def setup
18
+ super
19
+ spec.no_proxy('wxBackstageHeading')
20
+ spec.do_not_generate :variables, :enums, :defines, :functions, :typedefs
21
+ end
22
+ end # class BackstageHeading
23
+
24
+ end # class Director
25
+
26
+ end # module WXRuby3
@@ -0,0 +1,27 @@
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 BackstageItemList < Window
16
+
17
+ def setup
18
+ super
19
+ spec.gc_as_window 'wxBackstageItemList'
20
+ spec.override_inheritance_chain('wxBackstageItemList', %w[wxScrolledCanvas wxWindow wxEvtHandler wxObject])
21
+ spec.do_not_generate :variables, :enums, :defines, :functions, :typedefs
22
+ end
23
+ end # class BackstageItemList
24
+
25
+ end # class Director
26
+
27
+ end # module WXRuby3
@@ -0,0 +1,112 @@
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 BackstageMRUList < Window
16
+
17
+ include Typemap::DateTime
18
+
19
+ def setup
20
+ super
21
+ spec.gc_as_window 'wxBackstageMRUList'
22
+ spec.no_proxy('wxBackstageMRUList')
23
+ spec.override_inheritance_chain('wxBackstageMRUList', %w[wxBackstageItemList wxScrolledCanvas wxWindow wxEvtHandler wxObject])
24
+ spec.ignore 'wxBackstageMRUList::SetIconProvider'
25
+ spec.add_header_code <<~__HEREDOC
26
+ // define Ruby Icon Provider wrapper function object
27
+ class RbIconProvider
28
+ {
29
+ public:
30
+
31
+ RbIconProvider(VALUE rbip) : rbIconProvider_(rbip) {}
32
+
33
+ wxBitmapBundle operator() (const wxString& p)
34
+ {
35
+ static WxRuby_ID call_id("call");
36
+ static WxRuby_ID bitmap_bundle_id("BitmapBundle");
37
+ static WxRuby_ID bitmap_id("Bitmap");
38
+ static WxRuby_ID icon_id("Icon");
39
+ static WxRuby_ID image_id("Image");
40
+
41
+ bool ex_caught = false;
42
+ wxBitmapBundle tmpBundle;
43
+ if (!NIL_P(rbIconProvider_))
44
+ {
45
+ VALUE rc = wxRuby_Funcall(ex_caught, rbIconProvider_, call_id(), 1, WXSTR_TO_RSTR(p));
46
+ if (ex_caught)
47
+ {
48
+ #ifdef __WXRB_DEBUG__
49
+ if (!rb_obj_is_kind_of(rc, rb_eSystemExit))
50
+ {
51
+ wxRuby_PrintException(rc);
52
+ }
53
+ #endif
54
+ wxRuby_ExitMainLoop(rc);
55
+ }
56
+ if (!NIL_P(rc))
57
+ {
58
+ bool ok = false;
59
+ if (TYPE(rc) == T_DATA)
60
+ {
61
+ void *ptr = WXRUBY_WRAPPER_DATA_GET(rc, void);
62
+ if (ptr)
63
+ {
64
+ ok = true;
65
+ if (isClass(rc, bitmap_bundle_id()))
66
+ tmpBundle = *static_cast<wxBitmapBundle*> (ptr);
67
+ else if (isClass(rc, bitmap_id()))
68
+ tmpBundle = wxBitmapBundle(*static_cast<wxBitmap*> (ptr));
69
+ else if (isClass(rc, icon_id()))
70
+ tmpBundle = wxBitmapBundle(*static_cast<wxIcon*> (ptr));
71
+ else if (isClass(rc, image_id()))
72
+ tmpBundle = wxBitmapBundle(*static_cast<wxImage*> (ptr));
73
+ else
74
+ ok = false;
75
+ }
76
+ }
77
+
78
+ if (!ok)
79
+ {
80
+ std::wcerr << "Invalid return value from icon provider" << std::endl;
81
+ wxRuby_ExitMainLoop();
82
+ }
83
+ }
84
+ }
85
+ return tmpBundle;
86
+ }
87
+
88
+ private:
89
+
90
+ VALUE rbIconProvider_ {};
91
+
92
+ inline bool isClass(VALUE obj, ID class_id)
93
+ {
94
+ VALUE klass = rb_const_get(wxRuby_Core(), class_id);
95
+ return rb_obj_is_kind_of(obj, klass);
96
+ }
97
+ };
98
+ __HEREDOC
99
+ spec.add_extend_code 'wxBackstageMRUList', <<~__CODE
100
+ void set_icon_provider(VALUE provider)
101
+ {
102
+ std::function<wxBitmapBundle(const wxString&)> icon_provider_func = RbIconProvider(provider);
103
+ $self->SetIconProvider(icon_provider_func);
104
+ }
105
+ __CODE
106
+ spec.do_not_generate :variables, :enums, :defines, :functions, :typedefs
107
+ end
108
+ end # class BackstageMRUList
109
+
110
+ end # class Director
111
+
112
+ end # module WXRuby3
@@ -18,6 +18,20 @@ module WXRuby3
18
18
  super
19
19
  # for SetArtProvider (only in RibbonBar)
20
20
  spec.disown 'wxRibbonArtProvider *art'
21
+ if Config.instance.wx_version_check('3.3.4') >= 0
22
+ spec.regard 'wxRibbonBar::TriggerKey::keyCode',
23
+ 'wxRibbonBar::TriggerKey::modifiers'
24
+ spec.map 'const std::vector< wxRibbonBar::TriggerKey > &' => 'Array<Wx::RBN::RibbonBar::TriggerKey>' do
25
+ map_out code: <<~__CODE
26
+ $result = rb_ary_new();
27
+ for (const wxRibbonBar::TriggerKey& tkey : *$1)
28
+ {
29
+ VALUE r_tkey = SWIG_NewPointerObj(new wxRibbonBar::TriggerKey(tkey), SWIGTYPE_p_wxRibbonBar__TriggerKey, SWIG_POINTER_OWN);
30
+ rb_ary_push($result, r_tkey);
31
+ }
32
+ __CODE
33
+ end
34
+ end
21
35
  spec.do_not_generate :variables, :enums, :defines, :functions
22
36
  end
23
37
  end # class RibbonBar
@@ -19,8 +19,12 @@ module WXRuby3
19
19
  def setup
20
20
  super
21
21
  spec.ignore 'wxRibbonGallery::SetItemClientData',
22
- 'wxRibbonGallery::GetItemClientData',
23
- 'wxRibbonGallery::Append(const wxBitmap &, int, void *)'
22
+ 'wxRibbonGallery::GetItemClientData'
23
+ if Config.instance.wx_version_check('3.3.4') <= 0
24
+ spec.ignore 'wxRibbonGallery::Append(const wxBitmap &, int, void *)'
25
+ else
26
+ spec.ignore 'wxRibbonGallery::Append(const wxBitmapBundle &, int, void *)'
27
+ end
24
28
  spec.map 'wxRibbonGalleryItem*' => 'Integer' do
25
29
  map_out code: '$result = ULL2NUM(reinterpret_cast<uintptr_t> ($1));'
26
30
  map_directorout code: '$result = reinterpret_cast<wxRibbonGalleryItem*> ((uintptr_t)NUM2ULL($1));'
@@ -129,10 +129,12 @@ module WXRuby3
129
129
  # not needed because of type mapping
130
130
  spec.ignore 'wxRibbonToolBar::GetToolId',
131
131
  'wxRibbonToolBar::FindById'
132
- # replace incorrectly documented method
133
- spec.ignore 'wxRibbonToolBar::AddToggleTool', ignore_doc: false
134
- spec.extend_interface 'wxRibbonToolBar',
135
- 'virtual wxRibbonToolBarToolBase* AddToggleTool (int tool_id, const wxBitmap &bitmap, const wxString &help_string=wxEmptyString)'
132
+ if Config.instance.wx_version_check('3.3.4') <= 0
133
+ # replace incorrectly documented method
134
+ spec.ignore 'wxRibbonToolBar::AddToggleTool', ignore_doc: false
135
+ spec.extend_interface 'wxRibbonToolBar',
136
+ 'virtual wxRibbonToolBarToolBase* AddToggleTool (int tool_id, const wxBitmap &bitmap, const wxString &help_string=wxEmptyString)'
137
+ end
136
138
  # map opaque wxRibbonToolBarToolBase* to the integer tool ID
137
139
  spec.map 'wxRibbonToolBarToolBase*' => 'Integer' do
138
140
  map_out code: '$result = ($1) ? INT2NUM((arg1)->GetToolId($1)) : Qnil;'