wxruby3 1.3.0 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ed10da8feaf6d3e77a775f3386dd9970314810239e7e4ce1c2c447658f6f4106
4
- data.tar.gz: 125e2ddedb7148987456508b887dacae1262753a408cd39503faff80fe6435cc
3
+ metadata.gz: c43cace6f097af04e2d856782258313acd4e340719cf7794db36534e6d5e644b
4
+ data.tar.gz: 2f93d3489b95ca1a49ce2734222088aab5574841dd337d19fef58ec7a84587fb
5
5
  SHA512:
6
- metadata.gz: dbe29edc61e3c139efec7d90d5f80b17b3671c141f3f6f3421905320de87b2900e90785bd83550e6b9d502bb184bef4a58c5061c7271629dc5f83d4c2f55ac94
7
- data.tar.gz: 2b420414ee1c4b8eefa3fa797c5452e8490048876bfe2172fa14f8ffdd4937c907a4714c6af1650768e91cab08f4746881b5c19989bf66778f4ed4a1d2506020
6
+ metadata.gz: 1db323073fdde9896d9ea6d8ffb9dee71e3f52f52d2836603ff5e6f7274003bb252bc4cff832574454ad4390686a79b1ef01467d5e3b7362aad36d464c67f5ac
7
+ data.tar.gz: 0057e4f8462c5b4e2dd79e736ca417cea70305b38efdc796bcc32a8f22fd12d178824ebe92e5d4cca219e1e1dbcafcb9200b5d00d7052d89ddd8f905729af4a0
@@ -189,6 +189,9 @@ namespace Swig {
189
189
  }
190
190
  };
191
191
 
192
+ // SWIG < 4.3.0
193
+ #if SWIG_VERSION < 0x040300
194
+
192
195
  /* Simple thread abstraction for pthreads on win32 */
193
196
  #ifdef __THREAD__
194
197
  # define __PTHREAD__
@@ -219,8 +222,14 @@ namespace Swig {
219
222
  }
220
223
  };
221
224
  # define SWIG_GUARD(mutex) Guard _guard(mutex)
225
+ # define SWIG_GUARD_DEFINITION(_cls, _mutex) pthread_mutex_t _cls::_mutex
226
+ # define SWIG_GUARD_DECLARATION(_mutex) static pthread_mutex_t _mutex
222
227
  #else
223
228
  # define SWIG_GUARD(mutex)
229
+ # define SWIG_GUARD_DEFINITION(_cls, _mutex)
230
+ # define SWIG_GUARD_DECLARATION(_mutex)
231
+ #endif
232
+
224
233
  #endif
225
234
 
226
235
  /* director base class */
@@ -258,9 +267,7 @@ namespace Swig {
258
267
  private:
259
268
  typedef std::map<void *, GCItem_var> swig_ownership_map;
260
269
  mutable swig_ownership_map swig_owner;
261
- #ifdef __PTHREAD__
262
- static pthread_mutex_t swig_mutex_own;
263
- #endif
270
+ SWIG_GUARD_DECLARATION(swig_mutex_own);
264
271
 
265
272
  public:
266
273
  template <typename Type>
@@ -287,4 +294,5 @@ namespace Swig {
287
294
 
288
295
  swig_ruby_owntype swig_release_ownership(void *vptr) const;
289
296
  };
297
+ SWIG_GUARD_DEFINITION(Director, swig_mutex_own);
290
298
  }
@@ -12,8 +12,22 @@ extern "C" {
12
12
  #endif
13
13
 
14
14
  WXRUBY_EXPORT VALUE
15
- SWIG_Ruby_AppendOutput(VALUE target, VALUE o);
15
+ SWIG_wxRuby_AppendOutput(VALUE target, VALUE o, int is_void);
16
16
 
17
17
  #ifdef __cplusplus
18
18
  }
19
19
  #endif
20
+
21
+ /* SWIG >= 4.3.0 version */
22
+ inline VALUE
23
+ SWIG_Ruby_AppendOutput(VALUE target, VALUE o, int is_void)
24
+ {
25
+ return SWIG_wxRuby_AppendOutput(target, o, is_void);
26
+ }
27
+
28
+ /* SWIG < 4.3.0 version */
29
+ inline VALUE
30
+ SWIG_Ruby_AppendOutput(VALUE target, VALUE o)
31
+ {
32
+ return SWIG_wxRuby_AppendOutput(target, o, -1);
33
+ }
@@ -2,19 +2,66 @@
2
2
  #
3
3
  # This software is released under the MIT license.
4
4
 
