wxruby3 1.3.0 → 1.4.2

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 (139) hide show
  1. checksums.yaml +4 -4
  2. data/INSTALL.md +16 -12
  3. data/README.md +4 -3
  4. data/ext/wxruby3/include/wxRubyApp.h +9 -9
  5. data/ext/wxruby3/swig/custom/director.swg +11 -3
  6. data/ext/wxruby3/swig/custom/rubyapi.swg +15 -1
  7. data/ext/wxruby3/swig/mark_free_impl.i +47 -11
  8. data/ext/wxruby3/swig/wx.i +30 -12
  9. data/lib/wx/aui/auifloatframe.rb +1 -1
  10. data/lib/wx/aui/auimanager.rb +50 -14
  11. data/lib/wx/aui/auinotebook.rb +1 -1
  12. data/lib/wx/aui/require.rb +0 -2
  13. data/lib/wx/core/acceleratortable.rb +1 -1
  14. data/lib/wx/core/animation.rb +2 -2
  15. data/lib/wx/core/app.rb +1 -1
  16. data/lib/wx/core/array_ext.rb +1 -0
  17. data/lib/wx/core/artprovider.rb +4 -4
  18. data/lib/wx/core/bitmap.rb +1 -1
  19. data/lib/wx/core/bitmap_combobox.rb +2 -2
  20. data/lib/wx/core/brush.rb +8 -0
  21. data/lib/wx/core/clientdc.rb +1 -1
  22. data/lib/wx/core/clipboard.rb +4 -4
  23. data/lib/wx/core/colour.rb +1 -1
  24. data/lib/wx/core/combobox.rb +1 -1
  25. data/lib/wx/core/config.rb +7 -7
  26. data/lib/wx/core/controlwithitems.rb +3 -3
  27. data/lib/wx/core/data_object.rb +4 -4
  28. data/lib/wx/core/dataformat.rb +9 -3
  29. data/lib/wx/core/defs.rb +49 -0
  30. data/lib/wx/core/dialog.rb +3 -2
  31. data/lib/wx/core/enum.rb +16 -3
  32. data/lib/wx/core/event.rb +3 -3
  33. data/lib/wx/core/evthandler.rb +317 -289
  34. data/lib/wx/core/file_dialog.rb +1 -1
  35. data/lib/wx/core/find_replace_dialog.rb +2 -2
  36. data/lib/wx/core/font.rb +14 -0
  37. data/lib/wx/core/functions.rb +1 -1
  38. data/lib/wx/core/genericdirctrl.rb +1 -1
  39. data/lib/wx/core/geometry.rb +2 -2
  40. data/lib/wx/core/graphics_pen_info.rb +1 -1
  41. data/lib/wx/core/hboxsizer.rb +24 -4
  42. data/lib/wx/core/helpprovider.rb +1 -1
  43. data/lib/wx/core/icon.rb +1 -1
  44. data/lib/wx/core/image.rb +2 -2
  45. data/lib/wx/core/imagelist.rb +1 -1
  46. data/lib/wx/core/locale.rb +5 -5
  47. data/lib/wx/core/log.rb +8 -8
  48. data/lib/wx/core/menu.rb +3 -3
  49. data/lib/wx/core/module_ext.rb +16 -0
  50. data/lib/wx/core/owner_drawn_combobox.rb +3 -3
  51. data/lib/wx/core/pen.rb +20 -0
  52. data/lib/wx/core/pen_info.rb +1 -1
  53. data/lib/wx/core/persistence_manager.rb +2 -2
  54. data/lib/wx/core/real_point.rb +1 -0
  55. data/lib/wx/core/rect.rb +1 -1
  56. data/lib/wx/core/secret_store.rb +1 -1
  57. data/lib/wx/core/simplehelpprovider.rb +1 -1
  58. data/lib/wx/core/sizer.rb +166 -39
  59. data/lib/wx/core/splash_screen.rb +1 -1
  60. data/lib/wx/core/standard_paths.rb +1 -1
  61. data/lib/wx/core/task_bar_button.rb +1 -1
  62. data/lib/wx/core/text_entry.rb +1 -1
  63. data/lib/wx/core/textctrl.rb +2 -2
  64. data/lib/wx/core/timer.rb +2 -2
  65. data/lib/wx/core/tree_ctrl.rb +1 -1
  66. data/lib/wx/core/v_list_box.rb +1 -1
  67. data/lib/wx/core/validator.rb +2 -2
  68. data/lib/wx/core/variant.rb +2 -2
  69. data/lib/wx/core/vboxsizer.rb +24 -4
  70. data/lib/wx/core/window.rb +48 -2
  71. data/lib/wx/core/xmlresource.rb +4 -4
  72. data/lib/wx/core.rb +2 -0
  73. data/lib/wx/doc/array_ext.rb +1 -0
  74. data/lib/wx/doc/aui/auimanager.rb +2 -0
  75. data/lib/wx/doc/enum.rb +26 -0
  76. data/lib/wx/doc/evthandler.rb +1 -0
  77. data/lib/wx/doc/gdi_common.rb +1 -0
  78. data/lib/wx/doc/tip_window.rb +22 -0
  79. data/lib/wx/grid/grid.rb +3 -3
  80. data/lib/wx/grid/require.rb +0 -2
  81. data/lib/wx/html/htmlhelpcontroller.rb +1 -1
  82. data/lib/wx/html/htmlwindow.rb +1 -1
  83. data/lib/wx/html/require.rb +0 -2
  84. data/lib/wx/html/simple_html_listbox.rb +3 -3
  85. data/lib/wx/keyword_ctors.rb +14 -7
  86. data/lib/wx/keyword_defs.rb +7 -7
  87. data/lib/wx/pg/pg_properties.rb +1 -1
  88. data/lib/wx/pg/pg_property.rb +3 -3
  89. data/lib/wx/pg/property_grid.rb +2 -2
  90. data/lib/wx/pg/property_grid_interface.rb +2 -2
  91. data/lib/wx/pg/require.rb +0 -2
  92. data/lib/wx/prt/previewframe.rb +1 -1
  93. data/lib/wx/prt/require.rb +0 -2
  94. data/lib/wx/rbn/ribbon_control.rb +1 -1
  95. data/lib/wx/rbn/ribbon_page.rb +1 -1
  96. data/lib/wx/rbn/ribbon_panel.rb +1 -1
  97. data/lib/wx/rtc/require.rb +0 -2
  98. data/lib/wx/rtc/rich_text_composite_object.rb +1 -1
  99. data/lib/wx/rtc/rich_text_ctrl.rb +1 -1
  100. data/lib/wx/rtc/rich_text_paragraph.rb +1 -1
  101. data/lib/wx/rtc/richtext_buffer.rb +3 -3
  102. data/lib/wx/rtc/richtext_formatting_dialog.rb +2 -2
  103. data/lib/wx/rtc/richtext_style_organiser_dialog.rb +1 -1
  104. data/lib/wx/rtc/symbol_picker_dialog.rb +1 -1
  105. data/lib/wx/stc/require.rb +0 -2
  106. data/lib/wx/stc/styled_text_ctrl.rb +1 -1
  107. data/lib/wx/version.rb +1 -1
  108. data/lib/wx/wxruby/base.rb +8 -2
  109. data/lib/wx/wxruby/cmd/setup.rb +61 -37
  110. data/rakelib/gem.rb +8 -4
  111. data/rakelib/lib/config/mingw.rb +1 -1
  112. data/rakelib/lib/core/include/swigrubyrun.inc +2 -2
  113. data/rakelib/lib/director/about_dialog_info.rb +1 -0
  114. data/rakelib/lib/director/aui_manager.rb +124 -3
  115. data/rakelib/lib/director/aui_notebook.rb +7 -0
  116. data/rakelib/lib/director/colour.rb +1 -1
  117. data/rakelib/lib/director/data_format.rb +1 -1
  118. data/rakelib/lib/director/dialog.rb +4 -2
  119. data/rakelib/lib/director/event.rb +1 -0
  120. data/rakelib/lib/director/event_handler.rb +82 -46
  121. data/rakelib/lib/director/functions.rb +0 -3
  122. data/rakelib/lib/director/list_ctrl.rb +14 -10
  123. data/rakelib/lib/director/locale.rb +2 -0
  124. data/rakelib/lib/director/num_validator.rb +7 -0
  125. data/rakelib/lib/director/pgproperties.rb +2 -2
  126. data/rakelib/lib/director/property_grid_interface.rb +4 -3
  127. data/rakelib/lib/director/textctrl.rb +7 -0
  128. data/rakelib/lib/director/tip_window.rb +34 -0
  129. data/rakelib/lib/director/variant.rb +2 -2
  130. data/rakelib/lib/director/window.rb +9 -1
  131. data/rakelib/lib/director.rb +0 -1
  132. data/rakelib/lib/extractor/function.rb +5 -0
  133. data/rakelib/lib/generate/doc/evt_handler.yaml +31 -12
  134. data/rakelib/lib/specs/interfaces.rb +1 -0
  135. data/rakelib/lib/typemap/common.rb +2 -2
  136. data/samples/dialogs/dialogs.rb +1 -1
  137. data/tests/test_combo_ctrl.rb +1 -0
  138. data/tests/test_event_handling.rb +158 -31
  139. metadata +7 -5
