wxruby3 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/ext/wxruby3/swig/custom/director.swg +6 -20
  3. data/lib/wx/core/animation.rb +35 -14
  4. data/lib/wx/core/choicedlg.rb +7 -10
  5. data/lib/wx/core/colour.rb +10 -0
  6. data/lib/wx/core/dialog.rb +2 -2
  7. data/lib/wx/core/enum.rb +22 -5
  8. data/lib/wx/core/event.rb +7 -0
  9. data/lib/wx/core/file_dialog.rb +25 -0
  10. data/lib/wx/core/functions.rb +4 -10
  11. data/lib/wx/core/gdi_object.rb +24 -0
  12. data/lib/wx/core/object.rb +26 -11
  13. data/lib/wx/core/variant.rb +108 -51
  14. data/lib/wx/doc/animation_ctrl.rb +18 -0
  15. data/lib/wx/doc/colour.rb +12 -0
  16. data/lib/wx/doc/enum.rb +0 -11
  17. data/lib/wx/doc/evthandler.rb +6 -0
  18. data/lib/wx/doc/functions.rb +35 -3
  19. data/lib/wx/doc/gdi_object.rb +22 -0
  20. data/lib/wx/doc/object.rb +24 -0
  21. data/lib/wx/doc/variant.rb +8 -0
  22. data/lib/wx/helpers.rb +2 -3
  23. data/lib/wx/keyword_defs.rb +14 -1
  24. data/lib/wx/version.rb +1 -1
  25. data/rakelib/lib/config.rb +1 -1
  26. data/rakelib/lib/core/include/enum.inc +0 -80
  27. data/rakelib/lib/core/include/funcall.inc +9 -24
  28. data/rakelib/lib/core/include/swigdirector.inc +29 -11
  29. data/rakelib/lib/director/animation_ctrl.rb +11 -0
  30. data/rakelib/lib/director/defs.rb +3 -0
  31. data/rakelib/lib/director/dialog.rb +15 -7
  32. data/rakelib/lib/director/file_dialog_customize_hook.rb +77 -1
  33. data/rakelib/lib/director/functions.rb +0 -12
  34. data/rakelib/lib/director/validator.rb +7 -42
  35. data/rakelib/lib/generate/doc/credential_entry_dialog.yaml +10 -0
  36. data/rakelib/lib/generate/doc/generic_about_dialog.yaml +46 -0
  37. data/rakelib/lib/specs/interfaces.rb +2 -0
  38. data/rakelib/lib/swig_runner.rb +6 -3
  39. data/rakelib/lib/util/string.rb +7 -6
  40. data/samples/animate/anitest.rb +288 -0
  41. data/samples/animate/hourglass.ani +0 -0
  42. data/samples/animate/throbber.gif +0 -0
  43. data/samples/animate/throbber_2x.gif +0 -0
  44. data/samples/animate/tn_anitest.png +0 -0
  45. data/tests/lib/leaked_overload_exception_test.rb +25 -0
  46. data/tests/lib/leaked_process_event_exception_test.rb +33 -0
  47. data/tests/lib/leaked_queued_event_exception_test.rb +34 -0
  48. data/tests/lib/overload_type_exception_test.rb +25 -0
  49. data/tests/test_exceptions.rb +24 -24
  50. metadata +17 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4bac7565182a0ae6badaee56d7b323459bdc2b198281a50639fafd6fcb2d2499
4
- data.tar.gz: 5dc08857adaf213871ec7fce09117bac4cc19f00cac50638de552dc2219ea803
3
+ metadata.gz: ed10da8feaf6d3e77a775f3386dd9970314810239e7e4ce1c2c447658f6f4106
4
+ data.tar.gz: 125e2ddedb7148987456508b887dacae1262753a408cd39503faff80fe6435cc
5
5
  SHA512:
6
- metadata.gz: cbd4920bcc8ae2085ed85b49ee218642c1eb8a58c6bae7132fd653f479e5af6a60c716f61a9ad38bfdcc5cdc1e3560eb4152365127414bf0c401f266b39228c9
7
- data.tar.gz: 60bba874185fe173a83d8878e458721a3f3fe58cbf484be2826c100a6009dff062972af7ecbaa9bc7dd3095d100aafdf326ac2dd994e1e50e7939654673d2466
6
+ metadata.gz: dbe29edc61e3c139efec7d90d5f80b17b3671c141f3f6f3421905320de87b2900e90785bd83550e6b9d502bb184bef4a58c5061c7271629dc5f83d4c2f55ac94
7
+ data.tar.gz: 2b420414ee1c4b8eefa3fa797c5452e8490048876bfe2172fa14f8ffdd4937c907a4714c6af1650768e91cab08f4746881b5c19989bf66778f4ed4a1d2506020
@@ -147,20 +147,14 @@ namespace Swig {
147
147
 
148
148
  DirectorTypeMismatchException(VALUE self, const char *method, VALUE error, const char *msg="");
149
149
 
150
- static inline void raise(VALUE error, const char *msg)
151
- {
152
- throw DirectorTypeMismatchException(error, msg);
153
- }
150
+ static void raise(VALUE error, const char *msg);
154
151
 
155
- static inline void raise(const char *msg)
156
- {
157
- throw DirectorTypeMismatchException(msg);
158
- }
152
+ static void raise(const char *msg);
159
153
 
160
- static inline void raise(VALUE self, const char* method, VALUE error, const char *msg)
161
- {
162
- throw DirectorTypeMismatchException(self, method, error, msg);
163
- }
154
+ static void raise(VALUE self, const char* method, VALUE error, const char *msg);
155
+
156
+ private:
157
+ static void print(const DirectorTypeMismatchException& ex);
164
158
  };
165
159
 
166
160
  /* Any Ruby exception that occurs during a director method call */
@@ -195,14 +189,6 @@ namespace Swig {
195
189
  }
196
190
  };
197
191
 
198
- /* wxRuby customization */
199
- class WXRUBY_EXPORT DirectorRubyException : public DirectorException
200
- {
201
- public:
202
- DirectorRubyException(VALUE error, VALUE rcvr, ID fn_id);
203
-
204
- };
205
-
206
192
  /* Simple thread abstraction for pthreads on win32 */
207
193
  #ifdef __THREAD__
208
194
  # define __PTHREAD__
@@ -6,21 +6,42 @@
6
6
  # Copyright 2004-2007, wxRuby development team
7
7
  # released under the MIT-like wxRuby2 license
8
8
 
9
- class Wx::Animation
10
- # Redefine the initialize method so it raises an exception if a
11
- # non-existent file is given to the constructor; otherwise, wx Widgets
12
- # just carries on with an empty bitmap, which may cause faults later
13
- wx_init = self.instance_method(:initialize)
14
- define_method(:initialize) do | *args |
15
- if args[0].kind_of? String
16
- if not File.exist?( File.expand_path(args[0]) )
17
- Kernel.raise( ArgumentError,
18
- "Animation file does not exist: #{args[0]}" )
9
+ module Wx
10
+
11
+ class Animation
12
+ # Redefine the initialize method so it raises an exception if a
13
+ # non-existent file is given to the constructor; otherwise, wx Widgets
14
+ # just carries on with an empty bitmap, which may cause faults later
15
+ wx_init = self.instance_method(:initialize)
16
+ define_method(:initialize) do | *args |
17
+ if args[0].kind_of? String
18
+ if not File.exist?( File.expand_path(args[0]) )
19
+ Kernel.raise( ArgumentError,
20
+ "Animation file does not exist: #{args[0]}" )
21
+ end
22
+ res = wx_init.bind(self).call()
23
+ res.load_file(args[0], args[1] || Wx::ANIMATION_TYPE_ANY)
24
+ else
25
+ wx_init.bind(self).call(*args)
26
+ end
27
+ end
28
+ end
29
+
30
+ if Wx::WXWIDGETS_VERSION >= '3.3.0'
31
+
32
+ class AnimationCtrl
33
+
34
+ # Redefine this method to accept either a single animation or an animation bundle
35
+ wx_set_animation = self.instance_method(:set_animation)
36
+ define_method(:set_animation) do | arg |
37
+ if Wx::Animation === arg
38
+ arg = Wx::AnimationBundle.new(arg)
39
+ end
40
+ wx_set_animation.bind(self).call(arg)
19
41
  end
