wxruby3 1.5.3 → 1.6.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 (114) hide show
  1. checksums.yaml +4 -4
  2. data/ext/wxruby3/swig/RubyStockObjects.i +1 -0
  3. data/lib/wx/aui/auifloatframe.rb +1 -1
  4. data/lib/wx/aui/auimanager.rb +1 -1
  5. data/lib/wx/aui/auinotebook.rb +2 -2
  6. data/lib/wx/core/animation.rb +1 -1
  7. data/lib/wx/core/cursor.rb +10 -0
  8. data/lib/wx/core/dataformat.rb +1 -1
  9. data/lib/wx/core/dialog.rb +1 -1
  10. data/lib/wx/core/file_dialog.rb +1 -1
  11. data/lib/wx/core/geometry.rb +34 -0
  12. data/lib/wx/core/hboxsizer.rb +22 -0
  13. data/lib/wx/core/hyperlink_ctrl.rb +18 -0
  14. data/lib/wx/core/point.rb +12 -3
  15. data/lib/wx/core/position.rb +58 -0
  16. data/lib/wx/core/sizer.rb +163 -28
  17. data/lib/wx/core/splash_screen.rb +3 -3
  18. data/lib/wx/core/toolbar.rb +2 -2
  19. data/lib/wx/core/vboxsizer.rb +22 -0
  20. data/lib/wx/doc/aui/auimanager.rb +6 -3
  21. data/lib/wx/doc/aui/auinotebook.rb +6 -3
  22. data/lib/wx/doc/config.rb +14 -8
  23. data/lib/wx/doc/controlwithitems.rb +7 -3
  24. data/lib/wx/doc/core.rb +21 -0
  25. data/lib/wx/doc/geometry.rb +47 -7
  26. data/lib/wx/doc/graphics_object.rb +24 -0
  27. data/lib/wx/doc/grid/grid.rb +18 -9
  28. data/lib/wx/doc/hboxsizer.rb +41 -5
  29. data/lib/wx/doc/list_ctrl.rb +12 -6
  30. data/lib/wx/doc/menu.rb +6 -3
  31. data/lib/wx/doc/notebook.rb +6 -3
  32. data/lib/wx/doc/pg/pg_property.rb +18 -9
  33. data/lib/wx/doc/pg/property_grid_interface.rb +4 -4
  34. data/lib/wx/doc/region_iterator.rb +1 -1
  35. data/lib/wx/doc/rtc/rich_text_composite_object.rb +6 -3
  36. data/lib/wx/doc/rtc/rich_text_ctrl.rb +6 -3
  37. data/lib/wx/doc/rtc/rich_text_paragraph.rb +6 -3
  38. data/lib/wx/doc/sizer.rb +6 -3
  39. data/lib/wx/doc/stc/styled_text_ctrl.rb +6 -3
  40. data/lib/wx/doc/textctrl.rb +6 -3
  41. data/lib/wx/doc/tree_ctrl.rb +7 -3
  42. data/lib/wx/doc/v_list_box.rb +6 -3
  43. data/lib/wx/doc/variant.rb +1 -1
  44. data/lib/wx/doc/vboxsizer.rb +41 -5
  45. data/lib/wx/doc/window.rb +6 -3
  46. data/lib/wx/helpers.rb +36 -10
  47. data/lib/wx/keyword_ctors.rb +12 -14
  48. data/lib/wx/keyword_defs.rb +11 -2
  49. data/lib/wx/pg/pg_property.rb +1 -1
  50. data/lib/wx/rtc/richtext_formatting_dialog.rb +3 -3
  51. data/lib/wx/rtc/richtext_style_organiser_dialog.rb +3 -3
  52. data/lib/wx/rtc/symbol_picker_dialog.rb +3 -3
  53. data/lib/wx/version.rb +1 -1
  54. data/rakelib/lib/config/mingw.rb +1 -1
  55. data/rakelib/lib/config.rb +6 -0
  56. data/rakelib/lib/director/affine_matrix.rb +33 -0
  57. data/rakelib/lib/director/animation_ctrl.rb +1 -1
  58. data/rakelib/lib/director/app.rb +1 -1
  59. data/rakelib/lib/director/aui_manager.rb +2 -2
  60. data/rakelib/lib/director/aui_notebook.rb +1 -1
  61. data/rakelib/lib/director/aui_tab_art.rb +4 -4
  62. data/rakelib/lib/director/ctrl_with_items.rb +1 -1
  63. data/rakelib/lib/director/cursor.rb +11 -1
  64. data/rakelib/lib/director/dc.rb +2 -2
  65. data/rakelib/lib/director/defs.rb +1 -1
  66. data/rakelib/lib/director/derived_dc.rb +14 -14
  67. data/rakelib/lib/director/dialog.rb +3 -3
  68. data/rakelib/lib/director/gdicommon.rb +2 -2
  69. data/rakelib/lib/director/geometry.rb +55 -3
  70. data/rakelib/lib/director/graphics_context.rb +8 -3
  71. data/rakelib/lib/director/graphics_object.rb +29 -2
  72. data/rakelib/lib/director/html_listbox.rb +6 -5
  73. data/rakelib/lib/director/hvscrolled_window.rb +140 -0
  74. data/rakelib/lib/director/hyperlink_ctrl.rb +38 -1
  75. data/rakelib/lib/director/menu_item.rb +1 -1
  76. data/rakelib/lib/director/persistent_window.rb +2 -2
  77. data/rakelib/lib/director/pgeditor.rb +1 -1
  78. data/rakelib/lib/director/pgproperties.rb +4 -4
  79. data/rakelib/lib/director/pgproperty.rb +1 -1
  80. data/rakelib/lib/director/pgvalidation_info.rb +1 -1
  81. data/rakelib/lib/director/print_data.rb +1 -1
  82. data/rakelib/lib/director/property_grid_event.rb +1 -1
  83. data/rakelib/lib/director/property_grid_page.rb +1 -1
  84. data/rakelib/lib/director/property_grid_page_state.rb +1 -1
  85. data/rakelib/lib/director/ribbon_tool_bar.rb +1 -1
  86. data/rakelib/lib/director/richtext_buffer.rb +1 -1
  87. data/rakelib/lib/director/richtext_formatting_dialog.rb +1 -1
  88. data/rakelib/lib/director/richtext_paragraph_layout_box.rb +1 -1
  89. data/rakelib/lib/director/richtext_style_listbox.rb +2 -1
  90. data/rakelib/lib/director/scrolled_t.rb +22 -0
  91. data/rakelib/lib/director/sizer.rb +51 -0
  92. data/rakelib/lib/director/styled_text_event.rb +1 -1
  93. data/rakelib/lib/director/textctrl.rb +2 -2
  94. data/rakelib/lib/director/tree_ctrl.rb +1 -1
  95. data/rakelib/lib/director/utils.rb +1 -1
  96. data/rakelib/lib/director/variant.rb +1 -1
  97. data/rakelib/lib/director/vlistbox.rb +5 -3
  98. data/rakelib/lib/director/window.rb +14 -3
  99. data/rakelib/lib/extractor/function.rb +46 -15
  100. data/rakelib/lib/generate/doc/hyperlink_ctrl.yaml +22 -0
  101. data/rakelib/lib/generate/doc/scrolled_canvas.yaml +38 -0
  102. data/rakelib/lib/generate/doc/scrolled_control.yaml +38 -0
  103. data/rakelib/lib/generate/doc/scrolled_window.yaml +38 -0
  104. data/rakelib/lib/specs/interfaces.rb +2 -2
  105. data/rakelib/lib/typemap/print_page_range.rb +1 -1
  106. data/samples/scrolling/tn_varscroll.png +0 -0
  107. data/samples/scrolling/varscroll.rb +416 -0
  108. data/samples/widgets/hyperlink.rb +85 -60
  109. metadata +12 -6
  110. data/rakelib/lib/director/vscrolled_window.rb +0 -62
  111. /data/samples/{controls → scrolling}/htlbox.rb +0 -0
  112. /data/samples/{etc → scrolling}/scrollwin.rb +0 -0
  113. /data/samples/{controls → scrolling}/tn_htlbox.png +0 -0
  114. /data/samples/{etc → scrolling}/tn_scrollwin.png +0 -0
