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
@@ -26,7 +26,7 @@ WXRUBY_TRACE_GUARD(WxRubyTraceFreeRefcounted, "GC_FREE_REFCOUNT")
26
26
  // and not be either 0 or a reference to the SWIG tracking removal function.
27
27
  WXRUBY_EXPORT bool GC_IsObjectOwned(VALUE object)
28
28
  {
29
- return RDATA(object)->dfree != SWIG_RubyRemoveTracking && RDATA(object)->dfree != 0;
29
+ return WXRUBY_WRAPPER_DATA_DFREE(object) != SWIG_RubyRemoveTracking && WXRUBY_WRAPPER_DATA_DFREE(object) != 0;
30
30
  }
31
31
 
32
32
  // Tests if the window has been signalled as destroyed by a
@@ -124,7 +124,7 @@ WXRUBY_EXPORT void GC_mark_wxSizer(void* ptr)
124
124
  // as long as the dfree function is still the sizer's free function the sizer has not been attached to a window
125
125
  // or added to a parent sizer (as that would 'disown' and replace the free function by the tracking removal function)
126
126
  // but it may hay have already had child sizers added which need to be marked
127
- if (RDATA(rb_szr)->dfree != (void (*)(void *))SWIG_RubyRemoveTracking)
127
+ if (WXRUBY_WRAPPER_DATA_DFREE(rb_szr) != (void (*)(void *))SWIG_RubyRemoveTracking)
128
128
  {
129
129
  wxSizer* wx_szr = (wxSizer*)ptr;
130
130
 
@@ -15,6 +15,7 @@ WXRUBY_EXPORT void GcRefCountedFreeFunc(void *);
15
15
  WXRUBY_EXPORT void GC_mark_wxSizer(void *);
16
16
  WXRUBY_EXPORT void GC_mark_wxWindow(void *);
17
17
  WXRUBY_EXPORT void GC_mark_wxEvent(void *);
18
+ WXRUBY_EXPORT void GC_mark_wxFrame(void *);
18
19
  %}
19
20
 
20
21
  // Macro definitions.
@@ -281,9 +281,8 @@ WXRUBY_EXPORT VALUE wxRuby_WrapWxEventInRuby(wxEvent *wx_event)
281
281
 
282
282
  // No existing Ruby instance found, so a transitory event object; wrap
283
283
  // without mark or free functions as Wx will deal with deletion
284
- rb_event = Data_Wrap_Struct(rb_event_class, 0, 0, 0);
285
- DATA_PTR(rb_event) = wx_event;
286
- // do not forget to mark the instance with the mangled swig type name
284
+
285
+ // get swig type info for event class
287
286
  // (as there is no swig_type for the Wx::AsyncProcCallEvent class use it's base Wx::Event)
288
287
  swig_type_info* type;
289
288
  if (wx_event->GetEventType() == wxEVT_ASYNC_METHOD_CALL)
@@ -301,13 +300,27 @@ WXRUBY_EXPORT VALUE wxRuby_WrapWxEventInRuby(wxEvent *wx_event)
301
300
  {
302
301
  type = wxRuby_GetSwigTypeForClass(klass);
303
302
  }
303
+ // paranoia
304
+ if (!type)
305
+ {
306
+ type = wxRuby_GetSwigTypeForClass(wxRuby_GetDefaultEventClass());
307
+ }
304
308
  }
305
309
  }
306
- // type should never be null but let's be paranoid
307
- if (type) rb_iv_set(rb_event, "@__swigtype__", rb_str_new2(type->name));
310
+
311
+ #ifdef WXRUBY_SWIG_UNTYPED_DATA
312
+ rb_event = Data_Wrap_Struct(rb_event_class, 0, 0, wx_event);
313
+ #else
314
+ struct swig_ruby_wrapped_object *wrobj;
315
+ swig_class *sklass = (swig_class *)type->clientdata;
316
+ rb_event = TypedData_Make_Struct(rb_event_class, struct swig_ruby_wrapped_object, &sklass->cext_type, wrobj);
317
+ wrobj->data = wx_event;
318
+ #endif
319
+ // do not forget to mark the instance with the mangled swig type name
320
+ rb_iv_set(rb_event, "@__swigtype__", rb_str_new2(type->name));
308
321
 
309
322
  WXRUBY_TRACE_IF(WxRubyTraceGCWrapEvents, 2)
310
- WXRUBY_TRACE("< wxRuby_WrapWxEventInRuby - wrapped transitory event " << wx_event << "{" << (type ? type->name : rb_class2name(rb_event_class)) << "}")
323
+ WXRUBY_TRACE("< wxRuby_WrapWxEventInRuby - wrapped transitory event " << wx_event << "{" << type->name << "}")
311
324
  WXRUBY_TRACE_END