@@ -15,7 +15,7 @@ class Wx::SplashScreen
15
15
  end
16
16
 
17
17
  # now redefine the overridden ctor to account for deviating arglist
18
- def initialize(bitmap, splashstyle, milliseconds, parent = nil, *mixed_args, &block)
18
+ wx_redefine_method :initialize do |bitmap, splashstyle, milliseconds, parent = nil, *mixed_args, &block|
19
19
  # no zero-args ctor for use with XRC!
20
20
 
21
21
  real_args = begin
@@ -10,7 +10,7 @@ module Wx
10
10
  class << self
11
11
 
12
12
  wx_get = instance_method :get
13
- define_method :get do
13
+ wx_redefine_method :get do
14
14
  # cache the global singleton
15
15
  @instance ||= wx_get.bind(self).call
16
16
  end
@@ -9,7 +9,7 @@ module Wx
9
9
  class TaskBarButton
10
10
 
11
11
  wx_remove_thumb_bar_button = instance_method :remove_thumb_bar_button
12
- define_method :remove_thumb_bar_button do |button|
12
+ wx_redefine_method :remove_thumb_bar_button do |button|
13
13
  button = button.get_id if button.is_a?(Wx::ThumbBarButton)
14
14
  wx_remove_thumb_bar_button.bind(self).call(button)