data/lib/wx/helpers.rb CHANGED
@@ -19,16 +19,14 @@ module Wx
19
19
  # structs containing the keyword name and default value for each
20
20
  # possible argument. +mixed_args+ is an array which may optionally end
21
21
  # with a set of named arguments
22
- def self.args_as_list(param_spec, *mixed_args)
22
+ def self.args_as_list(param_spec, *args, **kwargs)
23
23
 
24
24
  begin
25
- # get keyword arguments from mixed args if supplied, else empty
26
- kwa = mixed_args.last.kind_of?(Hash) ? mixed_args.pop : {}
27
25
  out_args = []
28
26
  param_spec.each_with_index do | param, i |
29
27
  # has supplied list arg or the keyword arg?
30
- arg = mixed_args[i]
31
- arg = kwa.delete(param.name) if arg.nil? && kwa.key?(param.name)
28
+ arg = args[i]
29
+ arg = kwargs.delete(param.name) if arg.nil? && kwargs.key?(param.name)
32
30
  if Proc === param.default_or_proc
33
31
  arg = param.default_or_proc.call(arg) # provides default or converts arg
34
32
  elsif arg.nil?
@@ -37,13 +35,13 @@ module Wx
37
35
  out_args << arg
38
36
  end
39
37
  rescue
40
- Kernel.raise ArgumentError,
41
- "Bad arg composition of #{mixed_args.inspect}"
38
+ Kernel.raise ArgumentError,
39
+ "Bad arg composition of #{args.inspect}"
42
40
  end
43
41
 
44
- unless kwa.empty?
45
- Kernel.raise ArgumentError,
46
- "Unknown keyword argument(s) : #{kwa.keys.inspect}"
42
+ unless kwargs.empty?
43
+ Kernel.raise ArgumentError,
44
+ "Unknown keyword argument(s) : #{kwargs.keys.inspect}"
47
45
  end
48
46
 
49
47
  out_args
@@ -68,4 +66,32 @@ module Wx
68
66
  def self.has_feature?(featsym)
69
67
  Wx::Setup.const_defined?(featsym) && !!Wx::Setup.const_get(featsym)
70
68
  end