312
325
 
313
326
  return rb_event;
@@ -23,16 +23,9 @@ module Wx
23
23
  class FileDialogCustomizeHook
24
24
 
25
25
  # prevent construction of abstract base
26
- if (RUBY_VERSION.split('.').collect {|v| v.to_i} <=> [2,7,0]) < 0
27
- def self.new(*)
28
- raise NotImplementedError, 'Wx::FileDialogCustomizeHook is an abstract class.' if self == Wx::FileDialogCustomizeHook
29
- super
30
- end
31
- else
32
- def self.new(*, **)
33
- raise NotImplementedError, 'Wx::FileDialogCustomizeHook is an abstract class.' if self == Wx::FileDialogCustomizeHook
34
- super
35
- end
26
+ def self.new(*, **)
27
+ raise NotImplementedError, 'Wx::FileDialogCustomizeHook is an abstract class.' if self == Wx::FileDialogCustomizeHook
28
+ super
36
29
  end
37
30
 
38
31
  # provide default no-ops
@@ -0,0 +1,32 @@
1
+ # :stopdoc:
2
+ # Copyright (c) 2023 M.J.N. Corino, The Netherlands
3
+ #
4
+ # This software is released under the MIT license.
5
+ # :startdoc:
6
+
7
+
8
+ module Wx
9
+
10
+ class EvtHandler
11
+
12
+ # @!group RBN Event handler methods
13
+
14
+ # Respond to {Wx::RBN::EVT_BACKSTAGE_CLICKED} event.
15
+ # Triggered when a button on the left is clicked or activated. The event's ID is the button's ID. Call Wx::NotifyEvent#veto to keep the button's page from being shown.
16
+ # @param [Integer,Wx::Enum,Wx::Window,Wx::MenuItem,Wx::ToolBarTool,Wx::Timer] id window/control id
17
+ # @param [String,Symbol,Method,Proc] meth (name of) method or handler proc
18
+ # @yieldparam [Wx::NotifyEvent] event the event to handle
19
+ def evt_backstage_clicked(id, meth = nil, &block) end
20
+
21
+ # Respond to {Wx::RBN::EVT_BACKSTAGE_ITEM_CLICKED} event.
22
+ # Triggered when an item is clicked or activated. Wx::CommandEvent#get_int returns the item's index (not counting headers) and Wx::CommandEvent#get_string returns the item's user string (e.g., a file path).
23
+ # @param [Integer,Wx::Enum,Wx::Window,Wx::MenuItem,Wx::ToolBarTool,Wx::Timer] id window/control id
24
+ # @param [String,Symbol,Method,Proc] meth (name of) method or handler proc
25
+ # @yieldparam [Wx::CommandEvent] event the event to handle
26
+ def evt_backstage_item_clicked(id, meth = nil, &block) end
27
+
28
+ # @!endgroup
29
+
30
+ end
31
+
32
+ end
@@ -0,0 +1,25 @@
1
+ # :stopdoc:
2
+ # Copyright (c) 2023 M.J.N. Corino, The Netherlands
3
+ #
4
+ # This software is released under the MIT license.
5
+ # :startdoc:
6
+
7
+
8
+ module Wx
9
+
10
+ module RBN
11
+
12
+ class BackstageMRUList
13
+
14
+ # Sets a callback object (Method, Proc, block, lambda) that returns the icon to show for a file given the file name.
15
+ # By default, a standard file icon is used for all files.
16
+ #
17
+ # @param [Method,Proc] provider icon provider method or proc accepting a single string argument; to be supplied when no block is given
18
+ # @yieldparam [::String] path the file path for which to return a matching bitmap/icon
19
+ def set_icon_provider(provider=nil, &block); end
20
+
21
+ end
22
+
23
+ end
24
+
25
+ end
@@ -71,11 +71,7 @@ module Wx
71
71
  # by the Rails #class_attribute method.
72
72
  module ParamSpec
73
73
 
74
- if (RUBY_VERSION.split('.').collect {|v| v.to_i} <=> [2,7,0]) < 0
75
- PARAM_SPEC_ARG = [:param_spec]
76
- else
77
- PARAM_SPEC_ARG = [:param_spec, false]
78
- end
74
+ PARAM_SPEC_ARG = [:param_spec, false]
79
75
 
80
76
  def self.included(mod)
81
77
  mod.class_eval do
@@ -164,14 +160,8 @@ module Wx
164
160
  end
165
161
  end
166
162
 
