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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3ea544cb7fe32dce3bbef74d16dc56ebe6fe8cb0ff381cbeee3a5ee9a37471d5
4
- data.tar.gz: 2afddf4097dffcf4ee6bb4ed649d86165dd5e1decea9f330c27792e95eb2447d
3
+ metadata.gz: 74651be50bce49af8e8f2f5cfa6b75a103719aa06ac0cec8846a19397e6e32e8
4
+ data.tar.gz: aa9b54f0317028cf4677723c32926223115c0672b95484cec7586a42bf290ed5
5
5
  SHA512:
6
- metadata.gz: 03f848a8b259e10f1a7dfe74505361825e2819cbc8fd2f20d5ca1f1990afa9d9fea4abecaa5bbdda4129864c4f24aa22fb7b1508fc2632839f0d7ffa89919cba
7
- data.tar.gz: e187a4d0fd6c3f4985afae321228e6956e56df349001e2f6478ea458bafaf4bd5e8210d94de963270820eaedc7ff8de9f3b60684cc493415ce5ad67d4741a228
6
+ metadata.gz: daf1119a3e6c64bb5c42b2ab52ea9c553852e165392f8f98d51f89e0600edddfce5b1a9c4c57753f72c8b4da7a7eb8a883f0f01ec81c139c4cebb30b818a74a6
7
+ data.tar.gz: 682f3174d7accd03170735daf81d570f3895fec6594d7713db4fa99b9adfc21e5b91b9f85a670c5a2764369e59cebdc0978dabad37fb26c34d0bb62fcd8a9b34
@@ -28,6 +28,7 @@ extern VALUE mWxCore;
28
28
  %constant wxPen* const wxRED_PEN;
29
29
  %constant wxPen* const wxCYAN_PEN;
30
30
  %constant wxPen* const wxGREEN_PEN;
31
+ %constant wxPen* const wxBLUE_PEN;
31
32
  %constant wxPen* const wxBLACK_PEN;
32
33
  %constant wxPen* const wxWHITE_PEN;
33
34
  %constant wxPen* const wxTRANSPARENT_PEN;
@@ -9,7 +9,7 @@ class Wx::AUI::AuiFloatingFrame
9
9
  # Before wxWidgets 3.3 the AUI manager of this control would prevent
10
10
  # WindowDestroyEvent propagation so we 'patch' in a std event handler
11
11
  # that designates the event skipped.
12
- if Wx::WXWIDGETS_VERSION < '3.3'
12
+ if Wx.before_wxwidgets?('3.3')
13
13
  wx_initialize = instance_method :initialize
14
14
  wx_redefine_method :initialize do |*args|
15
15
  wx_initialize.bind(self).call(*args)
@@ -31,7 +31,7 @@ module Wx
31
31
  end
32
32
  end
33
33
 
34
- if WXWIDGETS_VERSION >= '3.3.0'
34
+ if Wx.at_least_wxwidgets?('3.3.0')
35
35
 
36
36
  class AuiTabLayoutInfo < AuiDockLayoutInfo
37
37
 
@@ -7,7 +7,7 @@
7
7
  module Wx
8
8
  module AUI
9
9
 
10
- if Wx::WXWIDGETS_VERSION >= '3.3'
10
+ if Wx.at_least_wxwidgets?('3.3.0')
11
11
  AuiDefaultTabArt = AuiFlatTabArt
12
12
  end
13
13
 
@@ -16,7 +16,7 @@ module Wx
16
16
  # Before wxWidgets 3.3 the AUI manager of this control would prevent
17
17
  # WindowDestroyEvent propagation so we 'patch' in a std event handler
18
18
  # that designates the event skipped.
19
- if Wx::WXWIDGETS_VERSION < '3.3'
19
+ if Wx.before_wxwidgets?('3.3')
20
20
  wx_initialize = instance_method :initialize
21
21
  wx_redefine_method :initialize do |*args|
22
22
  wx_initialize.bind(self).call(*args)