20
- res = wx_init.bind(self).call()
21
- res.load_file(args[0], args[1] || Wx::ANIMATION_TYPE_ANY)
22
- else
23
- wx_init.bind(self).call(*args)
42
+
24
43
  end
44
+
25
45
  end
46
+
26
47
  end
@@ -14,9 +14,8 @@ module Wx
14
14
  choices,
15
15
  parent = nil,
16
16
  initial_selection: 0,
17
- x: Wx::DEFAULT_COORD,
18
- y: Wx::DEFAULT_COORD)
19
- dialog = Wx::SingleChoiceDialog.new(parent, message, caption, choices, nil, Wx::CHOICEDLG_STYLE, [x, y])
17
+ pos: Wx::DEFAULT_POSITION)
18
+ dialog = Wx::SingleChoiceDialog.new(parent, message, caption, choices, Wx::CHOICEDLG_STYLE, pos)
20
19
 
21
20
  dialog.selection = initial_selection
22
21
  return dialog.show_modal == Wx::ID_OK ? dialog.get_string_selection : ''
@@ -28,9 +27,8 @@ module Wx
28
27
  choices,
29
28
  parent = nil,
30
29
  initial_selection: 0,
31
- x: Wx::DEFAULT_COORD,
32
- y: Wx::DEFAULT_COORD)
33
- dialog = Wx::SingleChoiceDialog.new(parent, message, caption, choices, nil, Wx::CHOICEDLG_STYLE, [x, y])
30
+ pos: Wx::DEFAULT_POSITION)
31
+ dialog = Wx::SingleChoiceDialog.new(parent, message, caption, choices, Wx::CHOICEDLG_STYLE, pos)
34
32
 
35
33
  dialog.selection = initial_selection
36
34
  return dialog.show_modal == Wx::ID_OK ? dialog.get_selection : -1
@@ -43,16 +41,15 @@ module Wx
43
41
  choices,
44
42
  parent = nil,
45
43
  initial_selections: [],
46
- x: Wx::DEFAULT_COORD,
47
- y: Wx::DEFAULT_COORD)
48
- dialog = Wx::MultiChoiceDialog.new(parent, message, caption, choices, Wx::CHOICEDLG_STYLE, [x, y])
44
+ pos: Wx::DEFAULT_POSITION)
45
+ dialog = Wx::MultiChoiceDialog.new(parent, message, caption, choices, Wx::CHOICEDLG_STYLE, pos)
49
46
 
50
47
  # call this even if selections array is empty and this then (correctly)
51
48
  # deselects the first item which is selected by default
52
49
  dialog.selections = initial_selections
53
50
 
54
51
  if dialog.show_modal != Wx::ID_OK
55
- return []
52
+ return nil
56
53
  end
57
54
 
58
55
  dialog.get_selections
@@ -45,6 +45,16 @@ module Wx
45
45
  def to_s
46
46
  "#<Wx::Colour: (#{red}, #{green}, #{blue} *#{alpha})>"
47
47
  end
48
+
49
+ # Copy ctor available.
50
+ def dup
51
+ self.class.new(self)
52
+ end
53
+
54
+ def clone
55
+ dup
56
+ end
57
+
48
58
  end
49
59
 
50
60
  end
@@ -25,8 +25,8 @@ class Wx::Dialog
25
25
  scope = klass.name.split('::')
26
26
  functor_nm = scope.pop
27
27
  code = <<~__CODE
28
- def #{functor_nm}(*args, &block)
29
- dlg = #{klass.name}.new(*args)
28
+ def #{functor_nm}(*args, **kwargs, &block)
29
+ dlg = #{klass.name}.new(*args, **kwargs)
30
30
  begin
31
31
  if block_given?
32
32
  return block.call(dlg)