167
- if (RUBY_VERSION.split('.').collect {|v| v.to_i} <=> [3,0,0]) <= 0
168
- def args_as_list(*mixed_args)
169
- Wx::args_as_list(param_spec, *mixed_args)
170
- end
171
- else
172
- def args_as_list(*args, **kwargs)
173
- Wx::args_as_list(param_spec, *args, **kwargs)
174
- end
163
+ def args_as_list(*args, **kwargs)
164
+ Wx::args_as_list(param_spec, *args, **kwargs)
175
165
  end
176
166
 
177
167
  def describe_constructor(txt = '')
data/lib/wx/rbn/events.rb CHANGED
@@ -5,3 +5,21 @@
5
5
  # Wx::RBN sub package for wxRuby3
6
6
 
7
7
  require_relative './events/evt_list'
8
+
9
+ if Wx.at_least_wxwidgets?('3.3.4')
10
+ # add event handlers missing from XML docs
11
+ class Wx::EvtHandler
12
+ # from wxBackstage
13
+ self.register_event_type EventType[
14
+ 'evt_backstage_clicked', 1,
15
+ Wx::RBN::EVT_BACKSTAGE_CLICKED,
16
+ Wx::NotifyEvent
17
+ ] if Wx::RBN.const_defined?(:EVT_BACKSTAGE_CLICKED)
18
+ # from wxBackstageItemList
19
+ self.register_event_type EventType[
20
+ 'evt_backstage_item_clicked', 1,
21
+ Wx::RBN::EVT_BACKSTAGE_ITEM_CLICKED,
22
+ Wx::CommandEvent
23
+ ] if Wx::RBN.const_defined?(:EVT_BACKSTAGE_ITEM_CLICKED)
24
+ end
25
+ end
@@ -14,3 +14,4 @@ require_relative './ribbon_panel'
14
14
  require_relative './ribbon_button_bar'
15
15
  require_relative './ribbon_tool_bar'
16
16
  require_relative './ribbon_gallery'
17
+ require_relative './ribbon_backstage_mrulist' if Wx.at_least_wxwidgets?('3.3.4')
@@ -0,0 +1,39 @@
1
+ # Copyright (c) 2023 M.J.N. Corino, The Netherlands
2
+ #
3
+ # This software is released under the MIT license.
4
+
5
+ module Wx
6
+
7
+ module RBN
8
+
9
+ class BackstageMRUList
10
+
11
+ # manage IconProvider for GC
12
+ wx_set_icon_provider = instance_method :set_icon_provider
13
+ wx_redefine_method :set_icon_provider do |prov = nil, &block|
14
+ @icon_provider = nil # clear any previously set
15
+ prov = if block and not prov
16
+ block
17
+ elsif prov and not block
18
+ case prov
19
+ when Proc then prov
20
+ when Method then prov
21
+ else Kernel.raise ArgumentError,
22
+ "set_icon_provider expects a Proc, Method, block or lambda excepting a single argument"
23
+ end
24
+ end
25
+ # check arity == 1
26
+ if prov.arity != 1
27
+ Kernel.raise ArgumentError,
28
+ "icon provider should accept a single argument"
29
+ end
30
+ wx_set_icon_provider.bind(self).call(prov)
31
+ @icon_provider = prov # keep non-wx-managed provider safe
32
+ end
33
+ alias :icon_provider= :set_icon_provider
34
+
35
+ end
36
+
37
+ end
38
+
39
+ end
data/lib/wx/version.rb CHANGED
@@ -3,5 +3,5 @@
3
3
  # This software is released under the MIT license.
4
4
 
5
5
  module Wx
6
- WXRUBY_VERSION = '1.8.1'
6
+ WXRUBY_VERSION = '2.0.0'
7
7
  end
@@ -84,10 +84,10 @@ module WXRuby3
84
84
  CONFIG['wxversion'] = ENV['WXRUBY_WXVERSION'] if ENV['WXRUBY_WXVERSION']
85
85
  BUILD_CFG = '.wxconfig'
86
86
 
87
- # Ruby 2.7 is the minimum version for wxRuby3
87
+ # Ruby 3.2 is the minimum version for wxRuby3
88
88
  __rb_ver = RUBY_VERSION.split('.').collect {|v| v.to_i}
89
- if (__rb_major = __rb_ver.shift) < 2 || (__rb_major == 2 && __rb_ver.shift < 7)
90
- $stderr.puts 'ERROR: wxRuby3 requires Ruby >= 2.7.0!'
89
+ if (__rb_major = __rb_ver.shift) < 3 || (__rb_major == 3 && __rb_ver.shift < 2)
90
+ $stderr.puts 'ERROR: wxRuby3 requires Ruby >= 3.2.0!'
91
91
  exit(1)
92
92
  end
93
93