@@ -27,7 +27,7 @@ module Wx
27
27
  end
28
28
  end
29
29
 
30
- if Wx::WXWIDGETS_VERSION >= '3.3.0'
30
+ if Wx.at_least_wxwidgets?('3.3.0')
31
31
 
32
32
  class AnimationCtrl
33
33
 
@@ -19,4 +19,14 @@ module Wx
19
19
  Cursor.new(art_file, bmp_type || Wx::Bitmap::BITMAP_TYPE_GUESS[File.extname(art_file).sub(/\A\./,'')], *rest)
20
20
  end
21
21
 
22
+ if at_least_wxwidgets?('3.3.0')
23
+ class << self
24
+
25
+ wx_set_cursor = instance_method :set_cursor
26
+ wx_redefine_method :set_cursor do |cursor|
27
+ wx_set_cursor.bind(self).call(cursor.is_a?(Wx::Cursor) ? Wx::CursorBundle.new(cursor) : cursor)
28
+ end
29
+ end
30
+ end
31
+
22
32
  end
@@ -37,7 +37,7 @@ module Wx
37
37
  end
38
38
  DF_FILENAME = DataFormat.new( Wx::DataFormatId::DF_FILENAME )
39
39
  DF_UNICODETEXT = DataFormat.new( Wx::DataFormatId::DF_UNICODETEXT )
40
- if Wx.has_feature?(:USE_HTML) && Wx::WXWIDGETS_VERSION >= '3.3'
40
+ if Wx.has_feature?(:USE_HTML) && Wx.at_least_wxwidgets?('3.3.0')
41
41
  DF_HTML = DataFormat.new( Wx::DataFormatId::DF_HTML )
42
42
  end
43
43
  end
@@ -55,7 +55,7 @@ class Wx::Dialog
55
55
  functor_nm = scope.pop
56
56
  code = <<~__CODE
57
57
  def #{functor_nm}(*args, **kwargs, &block)
58
- dlg = #{klass.name}.new(*args, **kwargs)
58
+ dlg = kwargs.empty? ? #{klass.name}.new(*args) : #{klass.name}.new(*args, **kwargs)
59
59
  begin
60
60
  if block_given?
61
61
  return block.call(dlg)
@@ -23,7 +23,7 @@ module Wx
23
23
  class FileDialogCustomizeHook
24
24
 
25
25
  # prevent construction of abstract base
26
- if RUBY_VERSION < '2.7.0'
26
+ if (RUBY_VERSION.split('.').collect {|v| v.to_i} <=> [2,7,0]) < 0
27
27
  def self.new(*)
28
28
  raise NotImplementedError, 'Wx::FileDialogCustomizeHook is an abstract class.' if self == Wx::FileDialogCustomizeHook
29
29
  super
@@ -28,6 +28,10 @@ module Wx
28
28
  self
29
29
  end
30
30
 
31
+ def to_ary
32
+ [self.x, self.y]
33
+ end
34
+
31
35
  def add!(pt)
32
36
  add(pt)
33
37
  self
@@ -81,6 +85,10 @@ module Wx
81
85
  self
82
86
  end
83
87
 
88
+ def to_ary
89
+ [self.x, self.y]
90
+ end
91
+
84
92
  def add!(pt)
85
93
  add(pt)
86
94
  self
@@ -118,4 +126,30 @@ module Wx
118
126
  end
119
127
 
120
128
  end
129
+
130
+ class Rect2DDouble
131
+
132
+ wx_assign = instance_method :assign
133
+ wx_redefine_method :assign do |pt|
134
+ wx_assign.bind(self).call(pt)
135
+ self
136
+ end
137
+
138
+ def to_ary
139
+ [self.x, self.y, self.width, self.height]
140
+ end
141
+
142
+ def self.intersect(src1, src2)
143
+ int = Rect2DDouble.new(src1.to_ary)
144
+ int.intersect(src2)
145
+ int
146
+ end
147
+
148
+ def self.union(src1, src2)
149
+ u = Rect2DDouble.new(src1.to_ary)
150
+ u.union(src2)
151
+ u
152
+ end
153
+
154
+ end
121
155
  end