15
15
  end
@@ -11,7 +11,7 @@ module Wx
11
11
  module TextEntry
12
12
 
13
13
  wx_auto_complete = instance_method :auto_complete
14
- define_method :auto_complete do |completer|
14
+ wx_redefine_method :auto_complete do |completer|
15
15
  if wx_auto_complete.bind(self).call(completer)
16
16
  @completer = completer.is_a?(Wx::TextCompleter) ? completer : nil # keep the Ruby object alive or cleanup
17
17
  true
@@ -58,14 +58,14 @@ module Wx
58
58
 
59
59
  class TextCtrl
60
60
  wx_op_append = instance_method :<<
61
- define_method :<< do |o|
61
+ wx_redefine_method :<< do |o|
62
62
  wx_op_append.bind(self).call(o.to_s)
63
63
  self
64
64
  end
65
65
 
66
66
  # Overload to provide Enumerator without block
67
67
  wx_each_line = instance_method :each_line
68
- define_method :each_line do |&block|
68
+ wx_redefine_method :each_line do |&block|
69
69
  if block
70
70
  wx_each_line.bind(self).call(&block)
71
71
  else
data/lib/wx/core/timer.rb CHANGED
@@ -47,14 +47,14 @@ class Wx::Timer
47
47
 
48
48
  # Redefine initialize
49
49
  wx_init = self.instance_method(:initialize)
50
- define_method(:initialize) do | *args |
50
+ wx_redefine_method(:initialize) do | *args |
51
51
  setup_owner_destruction_hook(args[0])
52
52
  wx_init.bind(self).call(*args)
53
53
  end
54
54
 
55
55
  # Redefine set_owner
56
56
  wx_set_owner = self.instance_method(:set_owner)
57
- define_method(:set_owner) do | *args |
57
+ wx_redefine_method(:set_owner) do | *args |
58
58
  setup_owner_destruction_hook(args[0])
