wxruby3 1.2.1 → 1.3.1

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 (66) hide show
  1. checksums.yaml +4 -4
  2. data/ext/wxruby3/swig/custom/director.swg +16 -22
  3. data/ext/wxruby3/swig/custom/rubyapi.swg +15 -1
  4. data/lib/wx/aui/auimanager.rb +61 -14
  5. data/lib/wx/core/animation.rb +35 -14
  6. data/lib/wx/core/array_ext.rb +1 -0
  7. data/lib/wx/core/brush.rb +8 -0
  8. data/lib/wx/core/choicedlg.rb +7 -10
  9. data/lib/wx/core/colour.rb +10 -0
  10. data/lib/wx/core/defs.rb +49 -0
  11. data/lib/wx/core/dialog.rb +2 -2
  12. data/lib/wx/core/enum.rb +16 -3
  13. data/lib/wx/core/event.rb +7 -0
  14. data/lib/wx/core/file_dialog.rb +25 -0
  15. data/lib/wx/core/font.rb +14 -0
  16. data/lib/wx/core/gdi_object.rb +24 -0
  17. data/lib/wx/core/hboxsizer.rb +24 -4
  18. data/lib/wx/core/object.rb +26 -11
  19. data/lib/wx/core/pen.rb +20 -0
  20. data/lib/wx/core/real_point.rb +1 -0
  21. data/lib/wx/core/sizer.rb +166 -39
  22. data/lib/wx/core/variant.rb +108 -51
  23. data/lib/wx/core/vboxsizer.rb +24 -4
  24. data/lib/wx/doc/array_ext.rb +1 -0
  25. data/lib/wx/doc/aui/auimanager.rb +2 -0
  26. data/lib/wx/doc/colour.rb +12 -0
  27. data/lib/wx/doc/enum.rb +26 -0
  28. data/lib/wx/doc/evthandler.rb +6 -0
  29. data/lib/wx/doc/functions.rb +35 -3
  30. data/lib/wx/doc/gdi_common.rb +1 -0
  31. data/lib/wx/doc/gdi_object.rb +22 -0
  32. data/lib/wx/doc/object.rb +24 -0
  33. data/lib/wx/doc/variant.rb +8 -0
  34. data/lib/wx/helpers.rb +2 -3
  35. data/lib/wx/keyword_defs.rb +7 -0
  36. data/lib/wx/version.rb +1 -1
  37. data/rakelib/lib/config.rb +1 -1
  38. data/rakelib/lib/core/include/funcall.inc +9 -24
  39. data/rakelib/lib/core/include/swigdirector.inc +29 -11
  40. data/rakelib/lib/core/include/swigrubyrun.inc +2 -2
  41. data/rakelib/lib/director/animation_ctrl.rb +6 -0
  42. data/rakelib/lib/director/aui_manager.rb +118 -3
  43. data/rakelib/lib/director/defs.rb +3 -0
  44. data/rakelib/lib/director/dialog.rb +17 -7
  45. data/rakelib/lib/director/file_dialog_customize_hook.rb +77 -1
  46. data/rakelib/lib/director/functions.rb +0 -12
  47. data/rakelib/lib/director/pgproperties.rb +2 -2
  48. data/rakelib/lib/director/property_grid_interface.rb +4 -3
  49. data/rakelib/lib/director/textctrl.rb +7 -0
  50. data/rakelib/lib/director/validator.rb +7 -42
  51. data/rakelib/lib/director/variant.rb +2 -2
  52. data/rakelib/lib/extractor/function.rb +5 -0
  53. data/rakelib/lib/generate/doc/credential_entry_dialog.yaml +10 -0
  54. data/rakelib/lib/generate/doc/generic_about_dialog.yaml +46 -0
  55. data/rakelib/lib/specs/interfaces.rb +2 -0
  56. data/rakelib/lib/swig_runner.rb +6 -3
  57. data/rakelib/lib/typemap/common.rb +2 -2
  58. data/rakelib/lib/util/string.rb +7 -6
  59. data/samples/animate/anitest.rb +13 -9
  60. data/samples/dialogs/dialogs.rb +1 -1
  61. data/tests/lib/leaked_overload_exception_test.rb +25 -0
  62. data/tests/lib/leaked_process_event_exception_test.rb +33 -0
  63. data/tests/lib/leaked_queued_event_exception_test.rb +34 -0
  64. data/tests/lib/overload_type_exception_test.rb +25 -0
  65. data/tests/test_exceptions.rb +24 -24
  66. metadata +13 -3
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
@@ -8,62 +8,119 @@
8
8
 