5
- class Wx::AUI::AuiManager
6
- def get_all_panes
7
- ::Enumerator.new { |y| each_pane { |p| y << p } }
8
- end
9
- alias :all_panes :get_all_panes
10
-
11
- unless Wx::EvtHandler.event_type_for_name(:evt_aui_find_manager)
12
- # missing from XML API refs
13
- Wx::EvtHandler.register_event_type Wx::EvtHandler::EventType[
14
- 'evt_aui_find_manager', 0,
15
- Wx::AUI::EVT_AUI_FIND_MANAGER,
16
- Wx::AUI::AuiManagerEvent
17
- ] if Wx::AUI.const_defined?(:EVT_AUI_FIND_MANAGER)
18
- end
5
+ module Wx
6
+ module AUI
7
+
8
+ class AuiManager
9
+
10
+ wx_each_pane = instance_method(:each_pane)
11
+ define_method(:each_pane) do |&block|
12
+ if block
13
+ wx_each_pane.bind(self).call(&block)
14
+ else
15
+ ::Enumerator.new { |y| wx_each_pane.bind(self).call { |p| y << p } }
16
+ end
17
+ end
18
+
19
+ def get_all_panes
20
+ each_pane.to_a
21
+ end
22
+ alias :all_panes :get_all_panes
23
+
24
+ unless Wx::EvtHandler.event_type_for_name(:evt_aui_find_manager)
25
+ # missing from XML API refs
26
+ Wx::EvtHandler.register_event_type Wx::EvtHandler::EventType[
27
+ 'evt_aui_find_manager', 0,
28
+ Wx::AUI::EVT_AUI_FIND_MANAGER,
29
+ Wx::AUI::AuiManagerEvent
30
+ ] if Wx::AUI.const_defined?(:EVT_AUI_FIND_MANAGER)
31
+ end
32
+ end
33
+
34
+ if WXWIDGETS_VERSION >= '3.3.0'
35
+
36
+ class AuiDockInfo
19
37
 
38
+ wx_each_pane = instance_method(:each_pane)
39
+ define_method(:each_pane) do |&block|
40
+ if block
41
+ wx_each_pane.bind(self).call(&block)
42
+ else
43
+ ::Enumerator.new { |y| wx_each_pane.bind(self).call { |p| y << p } }
44
+ end
45
+ end
46
+
47
+ def get_panes
48
+ each_pane.to_a
49
+ end
50
+ alias :panes :get_panes
51
+
52
+ end
53
+
54
+ class AuiDeserializer
55
+
56
+ wx_initialize = instance_method(:initialize)
57
+ define_method(:initialize) do |manager|
58
+ wx_initialize.bind(self).call(manager)
59
+ @manager = manager # prevent GC for lifetime of deserializer
60
+ end
61
+
62
+ end
63
+
64
+ end
65
+
66
+ end
20
67
  end
@@ -25,6 +25,7 @@ module Wx
25
25
  x, y = self
26
26
  Wx::RealPoint.new(x || Wx::DEFAULT_COORD, y || Wx::DEFAULT_COORD)
27
27
  end
28
+ alias :to_real :to_real_point
28
29
 
29
30
  end
30
31
 
data/lib/wx/core/brush.rb CHANGED
@@ -6,8 +6,16 @@
6
6
  # Copyright 2004-2007, wxRuby development team
7
7
  # released under the MIT-like wxRuby2 license
8
8
 
9
+ require_relative './enum'
10
+
9
11
  module Wx
10
12
 
11
13
  TheBrushList = Wx::Brush
12
14
 
15
+ class BrushStyle < Wx::Enum
16
+
17
+ set_non_distinct(%i[BRUSHSTYLE_INVALID BRUSHSTYLE_FIRST_HATCH BRUSHSTYLE_LAST_HATCH])
18
+
19
+ end
20
+
13
21
  end
@@ -0,0 +1,49 @@
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
+ require_relative './enum'
10
+
11
+ module Wx
12
+
13
+ class Orientation < Wx::Enum
14
+
15
+ set_non_distinct(%i[ORIENTATION_MASK])
16
+
17
+ end
18
+
19
+ class Direction < Wx::Enum
20
+
21
+ set_non_distinct(%i[TOP BOTTOM NORTH SOUTH WEST EAST ALL DIRECTION_MASK])
22
+
23
+ end
24
+
25
+ class Alignment < Wx::Enum
26
+
27
+ set_non_distinct(%i[ALIGN_INVALID ALIGN_CENTRE_HORIZONTAL ALIGN_LEFT ALIGN_TOP ALIGN_CENTRE_VERTICAL ALIGN_CENTER ALIGN_MASK])
28
+
29
+ end
30
+
31
+ class SizerFlagBits < Wx::Enum
32
+
33
+ set_non_distinct(%i[SIZER_FLAG_BITS_MASK])
34
+
35
+ end
36
+
37
+ class Stretch < Wx::Enum
38
+
39
+ set_non_distinct(%i[GROW STRETCH_MASK])
40
+
41
+ end
42
+
43
+ class Border < Wx::Enum
44
+
45
+ set_non_distinct(%i[BORDER_THEME BORDER_MASK])
46
+
47
+ end
48
+
49
+ end
data/lib/wx/core/enum.rb CHANGED
@@ -10,10 +10,23 @@ class Wx::Enum
10
10
 
11
11
  class << self
12
12
 
13
- def enumerators
13
+ def set_non_distinct(lst)
14
+ raise TypeError, 'Expected Array of Symbols' unless lst.is_a?(Array) && lst.all? { |e| e.is_a?(Symbol) }
15
+ @non_distinct = lst
16
+ end
17
+ alias :non_distinct= :set_non_distinct
18
+
19
+ def non_distinct
20
+ @non_distinct || []
21
+ end
22
+
23
+ def enumerators(excludes = nil)
24
+ excludes ||= self.non_distinct
14
25
  self.constants(false).inject({}) do |tbl, cn|
15
- cv = self.const_get(cn)
16
- tbl[cv.to_i] = cn if self === cv
26
+ unless excludes&.include?(cn)
27
+ cv = self.const_get(cn)
28
+ tbl[cv.to_i] = cn if self === cv
29
+ end
17
30
  tbl