data/lib/wx/core/enum.rb CHANGED
@@ -8,6 +8,23 @@
8
8
 
9
9
  class Wx::Enum
10
10
 
11
+ class << self
12
+
13
+ def enumerators
14
+ self.constants(false).inject({}) do |tbl, cn|
15
+ cv = self.const_get(cn)
16
+ tbl[cv.to_i] = cn if self === cv
17
+ tbl
18
+ end
19
+ end
20
+
21
+ def [](enum_name)
22
+ return self.const_get(enum_name) if self.const_defined?(enum_name)
23
+ nil
24
+ end
25
+
26
+ end
27
+
11
28
  def |(other)
12
29
  if other.instance_of?(self.class)
13
30
  self.class.new(to_i | other.to_i)
@@ -52,10 +69,10 @@ class Wx::Enum
52
69
  return '' if to_i == 0
53
70
  enums = []
54
71
  mask = to_i
55
- self.class.values.each_value do |enum|
56
- if enum != 0 && mask.allbits?(enum)
57
- enums << enum.to_s
58
- mask &= ~enum
72
+ self.class.enumerators.each_pair do |eval, ename|
73
+ if eval != 0 && mask.allbits?(eval)
74
+ enums << ename
75
+ mask &= ~eval
59
76
  break if mask == 0
60
77
  end
61
78
  end
@@ -65,7 +82,7 @@ class Wx::Enum
65
82
  private :bitmask_to_s
66
83
 
67
84
  def to_s
68
- self.class.values.has_key?(to_i) ? "#{self.class.name}::#{self.class.names_by_value[self]}" : bitmask_to_s
85
+ self.class.enumerators.has_key?(to_i) ? "#{self.class.name}::#{self.class.enumerators[to_i]}" : bitmask_to_s
69
86
  end
70
87
 
71
88
  end
data/lib/wx/core/event.rb CHANGED
@@ -58,4 +58,11 @@ module Wx
58
58
  Wx::EVT_NC_PAINT,
59
59
  Wx::NcPaintEvent
60
60
  ]
61
+ if Wx.const_defined?(:EVT_HOTKEY)
62
+ EvtHandler.register_event_type EvtHandler::EventType[
63
+ 'evt_hotkey', 1,
64
+ Wx::EVT_HOTKEY,
65
+ Wx::KeyEvent
66
+ ]
67
+ end
61
68
  end
@@ -20,4 +20,29 @@ module Wx
20
20
 
21
21
  end
22
22
 
23
+ class FileDialogCustomizeHook
24
+
25
+ # prevent construction of abstract base
26
+ if RUBY_VERSION < '2.7.0'
27
+ def self.new(*)
28
+ raise NotImplementedError, 'Wx::FileDialogCustomizeHook is an abstract class.' if self == Wx::FileDialogCustomizeHook
29
+ super
30
+ end
31
+ else
32
+ def self.new(*, **)
33
+ raise NotImplementedError, 'Wx::FileDialogCustomizeHook is an abstract class.' if self == Wx::FileDialogCustomizeHook
34
+ super
35
+ end
36
+ end
37
+
38
+ # provide default no-ops
39
+
40
+ def add_custom_controls(customizer) end
41
+
42
+ def update_custom_controls; end
43
+
44
+ def transfer_data_from_custom_controls; end
45
+
46
+ end
47
+
23
48
  end
@@ -13,20 +13,14 @@ module Wx
13
13
  # Allow this to be called with keyword parameters, and avoid
14
14
  # segfaults on OS X with bad params
15
15
  wx_about_box = self.instance_method(:about_box)
16
- define_method(:about_box) do | info |
17
- # If AboutDialogInfo has no version, it segfaults on OS X 10.5
18
- no_version = ArgumentError.new("Must supply a version for AboutDialog")
16
+ define_method(:about_box) do | info, parent=nil |
19
17
  case info
20
18
  when Wx::AboutDialogInfo
21
- unless info.has_version
22
- Kernel.raise no_version
23
- end
24
-
25
19
  ab_info = info
26
20
  when Hash
27
21
  ab_info = Wx::AboutDialogInfo.new