@@ -24,6 +24,28 @@ class Wx::HBoxSizer < Wx::BoxSizer
24
24
  end
25
25
  end
26
26
 
27
+ class Wx::HStaticBoxSizer < Wx::StaticBoxSizer
28
+ def initialize(box_or_window, *rest, &block)
29
+ if box_or_window.is_a?(Wx::StaticBox)
30
+ raise ArgumentError, "Unexpected argument(s) #{rest}" unless rest.empty?
31
+ super(box_or_window, Wx::HORIZONTAL, &nil)
32
+ else
33
+ raise ArgumentError, "Unexpected argument(s) #{rest}" unless rest.size <= 1
34
+ super(Wx::HORIZONTAL, box_or_window, *rest, &block)
35
+ end
36
+ if block
37
+ if block.arity == -1 or block.arity == 0
38
+ self.instance_eval(&block)
39
+ elsif block.arity == 1
40
+ block.call(self)
41
+ else
42
+ Kernel.raise ArgumentError,
43
+ "Block to initialize should accept a single argument or none"
44
+ end
45
+ end
46
+ end
47
+ end
48
+
27
49
  # Just a shortcut version for creating a horizontal wrap sizer
28
50
  class Wx::HWrapSizer < Wx::WrapSizer
29
51
  def initialize(flags=Wx::WRAPSIZER_DEFAULT_FLAGS, &block)
@@ -0,0 +1,18 @@
1
+ # Copyright (c) 2023 M.J.N. Corino, The Netherlands
2
+ #
3
+ # This software is released under the MIT license.
4
+ #
5
+ # Some parts are
6
+ # Copyright 2004-2007, wxRuby development team
7
+ # released under the MIT-like wxRuby2 license
8
+
9
+ module Wx
10
+
11
+ if Wx::PLATFORM == 'WXOSX'
12
+
13
+ # functionally identical for MacOS
14
+ GenericHyperlinkCtrl = HyperlinkCtrl
15
+
16
+ end
17
+
18
+ end
data/lib/wx/core/point.rb CHANGED
@@ -41,12 +41,21 @@ class Wx::Point
41
41
  end
42
42
 
43
43
  def <=>(other)
44
+ this_x, this_y = to_ary
44
45
  if Wx::Point === other
45
- (x*y) <=> (other.x*other.y)
46
+ that_x, that_y = other.to_ary
46
47
  elsif Array === other && other.size == 2
47
- (x*y) <=> (other.first.to_i*other.last.to_i)
48
+ that_x, that_y = other
48
49
  else
49
- nil
50
+ return nil
51
+ end
52
+
53
+ if this_y < that_y
54
+ -1
55
+ elsif that_y < this_y
56
+ 1
57
+ else
58
+ this_x <=> that_x
50
59
  end
51
60
  end
52
61
 
@@ -0,0 +1,58 @@
1
+ # Copyright (c) 2023 M.J.N. Corino, The Netherlands
2
+ #
3
+ # This software is released under the MIT license.
4
+ #
5
+ # Some parts are
6
+ # Copyright 2004-2007, wxRuby development team
7
+ # released under the MIT-like wxRuby2 license
8
+
9
+ module Wx
10
+
11
+ class Position
12
+
13
+ include Comparable
14
+
15
+ # make Position usable for parallel assignments like `r, c = pos`
16
+ def to_ary
17
+ [row, col]
18
+ end
19
+
20
+ # Compare with another position value
21
+ def <=>(other)
22
+ this_row, this_col = to_ary
23
+ if Wx::Position === other
24
+ that_row, that_col = other.to_ary
25
+ elsif Array === other and other.size == 2
26
+ that_row, that_col = other
27
+ else
28
+ return nil
29
+ end
30
+
31
+ if this_row < that_row
32
+ -1
33
+ elsif that_row < this_row
34
+ 1
35
+ else
36
+ this_col <=> that_col
37
+ end
38
+ end
39
+
40
+ def eql?(other)
41
+ if other.instance_of?(self.class)
42
+ self == other
43
+ else
44
+ false
45
+ end
46
+ end
47
+
48
+ def hash
49
+ to_ary.hash
50
+ end
51
+
52
+ def dup
53
+ Wx::Position.new(*self.to_ary)
54
+ end
55
+
56
+ end
57
+
58
+ end
data/lib/wx/core/sizer.rb CHANGED
@@ -10,44 +10,71 @@
10
10
 
