wxruby3 1.3.1 → 1.4.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) 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/mark_free_impl.i +47 -11
  6. data/ext/wxruby3/swig/wx.i +30 -12
  7. data/lib/wx/aui/auifloatframe.rb +1 -1
  8. data/lib/wx/aui/auimanager.rb +5 -16
  9. data/lib/wx/aui/auinotebook.rb +1 -1
  10. data/lib/wx/aui/require.rb +0 -2
  11. data/lib/wx/core/acceleratortable.rb +1 -1
  12. data/lib/wx/core/animation.rb +2 -2
  13. data/lib/wx/core/app.rb +1 -1
  14. data/lib/wx/core/artprovider.rb +4 -4
  15. data/lib/wx/core/bitmap.rb +1 -1
  16. data/lib/wx/core/bitmap_combobox.rb +2 -2
  17. data/lib/wx/core/clientdc.rb +1 -1
  18. data/lib/wx/core/clipboard.rb +4 -4
  19. data/lib/wx/core/colour.rb +1 -1
  20. data/lib/wx/core/combobox.rb +1 -1
  21. data/lib/wx/core/config.rb +7 -7
  22. data/lib/wx/core/controlwithitems.rb +3 -3
  23. data/lib/wx/core/data_object.rb +4 -4
  24. data/lib/wx/core/dataformat.rb +9 -3
  25. data/lib/wx/core/dialog.rb +3 -2
  26. data/lib/wx/core/event.rb +3 -3
  27. data/lib/wx/core/evthandler.rb +317 -289
  28. data/lib/wx/core/file_dialog.rb +1 -1
  29. data/lib/wx/core/find_replace_dialog.rb +2 -2
  30. data/lib/wx/core/functions.rb +1 -1
  31. data/lib/wx/core/genericdirctrl.rb +1 -1
  32. data/lib/wx/core/geometry.rb +2 -2
  33. data/lib/wx/core/graphics_pen_info.rb +1 -1
  34. data/lib/wx/core/helpprovider.rb +1 -1
  35. data/lib/wx/core/icon.rb +1 -1
  36. data/lib/wx/core/image.rb +2 -2
  37. data/lib/wx/core/imagelist.rb +1 -1
  38. data/lib/wx/core/locale.rb +5 -5
  39. data/lib/wx/core/log.rb +8 -8
  40. data/lib/wx/core/menu.rb +3 -3
  41. data/lib/wx/core/module_ext.rb +16 -0
  42. data/lib/wx/core/owner_drawn_combobox.rb +3 -3
  43. data/lib/wx/core/pen_info.rb +1 -1
  44. data/lib/wx/core/persistence_manager.rb +2 -2
  45. data/lib/wx/core/rect.rb +1 -1
  46. data/lib/wx/core/secret_store.rb +1 -1
  47. data/lib/wx/core/simplehelpprovider.rb +1 -1
  48. data/lib/wx/core/sizer.rb +8 -8
  49. data/lib/wx/core/splash_screen.rb +1 -1
  50. data/lib/wx/core/standard_paths.rb +1 -1
  51. data/lib/wx/core/task_bar_button.rb +1 -1
  52. data/lib/wx/core/text_entry.rb +1 -1
  53. data/lib/wx/core/textctrl.rb +2 -2
  54. data/lib/wx/core/timer.rb +2 -2
  55. data/lib/wx/core/tree_ctrl.rb +1 -1
  56. data/lib/wx/core/v_list_box.rb +1 -1
  57. data/lib/wx/core/validator.rb +2 -2
  58. data/lib/wx/core/variant.rb +2 -2
  59. data/lib/wx/core/window.rb +48 -2
  60. data/lib/wx/core/xmlresource.rb +4 -4
  61. data/lib/wx/core.rb +2 -0
  62. data/lib/wx/doc/evthandler.rb +1 -0
  63. data/lib/wx/doc/tip_window.rb +22 -0
  64. data/lib/wx/grid/grid.rb +3 -3
  65. data/lib/wx/grid/require.rb +0 -2
  66. data/lib/wx/html/htmlhelpcontroller.rb +1 -1
  67. data/lib/wx/html/htmlwindow.rb +1 -1
  68. data/lib/wx/html/require.rb +0 -2
  69. data/lib/wx/html/simple_html_listbox.rb +3 -3
  70. data/lib/wx/keyword_ctors.rb +14 -7
  71. data/lib/wx/keyword_defs.rb +7 -7
  72. data/lib/wx/pg/pg_properties.rb +1 -1
  73. data/lib/wx/pg/pg_property.rb +3 -3
  74. data/lib/wx/pg/property_grid.rb +2 -2
  75. data/lib/wx/pg/property_grid_interface.rb +2 -2
  76. data/lib/wx/pg/require.rb +0 -2
  77. data/lib/wx/prt/previewframe.rb +1 -1
  78. data/lib/wx/prt/require.rb +0 -2
  79. data/lib/wx/rbn/ribbon_control.rb +1 -1
  80. data/lib/wx/rbn/ribbon_page.rb +1 -1
  81. data/lib/wx/rbn/ribbon_panel.rb +1 -1
  82. data/lib/wx/rtc/require.rb +0 -2
  83. data/lib/wx/rtc/rich_text_composite_object.rb +1 -1
  84. data/lib/wx/rtc/rich_text_ctrl.rb +1 -1
  85. data/lib/wx/rtc/rich_text_paragraph.rb +1 -1
  86. data/lib/wx/rtc/richtext_buffer.rb +3 -3
  87. data/lib/wx/rtc/richtext_formatting_dialog.rb +2 -2
  88. data/lib/wx/rtc/richtext_style_organiser_dialog.rb +1 -1
  89. data/lib/wx/rtc/symbol_picker_dialog.rb +1 -1
  90. data/lib/wx/stc/require.rb +0 -2
  91. data/lib/wx/stc/styled_text_ctrl.rb +1 -1
  92. data/lib/wx/version.rb +1 -1
  93. data/lib/wx/wxruby/base.rb +8 -2
  94. data/lib/wx/wxruby/cmd/setup.rb +61 -37
  95. data/rakelib/gem.rb +8 -4
  96. data/rakelib/lib/config/mingw.rb +1 -1
  97. data/rakelib/lib/director/about_dialog_info.rb +1 -0
  98. data/rakelib/lib/director/aui_manager.rb +63 -57
  99. data/rakelib/lib/director/aui_notebook.rb +7 -0
  100. data/rakelib/lib/director/colour.rb +1 -1
  101. data/rakelib/lib/director/data_format.rb +1 -1
  102. data/rakelib/lib/director/event.rb +1 -0
  103. data/rakelib/lib/director/event_handler.rb +82 -46
  104. data/rakelib/lib/director/functions.rb +0 -3
  105. data/rakelib/lib/director/list_ctrl.rb +14 -10
  106. data/rakelib/lib/director/locale.rb +2 -0
  107. data/rakelib/lib/director/num_validator.rb +7 -0
  108. data/rakelib/lib/director/tip_window.rb +34 -0
  109. data/rakelib/lib/director/window.rb +9 -1
  110. data/rakelib/lib/director.rb +0 -1
  111. data/rakelib/lib/generate/doc/evt_handler.yaml +31 -12
  112. data/rakelib/lib/specs/interfaces.rb +1 -0
  113. data/tests/test_combo_ctrl.rb +1 -0
  114. data/tests/test_event_handling.rb +158 -31
  115. metadata +6 -5