28
22
  ab_info.name = info[:name] || 'wxRuby application'
29
- ab_info.version = info[:version] || Kernel.raise(no_version)
23
+ ab_info.version = info[:version] if info[:version]
30
24
 
31
25
  ab_info.description = info[:description] || ''
32
26
  ab_info.copyright = info[:copyright] || ''
@@ -36,7 +30,7 @@ module Wx
36
30
  ab_info.artists = info[:artists] || []
37
31
  ab_info.translators = info[:translators] || []
38
32
  if info.key?(:website)
39
- ab_info.set_website(*info[:website])
33
+ ab_info.set_web_site(*info[:website])
40
34
  end
41
35
  if info.key?(:icon)
42
36
  ab_info.icon = info[:icon]
@@ -46,7 +40,7 @@ module Wx
46
40
  Kernel.raise ArgumentError,
47
41
  "Can't use #{info.inspect} for AboutDialogInfo"
48
42
  end
49
- wx_about_box.bind(self).call(ab_info)
43
+ wx_about_box.bind(self).call(ab_info, parent)
50
44
  end
51
45
  end
52
46
  end
@@ -0,0 +1,24 @@
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 GDIObject < Object
12
+
13
+ # GDIObjects have safe, working (and relatively cheap) copy ctors.
14
+ def dup
15
+ self.class.new(self)
16
+ end
17
+
18
+ def clone
19
+ dup
20
+ end
21
+
22
+ end
23
+
24
+ end
@@ -8,16 +8,31 @@
8
8
 
9
9
  # The root class for most (not all) WxRuby classes
10
10
 
11
- class Wx::Object
12
- # Massage the output of inspect to show the public module name (Wx),
13
- # instead of the internal name (Wxruby2)
14
- # def to_s
15
- # super.sub('ruby2', '')
16
- # end
17
-
18
- # Returns a string containing the C++ pointer address of this
19
- # object. Only useful for debugging.
20
- def ptr_addr
21
- Wx::ptr_addr(self)
11
+ module Wx
12
+
13
+ class Object
14
+ # Massage the output of inspect to show the public module name (Wx),
15
+ # instead of the internal name (Wxruby2)
16
+ # def to_s
17
+ # super.sub('ruby2', '')
18
+ # end
19
+
20
+ # Returns a string containing the C++ pointer address of this
21
+ # object. Only useful for debugging.
22
+ def ptr_addr
23
+ Wx::ptr_addr(self)
24
+ end
25
+
26
+ # By default Wx:::Object derived class instances cannot be #dup-licated.
27
+ def dup
28
+ nil
29
+ end
30
+
31
+ # By default Wx::Object derived class instances cannot be cloned but instead return self.
32
+ def clone
33
+ self
34
+ end
35
+
22
36
  end
37
+
23
38
  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
@@ -0,0 +1,18 @@
1
+ # :stopdoc:
2
+ # This file is automatically generated by the WXRuby3 documentation
3
+ # generator. Do not alter this file.
4
+ # :startdoc:
5
+
6
+
7
+ module Wx
8
+
9
+ class GenericAnimationCtrl < AnimationCtrl
10
+
11
+ # This override of {Wx::AnimationCtrl#play} lets you specify if the animation must loop or not.
12
+ # @param looped [Boolean] default true
13
+ # @return [Boolean]
14
+ def play(looped = true) end
15
+
16
+ end
17
+
18
+ end
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
@@ -100,17 +100,6 @@ module Wx
100
100
  # of a bitwise **or** expression is returned matching the mask.
101
101
  def to_s; end
102
102
 
103
- # Create a new class and associated enum values.
104
- # @param [String,Symbol] name name of new enum class
105
- # @param [Hash] enum_values hash with enum value name and enum integer value pairs
106
- # @return [Class] new enum class
107
- def self.create(name, enum_values) end
108
-
109
- # Returns enum class matching name or nil.
110
- # @param [String,Symbol] name name of enum class
111
- # @return [Class,nil] enum class
112
- def self.[](name) end
113
-
114
103
  end
115
104
 
116
105
  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
  #