18
31
  end
19
32
  end
data/lib/wx/core/font.rb CHANGED
@@ -1,5 +1,13 @@
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
1
8
 
2
9
  require_relative './font/encoding'
10
+ require_relative './enum'
3
11
 
4
12
  module Wx
5
13
 
@@ -27,4 +35,10 @@ module Wx
27
35
  # can be accessed through that name too.
28
36
  TheFontList = Font
29
37
 
38
+ class FontFlag < Wx::Enum
39
+
40
+ set_non_distinct(%i[FONTFLAG_MASK])
41
+
42
+ end
43
+
30
44
  end
@@ -9,14 +9,34 @@
9
9
  # Just a shortcut version for creating a horizontal box sizer
10
10
 
11
11
  class Wx::HBoxSizer < Wx::BoxSizer
12
- def initialize
13
- super(Wx::HORIZONTAL)
12
+ def initialize(&block)
13
+ super(Wx::HORIZONTAL, &nil)
14
+ if block
15
+ if block.arity == -1 or block.arity == 0
16
+ self.instance_eval(&block)
17
+ elsif block.arity == 1
18
+ block.call(self)
19
+ else
20
+ Kernel.raise ArgumentError,
21
+ "Block to initialize should accept a single argument or none"
22
+ end
23
+ end
14
24
  end
15
25
  end
16
26
 
17
27
  # Just a shortcut version for creating a horizontal wrap sizer
18
28
  class Wx::HWrapSizer < Wx::WrapSizer
19
- def initialize(flags=Wx::WRAPSIZER_DEFAULT_FLAGS)
20
- super(Wx::HORIZONTAL)
29
+ def initialize(flags=Wx::WRAPSIZER_DEFAULT_FLAGS, &block)
30
+ super(Wx::HORIZONTAL, &nil)
31
+ if block
32
+ if block.arity == -1 or block.arity == 0
33
+ self.instance_eval(&block)
34
+ elsif block.arity == 1
35
+ block.call(self)
36
+ else
37
+ Kernel.raise ArgumentError,
38
+ "Block to initialize should accept a single argument or none"
39
+ end
40
+ end
21
41
  end
22
42
  end
data/lib/wx/core/pen.rb CHANGED
@@ -6,8 +6,28 @@
6
6
  # Copyright 2004-2007, wxRuby development team
7
7
  # released under the MIT-like wxRuby2 license
8
8
 
9
+ require_relative './enum'
10
+
9
11
  module Wx
10
12
 
11
13
  ThePenList = Wx::Pen
12
14
 
15
+ class PenStyle < Wx::Enum
16
+
17
+ set_non_distinct(%i[PENSTYLE_INVALID PENSTYLE_FIRST_HATCH PENSTYLE_LAST_HATCH])
18
+
19
+ end
20
+
21
+ class PenJoin < Wx::Enum
22
+
23
+ set_non_distinct(%i[JOIN_INVALID])
24
+
25
+ end
26
+
27
+ class PenCap < Wx::Enum
28
+
29
+ set_non_distinct(%i[CAP_INVALID])
30
+
31
+ end
32
+
13
33
  end
@@ -111,6 +111,7 @@ class Wx::RealPoint
111
111
  def to_real_point
112
112
  self
113
113
  end
114
+ alias :to_real :to_real_point
114
115
 
115
116
  def dup
116
117
  Wx::RealPoint.new(self.x, self.y)
data/lib/wx/core/sizer.rb CHANGED
@@ -6,57 +6,184 @@
6
6
  # Copyright 2004-2007, wxRuby development team
7
7
  # released under the MIT-like wxRuby2 license
8
8
 
9
- # Class for automatically managing layouts
9
+ # Classes for automatically managing layouts
10
10
 
11
- class Wx::Sizer
12
- # Generic method to add items, supporting positional and named
13
- # arguments
14
- ADD_ITEM_PARAMS = [ Wx::Parameter[ :index, -1 ],
15
- Wx::Parameter[ :proportion, 0 ],
16
- Wx::Parameter[ :flag, 0 ],
17
- Wx::Parameter[ :border, 0 ] ]
18
-
19
- def add_item(item, *mixed_args)
11
+ module Wx
12
+ class Sizer
13
+ # Generic method to add items, supporting positional and named
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]]
20
19
 