69
+
70
+ # returns true if WXWIDGETS_VERSION >= ver
71
+ # ver can be string or array of 3 integers
72
+ def self.at_least_wxwidgets?(ver)
73
+ ver = ver.split('.').collect {|s| s.to_i } unless ::Array === ver
74
+ ([ Wx::WXWIDGETS_MAJOR_VERSION, Wx::WXWIDGETS_MINOR_VERSION, Wx::WXWIDGETS_RELEASE_NUMBER ] <=> ver) >= 0
75
+ end
76
+
77
+ # returns true if WXWIDGETS_VERSION <= ver
78
+ # ver can be string or array of 3 integers
79
+ def self.up_to_wxwidgets?(ver)
80
+ ver = ver.split('.').collect {|s| s.to_i } unless ::Array === ver
81
+ ([ Wx::WXWIDGETS_MAJOR_VERSION, Wx::WXWIDGETS_MINOR_VERSION, Wx::WXWIDGETS_RELEASE_NUMBER ] <=> ver) <= 0
82
+ end
83
+
84
+ # returns true if WXWIDGETS_VERSION < ver
85
+ # ver can be string or array of 3 integers
86
+ def self.before_wxwidgets?(ver)
87
+ ver = ver.split('.').collect {|s| s.to_i } unless ::Array === ver
88
+ ([ Wx::WXWIDGETS_MAJOR_VERSION, Wx::WXWIDGETS_MINOR_VERSION, Wx::WXWIDGETS_RELEASE_NUMBER ] <=> ver) < 0
89
+ end
90
+
91
+ # returns true if WXWIDGETS_VERSION > ver
92
+ # ver can be string or array of 3 integers
93
+ def self.after_wxwidgets?(ver)
94
+ ver = ver.split('.').collect {|s| s.to_i } unless ::Array === ver
95
+ ([ Wx::WXWIDGETS_MAJOR_VERSION, Wx::WXWIDGETS_MINOR_VERSION, Wx::WXWIDGETS_RELEASE_NUMBER ] <=> ver) > 0
96
+ end
71
97
  end
@@ -71,7 +71,7 @@ module Wx
71
71
  # by the Rails #class_attribute method.
72
72
  module ParamSpec
73
73
 
74
- if RUBY_VERSION < '2.7.0'
74
+ if (RUBY_VERSION.split('.').collect {|v| v.to_i} <=> [2,7,0]) < 0
75
75
  PARAM_SPEC_ARG = [:param_spec]
76
76
  else
77
77
  PARAM_SPEC_ARG = [:param_spec, false]
@@ -164,18 +164,16 @@ module Wx
164
164
  end
165
165
  end
166
166
 
167
- def args_as_list(*mixed_args)
168
- Wx::args_as_list(param_spec, *mixed_args)
169
- end
170
-
171
- def args_as_hash(*mixed_args)
172
- kwa = mixed_args.last.kind_of?(Hash) ? mixed_args.pop : {}
173
- param_spec.zip(mixed_args) do | param, arg |
174
- kwa[param.name] = arg if arg
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)
175
174
  end
176
- kwa
177
175
  end
178
-
176
+
179
177
  def describe_constructor(txt = '')
180
178
  param_spec.inject(txt) do | desc, param |
181
179
  if Proc === param.default_or_proc
@@ -198,7 +196,7 @@ module Wx
198
196
  # The new definition of initialize; accepts a parent arg
199
197
  # mixed_args, which may zero or more position args, optionally
200
198
  # terminated with hash keyword args, and an optional block
201
- wx_redefine_method :initialize do |parent = :default_ctor, *mixed_args, &block|
199
+ wx_redefine_method :initialize do |parent = :default_ctor, *args, **kwargs, &block|
202
200
  # allow zero-args ctor for use with XRC
203
201
  if parent == :default_ctor
204
202
  pre_wx_kwctor_init
@@ -206,11 +204,11 @@ module Wx
206
204
  end
207
205
 
208
206
  real_args = begin
209
- [ parent ] + self.class.args_as_list(*mixed_args)
207
+ [ parent ] + self.class.args_as_list(*args, **kwargs)
210
208
  rescue => err
211
209
  msg = "Error initializing #{self.inspect}\n"+
212
210
  " : #{err.message} \n" +
213
- "Provided are #{[parent] + mixed_args} \n" +
211
+ "Provided are #{[parent] + args + [kwargs]} \n" +
214
212
  "Correct parameters for #{self.class.name}.new are:\n" +
215
213
  self.class.describe_constructor(":parent => (Wx::Window)\n")
216
214
 
@@ -389,8 +389,7 @@ end
389
389
 
390
390
  # wxGenericDirCtrl A control for displaying a directory tree
391
391
  Wx::define_keyword_ctors(Wx::GenericDirCtrl) do
392
- # TODO :dir => Wx::DIR_DIALOG_DEFAULT_FOLDER_STR
393
- wx_ctor_params :id, :dir => ''
392
+ wx_ctor_params :id, :dir => Wx::DIR_DIALOG_DEFAULT_FOLDER_STR
394
393
  wx_ctor_params :pos, :size,
395
394
  :style => Wx::DIRCTRL_3D_INTERNAL|Wx::SUNKEN_BORDER
396
395
  wx_ctor_params :filter => ''
@@ -517,6 +516,16 @@ Wx::define_keyword_ctors(Wx::HyperlinkCtrl) do
517
516
  wx_ctor_params :name => Wx::HYPERLINK_CTRL_NAME_STR
518
517
  end
519
518
 
519
+ # HyperlinkCtrl is identical to GenericHyperlinkCtrl on MacOS
520
+ unless Wx::PLATFORM == 'WXOSX'
521
+ Wx::define_keyword_ctors(Wx::GenericHyperlinkCtrl) do
522
+ wx_ctor_params :id, :label => ''
523
+ wx_ctor_params :url => ''
524
+ wx_ctor_params :pos, :size, :style => Wx::HL_DEFAULT_STYLE
525
+ wx_ctor_params :name => Wx::HYPERLINK_CTRL_NAME_STR
526
+ end
527
+ end
528
+
520
529
  Wx::define_keyword_ctors(Wx::CollapsiblePane) do