59
59
  wx_set_owner.bind(self).call(*args)
60
60
  end
@@ -12,7 +12,7 @@ class Wx::TreeCtrl
12
12
 
13
13
  # Overload to provide Enumerator without block
14
14
  wx_traverse = instance_method :traverse
15
- define_method :traverse do |start_id=nil, &block|
15
+ wx_redefine_method :traverse do |start_id=nil, &block|
16
16
  if block
17
17
  wx_traverse.bind(self).call(start_id, &block)
18
18
  else
@@ -9,7 +9,7 @@
9
9
  class Wx::VListBox
10
10
 
11
11
  wx_each_selected = instance_method :each_selected
12
- define_method :each_selected do |&block|
12
+ wx_redefine_method :each_selected do |&block|
13
13
  if block
14
14
  wx_each_selected.bind(self).call(&block)
15
15
  else
@@ -34,7 +34,7 @@ class Wx::Validator
34
34
  module Binding
35
35
  def self.included(base)
36
36
  wx_on_transfer_from_window = base.instance_method :on_transfer_from_window
37
- base.define_method :on_transfer_from_window do |meth = nil, &block|
37
+ base.wx_redefine_method :on_transfer_from_window do |meth = nil, &block|
38
38
  proc = if block and not meth
39
39
  block
40
40
  elsif meth and not block
@@ -54,7 +54,7 @@ class Wx::Validator
54
54
  end
55
55
 
56
56
  wx_on_transfer_to_window = base.instance_method :on_transfer_to_window
57
- base.define_method :on_transfer_to_window do |meth = nil, &block|
57
+ base.wx_redefine_method :on_transfer_to_window do |meth = nil, &block|
58
58
  proc = if block and not meth
59
59
  block
60
60
  elsif meth and not block
@@ -24,7 +24,7 @@ module Wx
24
24
 
25
25
  # make assign return self and add it's handy alias
26
26
  wx_assign = instance_method :assign
27
- define_method :assign do |v|
27
+ wx_redefine_method :assign do |v|
28
28
  wx_assign.bind(self).call(v)
29
29
  self
30
30
  end
@@ -33,7 +33,7 @@ module Wx
33
33
  # extend to_s to arraylist and list (easier in pure Ruby)
34
34
 
35
35
  wx_to_s = instance_method :to_s
36
- define_method :to_s do
36
+ wx_redefine_method :to_s do
37
37
  unless null?
38
38
  case type
39
39
  when 'list'
@@ -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
@@ -30,6 +30,52 @@ class Wx::Window
30
30
  alias :bring_to_front :raise_window
31
31
  alias :send_to_back :lower_window
32
32
 
33
+ # Event handling overrides
34
+ class << self
35
+ def process_event(evh, event)
36
+ (@m_process_event ||= Wx::EvtHandler.instance_method(:process_event)).bind(evh).call(event)
37
+ end
38
+ def process_event_locally(evh, event)
39
+ (@m_process_event_locally ||= Wx::EvtHandler.instance_method(:process_event_locally)).bind(evh).call(event)
40
+ end
41
+ def safely_process_event(evh, event)
42
+ (@m_safely_process_event ||= Wx::EvtHandler.instance_method(:safely_process_event)).bind(evh).call(event)
43
+ end
44
+ def process_pending_events(evh)
45
+ (@m_process_pending_events ||= Wx::EvtHandler.instance_method(:process_pending_events)).bind(evh).call
46
+ end
47
+ def queue_event(evh, event)
48
+ (@m_queue_event ||= Wx::EvtHandler.instance_method(:queue_event)).bind(evh).call(event)
49
+ end
50
+ def add_pending_event(evh, event)
51
+ (@m_add_pending_event ||= Wx::EvtHandler.instance_method(:add_pending_event)).bind(evh).call(event)
52
+ end
53
+ end
54
+
55
+ def process_event(event)
56
+ Wx::Window.process_event(get_event_handler, event)
57
+ end
58
+
59
+ def process_event_locally(event)
60
+ Wx::Window.process_event_locally(get_event_handler, event)
61
+ end
62
+
63
+ def safely_process_event(event)
64
+ Wx::Window.safely_process_event(get_event_handler, event)
65
+ end
66
+
67
+ def process_pending_events
68
+ Wx::Window.process_pending_events(get_event_handler)
69
+ end
70
+
71
+ def queue_event(event)
72
+ Wx::Window.queue_event(get_event_handler, event)
73
+ end
74
+
75
+ def add_pending_event(event)
76
+ Wx::Window.add_pending_event(get_event_handler, event)
77
+ end
78
+
33
79
  # Recursively searches all windows below +self+ and returns the first