11
11
  module Wx
12
12
  class Sizer
13
- # Generic method to add items, supporting positional and named
13
+ # Redefine #add and #insert methods to support positional and named
14
14
  # arguments
15
- ADD_ITEM_PARAMS = [Wx::Parameter[:index, -1],
16
- Wx::Parameter[:proportion, 0],
17
- Wx::Parameter[:flag, 0],
18
- Wx::Parameter[:border, 0]]
15
+ SIZER_ADD_PARAMS = [Wx::Parameter[:proportion, 0],
16
+ Wx::Parameter[:flag, 0],
17
+ Wx::Parameter[:border, 0],
18
+ Wx::Parameter[:userData, nil]]
19
19
 
20
- def add_item(item, *mixed_args)
20
+ wx_sizer_add = instance_method :add
21
+ wx_redefine_method :add do |*args, **kwargs|
21
22
 
22
- begin
23
- args = Wx::args_as_list(ADD_ITEM_PARAMS, *mixed_args)
24
- rescue => err
25
- err.set_backtrace(caller)
26
- Kernel.raise err
27
- end
23
+ if args.last.is_a?(Wx::SizerFlags) # using 'flags' variant?
24
+ wx_sizer_add.bind(self).call(*args) # no need for keyword scanning
25
+ else
26
+ full_args = []
28
27
 
29
- full_args = []
28
+ full_args << args.shift # get first argument
30
29
 
31
- # extract the width and the height in the case of a spacer
32
- # defined as an array
33
- if item.kind_of?(Array)
34
- Kernel.raise ArgumentError,
35
- "Invalid Sizer specification : [width, height] expected" if item.size != 2
36
- full_args << item[0] << item[1]
37
- else
38
- full_args << item
30
+ unless full_args.first.is_a?(Wx::Window) || full_args.first.is_a?(Wx::Sizer)
31
+ full_args << args.shift # must be spacer variant, get height argument as well
32
+ end
33
+
34
+ begin
35
+ args = Wx::args_as_list(SIZER_ADD_PARAMS, *args, **kwargs)
36
+ rescue => err
37
+ err.set_backtrace(caller)
38
+ Kernel.raise err
39
+ end
40
+
41
+ # update the full arguments list with the optional arguments
42
+ full_args.concat(args)
43
+
44
+ # Call original add with full args
45
+ wx_sizer_add.bind(self).call(*full_args)
39
46
  end
40
47
 
41
- # update the full arguments list with the optional arguments (except index)
42
- idx = args.shift
43
- full_args.concat(args)
48
+ end
44
49
 
45
- # Call add to append if default position
46
- if idx == -1
47
- add(*full_args)
50
+ wx_sizer_insert = instance_method :insert
51
+ wx_redefine_method :insert do |index, *args, **kwargs|
52
+
53
+ if args.last.is_a?(Wx::SizerFlags) # using 'flags' variant?
54
+ wx_sizer_insert.bind(self).call(index, *args) # no need for keyword scanning
48
55
  else