9
9
  require 'date'
10
10
 
11
- class Wx::Variant
12
- include ::Enumerable
11
+ module Wx
13
12
 
14
- # add a proper enumerator method
15
- def each
16
- if block_given?
17
- get_count.times { |i| yield self[i] }
18
- else
19
- ::Enumerator.new { |y| get_count.times { |i| y << self[i] } }
13
+ class Variant
14
+ include ::Enumerable
15
+
16
+ # add a proper enumerator method
17
+ def each
18
+ if block_given?
19
+ get_count.times { |i| yield self[i] }
20
+ else
21
+ ::Enumerator.new { |y| get_count.times { |i| y << self[i] } }
22
+ end
20
23
  end
21
- end
22
24
 
23
- # make assign return self and add it's handy alias
24
- wx_assign = instance_method :assign
25
- define_method :assign do |v|
26
- wx_assign.bind(self).call(v)
27
- self
28
- end
29
- alias :<< :assign
30
-
31
- # extend to_s to arraylist and list (easier in pure Ruby)
32
-
33
- wx_to_s = instance_method :to_s
34
- define_method :to_s do
35
- unless null?
36
- case type
37
- when 'list'
38
- return "[#{each.collect { |v| v.string? ? %Q{"#{v.to_s}"} : v.to_s }.join(', ')}]"
39
- when 'arrstring'
40
- return array_string.to_s
41
- when 'wxFont'
42
- return font.to_s
43
- when 'wxColour'
44
- return colour.to_s
45
- when 'wxColourPropertyValue'
46
- return colour_property_value.to_s
25
+ # make assign return self and add it's handy alias
26
+ wx_assign = instance_method :assign
27
+ define_method :assign do |v|
28
+ wx_assign.bind(self).call(v)
29
+ self
30
+ end
31
+ alias :<< :assign
32
+
33
+ # extend to_s to arraylist and list (easier in pure Ruby)
34
+
35
+ wx_to_s = instance_method :to_s
36
+ define_method :to_s do
37
+ unless null?
38
+ case type
39
+ when 'list'
40
+ return "[#{each.collect { |v| v.string? ? %Q{"#{v.to_s}"} : v.to_s }.join(', ')}]"
41
+ when 'arrstring'
42
+ return array_string.to_s
43
+ when 'wxFont'
44
+ return font.to_s
45
+ when 'wxColour'
46
+ return colour.to_s
47
+ when 'wxColourPropertyValue'
48
+ return colour_property_value.to_s
49
+ end
47
50
  end
51
+ wx_to_s.bind(self).call
52
+ end
53
+
54
+ # extend with more Ruby-like type checking
55
+
56
+ def string?
57
+ !null? && is_type('string');
58
+ end
59
+
60
+ def bool?
61
+ !null? && is_type('bool');
62
+ end
63
+
64
+ def long?
65
+ !null? && is_type('long');
66
+ end
67
+
68
+ def long_long?
69
+ !null? && is_type('longlong');
70
+ end
71
+
72
+ def u_long_long?
73
+ !null? && is_type('ulonglong');
74
+ end
75
+
76
+ def integer?
77
+ !null? && (long? || long_long? || u_long_long?);
78
+ end
79
+
80
+ def date_time?
81
+ !null? && is_type('datetime');
48
82
  end
49
- wx_to_s.bind(self).call
83
+
84
+ def double?
85
+ !null? && is_type('double');
86
+ end
87
+
88
+ def numeric?
89
+ !null? && (integer? || double?);
90
+ end
91
+
92
+ def list?
93
+ !null? && is_type('list');
94
+ end
95
+
96
+ def array_string?
97
+ !null? && is_type('arrstring');
98
+ end
99
+
100
+ def font?
101
+ !null? && is_type('wxFont');
102
+ end
103
+
104
+ def colour?
105
+ !null? && is_type('wxColour');
106
+ end
107
+
108
+ def colour_property_value?
109
+ !null? && is_type('wxColourPropertyValue');
110
+ end
111
+
112
+ def object?(klass = Object)
113
+ !null? && is_type('WXRB_VALUE') && klass === object;
114
+ end
115
+
116
+ def dup
117
+ self.class.new(self)
118
+ end
119
+
120
+ def clone
121
+ dup
122
+ end
123
+
50
124
  end