34
80
  # window which has the id +an_id+. This corresponds to the find_window
35
81
  # method method in WxWidgets when called with an integer.
@@ -67,7 +113,7 @@ class Wx::Window
67
113
 
68
114
  # Overload the wrapper method to check for @__painting__
69
115
  wx_paint_buffered = instance_method :paint_buffered
70
- define_method :paint_buffered do |&block|
116
+ wx_redefine_method :paint_buffered do |&block|
71
117
  if instance_variable_defined?('@__painting__')
72
118
  wx_paint_buffered.bind(self).call(&block)
73
119
  else
@@ -77,7 +123,7 @@ class Wx::Window
77
123
 
78
124
  # Overload to provide Enumerator without block
79
125
  wx_each_child = instance_method :each_child
80
- define_method :each_child do |&block|
126
+ wx_redefine_method :each_child do |&block|
81
127
  if block
82
128
  wx_each_child.bind(self).call(&block)
83
129
  else
@@ -9,14 +9,14 @@
9
9
  class Wx::XmlResource
10
10
  class << self
11
11
  wx_get = self.instance_method(:get)
12
- define_method(:get) do
12
+ wx_redefine_method(:get) do
13
13
  result = wx_get.bind(self).call
14
14
  result.init_all_handlers
15
15
  result
16
16
  end
17
17
 
18
18
  wx_add_subclass_factory = self.instance_method(:add_subclass_factory)
19
- define_method(:add_subclass_factory) do |factory|
19
+ wx_redefine_method(:add_subclass_factory) do |factory|
20
20
  @factories ||= []
21
21
  @factories << factory # keep Ruby factories alive through GC
22
22
  wx_add_subclass_factory.bind(self).call(factory)
@@ -25,7 +25,7 @@ class Wx::XmlResource
25
25
 
26
26
  # Again, if created via new, switch subclassing off and init_all_handlers
27
27
  wx_init = self.instance_method(:initialize)
28
- define_method(:initialize) do | *args |
28
+ wx_redefine_method(:initialize) do | *args |
29
29
  result = wx_init.bind(self).call(*args)
30
30
  result.init_all_handlers
31
31
  end
@@ -35,7 +35,7 @@ class Wx::XmlResource
35
35
  # file. In ruby, in these circumstances, it's more natural to raise an
36
36
  # Exception than expect the user to test the return value.
37
37
  wx_load = self.instance_method(:load)
38
- define_method(:load) do | fname |
38
+ wx_redefine_method(:load) do | fname |
39
39
  result = wx_load.bind(self).call(fname)
40
40
  if not result