21
- begin
22
- args = Wx::args_as_list(ADD_ITEM_PARAMS, *mixed_args)
23
- rescue => err
24
- err.set_backtrace(caller)
25
- Kernel.raise err
20
+ def add_item(item, *mixed_args)
21
+
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
28
+
29
+ full_args = []
30
+
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
39
+ end
40
+
41
+ # update the full arguments list with the optional arguments (except index)
42
+ idx = args.shift
43
+ full_args.concat(args)
44
+
45
+ # Call add to append if default position
46
+ if idx == -1
47
+ add(*full_args)
48
+ else
49
+ insert(idx, *full_args)
50
+ end
51
+ end
52
+
53
+ # Overload to provide Enumerator without block
54
+ wx_each_child = instance_method :each_child
55
+ define_method :each_child do |&block|
56
+ if block
57
+ wx_each_child.bind(self).call(&block)
58
+ else
59
+ ::Enumerator.new { |y| wx_each_child.bind(self).call { |c| y << c } }
60
+ end
61
+ end
62
+
63
+ end
64
+
65
+ class BoxSizer < Sizer
66
+
67
+ wx_initialize = instance_method :initialize
68
+ define_method :initialize do |*args, &block|
69
+ wx_initialize.bind(self).call(*args)
70
+ if block
71
+ if block.arity == -1 or block.arity == 0
72
+ self.instance_eval(&block)
73
+ elsif block.arity == 1
74
+ block.call(self)
75
+ else
76
+ Kernel.raise ArgumentError,
77
+ "Block to initialize should accept a single argument or none"
78
+ end
79
+ end
80
+ end
81
+
82
+ end
83
+
84
+ class WrapSizer < BoxSizer
85
+
86
+ wx_initialize = instance_method :initialize
87
+ define_method :initialize do |*args, &block|
88
+ wx_initialize.bind(self).call(*args)
89
+ if block
90
+ if block.arity == -1 or block.arity == 0
91
+ self.instance_eval(&block)
92
+ elsif block.arity == 1
93
+ block.call(self)
94
+ else
95
+ Kernel.raise ArgumentError,
96
+ "Block to initialize should accept a single argument or none"
97
+ end
98
+ end
26
99
  end
27
100
 
28
- full_args = []
101
+ end
102
+
103
+ class StaticBoxSizer < BoxSizer
29
104
 
30
- # extract the width and the height in the case of a spacer
31
- # defined as an array
32
- if item.kind_of?(Array)
33
- Kernel.raise ArgumentError,
34
- "Invalid Sizer specification : [width, height] expected" if item.size != 2
35
- full_args << item[0] << item[1]
36
- else
37
- full_args << item
105
+ wx_initialize = instance_method :initialize
106
+ define_method :initialize do |*args, &block|
107
+ wx_initialize.bind(self).call(*args)
108
+ if block
109
+ if block.arity == -1 or block.arity == 0
110
+ self.instance_eval(&block)
111
+ elsif block.arity == 1
112
+ block.call(self)
113
+ else
114
+ Kernel.raise ArgumentError,
115
+ "Block to initialize should accept a single argument or none"
116
+ end
117
+ end
38
118
  end
39
119
 
40
- # update the full arguments list with the optional arguments (except index)
41
- idx = args.shift
42
- full_args.concat(args)
120
+ end
43
121
 
44
- # Call add to append if default position
45
- if idx == -1
46
- add(*full_args)
47
- else
48
- insert(idx, *full_args)
122
+ class StdDialogButtonSizer < BoxSizer
123
+
124
+ wx_initialize = instance_method :initialize
125
+ define_method :initialize do |*args, &block|
126
+ wx_initialize.bind(self).call(*args)
127
+ if block
128
+ if block.arity == -1 or block.arity == 0
129
+ self.instance_eval(&block)
130
+ elsif block.arity == 1
131
+ block.call(self)
132
+ else
133
+ Kernel.raise ArgumentError,
134
+ "Block to initialize should accept a single argument or none"
135
+ end
136
+ end
49
137
  end
138
+
50
139
  end
51
140
 
52
- # Overload to provide Enumerator without block
53
- wx_each_child = instance_method :each_child
54
- define_method :each_child do |&block|
55
- if block
56
- wx_each_child.bind(self).call(&block)
57
- else
58
- ::Enumerator.new { |y| wx_each_child.bind(self).call { |c| y << c } }
141
+ class GridSizer < Sizer
142
+
143
+ wx_initialize = instance_method :initialize
144
+ define_method :initialize do |*args, &block|
145
+ wx_initialize.bind(self).call(*args)
146
+ self.instance_eval(&block) if block
59
147
  end
148
+
149
+ end
150
+
151
+ class FlexGridSizer < GridSizer
152
+
153
+ wx_initialize = instance_method :initialize
154
+ define_method :initialize do |*args, &block|
155
+ wx_initialize.bind(self).call(*args)
156
+ if block
157
+ if block.arity == -1 or block.arity == 0
158
+ self.instance_eval(&block)
159
+ elsif block.arity == 1
160
+ block.call(self)
161
+ else
162
+ Kernel.raise ArgumentError,
163
+ "Block to initialize should accept a single argument or none"
164
+ end
165
+ end
166
+ end
167
+
168
+ end
169
+
170
+ class GridBagSizer < FlexGridSizer
171
+
172
+ wx_initialize = instance_method :initialize
173
+ define_method :initialize do |*args, &block|
174
+ wx_initialize.bind(self).call(*args)
175
+ if block
176
+ if block.arity == -1 or block.arity == 0
177
+ self.instance_eval(&block)
178
+ elsif block.arity == 1
179
+ block.call(self)
180
+ else
181
+ Kernel.raise ArgumentError,
182
+ "Block to initialize should accept a single argument or none"
183
+ end
184
+ end
185
+ end
186
+
60
187
  end
61
188
 
62
189
  end
@@ -9,14 +9,34 @@
9
9
  # Just a shortcut version for creating a vertical box sizer
10
10
 
11
11
  class Wx::VBoxSizer < Wx::BoxSizer
12
- def initialize
13
- super(Wx::VERTICAL)
12
+ def initialize(&block)
13
+ super(Wx::VERTICAL, &nil)
14
+ if block
15
+ if block.arity == -1 or block.arity == 0
16
+ self.instance_eval(&block)
17
+ elsif block.arity == 1
18
+ block.call(self)
19
+ else
20
+ Kernel.raise ArgumentError,
21
+ "Block to initialize should accept a single argument or none"
22
+ end
23
+ end
14
24
  end
