wxruby3 1.5.2 → 1.5.4
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.
- checksums.yaml +4 -4
- data/lib/wx/aui/auinotebook.rb +26 -17
- data/lib/wx/core/dialog.rb +29 -1
- data/lib/wx/core/point.rb +12 -3
- data/lib/wx/core/sizer.rb +163 -28
- data/lib/wx/core/splash_screen.rb +3 -3
- data/lib/wx/core/toolbar.rb +2 -2
- data/lib/wx/helpers.rb +8 -10
- data/lib/wx/keyword_ctors.rb +11 -13
- data/lib/wx/rtc/richtext_formatting_dialog.rb +3 -3
- data/lib/wx/rtc/richtext_style_organiser_dialog.rb +3 -3
- data/lib/wx/rtc/symbol_picker_dialog.rb +3 -3
- data/lib/wx/version.rb +1 -1
- data/rakelib/lib/director/aui_tab_art.rb +52 -1
- data/rakelib/lib/director/dialog.rb +22 -1
- data/rakelib/lib/director/sizer.rb +30 -0
- data/tests/test_dialog.rb +61 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 365785c8c4a67019170ce82f52b08eef0c29c1eeaf83f9868edaf5883e5ca2a2
|
4
|
+
data.tar.gz: 48ea3a4a58c2f3f4cb2abab5a935a4b62b933f9413d007dc154aa92e038dc0ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b5921c7a072a6d44baa1afeea45718abf9e632e7b23ed5a24a431589dcc889bda5bafeb3b78d09cb9aebdfc07e752796849a9dbee95259abc7260a2d09974f85
|
7
|
+
data.tar.gz: ab2d3f5579f563a37f7eb61256c4ad95d1498f4b6adf23cb732c6675826c2869d351f049dc91d544427ce0b218e7b1327b8a179ab1dde8c4ed5b1025ce80b206
|
data/lib/wx/aui/auinotebook.rb
CHANGED
@@ -4,27 +4,36 @@
|
|
4
4
|
|
5
5
|
# Advanced User Interface Notebook - draggable panes etc
|
6
6
|
|
7
|
-
|
7
|
+
module Wx
|
8
|
+
module AUI
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
# that designates the event skipped.
|
12
|
-
if Wx::WXWIDGETS_VERSION < '3.3'
|
13
|
-
wx_initialize = instance_method :initialize
|
14
|
-
wx_redefine_method :initialize do |*args|
|
15
|
-
wx_initialize.bind(self).call(*args)
|
16
|
-
evt_window_destroy { |evt| evt.skip }
|
10
|
+
if Wx::WXWIDGETS_VERSION >= '3.3'
|
11
|
+
AuiDefaultTabArt = AuiFlatTabArt
|
17
12
|
end
|
18
|
-
end
|
19
13
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
14
|
+
class AuiNotebook
|
15
|
+
|
16
|
+
# Before wxWidgets 3.3 the AUI manager of this control would prevent
|
17
|
+
# WindowDestroyEvent propagation so we 'patch' in a std event handler
|
18
|
+
# that designates the event skipped.
|
19
|
+
if Wx::WXWIDGETS_VERSION < '3.3'
|
20
|
+
wx_initialize = instance_method :initialize
|
21
|
+
wx_redefine_method :initialize do |*args|
|
22
|
+
wx_initialize.bind(self).call(*args)
|
23
|
+
evt_window_destroy { |evt| evt.skip }
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
# Convenience method for iterating pages
|
28
|
+
def each_page
|
29
|
+
if block_given?
|
30
|
+
0.upto(get_page_count - 1) do | i |
|
31
|
+
yield get_page(i)
|
32
|
+
end
|
33
|
+
else
|
34
|
+
::Enumerator.new { |y| each_page { |pg| y << pg } }
|
35
|
+
end
|
25
36
|
end
|
26
|
-
else
|
27
|
-
::Enumerator.new { |y| each_page { |pg| y << pg } }
|
28
37
|
end
|
29
38
|
end
|
30
39
|
end
|
data/lib/wx/core/dialog.rb
CHANGED
@@ -21,13 +21,41 @@ class Wx::Dialog
|
|
21
21
|
|
22
22
|
end
|
23
23
|
|
24
|
+
def create_button_sizer(flags)
|
25
|
+
if Wx.has_feature?(:USE_BUTTON)
|
26
|
+
create_std_dialog_button_sizer(flags)
|
27
|
+
else
|
28
|
+
nil
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def create_separated_sizer(sizer)
|
33
|
+
# Mac Human Interface Guidelines recommend not to use static lines as
|
34
|
+
# grouping elements
|
35
|
+
if Wx.has_feature?(:USE_STATLINE) && Wx::PLATFORM != 'WXOSX'
|
36
|
+
topsizer = Wx::VBoxSizer.new
|
37
|
+
topsizer.add(Wx::StaticLine.new(self),
|
38
|
+
Wx::SizerFlags.new.expand.double_border(Wx::BOTTOM))
|
39
|
+
topsizer.add(sizer, Wx::SizerFlags.new.expand)
|
40
|
+
sizer = topsizer
|
41
|
+
end
|
42
|
+
|
43
|
+
sizer
|
44
|
+
end
|
45
|
+
|
46
|
+
def create_separated_button_sizer(flags)
|
47
|
+
sizer = create_button_sizer(flags)
|
48
|
+
return create_separated_sizer(sizer) if sizer
|
49
|
+
nil
|
50
|
+
end
|
51
|
+
|
24
52
|
module Functor
|
25
53
|
def self.included(klass)
|
26
54
|
scope = klass.name.split('::')
|
27
55
|
functor_nm = scope.pop
|
28
56
|
code = <<~__CODE
|
29
57
|
def #{functor_nm}(*args, **kwargs, &block)
|
30
|
-
dlg = #{klass.name}.new(*args, **kwargs)
|
58
|
+
dlg = kwargs.empty? ? #{klass.name}.new(*args) : #{klass.name}.new(*args, **kwargs)
|
31
59
|
begin
|
32
60
|
if block_given?
|
33
61
|
return block.call(dlg)
|
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
|
-
|
46
|
+
that_x, that_y = other.to_ary
|
46
47
|
elsif Array === other && other.size == 2
|
47
|
-
|
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
|
|
data/lib/wx/core/sizer.rb
CHANGED
@@ -10,44 +10,71 @@
|
|
10
10
|
|
11
11
|
module Wx
|
12
12
|
class Sizer
|
13
|
-
#
|
13
|
+
# Redefine #add and #insert methods to support positional and named
|
14
14
|
# arguments
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
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
|
-
|
20
|
+
wx_sizer_add = instance_method :add
|
21
|
+
wx_redefine_method :add do |*args, **kwargs|
|
21
22
|
|
22
|
-
|
23
|
-
args
|
24
|
-
|
25
|
-
|
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
|
-
|
28
|
+
full_args << args.shift # get first argument
|
30
29
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
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
|
-
|
42
|
-
idx = args.shift
|
43
|
-
full_args.concat(args)
|
48
|
+
end
|
44
49
|
|
45
|
-
|
46
|
-
|
47
|
-
|
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
|
-
|
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, *
|
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(*
|
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 ] +
|
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")
|
data/lib/wx/core/toolbar.rb
CHANGED
@@ -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, *
|
24
|
+
def add_item(bitmap1, *args, **kwargs)
|
25
25
|
|
26
26
|
begin
|
27
|
-
args = Wx::args_as_list(ADD_ITEM_PARAMS, *
|
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
|
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, *
|
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 =
|
31
|
-
arg =
|
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
|
-
|
38
|
+
Kernel.raise ArgumentError,
|
39
|
+
"Bad arg composition of #{args.inspect}"
|
42
40
|
end
|
43
41
|
|
44
|
-
unless
|
45
|
-
Kernel.raise ArgumentError,
|
46
|
-
|
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
|
data/lib/wx/keyword_ctors.rb
CHANGED
@@ -164,18 +164,16 @@ module Wx
|
|
164
164
|
end
|
165
165
|
end
|
166
166
|
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
kwa[param.name] = arg if arg
|
167
|
+
if RUBY_VERSION < '3.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, *
|
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(*
|
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] +
|
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
|
|
@@ -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, *
|
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(*
|
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 ] +
|
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, *
|
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(*
|
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 ] +
|
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, *
|
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(*
|
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 ] +
|
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
@@ -14,7 +14,12 @@ module WXRuby3
|
|
14
14
|
|
15
15
|
def setup
|
16
16
|
super
|
17
|
-
|
17
|
+
if Config.instance.wx_version >= '3.3.0'
|
18
|
+
spec.items << 'wxAuiFlatTabArt' << 'wxAuiSimpleTabArt'
|
19
|
+
spec.ignore 'wxAuiDefaultTabArt', 'wxAuiNativeTabArt'
|
20
|
+
else
|
21
|
+
spec.items << 'wxAuiDefaultTabArt' << 'wxAuiSimpleTabArt'
|
22
|
+
end
|
18
23
|
spec.gc_as_object
|
19
24
|
spec.disable_proxies
|
20
25
|
# missing from interface documentation
|
@@ -92,8 +97,54 @@ module WXRuby3
|
|
92
97
|
'wxAuiSimpleTabArt::Clone')
|
93
98
|
spec.do_not_generate(:variables, :defines, :enums, :functions)
|
94
99
|
end
|
100
|
+
|
101
|
+
|
102
|
+
def generator
|
103
|
+
WXRuby3::AuiTabArtGenerator.new(self)
|
104
|
+
end
|
105
|
+
protected :generator
|
106
|
+
|
107
|
+
def doc_generator
|
108
|
+
WXRuby3::AuiTabArtDocGenerator.new(self)
|
109
|
+
end
|
110
|
+
protected :doc_generator
|
111
|
+
|
95
112
|
end # class AuiTabArt
|
96
113
|
|
97
114
|
end # class Director
|
98
115
|
|
116
|
+
class AuiTabArtGenerator < InterfaceGenerator
|
117
|
+
|
118
|
+
def gen_interface_classes(fout)
|
119
|
+
super
|
120
|
+
if Config.instance.wx_version >= '3.3.0'
|
121
|
+
fout.puts
|
122
|
+
fout.puts 'class wxAuiNativeTabArt : public wxAuiTabArt'
|
123
|
+
fout.puts '{'
|
124
|
+
fout.puts '};'
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
end
|
129
|
+
|
130
|
+
class AuiTabArtDocGenerator < DocGenerator
|
131
|
+
def gen_class_doc(fdoc)
|
132
|
+
super
|
133
|
+
if Config.instance.wx_version >= '3.3.0'
|
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
|
+
fdoc.puts 'class AuiNativeTabArt < AuiTabArt; end'
|
136
|
+
fdoc.puts
|
137
|
+
end
|
138
|
+
end
|
139
|
+
def gen_constants_doc(fdoc)
|
140
|
+
super
|
141
|
+
if Config.instance.wx_version >= '3.3.0'
|
142
|
+
fdoc.doc.puts 'Wx::AUI::AuiDefaultTabArt is an alias for the tab art provider used by {Wx::AUI::AuiNotebook} by default.'
|
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
|
+
fdoc.puts 'AuiDefaultTabArt = Wx::AUI::AuiFlatTabArt'
|
145
|
+
fdoc.puts
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
99
150
|
end # module WXRuby3
|
@@ -34,7 +34,28 @@ module WXRuby3
|
|
34
34
|
extern VALUE wxRuby_GetDialogClass() {
|
35
35
|
return SwigClassWxDialog.klass;
|
36
36
|
}
|
37
|
-
|
37
|
+
__HEREDOC
|
38
|
+
spec.ignore 'wxDialog::CreateButtonSizer', # pure Ruby impl
|
39
|
+
'wxDialog::CreateSeparatedButtonSizer', # pure Ruby impl
|
40
|
+
'wxDialog::CreateSeparatedSizer', # pure Ruby impl
|
41
|
+
'wxDialog::CreateTextSizer', # custom impl
|
42
|
+
ignore_doc: false
|
43
|
+
spec.new_object 'wxDialog::CreateStdDialogButtonSizer' if Config.instance.features_set?('USE_BUTTON')
|
44
|
+
spec.add_extend_code 'wxDialog', <<~__HEREDOC
|
45
|
+
VALUE CreateTextSizer(const wxString& message, int widthMax)
|
46
|
+
{
|
47
|
+
wxSizer* txt_szr = $self->CreateTextSizer(message, widthMax);
|
48
|
+
if (txt_szr)
|
49
|
+
{
|
50
|
+
// Get the wx class
|
51
|
+
wxString class_name( txt_szr->GetClassInfo()->GetClassName() );
|
52
|
+
swig_type_info* swig_type = wxRuby_GetSwigTypeForClassName(class_name);
|
53
|
+
if (swig_type)
|
54
|
+
return SWIG_NewPointerObj(SWIG_as_voidptr(txt_szr), swig_type, SWIG_POINTER_OWN | 0 );
|
55
|
+
}
|
56
|
+
return Qnil;
|
57
|
+
}
|
58
|
+
__HEREDOC
|
38
59
|
when 'wxMessageDialog'
|
39
60
|
spec.ignore 'wxMessageDialog::ButtonLabel'
|
40
61
|
spec.map 'const ButtonLabel&' => 'String,Integer' do
|
@@ -139,6 +139,36 @@ module WXRuby3
|
|
139
139
|
'wxSizerItem * Add(wxWindow *window, const wxGBPosition &pos, const wxGBSpan &span=wxDefaultSpan, int flag=0, int border=0, wxObject *userData=NULL)',
|
140
140
|
'wxSizerItem * Add(int width, int height, const wxGBPosition &pos, const wxGBSpan &span=wxDefaultSpan, int flag=0, int border=0, wxObject *userData=NULL)'
|
141
141
|
spec.disown 'wxSizer* sizer_disown'
|
142
|
+
spec.map 'const wxGBPosition&' => 'Array(Integer, Integer), Wx::GBPosition',
|
143
|
+
'const wxGBSpan&' => 'Array(Integer, Integer), Wx::GBSpan' do
|
144
|
+
add_header_code '#include <memory>'
|
145
|
+
map_in temp: 'std::unique_ptr<$1_basetype> tmp', code: <<~__CODE
|
146
|
+
if ( TYPE($input) == T_DATA )
|
147
|
+
{
|
148
|
+
void* argp$argnum;
|
149
|
+
SWIG_ConvertPtr($input, &argp$argnum, $1_descriptor, 0);
|
150
|
+
$1 = reinterpret_cast< $1_basetype * >(argp$argnum);
|
151
|
+
}
|
152
|
+
else if ( TYPE($input) == T_ARRAY )
|
153
|
+
{
|
154
|
+
$1 = new $1_basetype( NUM2INT( rb_ary_entry($input, 0) ),
|
155
|
+
NUM2INT( rb_ary_entry($input, 1) ) );
|
156
|
+
tmp.reset($1); // auto destruct when method scope ends
|
157
|
+
}
|
158
|
+
else
|
159
|
+
{
|
160
|
+
rb_raise(rb_eTypeError, "Wrong type for $1_basetype parameter");
|
161
|
+
}
|
162
|
+
__CODE
|
163
|
+
map_typecheck precedence: 'POINTER', code: <<~__CODE
|
164
|
+
void *vptr = 0;
|
165
|
+
$1 = 0;
|
166
|
+
if (TYPE($input) == T_ARRAY && RARRAY_LEN($input) == 2)
|
167
|
+
$1 = 1;
|
168
|
+
else if (TYPE($input) == T_DATA && SWIG_CheckState (SWIG_ConvertPtr ($input, &vptr, $1_descriptor, 0)))
|
169
|
+
$1 = 1;
|
170
|
+
__CODE
|
171
|
+
end
|
142
172
|
end
|
143
173
|
# no real use for allowing these to be overloaded but a whole lot of grieve
|
144
174
|
# if we do allow it
|
data/tests/test_dialog.rb
CHANGED
@@ -16,5 +16,66 @@ class DialogTests < Test::Unit::TestCase
|
|
16
16
|
dlg = TestDialog.new
|
17
17
|
assert_kind_of(Wx::Dialog, dlg)
|
18
18
|
assert_kind_of(Wx::Window, dlg)
|
19
|
+
dlg.destroy
|
20
|
+
end
|
21
|
+
|
22
|
+
class TestDialog2 < Wx::Dialog
|
23
|
+
def initialize
|
24
|
+
super(nil, -1, 'Test Dialog')
|
25
|
+
|
26
|
+
sizer_top = Wx::VBoxSizer.new
|
27
|
+
sizer_top.add(Wx::StaticText.new(self, label: 'Some text ...'))
|
28
|
+
|
29
|
+
sizer_btn = Wx::HBoxSizer.new
|
30
|
+
btn_focused = Wx::Button.new(self, -1, "Default button")
|
31
|
+
btn_other = Wx::Button.new(self, -1, "&Another button")
|
32
|
+
btn_close = Wx::Button.new(self, Wx::ID_CANCEL, "&Close")
|
33
|
+
sizer_btn.add(btn_focused, 0, Wx::ALIGN_CENTER | Wx::ALL, 5)
|
34
|
+
sizer_btn.add(btn_other, 0, Wx::ALIGN_CENTER | Wx::ALL, 5)
|
35
|
+
sizer_btn.add(btn_close, 0, Wx::ALIGN_CENTER | Wx::ALL, 5)
|
36
|
+
|
37
|
+
sizer_top.add(create_separated_sizer(sizer_btn))
|
38
|
+
|
39
|
+
set_auto_layout(true)
|
40
|
+
set_sizer(sizer_top)
|
41
|
+
|
42
|
+
sizer_top.set_size_hints(self)
|
43
|
+
sizer_top.fit(self)
|
44
|
+
|
45
|
+
btn_focused.set_focus
|
46
|
+
btn_focused.set_default
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_dialog_with_separated_sizer
|
51
|
+
dlg = TestDialog2.new
|
52
|
+
dlg.show(true)
|
53
|
+
200.times { Wx.get_app.yield }
|
54
|
+
sleep(2) unless is_ci_build?
|
55
|
+
dlg.destroy
|
56
|
+
end
|
57
|
+
|
58
|
+
class TestDialog3 < Wx::Dialog
|
59
|
+
def initialize
|
60
|
+
super(nil, -1, 'Test Dialog')
|
61
|
+
|
62
|
+
sizer_top = Wx::VBoxSizer.new
|
63
|
+
sizer_top.add(Wx::StaticText.new(self, label: 'Some text ...'))
|
64
|
+
sizer_top.add(create_separated_button_sizer(Wx::YES_NO|Wx::CANCEL))
|
65
|
+
|
66
|
+
set_auto_layout(true)
|
67
|
+
set_sizer(sizer_top)
|
68
|
+
|
69
|
+
sizer_top.set_size_hints(self)
|
70
|
+
sizer_top.fit(self)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def test_dialog_with_button_sizer
|
75
|
+
dlg = TestDialog3.new
|
76
|
+
dlg.show(true)
|
77
|
+
200.times { Wx.get_app.yield }
|
78
|
+
sleep(2) unless is_ci_build?
|
79
|
+
dlg.destroy
|
19
80
|
end
|
20
81
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wxruby3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Corino
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: nokogiri
|
@@ -1210,7 +1210,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1210
1210
|
- !ruby/object:Gem::Version
|
1211
1211
|
version: '0'
|
1212
1212
|
requirements: []
|
1213
|
-
rubygems_version: 3.6.
|
1213
|
+
rubygems_version: 3.6.7
|
1214
1214
|
specification_version: 4
|
1215
1215
|
summary: wxWidgets extension for Ruby
|
1216
1216
|
test_files: []
|