@@ -6,23 +6,42 @@
6
6
  - :pattern: !ruby/regexp /.*/
7
7
  :replace: ''
8
8
  :post:
9
- - :pattern: !ruby/regexp /This\s+implies\s+that\s+the\s+event\s+should\s+be\s+allocated\s+on\s+the\s+heap\s+and/
10
- :subst: 'This implies'
11
- - :pattern: !ruby/regexp /\{Wx::EvtHandler#queue_event\}.*For\s+example:/
9
+ - :pattern: !ruby/regexp /\,\s+i\.e\.\s+it\s+will\s+delete\s+it\s+itself/
12
10
  :subst: ''
13
- - :pattern: !ruby/regexp /Note.*problem:/
11
+ - :pattern: !ruby/regexp /This\s+implies\s+that\s+the\s+event\s+should\s+be\s+allocated.*deleted\s+at\s+any\s+moment\)/
12
+ :subst: "This implies that the event (or any of it's member objects) should not be used/changed after the function returns (as it can be handled and subsequently discarded at any moment)"
13
+ - :pattern: !ruby/regexp /\{Wx::EvtHandler#queue_event\}.*not\s+used\s+by\s+the\s+calling\s+thread\s+any\s+more\./
14
+ :subst: ''
15
+ - :pattern: !ruby/regexp /Care\s+should\s+still\s+be\s+taken\s+to\s+avoid\s+that\s+some\s+fields.*/
16
+ :subst: ''
17
+ - :pattern: !ruby/regexp /Example:/
18
+ :subst: ''
19
+ - :pattern: !ruby/regexp /Note\s+that\s+if\s+you\s+want\s+to\s+pass\s+more\s+data.*/
20
+ :subst: ''
21
+ - :pattern: !ruby/regexp /Reimplemented\s+in.*/
22
+ :subst: ''
23
+ :wxEvtHandler.AddPendingEvent:
24
+ :detail:
25
+ :post:
26
+ - :pattern: !ruby/regexp /This\s+function\s+is\s+similar\s+to\s+\{Wx::EvtHandler#queue_event\}.*/
27
+ :subst: 'This function is similar to {Wx::EvtHandler#queue_event}.'
28
+ - :pattern: !ruby/regexp /A\s+copy\s+of\s+event\s+is\s+made\s+by\s+the\s+function,.*/
29
+ :subst: 'Other than {Wx::EvtHandler#queue_event} this method creates a (shallow) copy of event before queueing the copied event. In case (user defined) event classes require deep copying of Ruby member object these classes should override the #initialize_clone method (**NOT** #clone as wxRuby3 does not currently support overriding event class #clone methods).'
30
+ - :pattern: !ruby/regexp /Reimplemented\s+in.*/
14
31
  :subst: ''
15
32
  :wxEvtHandler.SetNextHandler:
33
+ :brief:
34
+ :post:
35
+ - :pattern: !ruby/regexp /Sets\s+the\s+pointer\s+to\s+the\s+next\s+handler\./
36
+ :subst: 'Inserts the given handler as the next handler in the chain.'
16
37
  :detail:
17
38
  :pre:
18
- :programlisting:
19
- - :pattern: !ruby/regexp /.*/
20
- :replace: |
21
-
22
- ```ruby
23
- handlerA.set_next_handler(handlerB)
24
- handlerB.set_previous_handler(handlerA)
25
- ```
39
+ :para:
40
+ - :pattern: !ruby/regexp /See.*ProcessEvent\(\)/
41
+ :replace: |
42
+ In wxRuby this fully handles double linking, i.e. wxRuby will take care of pointing the handler given
43
+ back to this handler as well. There is no need to call set_previous_handler so this method is not supported
44
+ in wxRuby3.
26
45
  :wxEvtHandler.TryBefore:
27
46
  :detail:
28
47
  :pre:
@@ -201,6 +201,7 @@ module WXRuby3
201
201
  Director.Spec(pkg, 'wxDragDrop', requirements: %w[USE_DRAG_AND_DROP])
202
202
  Director.Spec(pkg, 'wxContextHelpButton', requirements: %w[USE_HELP])
203
203
  Director.Spec(pkg, 'wxHelpProvider', requirements: %w[USE_HELP])
204
+ Director.Spec(pkg, 'wxTipWindow', requirements: %w[USE_HELP])
204
205
  Director.Spec(pkg, 'wxHelpController', requirements: %w[USE_HELP])
205
206
  Director.Spec(pkg, 'wxExtHelpController', director: Director::HelpController, requirements: %w[USE_HELP])
206
207
  Director.Spec(pkg, 'wxTaskBarIconEvent', director: Director::Event, requirements: %w[USE_TASKBARICON])
@@ -23,6 +23,7 @@ class ComboCtrlCtrlTests < WxRuby::Test::GUITests
23
23
  end
24
24
 
25
25
  def create(parent)
26
+ GC.start
26
27
  # need to finish creating the list view here
27
28
  # as calling super here would just call Wx::ComboPopup#create and not Wx::ListView#create
28
29
  # we need to use Ruby magic
@@ -10,6 +10,14 @@ class EventHandlingTests < Test::Unit::TestCase
10
10
  EVT_TEST_EVENT = Wx::EvtHandler.register_class(self, nil, 'evt_test_event', 0)
11
11
  def initialize(id=0)
12
12
  super(EVT_TEST_EVENT, id)
13
+ @value = nil
14
+ end
15
+
16
+ attr_accessor :value
17
+
18
+ def initialize_clone(org)
19
+ super
20
+ self.value = org.value.dup if org.value
13
21
  end
14
22
  end
15
23
 
@@ -53,15 +61,18 @@ class EventHandlingTests < Test::Unit::TestCase
53
61
  super(nil, size: [300,300])
54
62
  @child = Child.new(self)
55
63
  @test_event = false
64
+ @test_event_value = nil
56
65
  @test_cmd_event = false
66
+ @focus_event = false
57
67
  @called_after = false
58
68
 
59
- evt_test_event { |evt| @test_event = true }
69
+ evt_test_event { |evt| @test_event = true; @test_event_value = evt.value }
60
70
  evt_test_cmd_event { |evt| @test_cmd_event = true }
71
+ evt_set_focus { |evt| @focus_event = true }
61
72
  end
62
73
 
63
74
  attr_reader :child
64
- attr_reader :test_event, :test_cmd_event
75
+ attr_reader :test_event, :test_event_value, :test_cmd_event, :focus_event
65
76
  attr_accessor :called_after
66
77
 
67
78
  def reset
@@ -76,16 +87,20 @@ class EventHandlingTests < Test::Unit::TestCase
76
87
  win = TestFrame.new
77
88
  assert(!win.test_event)
78
89
  assert(!win.child.test_event)
79
- win.child.event_handler.process_event(TestEvent.new)
90
+ win.child.process_event(TestEvent.new)
80
91
  assert(!win.test_event)
81
92
  assert(win.child.test_event)
82
93
  win.reset
83
- win.child.event_handler.process_event(TestEvent.new(1))
94
+ win.child.process_event(TestEvent.new(1))
84
95
  assert(!win.test_event)
85
96
  assert(win.child.test_event)
86
97
  win.reset
87
- win.event_handler.process_event(TestEvent.new)
98
+ evt = TestEvent.new
99
+ evt.value = 'Something happened'.dup
100
+ win.process_event(evt)
101
+ evt.value << ' again'
88
102
  assert(win.test_event)
103
+ assert_equal('Something happened again', win.test_event_value)
89
104
  assert(!win.child.test_event)
90
105
  win.destroy
91
106
  Wx.get_app.yield
@@ -95,43 +110,72 @@ class EventHandlingTests < Test::Unit::TestCase
95
110
  win = TestFrame.new
96
111
  assert_false(win.test_cmd_event)
97
112
  assert_false(win.child.test_cmd_event)
98
- win.child.event_handler.process_event(TestCmdEvent.new)
113
+ win.child.process_event(TestCmdEvent.new)
99
114
  assert_false(win.test_cmd_event)
100
115
  assert_true(win.child.test_cmd_event)
101
116
  assert_false(win.child.test_client_data)
102
117
  win.reset
103
- win.child.event_handler.process_event(TestCmdEvent.new(1))
118
+ win.child.process_event(TestCmdEvent.new(1))
104
119
  assert_true(win.test_cmd_event)
105
120
  assert_true(win.child.test_cmd_event)
106
121
  assert_true(win.child.test_client_data)
107
122
  win.reset
108
- win.event_handler.process_event(TestCmdEvent.new)
123
+ win.process_event(TestCmdEvent.new)
109
124
  assert_true(win.test_cmd_event)
110
125
  assert_false(win.child.test_cmd_event)
111
126
  win.destroy
112
127
  Wx.get_app.yield
113
128
  end
114
129
 
130
+ def test_queue_focus_event
131
+ win = TestFrame.new
132
+ assert_false(win.focus_event)
133
+ win.queue_event(Wx::FocusEvent.new(Wx::EVT_SET_FOCUS))
134
+ Wx.get_app.yield
135
+ assert_true(win.focus_event)
136
+ win.destroy
137
+ Wx.get_app.yield
138
+ end
139
+
115
140
  def test_queue_event
116
141
  win = TestFrame.new
117
142
  assert_false(win.test_cmd_event)
118
143
  assert_false(win.child.test_cmd_event)
119
- win.child.event_handler.queue_event(TestCmdEvent.new)
144
+ win.child.queue_event(TestCmdEvent.new)
120
145
  Wx.get_app.yield
121
146
  assert_false(win.test_cmd_event)
122
147
  assert_true(win.child.test_cmd_event)
123
148
  assert_false(win.child.test_client_data)
124
149
  win.reset
125
- win.child.event_handler.queue_event(TestCmdEvent.new(1))
150
+ win.child.queue_event(TestCmdEvent.new(1))
126
151
  Wx.get_app.yield
127
152
  assert_true(win.test_cmd_event)
128
153
  assert_true(win.child.test_cmd_event)
129
154
  assert_true(win.child.test_client_data)
130
155
  win.reset
131
- win.event_handler.queue_event(TestCmdEvent.new)
156
+ win.queue_event(TestCmdEvent.new)
132
157
  Wx.get_app.yield
133
158
  assert_true(win.test_cmd_event)
134
159
  assert_false(win.child.test_cmd_event)
160
+ win.reset
161
+ evt = TestEvent.new
162
+ evt.value = 'Something happened'.dup
163
+ win.queue_event(evt)
164
+ evt.value << ' again'
165
+ Wx.get_app.yield
166
+ assert_true(win.test_event)
167
+ assert_equal('Something happened again', win.test_event_value)
168
+ assert_false(win.child.test_event)
169
+ win.destroy
170
+ Wx.get_app.yield
171
+ end
172
+
173
+ def test_pending_focus_event
174
+ win = TestFrame.new
175
+ assert_false(win.focus_event)
176
+ win.add_pending_event(Wx::FocusEvent.new(Wx::EVT_SET_FOCUS))
177
+ Wx.get_app.yield
178
+ assert_true(win.focus_event)
135
179
  win.destroy
136
180
  Wx.get_app.yield
137
181
  end
@@ -140,22 +184,31 @@ class EventHandlingTests < Test::Unit::TestCase
140
184
  win = TestFrame.new
141
185
  assert_false(win.test_cmd_event)
142
186
  assert_false(win.child.test_cmd_event)
143
- win.child.event_handler.add_pending_event(TestCmdEvent.new)
187
+ win.child.add_pending_event(TestCmdEvent.new)
144
188
  Wx.get_app.yield
145
189
  assert_false(win.test_cmd_event)
146
190
  assert_true(win.child.test_cmd_event)
147
191
  assert_false(win.child.test_client_data)
148
192
  win.reset
149
- win.child.event_handler.add_pending_event(TestCmdEvent.new(1))
193
+ win.child.add_pending_event(TestCmdEvent.new(1))
150
194
  Wx.get_app.yield
151
195
  assert_true(win.test_cmd_event)
152
196
  assert_true(win.child.test_cmd_event)
153
197
  assert_true(win.child.test_client_data)
154
198
  win.reset
155
- win.event_handler.add_pending_event(TestCmdEvent.new)
199
+ win.add_pending_event(TestCmdEvent.new)
156
200
  Wx.get_app.yield
157
201
  assert_true(win.test_cmd_event)
158
202
  assert_false(win.child.test_cmd_event)
203
+ win.reset
204
+ evt = TestEvent.new
205
+ evt.value = 'Something happened'.dup
206
+ win.add_pending_event(evt)
207
+ evt.value << ' again'
208
+ Wx.get_app.yield
209
+ assert_true(win.test_event)
210
+ assert_equal('Something happened', win.test_event_value)
211
+ assert_false(win.child.test_event)
159
212
  win.destroy
160
213
  Wx.get_app.yield
161
214
  end
@@ -164,19 +217,19 @@ class EventHandlingTests < Test::Unit::TestCase
164
217
  win = TestFrame.new
165
218
  assert_false(win.test_cmd_event)
166
219
  assert_false(win.child.test_cmd_event)
167
- Wx.post_event(win.child.event_handler, TestCmdEvent.new)
220
+ Wx.post_event(win.child, TestCmdEvent.new)
168
221
  Wx.get_app.yield
169
222
  assert_false(win.test_cmd_event)
170
223
  assert_true(win.child.test_cmd_event)
171
224
  assert_false(win.child.test_client_data)
172
225
  win.reset
173
- Wx.post_event(win.child.event_handler, TestCmdEvent.new(1))
226
+ Wx.post_event(win.child, TestCmdEvent.new(1))
174
227
  Wx.get_app.yield
175
228
  assert_true(win.test_cmd_event)
176
229
  assert_true(win.child.test_cmd_event)
177
230
  assert_true(win.child.test_client_data)
178
231
  win.reset
179
- Wx.post_event(win.event_handler, TestCmdEvent.new)
232
+ Wx.post_event(win, TestCmdEvent.new)
180
233
  Wx.get_app.yield
181
234
  assert_true(win.test_cmd_event)
182
235
  assert_false(win.child.test_cmd_event)
@@ -187,11 +240,11 @@ class EventHandlingTests < Test::Unit::TestCase
187
240
  def test_call_after
188
241
  win = TestFrame.new
189
242
  assert(!win.called_after)
190
- win.event_handler.call_after { win.called_after = true }
243
+ win.call_after { win.called_after = true }
191
244
  Wx.get_app.yield
192
245
  assert(win.called_after)
193
246
  win.reset
194
- win.child.event_handler.call_after { win.called_after = true }
247
+ win.child.call_after { win.called_after = true }
195
248
  Wx.get_app.yield
196
249
  assert(win.called_after)
197
250
  win.destroy
@@ -201,31 +254,105 @@ class EventHandlingTests < Test::Unit::TestCase
201
254
  def test_event_blocker
202
255
  win = TestFrame.new
203
256
  assert(!win.test_event)
204
- win.event_handler.process_event(TestEvent.new)
257
+ win.process_event(TestEvent.new)
205
258
  assert(win.test_event)
206
259
  win.reset
207
260
  Wx::EventBlocker.blocked_for(win) do |blkr|
208
- win.event_handler.process_event(TestEvent.new(1))
261
+ win.process_event(TestEvent.new(1))
209
262
  end
210
263
  assert(!win.test_event)
211
- win.event_handler.process_event(TestEvent.new)
264
+ win.process_event(TestEvent.new)
212
265
  assert(win.test_event)
213
266
  win.reset
214
267
  Wx::EventBlocker.blocked_for(win, TestEvent::EVT_TEST_EVENT) do |blkr|
215
- win.event_handler.process_event(TestEvent.new(1))
268
+ win.process_event(TestEvent.new(1))
216
269
  end
217
270
  assert(!win.test_event)
218
- win.event_handler.process_event(TestEvent.new)
271
+ win.process_event(TestEvent.new)
219
272
  assert(win.test_event)
220
273
  win.reset
221
274
  Wx::EventBlocker.blocked_for(win, Wx::EVT_ACTIVATE) do |blkr|
222
- win.event_handler.process_event(TestEvent.new(1))
275
+ win.process_event(TestEvent.new(1))
223
276
  end
224
277
  assert(win.test_event)
225
278
  win.destroy
226
279
  Wx.get_app.yield
227
280
  end
228
281
 
282
+ class MyEventHandler < Wx::EvtHandler
283
+
284
+ def initialize
285
+ super
286
+ @test_event = false
287
+ @test_cmd_event = false
288
+ evt_test_event :on_test_event
289
+ evt_test_cmd_event :on_test_cmd_event
290
+ end
291
+
292
+ attr_reader :test_event, :test_cmd_event
293
+
294
+ def on_test_event(_evt)
295
+ @test_event = true
296
+ end
297
+
298
+ def on_test_cmd_event(evt)
299
+ @test_cmd_event = true
300
+ end
301
+ end
302
+
303
+ class EventSnooper < Wx::EvtHandler
304
+
305
+ def initialize
306
+ super
307
+ @test_event = false
308
+ @test_cmd_event = false
309
+ evt_test_event :on_test_event
310
+ evt_test_cmd_event :on_test_cmd_event
311
+ end
312
+
313
+ attr_reader :test_event, :test_cmd_event
314
+
315
+ def on_test_event(_evt)
316
+ @test_event = true
317
+ end
318
+
319
+ def on_test_cmd_event(evt)
320
+ @test_cmd_event = true
321
+ evt.skip # make sure other handler(s) get this too
322
+ end
323
+
324
+ end
325
+
326
+ def test_chained_event_handler
327
+ snooper = EventSnooper.new
328
+ my_handler = MyEventHandler.new
329
+ snooper.set_next_handler(my_handler)
330
+ assert_false(my_handler.test_event)
331
+ assert_false(snooper.test_event)
332
+ snooper.process_event(TestEvent.new)
333
+ assert_false(my_handler.test_event)
334
+ assert_true(snooper.test_event)
335
+ end
336
+
337
+ def test_pushed_event_handler
338
+ win = TestFrame.new
339
+ snooper = EventSnooper.new
340
+ win.push_event_handler(snooper)
341
+ assert_false(win.test_event)
342
+ assert_false(snooper.test_event)
343
+ win.process_event(TestEvent.new)
344
+ assert_false(win.test_event)
345
+ assert_true(snooper.test_event)
346
+ win.reset
347
+ assert_false(win.test_cmd_event)
348
+ assert_false(snooper.test_cmd_event)
349
+ win.process_event(TestCmdEvent.new)
350
+ assert_true(win.test_cmd_event)
351
+ assert_true(snooper.test_cmd_event)
352
+ win.destroy
353
+ Wx.get_app.yield
354
+ end
355
+
229
356
  class MyEventFilter < Wx::EventFilter
230
357
  def initialize
231
358
  super
@@ -245,16 +372,16 @@ class EventHandlingTests < Test::Unit::TestCase
245
372
  assert_nothing_raised { Wx::EvtHandler.add_filter(filter) }
246
373
  GC.start
247
374
  win = TestFrame.new
248
- win.child.event_handler.process_event(TestEvent.new)
375
+ win.child.process_event(TestEvent.new)
249
376
  GC.start
250
377
  assert(filter.filtered)
251
378
  filter.filtered = false
252
- win.child.event_handler.process_event(TestCmdEvent.new)
379
+ win.child.process_event(TestCmdEvent.new)
253
380
  GC.start
254
381
  assert(!filter.filtered)
255
382
  assert_nothing_raised { Wx::EvtHandler.remove_filter(filter) }
256
383
  GC.start
257
- win.child.event_handler.process_event(TestEvent.new)
384
+ win.child.process_event(TestEvent.new)
258
385
  assert(!filter.filtered)
259
386
  GC.start
260
387
  win.destroy
@@ -277,16 +404,16 @@ class EventHandlingTests < Test::Unit::TestCase
277
404
  assert_nothing_raised { Wx::EvtHandler.add_filter(MyEventFilter2.new) }
278
405
  GC.start
279
406
  win = TestFrame.new
280
- win.child.event_handler.process_event(TestEvent.new)
407
+ win.child.process_event(TestEvent.new)
281
408
  GC.start
282
409
  assert(MyEventFilter2.filtered)
283
410
  MyEventFilter2.filtered = false
284
- win.child.event_handler.process_event(TestCmdEvent.new)
411
+ win.child.process_event(TestCmdEvent.new)
285
412
  GC.start
286
413
  assert(!MyEventFilter2.filtered)
287
414
  assert_nothing_raised { Wx::EvtHandler.clear_filters }
288
415
  GC.start
289
- win.child.event_handler.process_event(TestEvent.new)
416
+ win.child.process_event(TestEvent.new)
290
417
  assert(!MyEventFilter2.filtered)
291
418
  GC.start
292
419
  win.destroy
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wxruby3
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Corino
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-11-08 00:00:00.000000000 Z
10
+ date: 2024-12-29 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: nokogiri
@@ -205,6 +204,7 @@ files:
205
204
  - lib/wx/core/menu.rb
206
205
  - lib/wx/core/menu_bar.rb
207
206
  - lib/wx/core/menuitem.rb
207
+ - lib/wx/core/module_ext.rb
208
208
  - lib/wx/core/notebook.rb
209
209
  - lib/wx/core/object.rb
210
210
  - lib/wx/core/owner_drawn_combobox.rb
@@ -339,6 +339,7 @@ files:
339
339
  - lib/wx/doc/system_settings.rb
340
340
  - lib/wx/doc/text_validator.rb
341
341
  - lib/wx/doc/textctrl.rb
342
+ - lib/wx/doc/tip_window.rb
342
343
  - lib/wx/doc/top_level_window.rb
343
344
  - lib/wx/doc/tree_ctrl.rb
344
345
  - lib/wx/doc/tree_event.rb
@@ -667,6 +668,7 @@ files:
667
668
  - rakelib/lib/director/time_picker_ctrl.rb
668
669
  - rakelib/lib/director/timer.rb
669
670
  - rakelib/lib/director/tip_provider.rb
671
+ - rakelib/lib/director/tip_window.rb
670
672
  - rakelib/lib/director/toggle_button.rb
671
673
  - rakelib/lib/director/tool_bar.rb
672
674
  - rakelib/lib/director/tool_tip.rb
@@ -1207,8 +1209,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1207
1209
  - !ruby/object:Gem::Version
1208
1210
  version: '0'
1209
1211
  requirements: []
1210
- rubygems_version: 3.5.22
1211
- signing_key:
1212
+ rubygems_version: 3.6.2
1212
1213
  specification_version: 4
1213
1214
  summary: wxWidgets extension for Ruby
1214
1215
  test_files: []