15
25
  end
16
26
 
17
27
  # Just a shortcut version for creating a vertical wrap sizer
18
28
  class Wx::VWrapSizer < Wx::WrapSizer
19
- def initialize(flags=Wx::WRAPSIZER_DEFAULT_FLAGS)
20
- super(Wx::VERTICAL)
29
+ def initialize(flags=Wx::WRAPSIZER_DEFAULT_FLAGS, &block)
30
+ super(Wx::VERTICAL, &nil)
31
+ if block
32
+ if block.arity == -1 or block.arity == 0
33
+ self.instance_eval(&block)
34
+ elsif block.arity == 1
35
+ block.call(self)
36
+ else
37
+ Kernel.raise ArgumentError,
38
+ "Block to initialize should accept a single argument or none"
39
+ end
40
+ end
21
41
  end
22
42
  end
@@ -27,6 +27,7 @@ module Wx
27
27
  # The array is not altered.
28
28
  # @return [Wx::RealPoint]
29
29
  def to_real_point; end
30
+ alias :to_real :to_real_point
30
31
 
31
32
  end
32
33
 
@@ -12,7 +12,9 @@ module Wx
12
12
  class AuiManager
13
13
 
14
14
  # Yield each pane to the given block.
15
+ # If no block passed returns an Enumerator.
15
16
  # @yieldparam [Wx::AUI::AuiPaneInfo] pane the Aui pane info yielded
17
+ # @return [::Object, ::Enumerator] result of last block execution or enumerator
16
18
  def each_pane; end
17
19
 
18
20
  # Returns an array of all panes managed by the frame manager.
data/lib/wx/doc/enum.rb CHANGED
@@ -18,6 +18,32 @@ module Wx
18
18
  # type safety for arguments requiring the specific enum class.
19
19
  class Enum < Numeric
20
20
 
21
+ class << self
22
+
23
+ # Sets a class specific list of enumerator ids (symbols) that should be considered
24
+ # non-distinctive enum values (examples would be convenience constants combining
25
+ # multiple distinctive enumerators or enumerators denoting the first/lowest and/or last/highest
26
+ # distinctive enumerators). Mostly useful for bitmask enum classes.
27
+ # @param [Array<Symbol>] lst
28
+ def set_non_distinct(lst) end
29
+ alias :non_distinct= :set_non_distinct
30
+
31
+ # Returns the class specific list of enumerator ids (symbols) that should be considered
32
+ # non-distinctive enum values. Returns nil if not set.
33
+ # @see set_non_distinct
34
+ # @return [Array<Symbol>,nil]
35
+ def non_distinct; end
36
+
37
+ # Returns a hash table with enumerator value : enumerator id (symbol) pairs for the enum class.
38
+ # @param [Array<Symbol>, nil] excludes list of enumerator ids (symbols) to exclude (by default the non_distinct list is used if defined)
39
+ # @return [Hash(Integer, Symbol)]
40
+ def enumerators(excludes = nil) end
41
+
42
+ # Returns the enumerator for the given enumerator symbol or nil if no such enumerator exists.
43
+ # @return [Wx::Enum, nil]
44
+ def [](enum_name) end
45
+ end
46
+
21
47
  # Initialize a new enum value.
22
48
  # @param [Integer] val enum integer value
23
49
  def initialize(val)end
@@ -209,6 +209,7 @@ module Wx
209
209
  # Returns self.
210
210
  # @return [self]
211
211
  def to_real_point; end
212
+ alias :to_real :to_real_point
212
213
 
213
214
  # Set this point to the given point's x,y values
214
215
  # @param [Wx::RealPoint] pt
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.3.0'
6
+ WXRUBY_VERSION = '1.3.1'
7
7
  end