521
530
  wx_ctor_params :id, :label => ''
522
531
  wx_ctor_params :pos, :size, :style => 0
@@ -14,7 +14,7 @@ module Wx::PG
14
14
 
15
15
  PG_DEFAULT_IMAGE_SIZE = Wx::DEFAULT_SIZE
16
16
 
17
- if Wx::WXWIDGETS_VERSION >= '3.3.0'
17
+ if Wx.at_least_wxwidgets?('3.3.0')
18
18
  # backward compatibility constants
19
19
  PG_FULL_VALUE = PGPropValFormatFlags::FullValue
20
20
  PG_REPORT_ERROR = PGPropValFormatFlags::ReportError
@@ -23,7 +23,7 @@ module Wx::RTC
23
23
  end
24
24
 
25
25
  # now redefine the overridden ctor to account for deviating arglist
26
- wx_redefine_method :initialize do |flags = nil, parent = nil, *mixed_args, &block|
26
+ wx_redefine_method :initialize do |flags = nil, parent = nil, *args, **kwargs, &block|
27
27
  # allow zero-args ctor for use with XRC
28
28
  if flags.nil?
29
29
  pre_wx_kwctor_init
@@ -31,11 +31,11 @@ module Wx::RTC
31
31
  end
32
32
 
33
33
  real_args = begin
34
- [ flags, parent ] + self.class.args_as_list(*mixed_args)
34
+ [ flags, parent ] + self.class.args_as_list(*args, **kwargs)
35
35
  rescue => err
36
36
  msg = "Error initializing #{self.inspect}\n"+
37
37
  " : #{err.message} \n" +
38
- "Provided are #{[ flags, parent ] + mixed_args} \n" +
38
+ "Provided are #{[ flags, parent ] + args + [kwargs]} \n" +
39
39
  "Correct parameters for #{self.class.name}.new are:\n" +
40
40
  self.class.describe_constructor(
41
41
  ":flags => (Integer)\n:parent => (Wx::Window)\n")
@@ -12,13 +12,13 @@ class Wx::RTC::RichTextStyleOrganiserDialog
12
12
  end
13
13
 
14
14
  # now redefine the overridden ctor to account for deviating arglist
15
- wx_redefine_method :initialize do |flags, sheet, ctrl, parent = nil, *mixed_args, &block|
15
+ wx_redefine_method :initialize do |flags, sheet, ctrl, parent = nil, *args, **kwargs, &block|
16
16
  real_args = begin
17
- [ flags, sheet, ctrl, parent ] + self.class.args_as_list(*mixed_args)
17
+ [ flags, sheet, ctrl, parent ] + self.class.args_as_list(*args, **kwargs)
18
18
  rescue => err
19
19
  msg = "Error initializing #{self.inspect}\n"+
20
20
  " : #{err.message} \n" +
21
- "Provided are #{[ flags, sheet, ctrl, parent ] + mixed_args} \n" +
21
+ "Provided are #{[ flags, sheet, ctrl, parent ] + args + [kwargs]} \n" +
22
22
  "Correct parameters for #{self.class.name}.new are:\n" +
23
23
  self.class.describe_constructor(
24
24
  ":flags => (Integer)\n:sheet => (Wx::RTC::RichTextStyleSheet)\n:ctrl => (Wx::RTC::RichTextCtrl)\n:parent => (Wx::Window)\n")
@@ -13,13 +13,13 @@ class Wx::RTC::SymbolPickerDialog
13
13
  end
14
14
 
15
15
  # now redefine the overridden ctor to account for deviating arglist
16
- wx_redefine_method :initialize do |symbol, initialFont, normalTextFont, parent = nil, *mixed_args, &block|
16
+ wx_redefine_method :initialize do |symbol, initialFont, normalTextFont, parent = nil, *args, **kwargs, &block|
17
17
  real_args = begin
18
- [ symbol, initialFont, normalTextFont, parent ] + self.class.args_as_list(*mixed_args)
18
+ [ symbol, initialFont, normalTextFont, parent ] + self.class.args_as_list(*args, **kwargs)
19
19
  rescue => err
20
20
  msg = "Error initializing #{self.inspect}\n"+
21
21
  " : #{err.message} \n" +
22
- "Provided are #{[ symbol, initialFont, normalTextFont, parent ] + mixed_args} \n" +
22
+ "Provided are #{[ symbol, initialFont, normalTextFont, parent ] + args + [kwargs]} \n" +
23
23
  "Correct parameters for #{self.class.name}.new are:\n" +
24
24
  self.class.describe_constructor(
25
25
  ":symbol => (String)\n:initialFont => (String)\n:normalTextFont => (String)\n:parent => (Wx::Window)\n")
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.5.3'
6
+ WXRUBY_VERSION = '1.6.0'
7
7
  end
@@ -177,7 +177,7 @@ module WXRuby3
177
177
  @rescomp << ' --define __WXMSW__ --define wxUSE_DPI_AWARE_MANIFEST=2 --define wxUSE_RC_MANIFEST=1 --define ISOLATION_AWARE_ENABLED'
178
178
  @rescomp << ' --define WXUSINGDLL'
179
179
  @extra_cflags << '-DISOLATION_AWARE_ENABLED'
180
- if @wx_version >= '3.3.0'
180
+ if wx_version_check('3.3.0') >= 0
181
181
  @extra_cflags << '-D_UNICODE' << '-DUNICODE'
182
182
  end
183
183
  end