49
- insert(idx, *full_args)
56
+ full_args = []
57
+
58
+ full_args << args.shift # get first argument after index
59
+
60
+ unless full_args.first.is_a?(Wx::Window) || full_args.first.is_a?(Wx::Sizer)
61
+ full_args << args.shift # must be spacer variant, get height argument as well
62
+ end
63
+
64
+ begin
65
+ args = Wx::args_as_list(SIZER_ADD_PARAMS, *args, **kwargs)
66
+ rescue => err
67
+ err.set_backtrace(caller)
68
+ Kernel.raise err
69
+ end
70
+
71
+ # update the full arguments list with the optional arguments
72
+ full_args.concat(args)
73
+
74
+ # Call original insert with full args
75
+ wx_sizer_insert.bind(self).call(index, *full_args)
50
76
  end
77
+
51
78
  end
52
79
 
53
80
  # Overload to provide Enumerator without block
@@ -169,6 +196,42 @@ module Wx
169
196
 
170
197
  class GridBagSizer < FlexGridSizer
171
198
 
199
+ # Redefine #add method to support positional and named
200
+ # arguments
201
+ GBSIZER_ADD_PARAMS = [Wx::Parameter[:span, Wx::DEFAULT_SPAN],
202
+ Wx::Parameter[:flag, 0],
203
+ Wx::Parameter[:border, 0],
204
+ Wx::Parameter[:userData, nil]]
205
+
206
+ wx_gbsizer_add = instance_method :add
207
+ wx_redefine_method :add do |*args, **kwargs|
208
+
209
+ full_args = []
210
+
211
+ full_args << args.shift # get first argument
212
+
213
+ unless full_args.first.is_a?(Wx::Window) || full_args.first.is_a?(Wx::Sizer)
214
+ full_args << args.shift # must be spacer variant, get height argument as well
215
+ end
216
+
217
+ # get mandatory pos arg
218
+ full_args << args.shift
219
+
220
+ begin
221
+ args = Wx::args_as_list(GBSIZER_ADD_PARAMS, *args, **kwargs)
222
+ rescue => err
223
+ err.set_backtrace(caller)
224
+ Kernel.raise err
225
+ end
226
+
227
+ # update the full arguments list with the optional arguments
228
+ full_args.concat(args)
229
+
230
+ # Call original add with full args
231
+ wx_gbsizer_add.bind(self).call(*full_args)
232
+
233
+ end
234
+
172
235
  wx_initialize = instance_method :initialize
173
236
  wx_redefine_method :initialize do |*args, &block|
174
237
  wx_initialize.bind(self).call(*args)
@@ -186,4 +249,76 @@ module Wx
186
249
 
187
250
  end
188
251
 
252
+ class GBPosition
253
+
254
+ include Comparable
255
+
256
+ # make GBPosition usable for parallel assignments like `r, c = pos`
257
+ def to_ary
258
+ [row, col]
259
+ end
260
+
261
+ # Compare with another position value
262
+ def <=>(other)
263
+ this_row, this_col = to_ary
264
+ if Wx::GBPosition === other
265
+ that_row, that_col = other.to_ary
266
+ elsif Array === other and other.size == 2
267
+ that_row, that_col = other
268
+ else
269
+ return nil
270
+ end
271
+
272
+ if this_row < that_row
273
+ -1
274
+ elsif that_row < this_row
275
+ 1
276
+ else
277
+ this_col <=> that_col
278
+ end
279
+ end
280
+
281
+ def eql?(other)
282
+ if other.instance_of?(self.class)
283
+ self == other
284
+ else
285
+ false
286
+ end
287
+ end
288
+
289
+ def hash
290
+ to_ary.hash
291
+ end
292
+
293
+ def dup
294
+ Wx::GBPosition.new(*self.to_ary)
295
+ end
296
+
297
+ end
298
+
299
+ class GBSpan
300
+
301
+ # make GBSpan usable for parallel assignments like `r, c = span`
302
+ def to_ary
303
+ [rowspan, colspan]
304
+ end
305
+
306
+ def eql?(other)
307
+ if other.instance_of?(self.class)
308
+ self == other
309
+ else
310
+ false
311
+ end
312
+ end
313
+
314
+ def hash
315
+ to_ary.hash
316
+ end
317
+
318
+ def dup
319
+ Wx::GBSpan.new(*self.to_ary)
320
+ end
321
+
322
+ end
323
+
189
324
  end