@@ -59,9 +59,9 @@ extern "C" {
59
59
  #endif
60
60
 
61
61
  WXRB_EXPORT_FLAG VALUE
62
- SWIG_Ruby_AppendOutput(VALUE target, VALUE o)
62
+ SWIG_wxRuby_AppendOutput(VALUE target, VALUE o, int is_void)
63
63
  {
64
- if (NIL_P(target))
64
+ if (NIL_P(target) && is_void != 0)
65
65
  {
66
66
  target = o;
67
67
  }
@@ -16,7 +16,98 @@ module WXRuby3
16
16
 
17
17
  def setup
18
18
  super
19
- spec.gc_as_object
19
+ spec.gc_as_object 'wxAuiManager'
20
+ if Config.instance.wx_version >= '3.3.0'
21
+ spec.items << 'wxAuiSerializer' << 'wxAuiDockInfo' << 'wxAuiDeserializer'
22
+ spec.gc_as_untracked 'wxAuiSerializer', 'wxAuiDockInfo'
23
+ spec.regard 'wxAuiDockInfo::rect',
24
+ 'wxAuiDockInfo::dock_direction',
25
+ 'wxAuiDockInfo::dock_layer',
26
+ 'wxAuiDockInfo::dock_row',
27
+ 'wxAuiDockInfo::size',
28
+ 'wxAuiDockInfo::min_size',
29
+ 'wxAuiDockInfo::resizable',
30
+ 'wxAuiDockInfo::toolbar',
31
+ 'wxAuiDockInfo::fixed',
32
+ 'wxAuiDockInfo::reserved1'
33
+ spec.make_readonly 'wxAuiDockInfo::rect',
34
+ 'wxAuiDockInfo::dock_direction',
35
+ 'wxAuiDockInfo::dock_layer',
36
+ 'wxAuiDockInfo::dock_row',
37
+ 'wxAuiDockInfo::size',
38
+ 'wxAuiDockInfo::min_size',
39
+ 'wxAuiDockInfo::resizable',
40
+ 'wxAuiDockInfo::toolbar',
41
+ 'wxAuiDockInfo::fixed',
42
+ 'wxAuiDockInfo::reserved1'
43
+ spec.add_extend_code 'wxAuiDockInfo', <<~__HEREDOC
44
+ VALUE each_pane()
45
+ {
46
+ wxAuiPaneInfoPtrArray panes = self->panes;
47
+ VALUE rc = Qnil;
48
+ for (wxAuiPaneInfo* pane : panes)
49
+ {
50
+ VALUE r_pane = SWIG_NewPointerObj(pane, SWIGTYPE_p_wxAuiPaneInfo, 0);
51
+ rc = rb_yield(r_pane);
52
+ }
53
+ return rc;
54
+ }
55
+ __HEREDOC
56
+ spec.map 'std::vector<wxAuiPaneInfo>' => 'Array<Wx::AuiPaneInfo>' do
57
+ map_out code: <<~__CODE
58
+ $result = rb_ary_new();
59
+ std::vector<wxAuiPaneInfo>& panes = (std::vector<wxAuiPaneInfo>&)$1;
60
+ for (const wxAuiPaneInfo& pane : panes)
61
+ {
62
+ VALUE r_pane = SWIG_NewPointerObj(new wxAuiPaneInfo(pane), SWIGTYPE_p_wxAuiPaneInfo, SWIG_POINTER_OWN);
63
+ rb_ary_push($result, r_pane);
64
+ }
65
+ __CODE
66
+ map_directorout code: <<~__CODE
67
+ if (TYPE($input) == T_ARRAY)
68
+ {
69
+ for (int i = 0; i < RARRAY_LEN($input); i++)
70
+ {
71
+ void *ptr;
72
+ VALUE r_pane = rb_ary_entry($input, i);
73
+ int res = SWIG_ConvertPtr(r_pane, &ptr, SWIGTYPE_p_wxAuiPaneInfo, 0);
74
+ if (!SWIG_IsOK(res) || !ptr) {
75
+ Swig::DirectorTypeMismatchException::raise(swig_get_self(), "load_panes", rb_eTypeError, "in return value. Expected Array of Wx::AuiPaneInfo");
76
+ }
77
+ wxAuiPaneInfo *pane = reinterpret_cast< wxAuiPaneInfo * >(ptr);
78
+ $result.push_back(*pane);
79
+ }
80
+ }
81
+ __CODE
82
+ end
83
+ spec.map 'std::vector<wxAuiDockInfo>' => 'Array<Wx::AuiDockInfo>' do
84
+ map_out code: <<~__CODE
85
+ $result = rb_ary_new();
86
+ std::vector<wxAuiDockInfo>& docks = (std::vector<wxAuiDockInfo>&)$1;
87
+ for (const wxAuiDockInfo& dock : docks)
88
+ {
89
+ VALUE r_dock = SWIG_NewPointerObj(new wxAuiDockInfo(dock), SWIGTYPE_p_wxAuiDockInfo, SWIG_POINTER_OWN);
90
+ rb_ary_push($result, r_dock);
91
+ }
92
+ __CODE
93
+ map_directorout code: <<~__CODE
94
+ if (TYPE($input) == T_ARRAY)
95
+ {
96
+ for (int i = 0; i < RARRAY_LEN($input); i++)
97
+ {
98
+ void *ptr;
99
+ VALUE r_dock = rb_ary_entry($input, i);
100
+ int res = SWIG_ConvertPtr(r_dock, &ptr, SWIGTYPE_p_wxAuiDockInfo, 0);
101
+ if (!SWIG_IsOK(res) || !ptr) {
102
+ Swig::DirectorTypeMismatchException::raise(swig_get_self(), "load_docks", rb_eTypeError, "in return value. Expected Array of Wx::AuiDockInfo");
103
+ }
104
+ wxAuiDockInfo *dock = reinterpret_cast< wxAuiDockInfo * >(ptr);
105
+ $result.push_back(*dock);
106
+ }
107
+ }
108
+ __CODE
109
+ end
110
+ end
20
111
  # need a custom implementation to handle (event handler proc) cleanup
21
112
  spec.add_header_code <<~__HEREDOC
22
113
  #include "wx/aui/aui.h"
@@ -80,7 +171,7 @@ module WXRuby3
80
171
  rb_gc_mark( rb_art_prov );
81
172
  }
82
173
  }
83
- __HEREDOC
174
+ __HEREDOC
84
175
  spec.add_swig_code '%markfunc wxAuiManager "GC_mark_wxAuiManager";'
85
176
  # provide pure Ruby implementation based on use custom alternative provided below
86
177
  spec.ignore('wxAuiManager::GetAllPanes')