51
125
 
52
- # extend with more Ruby-like type checking
53
-
54
- def string?; !null? && is_type('string'); end
55
- def bool?; !null? && is_type('bool'); end
56
- def long?; !null? && is_type('long'); end
57
- def long_long?; !null? && is_type('longlong'); end
58
- def u_long_long?; !null? && is_type('ulonglong'); end
59
- def integer?; !null? && (long? || long_long? || u_long_long?); end
60
- def date_time?; !null? && is_type('datetime'); end
61
- def double?; !null? && is_type('double'); end
62
- def numeric?; !null? && (integer? || double?); end
63
- def list?; !null? && is_type('list'); end
64
- def array_string?; !null? && is_type('arrstring'); end
65
- def font?; !null? && is_type('wxFont'); end
66
- def colour?; !null? && is_type('wxColour'); end
67
- def colour_property_value?; !null? && is_type('wxColourPropertyValue'); end
68
- def object?(klass=Object) !null? && is_type('WXRB_VALUE') && klass === object; end
69
126
  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/colour.rb CHANGED
@@ -9,4 +9,16 @@ module Wx
9
9
 
10
10
  TRANSPARENT_COLOUR = Wx::Colour.new(0, 0, 0, Wx::ALPHA_TRANSPARENT)
11
11
 
12
+ class Colour < Object
13
+
14
+ # Returns a copy-constructed Colour object.
15
+ # @return [Wx::Colour] the duplicated Colour object
16
+ def dup; end
17
+
18
+ # Calls #dup.
19
+ # @return [Wx::Colour]
20
+ def clone; end
21
+
22
+ end
23
+
12
24
  end
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
@@ -142,6 +142,12 @@ module Wx
142
142
  # @yield [*args] optional arguments
143
143
  def call_after(meth = nil, *args, &block) end
144
144
 
145
+ # Process a {Wx::EVT_HOTKEY} event.
146
+ # @param [Integer] id hotkey id
147
+ # @param [String,Symbol,Method,Proc] meth (name of) method or handler proc
148
+ # @yieldparam [Wx::KeyEvent] event the event to handle
149
+ def evt_hotkey(id, meth = nil, &block) end
150
+
145
151
  end
146
152
 
147
153
  end
@@ -158,9 +158,41 @@ module Wx
158
158
  # @!group Dialog shortcuts
159
159
 
160
160
  # @return [Array<Integer>] Selected choices
161
- def self.get_selected_choices(message, caption, choices,
162
- parent = nil, x = Wx::DEFAULT_COORD, y = Wx::DEFAULT_COORD,
163
- centre = true, width = Wx::CHOICE_WIDTH, height = Wx::CHOICE_HEIGHT) end
161
+
162
+ # Get the user selection as a string.
163
+ # @param [String] message
164
+ # @param [String] caption
165
+ # @param [Array<String>] choices choice strings
166
+ # @param [Wx::Window,nil] parent
167
+ # @param [Integer] initial_selection initial choice index
168
+ # @param [Wx::Point,Array(Integer,Integer)] pos
169
+ # @return [String] selected choice or '' if cancelled
170
+ def self.get_single_choice(message, caption, choices, parent = nil,
171
+ initial_selection: 0,
172
+ pos: Wx::DEFAULT_POSITION) end
173
+
174
+ # Get the user selection as an index.
175
+ # @param [String] message
176
+ # @param [String] caption
177
+ # @param [Array<String>] choices choice strings
178
+ # @param [Wx::Window,nil] parent
179
+ # @param [Integer] initial_selection
180
+ # @param [Wx::Point,Array(Integer,Integer)] pos
181
+ # @return [Integer] selected choice index or -1 if cancelled
182
+ def self.get_single_choice_index(message, caption, choices, parent = nil,
183
+ initial_selection: 0,
184
+ pos: Wx::DEFAULT_POSITION) end
185
+
186
+ # @param [String] message
187
+ # @param [String] caption
188
+ # @param [Array<String>] choices choice strings
189
+ # @param [Wx::Window,nil] parent
190
+ # @param [Array<Integer>] initial_selections array of initial choice indexes
191
+ # @param [Wx::Point,Array(Integer,Integer)] pos
192
+ # @return [Array<Integer>,nil] selected choice indexes (can be empty array if none selected) or nil if cancelled
193
+ def self.get_selected_choices(message, caption, choices, parent = nil,
194
+ initial_selections: [],
195
+ pos: Wx::DEFAULT_POSITION) end
164
196
 