@@ -15,15 +15,15 @@ class Wx::SplashScreen
15
15
  end
16
16
 
17
17
  # now redefine the overridden ctor to account for deviating arglist
18
- wx_redefine_method :initialize do |bitmap, splashstyle, milliseconds, parent = nil, *mixed_args, &block|
18
+ wx_redefine_method :initialize do |bitmap, splashstyle, milliseconds, parent = nil, *args, **kwargs, &block|
19
19
  # no zero-args ctor for use with XRC!
20
20
 
21
21
  real_args = begin
22
- [ bitmap, splashstyle, milliseconds, parent ] + self.class.args_as_list(*mixed_args)
22
+ [ bitmap, splashstyle, milliseconds, parent ] + self.class.args_as_list(*args, **kwargs)
23
23
  rescue => err
24
24
  msg = "Error initializing #{self.inspect}\n"+
25
25
  " : #{err.message} \n" +
26
- "Provided are #{[ bitmap, splashstyle, milliseconds, parent ] + mixed_args} \n" +
26
+ "Provided are #{[ bitmap, splashstyle, milliseconds, parent ] + args + [kwargs]} \n" +
27
27
  "Correct parameters for #{self.class.name}.new are:\n" +
28
28
  self.class.describe_constructor(
29
29
  ":bitmap => (Wx::Bitmap)\n:splashstyle => (Integer)\n:milliseconds => (Integer)\n:parent => (Wx::Window)\n")
@@ -21,10 +21,10 @@ class Wx::ToolBar
21
21
  Wx::Parameter[ :long_help, "" ],
22
22
  Wx::Parameter[ :client_data, nil ] ]
23
23
 
24
- def add_item(bitmap1, *mixed_args)
24
+ def add_item(bitmap1, *args, **kwargs)
25
25
 
26
26
  begin
27
- args = Wx::args_as_list(ADD_ITEM_PARAMS, *mixed_args)
27
+ args = Wx::args_as_list(ADD_ITEM_PARAMS, *args, **kwargs)
28
28
  rescue => err
29
29
  err.set_backtrace(caller)
30
30
  Kernel.raise err
@@ -24,6 +24,28 @@ class Wx::VBoxSizer < Wx::BoxSizer
24
24
  end
25
25
  end
26
26
 
27
+ class Wx::VStaticBoxSizer < Wx::StaticBoxSizer
28
+ def initialize(box_or_window, *rest, &block)
29
+ if box_or_window.is_a?(Wx::StaticBox)
30
+ raise ArgumentError, "Unexpected argument(s) #{rest}" unless rest.empty?
31
+ super(box_or_window, Wx::VERTICAL, &nil)
32
+ else
33
+ raise ArgumentError, "Unexpected argument(s) #{rest}" unless rest.size <= 1
34
+ super(Wx::VERTICAL, box_or_window, *rest, &block)
35
+ end
36
+ if block
37
+ if block.arity == -1 or block.arity == 0
38
+ self.instance_eval(&block)
39
+ elsif block.arity == 1
40
+ block.call(self)
41
+ else
42
+ Kernel.raise ArgumentError,
43
+ "Block to initialize should accept a single argument or none"
44
+ end
45
+ end
46
+ end
47
+ end
48
+
27
49
  # Just a shortcut version for creating a vertical wrap sizer
28
50
  class Wx::VWrapSizer < Wx::WrapSizer
29
51
  def initialize(flags=Wx::WRAPSIZER_DEFAULT_FLAGS, &block)
@@ -13,9 +13,12 @@ module Wx
13
13
 
14
14
  # Yield each pane to the given block.
15
15
  # If no block passed returns an Enumerator.