@@ -110,12 +201,36 @@ module WXRuby3
110
201
  WXRubyAuiManager* aui_mng = dynamic_cast<WXRubyAuiManager*> (self);
111
202
  managedWnd->Bind(wxEVT_CLOSE_WINDOW, &WXRubyAuiManager::OnManagedWindowClose, aui_mng);
112
203
  }
113
- __HEREDOC
204
+ __HEREDOC
114
205
  spec.suppress_warning(473, 'wxAuiManager::CreateFloatingFrame')
115
206
  spec.do_not_generate(:variables, :defines, :enums, :functions) # with AuiPaneInfo
116
207
  end
208
+
209
+ def doc_generator
210
+ AuiManagerDocGenerator.new(self)
211
+ end
117
212
  end # class AuiManager
118
213
 
214
+ class AuiManagerDocGenerator < DocGenerator
215
+
216
+ def gen_class_doc_members(fdoc, clsdef, cls_members, alias_methods)
217
+ super
218
+ if Config.instance.wx_version >= '3.3.0' && clsdef.name == 'wxAuiDockInfo'
219
+ fdoc.doc.puts 'Yield each pane to the given block.'
220
+ fdoc.doc.puts 'If no block passed returns an Enumerator.'
221
+ fdoc.doc.puts '@yieldparam [Wx::AUI::AuiPaneInfo] pane the Aui pane info yielded'
222
+ fdoc.doc.puts '@return [::Object, ::Enumerator] result of last block execution or enumerator'
223
+ fdoc.puts 'def each_pane; end'
224
+ fdoc.puts
225
+ fdoc.doc.puts 'Returns an array of Wx::AuiPaneInfo for all panes managed by the frame manager.'
226
+ fdoc.doc.puts '@return [Array<Wx::AUI::AuiPaneInfo>] info for all managed panes'
227
+ fdoc.puts 'def get_panes; end'
228
+ fdoc.puts 'alias_method :panes, :get_panes'
229
+ end
230
+ end
231
+
232
+ end
233
+
119
234
  end # class Director
120
235
 
121
236
  end # module WXRuby3
@@ -230,8 +230,10 @@ module WXRuby3
230
230
  # regard protected methods
231
231
  spec.regard 'wxGenericAboutDialog::DoAddCustomControls',
232
232
  'wxGenericAboutDialog::AddControl',
233
- 'wxGenericAboutDialog::AddText',
234
- 'wxGenericAboutDialog::GetCustomControlParent'
233
+ 'wxGenericAboutDialog::AddText'
234
+ if Config.instance.wx_version >= '3.3.0'
235
+ spec.regard 'wxGenericAboutDialog::GetCustomControlParent'
236
+ end
235
237
  if Config.instance.features_set?('USE_COLLPANE')
236
238
  spec.regard 'wxGenericAboutDialog::AddCollapsiblePane'
237
239
  end
@@ -141,7 +141,7 @@ module WXRuby3
141
141
  spec.map_apply 'int * OUTPUT' => 'int* pIndex'
142
142
  end
143
143
  # for UIntProperty and IntProperty
144
- if Config.instance.features_set?('USE_LONGLONG')
144
+ if Config.instance.features_set?('USE_LONGLONG') || Config.instance.wx_version >= '3.3.0'
145
145
  # wxLongLong mapping to be considered before considering 'long' (see typecheck precedence)
146
146
  spec.map 'const wxLongLong&' => 'Integer' do
147
147
  map_in temp: 'wxLongLong tmp', code: <<~__CODE
@@ -162,7 +162,7 @@ module WXRuby3
162
162
  end
163
163
  else
164
164
  spec.ignore 'wxUIntProperty::wxUIntProperty(const wxString &, const wxString &, const wxULongLong &)',
165
- 'wxIntProperty::wxUIntProperty(const wxString &, const wxString &, const wxLongLong &)'
165
+ 'wxIntProperty::wxIntProperty(const wxString &, const wxString &, const wxLongLong &)'
166
166
  end
167
167
  spec.new_object 'wxArrayStringProperty::CreateEditorDialog'
168
168
  spec.suppress_warning(473, 'wxArrayStringProperty::CreateEditorDialog')
@@ -39,9 +39,10 @@ module WXRuby3
39
39
  spec.extend_interface 'wxPropertyGridInterface',
40
40
  'void SetPropertyValues(const wxVariant &list, const wxPGPropArgCls& defaultCategory = 0)'
41
41
  # optionals
42
- spec.ignore_unless 'USE_LONGLONG',
43
- 'wxPropertyGridInterface::GetPropertyValueAsLongLong',
44
- 'wxPropertyGridInterface::GetPropertyValueAsULongLong'
42
+ unless Config.instance.features_set?('USE_LONGLONG') || Config.instance.wx_version >= '3.3.0'
43
+ spec.ignore_unless 'wxPropertyGridInterface::GetPropertyValueAsLongLong',
44
+ 'wxPropertyGridInterface::GetPropertyValueAsULongLong'
45
+ end
45
46
  spec.ignore_unless 'USE_DATETIME', 'wxPropertyGridInterface::GetPropertyValueAsDateTime'
46
47
  spec.ignore_unless 'USE_VALIDATORS', 'wxPropertyGridInterface::GetPropertyValidator'
47
48
  # fix incorrect XML documentation
@@ -24,6 +24,13 @@ module WXRuby3
24
24
  spec.ignore 'wxTextCtrl::GTKGetTextBuffer',