165
197
  # Pops up a file selector box.
166
198
  #
@@ -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
@@ -0,0 +1,22 @@
1
+ # :stopdoc:
2
+ # Copyright (c) 2023 M.J.N. Corino, The Netherlands
3
+ #
4
+ # This software is released under the MIT license.
5
+ # :startdoc:
6
+
7
+
8
+ module Wx
9
+
10
+ class GDIObject < Object
11
+
12
+ # Returns a copy-constructed GDI object.
13
+ # @return [Wx::GDIObject] the duplicated GDI object
14
+ def dup; end
15
+
16
+ # Calls #dup.
17
+ # @return [Wx::GDIObject]
18
+ def clone; end
19
+
20
+ end
21
+
22
+ end
@@ -0,0 +1,24 @@
1
+ # :stopdoc:
2
+ # Copyright (c) 2023 M.J.N. Corino, The Netherlands
3
+ #
4
+ # This software is released under the MIT license.
5
+ # :startdoc:
6
+
7
+
8
+ module Wx
9
+
10
+ class Object
11
+
12
+ # By default Wx:::Object derived classes cannot be #dup-licated.
13
+ # Some derived classes (like GDIObject-s) may provide functional overloads.
14
+ # @return [nil]
15
+ def dup; end
16
+
17
+ # By default Wx::Object derived class instances cannot be cloned but instead return self.
18
+ # Derived classes (like the Event classes) may provide functional overloads.
19
+ # @return [self]
20
+ def clone; end
21
+
22
+ end
23
+
24
+ end
@@ -168,6 +168,14 @@ module Wx
168
168
  # @return [true,false]
169
169
  def object?(klass=Object) end
170
170
 
171
+ # Copy constructs a Variant instance.
172
+ # @return [Wx::Variant]
173
+ def dup; end
174
+
175
+ # Calls #dup.
176
+ # @return [Wx::Variant]
177
+ def clone; end
178
+
171
179
  end
172
180
 
173
181
  end
data/lib/wx/helpers.rb CHANGED
@@ -27,9 +27,8 @@ module Wx
27
27
  out_args = []
28
28
  param_spec.each_with_index do | param, i |
29
29
  # has supplied list arg or the keyword arg?
30
- if (arg = mixed_args[i]) || kwa.key?(param.name)
31
- arg = kwa.delete(param.name) unless arg
32
- end
30
+ arg = mixed_args[i]
31
+ arg = kwa.delete(param.name) if arg.nil? && kwa.key?(param.name)
33
32
  if Proc === param.default_or_proc
34
33
  arg = param.default_or_proc.call(arg) # provides default or converts arg
35
34
  elsif arg.nil?
@@ -267,6 +267,13 @@ Wx::define_keyword_ctors(Wx::PropertySheetDialog) do
267
267
  wx_ctor_params :name => Wx::DIALOG_NAME_STR
268
268
  end
269
269
 
270
+ # Credentials entry dialog
271
+ Wx::define_keyword_ctors(Wx::CredentialEntryDialog) do
272
+ wx_ctor_params :message => ''
273
+ wx_ctor_params :title => 'Enter credentials'
274
+ wx_ctor_params :cred => ->(cred) { cred || Wx::WebCredentials.new }
275
+ end
276
+
270
277
  ### CONTROLS
271
278
 
272
279
  # Push button control, displaying text
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.2.1'
6
+ WXRUBY_VERSION = '1.3.1'
7
7
  end
@@ -360,7 +360,7 @@ module WXRuby3
360
360
  test = File.join(Config.instance.test_dir, test)
361
361
  test = Dir.glob(test+'.rb').shift || test unless File.exist?(test)
362
362
  end
363
- Rake.sh(Config.instance.exec_env, *make_ruby_cmd(test)) { |ok,status| errors += 1 unless ok }
363
+ Rake.sh(Config.instance.exec_env.merge({'RUBYLIB'=>rb_lib_path}), FileUtils::RUBY, test) { |ok,status| errors += 1 unless ok }
364
364
  end
365
365
  end
366
366
  fail "ERRORS: ##{errors} test scripts failed." if errors>0