@@ -728,6 +728,12 @@ module WXRuby3
728
728
  @wx_version || ''
729
729
  end
730
730
 
731
+ def wx_version_check(ver)
732
+ @wx_version_list ||= (@wx_version || '0.0.0').split('.').collect {|s| s.to_i }
733
+ ver = ver.split('.').collect {|s| s.to_i } unless ::Array === ver
734
+ @wx_version_list <=> ver
735
+ end
736
+
731
737
  def mingw?
732
738
  @platform == :mingw
733
739
  end
@@ -19,6 +19,39 @@ module WXRuby3
19
19
  spec.disable_proxies
20
20
 
21
21
  spec.map_apply 'int * OUTPUT' => ['wxDouble *']
22
+ spec.ignore 'wxAffineMatrix2DBase::TransformPoint(wxDouble*, wxDouble*)',
23
+ 'wxAffineMatrix2DBase::TransformDistance(wxDouble*, wxDouble*)'
24
+
25
+ spec.map 'wxPoint2DDouble&' => 'Array(Float, Float), Wx::Point2DDouble' do
26
+ add_header_code '#include <memory>'
27
+ map_in temp: 'std::unique_ptr<$1_basetype> tmp', code: <<~__CODE
28
+ if ( TYPE($input) == T_DATA )
29
+ {
30
+ void* argp$argnum;
31
+ SWIG_ConvertPtr($input, &argp$argnum, $1_descriptor, 0);
32
+ $1 = reinterpret_cast< $1_basetype * >(argp$argnum);
33
+ }
34
+ else if ( TYPE($input) == T_ARRAY )
35
+ {
36
+ $1 = new $1_basetype( NUM2DBL( rb_ary_entry($input, 0) ),
37
+ NUM2DBL( rb_ary_entry($input, 1) ) );
38
+ tmp.reset($1); // auto destruct when method scope ends
39
+ }
40
+ else
41
+ {
42
+ rb_raise(rb_eTypeError, "Wrong type for $1_basetype parameter");
43
+ }
44
+ __CODE
45
+ map_typecheck precedence: 'POINTER', code: <<~__CODE
46
+ void *vptr = 0;
47
+ $1 = 0;
48
+ if (TYPE($input) == T_ARRAY && RARRAY_LEN($input) == 2)
49
+ $1 = 1;
50
+ else if (TYPE($input) == T_DATA && SWIG_CheckState (SWIG_ConvertPtr ($input, &vptr, $1_descriptor, 0)))
51
+ $1 = 1;
52
+ __CODE
53
+ end
54
+
22
55
  spec.map 'wxPoint2DDouble *' => 'Wx::Point2DDouble' do
23
56
  map_in ignore: true, temp: 'wxPoint2DDouble tmp', code: '$1 = &tmp;'
24
57
 
@@ -21,7 +21,7 @@ module WXRuby3
21
21
  spec.items << 'wxGenericAnimationCtrl'
22
22
  spec.include 'wx/animate.h'
23
23
  spec.include 'wx/generic/animate.h'
24
- if Config.instance.wx_version >= '3.3.0'
24
+ if Config.instance.wx_version_check('3.3.0') >= 0
25
25
  spec.items << 'wxAnimationBundle'
26
26
  spec.ignore 'wxAnimationBundle::GetAll', ignore_doc: false
27
27
  spec.add_extend_code 'wxAnimationBundle', <<~__HEREDOC
@@ -16,7 +16,7 @@ module WXRuby3
16
16
 
17
17
  def setup
18
18
  spec.items << 'wxAppConsole' << 'wxEventFilter'
19
- if Config.instance.wx_version >= '3.3.0'
19
+ if Config.instance.wx_version_check('3.3.0') >= 0
20
20
  spec.items << 'wxDarkModeSettings'
21
21
  spec.ignore_unless('WXMSW', 'wxDarkModeSettings', 'wxMenuColour')
22
22
  if Config.instance.features_set?('WXMSW')
@@ -17,7 +17,7 @@ module WXRuby3
17
17
  def setup
18
18
  super
19
19
  spec.gc_as_object 'wxAuiManager'
20
- if Config.instance.wx_version >= '3.3.0'
20
+ if Config.instance.wx_version_check('3.3.0') >= 0
21
21
  spec.items << 'wxAuiBookSerializer' << 'wxAuiSerializer' <<
22
22
  'wxAuiDockLayoutInfo' << 'wxAuiPaneLayoutInfo' << 'wxAuiTabLayoutInfo' <<
23
23
  'wxAuiBookDeserializer' << 'wxAuiDeserializer'
@@ -303,7 +303,7 @@ module WXRuby3
303
303
 
304
304
  def gen_class_doc_members(fdoc, clsdef, cls_members, alias_methods)
305
305
  super
306
- if Config.instance.wx_version >= '3.3.0' && clsdef.name == 'wxAuiTabLayoutInfo'
306
+ if Config.instance.wx_version_check('3.3.0') >= 0 && clsdef.name == 'wxAuiTabLayoutInfo'
307
307
  fdoc.doc.puts 'Returns the indices of the pages in this tab control in their order on screen.'
308
308
  fdoc.doc.puts 'If this array is empty, it means that the tab control contains all notebook pages in natural order.'
309
309
  fdoc.doc.puts '@return [::Array<Integer>] indices of the pages in this tab control'
@@ -24,7 +24,7 @@ module WXRuby3
24
24
  wxAuiNotebookPage::tooltip
25
25
  wxAuiNotebookPage::bitmap
26
26
  wxAuiNotebookPage::active]