16
- # @yieldparam [Wx::AUI::AuiPaneInfo] pane the Aui pane info yielded
17
- # @return [::Object, ::Enumerator] result of last block execution or enumerator
18
- def each_pane; end
16
+ # @overload each_pane(&block)
17
+ # @yieldparam [Wx::AUI::AuiPaneInfo] pane the Aui pane info yielded
18
+ # @return [::Object] result of last block execution
19
+ # @overload each_pane()
20
+ # @return [::Enumerator] enumerator
21
+ def each_pane(*) end
19
22
 
20
23
  # Returns an array of all panes managed by the frame manager.
21
24
  # @return [Array<Wx::AUI::AuiPaneInfo>] all managed panes
@@ -14,9 +14,12 @@ module Wx
14
14
  # Iterate each notebook page.
15
15
  # Passes each page to the given block.
16
16
  # Returns an Enumerator if no block given.
17
- # @yieldparam [Wx::Window] page notebook page
18
- # @return [Object,Enumerator] last result of block or Enumerator if no block given.
19
- def each_page; end
17
+ # @overload each_page(&block)
18
+ # @yieldparam [Wx::Window] page notebook page
19
+ # @return [Object] last result of block
20
+ # @overload each_page()
21
+ # @return [Enumerator] enumerator
22
+ def each_page(*) end
20
23
 
21
24
  # Finds tab control and its tab index associated with a given window.
22
25
  # @param [Wx::Window] page the notebook page window
data/lib/wx/doc/config.rb CHANGED
@@ -45,17 +45,23 @@ module Wx
45
45
 
46
46
  # Iterate all value entries at the current object (no recursion).
47
47
  # Passes key/value pairs to the given block or returns an Enumerator is no block given.
48
- # @yieldparam [String] key entry key
49
- # @yieldparam [Boolean,String,Integer,Float] value entry value
50
- # @return [Object,Enumerator] either the last result of the executed block or an enumerator if no block given
51
- def each_entry(&block) end
48
+ # @overload each_entry(&block)
49
+ # @yieldparam [String] key entry key
50
+ # @yieldparam [Boolean,String,Integer,Float] value entry value
51
+ # @return [Object] the last result of the executed block
52
+ # @overload each_entry()
53
+ # @return [Enumerator] enumerator
54
+ def each_entry(*) end
52
55
 
53
56
  # Iterate all group entries at the current object (no recursion).
54
57
  # Passes key/value pairs to the given block or returns an Enumerator is no block given.
55
- # @yieldparam [String] key entry key
56
- # @yieldparam [Wx::Config::Group] value entry value
57
- # @return [Object,Enumerator] either the last result of the executed block or an enumerator if no block given
58
- def each_group(&block) end
58
+ # @overload each_group(&block)
59
+ # @yieldparam [String] key entry key
60
+ # @yieldparam [Wx::Config::Group] value entry value
61
+ # @return [Object] the last result of the executed block
62
+ # @overload each_group()
63
+ # @return [Enumerator] enumerator
64
+ def each_group(*) end
59
65
 
60
66
  # Returns the total number of value entries at the current object only (if recurse is false) or including
61
67
  # any nested groups (if recurse is true)
@@ -19,9 +19,13 @@ module Wx
19
19
 
20
20
  # Yield each string to the given block.
21
21
  # Returns an Enumerator if no block given.
22
- # @yieldparam [String] string the string yielded
23
- # @return [Object,Enumerator] last result of block or Enumerator if no block given.
24
- def each_string; end
22
+ # @overload each_string(&block)
23
+ # @yieldparam [String] string the string yielded
24
+ # @return [Object] last result of block
25
+ # @overload each_string()
26
+ # @yieldparam [String] string the string yielded
27
+ # @return [Enumerator] enumerator
28
+ def each_string(*) end
25
29
 
26
30
  # Returns true if the items in the control are sorted
27
31
  # (style Wx::LB_SORT for list boxes or Wx::CB_SORT for combo boxes).