25
25
  'wxTextCtrl::GTKGetEditable'
26
26
  end
27
+ if Config.instance.wx_version >= '3.3.0' && Config.instance.wx_port == :wxmsw
28
+ spec.items << 'wxTextSearch' << 'wxTextSearchResult'
29
+ spec.regard 'wxTextSearchResult::m_start', 'wxTextSearchResult::m_end'
30
+ spec.make_readonly 'wxTextSearchResult::m_start', 'wxTextSearchResult::m_end'
31
+ spec.rename_for_ruby 'start' => 'wxTextSearchResult::m_start',
32
+ 'end' => 'wxTextSearchResult::m_end'
33
+ end
27
34
  if Config.instance.wx_port == :wxqt
28
35
  # not implemented
29
36
  spec.ignore 'wxTextCtrl::OnDropFiles'
@@ -142,7 +142,7 @@ module WXRuby3
142
142
  {
143
143
  return wxVariant(TYPE(rbval) == T_TRUE);
144
144
  }
145
- #ifdef wxUSE_LONGLONG
145
+ #if !defined(wxUSE_LONGLONG) || (wxUSE_LONGLONG == 1)
146
146
  if ((sizeof(long) < 8) && (TYPE(rbval) == T_BIGNUM) && (rb_big_sign(rbval) == 0))
147
147
  {
148
148
  wxLongLong_t ll = rb_big2ll(rbval);
@@ -227,7 +227,7 @@ module WXRuby3
227
227
  $1 = rb_obj_is_kind_of($input, rb_const_get(mWxPG, var_ColourPropertyValue_id()));
228
228
  __CODE
229
229
  end
230
- if Config.instance.features_set?('USE_LONGLONG')
230
+ if Config.instance.features_set?('USE_LONGLONG') || Config.instance.wx_version >= '3.3.0'
231
231
  # wxLongLong mapping to be considered before considering 'long' (see typecheck precedence)
232
232
  spec.map 'wxLongLong' => 'Integer' do
233
233
  map_in code: <<~__CODE
@@ -49,6 +49,9 @@ module WXRuby3
49
49
  @template_params << txt
50
50
  end
51
51
  @args_string = element.at_xpath('argsstring').text
52
+ # transform unified initializers to ctor form (SWIG does not like unified initializers)
53
+ # (also see ParamDef#extract)
54
+ @args_string.gsub!(/(\w+(::\w+)*)\s*{([^}]*)}/) { |_| "#{$1}(#{$3})"}
52
55
  check_deprecated
53
56
  element.xpath('param').each do |node|
54
57
  p = ParamDef.new(node)
@@ -370,6 +373,8 @@ module WXRuby3
370
373
  end
371
374
  if element.at_xpath('defval')
372
375
  @default = BaseDef.flatten_node(element.at_xpath('defval'))
376
+ # transform unified initializers to ctor form (SWIG does not like unified initializers)
377
+ @default.sub!(/(\w+(::\w+)*)\s*{([^}]*)}/) { |_| "#{$1}(#{$3})"}
373
378
  end
374
379
  end
375
380
  rescue Exception
@@ -364,7 +364,7 @@ module WXRuby3
364
364
  }
365
365
  __CODE
366
366
  map_directorout code: <<~__CODE
367
- if (TYPE($input) != T_ARRAY)
367
+ if (TYPE($input) == T_ARRAY)
368
368
  {
369
369
  for (int i = 0; i < RARRAY_LEN($input); i++)
370
370
  {
@@ -398,7 +398,7 @@ module WXRuby3
398
398
  }
399
399
  __CODE
400
400
  map_directorout code: <<~__CODE
401
- if (TYPE($input) != T_ARRAY)
401
+ if (TYPE($input) == T_ARRAY)
402
402
  {
403
403
  for (int i = 0; i < RARRAY_LEN($input); i++)
404
404
  {
@@ -167,7 +167,7 @@ module Dialogs
167
167
  end
168
168
 
169
169
  create(parent, -1, "Preferences")
170
- create_buttons(Wx::ID_OK|Wx::ID_CANCEL)
170
+ create_buttons(Wx::OK|Wx::CANCEL)
171
171
  book_ctrl.set_images(imgs)
172
172
  book_ctrl.add_page(file_panel(book_ctrl), "File", false, img_id1)
173
173
  book_ctrl.add_page(cdrom_panel(book_ctrl), "CD ROM", false, img_id2)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wxruby3
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Corino
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-10-15 00:00:00.000000000 Z
11
+ date: 2024-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -172,6 +172,7 @@ files:
172
172
  - lib/wx/core/dataformat.rb
173
173
  - lib/wx/core/datetime.rb
174
174
  - lib/wx/core/dc.rb
175
+ - lib/wx/core/defs.rb
175
176
  - lib/wx/core/dialog.rb
176
177
  - lib/wx/core/enum.rb
177
178
  - lib/wx/core/event.rb
@@ -1206,7 +1207,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1206
1207
  - !ruby/object:Gem::Version
1207
1208
  version: '0'
1208
1209
  requirements: []
1209
- rubygems_version: 3.5.16
1210
+ rubygems_version: 3.5.22
1210
1211
  signing_key:
1211
1212
  specification_version: 4
1212
1213
  summary: wxWidgets extension for Ruby