27
- if Config.instance.wx_version >= '3.3.0'
27
+ if Config.instance.wx_version_check('3.3.0') >= 0
28
28
  spec.items << 'wxAuiNotebookPosition'
29
29
  spec.regard 'wxAuiNotebookPosition::tabCtrl',
30
30
  'wxAuiNotebookPosition::tabIdx'
@@ -14,7 +14,7 @@ module WXRuby3
14
14
 
15
15
  def setup
16
16
  super
17
- if Config.instance.wx_version >= '3.3.0'
17
+ if Config.instance.wx_version_check('3.3.0') >= 0
18
18
  spec.items << 'wxAuiFlatTabArt' << 'wxAuiSimpleTabArt'
19
19
  spec.ignore 'wxAuiDefaultTabArt', 'wxAuiNativeTabArt'
20
20
  else
@@ -117,7 +117,7 @@ module WXRuby3
117
117
 
118
118
  def gen_interface_classes(fout)
119
119
  super
120
- if Config.instance.wx_version >= '3.3.0'
120
+ if Config.instance.wx_version_check('3.3.0') >= 0
121
121
  fout.puts
122
122
  fout.puts 'class wxAuiNativeTabArt : public wxAuiTabArt'
123
123
  fout.puts '{'
@@ -130,7 +130,7 @@ module WXRuby3
130
130
  class AuiTabArtDocGenerator < DocGenerator
131
131
  def gen_class_doc(fdoc)
132
132
  super
133
- if Config.instance.wx_version >= '3.3.0'
133
+ if Config.instance.wx_version_check('3.3.0') >= 0
134
134
  fdoc.doc.puts 'Wx::AUI::AuiNativeTabArt is either an art provider providing native-like appearance (WXMSW and WXGTK) or a generic Tab Art provider if not available.'
135
135
  fdoc.puts 'class AuiNativeTabArt < AuiTabArt; end'
136
136
  fdoc.puts
@@ -138,7 +138,7 @@ module WXRuby3
138
138
  end
139
139
  def gen_constants_doc(fdoc)
140
140
  super
141
- if Config.instance.wx_version >= '3.3.0'
141
+ if Config.instance.wx_version_check('3.3.0') >= 0
142
142
  fdoc.doc.puts 'Wx::AUI::AuiDefaultTabArt is an alias for the tab art provider used by {Wx::AUI::AuiNotebook} by default.'
143
143
  fdoc.doc.puts 'Since wxWidgets 3.3.0, this is {Wx::AUI::AuiFlatTabArt} under all platforms. In the previous versions, this was wxAuiNativeTabArt.'
144
144
  fdoc.puts 'AuiDefaultTabArt = Wx::AUI::AuiFlatTabArt'
@@ -54,7 +54,7 @@ module WXRuby3
54
54
  'wxItemContainer::Append(const wxArrayString &, wxClientData **)',
55
55
  'wxItemContainer::Insert(const wxArrayString &, unsigned int, wxClientData **)',
56
56
  'wxItemContainer::Set(const wxArrayString &, wxClientData **)'], ignore_doc: false)
57
- if Config.instance.wx_version < '3.3.0'
57
+ if Config.instance.wx_version_check('3.3.0') < 0
58
58
  # add undocumented method
59
59
  spec.extend_interface 'wxControlWithItems',
60
60
  'bool IsSorted() const'
@@ -21,8 +21,18 @@ module WXRuby3
21
21
  'wxCursor::wxCursor(const char *const *)',
22
22
  'wxCursor::wxCursor(const wxCursor &)'
23
23
  spec.ignore 'wxCursor::wxCursor(const char *const *)'
24
- if Config.instance.wx_version >= '3.3.0'
24
+ if Config.instance.wx_version_check('3.3.0') >= 0
25
25
  spec.ignore 'wxCursor::wxCursor(const char[],int,int,int,int,const char[], const wxColour*, const wxColour*)'
26
+
27
+ spec.items << 'wxCursorBundle'
28
+ spec.gc_as_untracked 'wxCursorBundle'
29
+ # all but the default ctor require a running App
30
+ spec.require_app 'wxCursorBundle::wxCursorBundle(const wxBitmapBundle &, const wxPoint &)',
31
+ 'wxCursorBundle::wxCursorBundle(const wxBitmapBundle &, int, int)',
32
+ 'wxCursorBundle::wxCursorBundle(const wxCursorBundle &)'
33
+ # add undocumented but useful ctor
34
+ spec.extend_interface 'wxCursorBundle',
35
+ 'wxCursorBundle(const wxCursor& cursor)'
26
36
  else
27
37
  spec.ignore 'wxCursor::wxCursor(const char[],int,int,int,int,const char[])'
28
38
  end
@@ -16,7 +16,7 @@ module WXRuby3
16
16
 
17
17
  def setup
18
18
  super
19
- _readDC = if Config.instance.wx_version >= '3.3.0'
19
+ _readDC = if Config.instance.wx_version_check('3.3.0') >= 0
20
20
  spec.items.unshift 'wxReadOnlyDC' # prepend before wxDC
21
21
  spec.items << 'wxInfoDC'
22
22
  'wxReadOnlyDC'
@@ -70,7 +70,7 @@ module WXRuby3
70
70
  # for GetUserScale and GetLogicalScale
71
71
  spec.map_apply 'double * OUTPUT' => 'double *'
72
72
  spec.swig_import 'swig/classes/include/wxGDICommon.h'