41
41
  Kernel.raise( RuntimeError,
data/lib/wx/core.rb CHANGED
@@ -38,6 +38,8 @@ require 'wx/global_const'
38
38
  # ctor syntax sweeteners support
39
39
  require 'wx/keyword_ctors'
40
40
 
41
+ require 'wx/core/module_ext'
42
+
41
43
  # Load in all the class extension methods written in ruby
42
44
  # evthandler must be required first b/c it sets up methods modified elsewhere
43
45
  require 'wx/core/evthandler.rb'
@@ -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
@@ -143,6 +143,7 @@ module Wx
143
143
  def call_after(meth = nil, *args, &block) end
144
144
 
145
145
  # Process a {Wx::EVT_HOTKEY} event.
146
+ # @wxrb_require WXOSX|WXMSW
146
147
  # @param [Integer] id hotkey id
147
148
  # @param [String,Symbol,Method,Proc] meth (name of) method or handler proc
148
149
  # @yieldparam [Wx::KeyEvent] event the event to handle
@@ -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 TipWindow < Wx::Window
11
+
12
+ # Constructor.
13
+ #
14
+ # The tip is shown immediately after the window is constructed.
15
+ # @param [Wx::Window] parent The parent window, must be non-nil
16
+ # @param [String] text The text to show, may contain the new line characters
17
+ # @param [Integer] max_length The length of each line, in pixels. Set to a very large value to avoid wrapping lines.
18
+ def initialize(parent, text, max_length = 100); end
19
+
20
+ end
21
+
22
+ end
data/lib/wx/grid/grid.rb CHANGED
@@ -13,7 +13,7 @@ module Wx
13
13
  alias :table= :assign_table
14
14
 
15
15
  wx_each_selected_block = instance_method :each_selected_block
16
- define_method :each_selected_block do
16
+ wx_redefine_method :each_selected_block do
17
17
  if block_given?
18
18
  wx_each_selected_block.bind(self).call
19
19
  else
@@ -27,7 +27,7 @@ module Wx
27
27
  alias :selected_blocks :get_selected_blocks
28
28
 
29
29
  wx_each_selected_row_block = instance_method :each_selected_row_block
30
- define_method :each_selected_row_block do
30
+ wx_redefine_method :each_selected_row_block do
31
31
  if block_given?
32
32
  wx_each_selected_row_block.bind(self).call
33
33
  else
@@ -36,7 +36,7 @@ module Wx
36
36
  end
37
37
 
38
38
  wx_each_selected_col_block = instance_method :each_selected_col_block
39
- define_method :each_selected_col_block do
39
+ wx_redefine_method :each_selected_col_block do
40
40
  if block_given?
41
41
  wx_each_selected_col_block.bind(self).call
42
42
  else
@@ -8,5 +8,3 @@
8
8
  require_relative './events/evt_list'
9
9
  require_relative './keyword_defs'
10
10
  require_relative './grid'
11
-
12
- Wx::Dialog.setup_dialog_functors(Wx::GRID)
@@ -14,7 +14,7 @@ module Wx
14
14
 
15
15
  # cache any explicitly assigned config for GC protection
16
16
  wx_use_config = instance_method(:use_config)
17
- define_method :use_config do |cfg, *args|
17
+ wx_redefine_method :use_config do |cfg, *args|
18
18
  @configuration = cfg
19
19
  if get_help_window
20
20
  # also set config var for any associated help window (as wxWidgets propagates it too)
@@ -17,7 +17,7 @@ module Wx
17
17
  private :html_filters
18
18
 
19
19
  wx_add_filter = instance_method(:add_filter)
20
- define_method(:add_filter) do |filter|
20
+ wx_redefine_method(:add_filter) do |filter|
21
21
  html_filters << filter
22
22
  wx_add_filter.bind(self).call(filter)
23
23
  end
@@ -10,5 +10,3 @@ require_relative './keyword_defs'
10
10
  require_relative './htmlwindow'
11
11
  require_relative './htmlhelpcontroller'
12
12
  require_relative './simple_html_listbox'
13
-
14
- Wx::Dialog.setup_dialog_functors(Wx::HTML)
@@ -6,7 +6,7 @@ class Wx::HTML::SimpleHtmlListBox
6
6
 
7
7
  # make sure to honor the inherited common overloads
8
8
  wx_get_client_object = instance_method :get_client_object
9
- define_method :get_client_object do |*args|
9
+ wx_redefine_method :get_client_object do |*args|
10
10
  if args.empty?
11
11
  super()
12
12
  else
@@ -14,7 +14,7 @@ class Wx::HTML::SimpleHtmlListBox
14
14
  end
15
15
  end
16
16
  wx_set_client_object = instance_method :set_client_object
17
- define_method :set_client_object do |*args|
17
+ wx_redefine_method :set_client_object do |*args|
18
18
  if args.size < 2
19
19
  super(*args)
20
20
  else
@@ -30,7 +30,7 @@ class Wx::HTML::SimpleHtmlListBox
30
30
 
31
31
  # Overload to provide Enumerator without block
32
32
  wx_each_string = instance_method :each_string
33
- define_method :each_string do |&block|
33
+ wx_redefine_method :each_string do |&block|
34
34
  if block
35
35
  wx_each_string.bind(self).call(&block)
36
36
  else
@@ -70,6 +70,13 @@ module Wx
70
70
  # This module defines an inheritable class attribute like the ones defined
71
71
  # by the Rails #class_attribute method.
72
72
  module ParamSpec
73
+
74
+ if RUBY_VERSION < '2.7.0'
75
+ PARAM_SPEC_ARG = [:param_spec]
76
+ else
77
+ PARAM_SPEC_ARG = [:param_spec, false]
78
+ end
79
+
73
80
  def self.included(mod)
74
81
  mod.class_eval do
75
82
  def self.param_spec
@@ -82,9 +89,9 @@ module Wx
82
89
 
83
90
  def self.param_spec=(val)
84
91
  singleton_class.class_eval do
85
- if method_defined?(:param_spec) || private_method_defined?(:param_spec)
92
+ if method_defined?(*PARAM_SPEC_ARG) || private_method_defined?(*PARAM_SPEC_ARG)
86
93
  begin
87
- remove_method(:param_spec);
94
+ remove_method(:param_spec)
88
95
  rescue NameError;
89
96
  end
90
97
  end
@@ -93,9 +100,9 @@ module Wx
93
100
 
94
101
  if singleton_class?
95
102
  class_eval do
96
- if method_defined?(:param_spec) || private_method_defined?(:param_spec)
103
+ if method_defined?(*PARAM_SPEC_ARG) || private_method_defined?(*PARAM_SPEC_ARG)
97
104
  begin
98
- remove_method(:param_spec);
105
+ remove_method(:param_spec)
99
106
  rescue NameError;
100
107
  end
101
108
  end
@@ -108,9 +115,9 @@ module Wx
108
115
  val
109
116
  end
110
117
 
111
- if method_defined?(:param_spec) || private_method_defined?(:param_spec)
118
+ if method_defined?(*PARAM_SPEC_ARG) || private_method_defined?(*PARAM_SPEC_ARG)
112
119
  begin
113
- remove_method(:param_spec);
120
+ remove_method(:param_spec)
114
121
  rescue NameError;
115
122
  end
116
123
  end
@@ -191,7 +198,7 @@ module Wx
191
198
  # The new definition of initialize; accepts a parent arg
192
199
  # mixed_args, which may zero or more position args, optionally
193
200
  # terminated with hash keyword args, and an optional block
194
- def initialize(parent = :default_ctor, *mixed_args, &block)
201
+ wx_redefine_method :initialize do |parent = :default_ctor, *mixed_args, &block|
195
202
  # allow zero-args ctor for use with XRC
196
203
  if parent == :default_ctor
197
204
  pre_wx_kwctor_init
@@ -61,13 +61,13 @@ end
61
61
  # MISCELLANEOUS WINDOWS
62
62
 
63
63
  # OpenGL Canvas
64
- Wx::define_keyword_ctors('GLCanvas') do
65
- wx_ctor_params :id
66
- wx_ctor_params :pos, :size, :style => Wx::FULL_REPAINT_ON_RESIZE
67
- wx_ctor_params :name => 'GLCanvas'
68
- wx_ctor_params :attrib_list => [Wx::GL_RGBA, Wx::GL_DOUBLEBUFFER]
69
- wx_ctor_params :palette => Wx::NULL_PALETTE
70
- end
64
+ # Wx::define_keyword_ctors('GLCanvas') do
65
+ # wx_ctor_params :id
66
+ # wx_ctor_params :pos, :size, :style => Wx::FULL_REPAINT_ON_RESIZE
67
+ # wx_ctor_params :name => 'GLCanvas'
68
+ # wx_ctor_params :attrib_list => [Wx::GL_RGBA, Wx::GL_DOUBLEBUFFER]
69
+ # wx_ctor_params :palette => Wx::NULL_PALETTE
70
+ # end
71
71
 
72
72
  # A window whose colour changes according to current user settings
73
73
  Wx::define_keyword_ctors(Wx::Panel) do
@@ -10,7 +10,7 @@ module Wx::PG
10
10
 
11
11
  # add some 'smart' conversions
12
12
  wx_initialize = instance_method :initialize
13
- define_method :initialize do |label=Wx::PG_LABEL, name=Wx::PG_LABEL, value=Wx::PG::ColourPropertyValue.new|
13
+ wx_redefine_method :initialize do |label=Wx::PG_LABEL, name=Wx::PG_LABEL, value=Wx::PG::ColourPropertyValue.new|
14
14
  value = case value
15
15
  when Wx::Colour
16
16
  Wx::PG::ColourPropertyValue.new(value)
@@ -29,7 +29,7 @@ module Wx::PG
29
29
  class PGProperty
30
30
 
31
31
  wx_each_attribute = instance_method :each_attribute
32
- define_method :each_attribute do
32
+ wx_redefine_method :each_attribute do
33
33
  if block_given?
34
34
  wx_each_attribute.bind(self).call
35
35
  else
@@ -52,7 +52,7 @@ module Wx::PG
52
52
  class PGChoices
53
53
 
54
54
  wx_each_label = instance_method :each_label
55
- define_method :each_label do
55
+ wx_redefine_method :each_label do
56
56
  if block_given?
57
57
  wx_each_label.bind(self).call
58
58
  else
@@ -61,7 +61,7 @@ module Wx::PG
61
61
  end
62
62
 
63
63
  wx_each_entry = instance_method :each_entry
64
- define_method :each_entry do
64
+ wx_redefine_method :each_entry do
65
65
  if block_given?
66
66
  wx_each_entry.bind(self).call
67
67
  else
@@ -29,7 +29,7 @@ module Wx::PG
29
29
  private :property_editors
30
30
 
31
31
  wx_do_register_editor_class = self.instance_method(:do_register_editor_class)
32
- define_method(:do_register_editor_class) do |editor_class, name|
32
+ wx_redefine_method(:do_register_editor_class) do |editor_class, name|
33
33
  editor = wx_do_register_editor_class.bind(self).call(editor_class, name)
34
34
  property_editors[name] = editor # keep safe from GC and for lookup
35
35
  end
@@ -44,7 +44,7 @@ module Wx::PG
44
44
  end
45
45
 
46
46
  wx_set_sorter = instance_method :set_sorter
47
- define_method :set_sorter do |meth, &block|
47
+ wx_redefine_method :set_sorter do |meth, &block|
48
48
  h_sorter = if block and not meth
49
49
  block
50
50
  elsif meth and not block
@@ -20,7 +20,7 @@ module Wx::PG
20
20
  module PropertyGridInterface
21
21
 
22
22
  wx_each_property = instance_method :each_property
23
- define_method :each_property do |flags = Wx::PG::PG_ITERATE_DEFAULT, start = nil, reverse: false, &block|
23
+ wx_redefine_method :each_property do |flags = Wx::PG::PG_ITERATE_DEFAULT, start = nil, reverse: false, &block|
24
24
  if block
25
25
  wx_each_property.bind(self).call(flags.to_int, start, reverse, &block)
26
26
  else
@@ -35,7 +35,7 @@ module Wx::PG
35
35
  alias :properties_reversed :reverse_each_property
36
36
 
37
37
  wx_each_property_attribute = instance_method :each_property_attribute
38
- define_method :each_property_attribute do |id, &block|
38
+ wx_redefine_method :each_property_attribute do |id, &block|
39
39
  if block
40
40
  wx_each_property_attribute.bind(self).call(id, &block)
41
41
  else
data/lib/wx/pg/require.rb CHANGED
@@ -11,5 +11,3 @@ require_relative './property_grid'
11
11
  require_relative './pg_property'
12
12
  require_relative './pg_properties'
13
13
  require_relative './pg_editor'
14
-
15
- Wx::Dialog.setup_dialog_functors(Wx::PG)
@@ -11,7 +11,7 @@ class Wx::PRT::PreviewFrame
11
11
  # to assign it to an instance variable so it is marked correctly when
12
12
  # the frame displaying it is marked.
13
13
  wx_init = self.instance_method(:initialize)
14
- define_method(:initialize) do | *args |
14
+ wx_redefine_method(:initialize) do | *args |
15
15
  wx_init.bind(self).call(*args)
16
16
  @__preview = args[0]
17
17
  end
@@ -7,5 +7,3 @@
7
7
  require_relative './keyword_defs'
8
8
  require_relative './previewframe'
9
9
  require_relative './page_setup_dialog'
10
-
11
- Wx::Dialog.setup_dialog_functors(Wx::PRT)