73
- if Config.instance.wx_version >= '3.3.0'
73
+ if Config.instance.wx_version_check('3.3.0') >= 0
74
74
  # add similar block-style creator as #draw_on methods
75
75
  spec.add_extend_code 'wxInfoDC', <<~__HEREDOC
76
76
  static VALUE inform_on(wxWindow* win)
@@ -32,7 +32,7 @@ module WXRuby3
32
32
  wxDELETEA
33
33
  wxSwap
34
34
  }
35
- if Config.instance.wx_version >= '3.2.7'
35
+ if Config.instance.wx_version_check('3.2.7') >= 0
36
36
  spec.ignore %w[wxWARN_UNUSED]
37
37
  end
38
38
  spec.ignore 'wxOVERRIDE'
@@ -18,7 +18,7 @@ module WXRuby3
18
18
  spec.gc_as_untracked spec.module_name
19
19
  case spec.module_name
20
20
  when 'wxScreenDC'
21
- spec.override_inheritance_chain('wxScreenDC', ['wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version >= '3.3.0'
21
+ spec.override_inheritance_chain('wxScreenDC', ['wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version_check('3.3.0') >= 0
22
22
  spec.make_abstract 'wxScreenDC'
23
23
  # as a ScreenDC should always be a temporary stack object
24
24
  # we do not allow creation in Ruby but rather provide a class
@@ -44,7 +44,7 @@ module WXRuby3
44
44
  'wxScreenDC::EndDrawingOnTop',
45
45
  'wxScreenDC::wxScreenDC'
46
46
  when 'wxClientDC'
47
- spec.override_inheritance_chain('wxClientDC', ['wxWindowDC', 'wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version >= '3.3.0'
47
+ spec.override_inheritance_chain('wxClientDC', ['wxWindowDC', 'wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version_check('3.3.0') >= 0
48
48
  spec.make_abstract 'wxClientDC'
49
49
  spec.ignore 'wxClientDC::wxClientDC'
50
50
  # as a ClientDC should best always be a temporary stack object
@@ -67,7 +67,7 @@ module WXRuby3
67
67
  }
68
68
  __HEREDOC
69
69
  when 'wxPaintDC'
70
- spec.override_inheritance_chain('wxPaintDC', ['wxClientDC', 'wxWindowDC', 'wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version >= '3.3.0'
70
+ spec.override_inheritance_chain('wxPaintDC', ['wxClientDC', 'wxWindowDC', 'wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version_check('3.3.0') >= 0
71
71
  spec.make_abstract 'wxPaintDC'
72
72
  spec.ignore 'wxPaintDC::wxPaintDC'
73
73
  spec.add_header_code <<~__HEREDOC
@@ -92,10 +92,10 @@ module WXRuby3
92
92
  __HEREDOC
93
93
  when 'wxMemoryDC'
94
94
  spec.items << 'wxBufferedDC' << 'wxBufferedPaintDC'
95
- spec.override_inheritance_chain('wxMemoryDC', ['wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version >= '3.3.0'
95
+ spec.override_inheritance_chain('wxMemoryDC', ['wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version_check('3.3.0') >= 0
96
96
  spec.gc_as_untracked %w[wxBufferedDC wxBufferedPaintDC]
97
- spec.override_inheritance_chain('wxBufferedDC', ['wxMemoryDC', 'wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version >= '3.3.0'
98
- spec.override_inheritance_chain('wxBufferedPaintDC', ['wxBufferedDC', 'wxMemoryDC', 'wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version >= '3.3.0'
97
+ spec.override_inheritance_chain('wxBufferedDC', ['wxMemoryDC', 'wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version_check('3.3.0') >= 0
98
+ spec.override_inheritance_chain('wxBufferedPaintDC', ['wxBufferedDC', 'wxMemoryDC', 'wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version_check('3.3.0') >= 0
99
99
  spec.make_abstract 'wxMemoryDC'
100
100
  spec.make_abstract 'wxBufferedDC'
101
101
  spec.make_abstract 'wxBufferedPaintDC'
@@ -224,7 +224,7 @@ module WXRuby3
224
224
  }
225
225
  __HEREDOC
226
226
  when 'wxMirrorDC'
227
- spec.override_inheritance_chain('wxMirrorDC', ['wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version >= '3.3.0'
227
+ spec.override_inheritance_chain('wxMirrorDC', ['wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version_check('3.3.0') >= 0
228
228
  spec.make_abstract 'wxMirrorDC'
229
229
  spec.ignore 'wxMirrorDC::wxMirrorDC'
230
230
  # as a MirrorDC should best always be a temporary stack object
@@ -247,7 +247,7 @@ module WXRuby3
247
247
  }
248
248
  __HEREDOC
249
249
  when 'wxSVGFileDC'
250
- spec.override_inheritance_chain('wxSVGFileDC', ['wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version >= '3.3.0'
250
+ spec.override_inheritance_chain('wxSVGFileDC', ['wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version_check('3.3.0') >= 0
251
251
  spec.items.concat %w[wxSVGBitmapHandler wxSVGBitmapFileHandler wxSVGBitmapEmbedHandler]
252
252
  spec.make_abstract 'wxSVGFileDC'
253
253
  spec.ignore 'wxSVGFileDC::wxSVGFileDC'
@@ -285,7 +285,7 @@ module WXRuby3
285
285
  'wxSVGFileDC::StartPage',
286
286
  'wxSVGFileDC::EndPage'
287
287
  when 'wxGCDC'
288
- spec.override_inheritance_chain('wxGCDC', ['wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version >= '3.3.0'
288
+ spec.override_inheritance_chain('wxGCDC', ['wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version_check('3.3.0') >= 0
289
289
  spec.make_abstract 'wxGCDC'
290
290
  spec.ignore 'wxGCDC::wxGCDC'
291
291
  # like all DC this should best always be a temporary stack object
@@ -391,7 +391,7 @@ module WXRuby3
391
391
  spec.ignore 'wxGCDC::wxGCDC(const wxEnhMetaFileDC &)'
392
392
  when 'wxScaledDC'
393
393
  spec.items.clear # wxRuby extension; no XML docs
394
- if Config.instance.wx_version >= '3.3.0'
394
+ if Config.instance.wx_version_check('3.3.0') >= 0
395
395
  spec.override_inheritance_chain('wxScaledDC', ['wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject'])
396
396
  else
397
397
  spec.override_inheritance_chain('wxScaledDC', %w[wxDC wxObject])
@@ -435,7 +435,7 @@ module WXRuby3
435
435
  };
436
436
  __HEREDOC
437
437
  when 'wxPrinterDC'
438
- spec.override_inheritance_chain('wxPrinterDC', ['wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version >= '3.3.0'
438
+ spec.override_inheritance_chain('wxPrinterDC', ['wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version_check('3.3.0') >= 0
439
439
  spec.make_abstract 'wxPrinterDC'
440
440
  spec.ignore 'wxPrinterDC::wxPrinterDC'
441
441
  # as a PrinterDC should best always be a temporary stack object
@@ -458,7 +458,7 @@ module WXRuby3
458
458
  }
459
459
  __HEREDOC
460
460
  when 'wxPostScriptDC'
461
- spec.override_inheritance_chain('wxPostScriptDC', ['wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version >= '3.3.0'
461
+ spec.override_inheritance_chain('wxPostScriptDC', ['wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version_check('3.3.0') >= 0
462
462
  spec.make_abstract 'wxPostScriptDC'
463
463
  spec.ignore 'wxPostScriptDC::wxPostScriptDC'
464
464
  # as a PostScriptDC should best always be a temporary stack object
@@ -514,7 +514,7 @@ module WXRuby3
514
514
  return rc;
515
515
  }
516
516
  __HEREDOC
517
- if Config.instance.wx_version >= '3.3.0'
517
+ if Config.instance.wx_version_check('3.3.0') >= 0
518
518
  spec.items << 'wxOverlayDC'
519
519
  spec.override_inheritance_chain('wxOverlayDC', ['wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject'])
520
520
  spec.make_abstract 'wxOverlayDC'
@@ -551,7 +551,7 @@ module WXRuby3
551
551
  __HEREDOC
552
552
  end
553
553
  else
554
- spec.override_inheritance_chain(spec.module_name, ['wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version >= '3.3.0'
554
+ spec.override_inheritance_chain(spec.module_name, ['wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version_check('3.3.0') >= 0
555
555
  # ctors of all other derived DC require a running App
556
556
  spec.require_app spec.module_name
557
557
  end
@@ -84,7 +84,7 @@ module WXRuby3
84
84
  end
85
85
  when 'wxFontDialog'
86
86
  # ignore the non-const version
87
- if Config.platform == :macosx && Config.instance.wx_version < '3.3'
87
+ if Config.platform == :macosx && Config.instance.wx_version_check('3.3') < 0
88
88
  # MacOSX implementation is incorrect so we need to use
89
89
  # the non-const definition here
90
90
  spec.ignore 'wxFontDialog::GetFontData() const'
@@ -103,7 +103,7 @@ module WXRuby3
103
103
  __CODE
104
104
  end
105
105
  spec.ignore 'wxFileDialog::SetExtraControlCreator'
106
- if Config.instance.wx_version >= '3.2.1'
106
+ if Config.instance.wx_version_check('3.2.1') >= 0
107
107
  # doc does not seem to match actual header code so just ignore for now
108
108
  spec.ignore('wxFileDialog::AddShortcut')
109
109
  end
@@ -252,7 +252,7 @@ module WXRuby3
252
252
  spec.regard 'wxGenericAboutDialog::DoAddCustomControls',
253
253
  'wxGenericAboutDialog::AddControl',
254
254
  'wxGenericAboutDialog::AddText'
255
- if Config.instance.wx_version >= '3.3.0'
255
+ if Config.instance.wx_version_check('3.3.0') >= 0
256
256
  spec.regard 'wxGenericAboutDialog::GetCustomControlParent'
257
257
  end
258
258
  if Config.instance.features_set?('USE_COLLPANE')
@@ -22,7 +22,7 @@ module WXRuby3
22
22
  spec.ignore %w{
23
23
  wxTheColourDatabase
24
24
  }
25
- if Config.instance.wx_version >= '3.3.0'
25
+ if Config.instance.wx_version_check('3.3.0') >= 0
26
26
  spec.ignore 'wxColourDatabase::GetAllNames', ignore_doc: false
27
27
  spec.add_extend_code 'wxColourDatabase', <<~__HEREDOC
28
28
  VALUE get_all_names() const
@@ -49,7 +49,7 @@ module WXRuby3
49
49
  'wxRect::Intersect(const wxRect &)',
50
50
  'wxRect::Union(const wxRect &)'
51
51
  ]
52
- if Config.instance.wx_version >= '3.3.0'
52
+ if Config.instance.wx_version_check('3.3.0') >= 0
53
53
  # ignore these as they are supposed to specify unary minus but confuse
54
54
  # SWIG
55
55
  spec.ignore 'wxPoint::operator-(const wxPoint&)'