wxruby3 1.3.1 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/INSTALL.md +16 -12
- data/README.md +4 -3
- data/ext/wxruby3/include/wxRubyApp.h +9 -9
- data/ext/wxruby3/swig/mark_free_impl.i +47 -11
- data/ext/wxruby3/swig/wx.i +30 -12
- data/lib/wx/aui/auifloatframe.rb +1 -1
- data/lib/wx/aui/auimanager.rb +5 -16
- data/lib/wx/aui/auinotebook.rb +1 -1
- data/lib/wx/aui/require.rb +0 -2
- data/lib/wx/core/acceleratortable.rb +1 -1
- data/lib/wx/core/animation.rb +2 -2
- data/lib/wx/core/app.rb +1 -1
- data/lib/wx/core/artprovider.rb +4 -4
- data/lib/wx/core/bitmap.rb +1 -1
- data/lib/wx/core/bitmap_combobox.rb +2 -2
- data/lib/wx/core/clientdc.rb +1 -1
- data/lib/wx/core/clipboard.rb +4 -4
- data/lib/wx/core/colour.rb +1 -1
- data/lib/wx/core/combobox.rb +1 -1
- data/lib/wx/core/config.rb +7 -7
- data/lib/wx/core/controlwithitems.rb +3 -3
- data/lib/wx/core/data_object.rb +4 -4
- data/lib/wx/core/dataformat.rb +9 -3
- data/lib/wx/core/dialog.rb +3 -2
- data/lib/wx/core/event.rb +3 -3
- data/lib/wx/core/evthandler.rb +325 -289
- data/lib/wx/core/file_dialog.rb +1 -1
- data/lib/wx/core/find_replace_dialog.rb +2 -2
- data/lib/wx/core/functions.rb +1 -1
- data/lib/wx/core/genericdirctrl.rb +1 -1
- data/lib/wx/core/geometry.rb +2 -2
- data/lib/wx/core/graphics_pen_info.rb +1 -1
- data/lib/wx/core/helpprovider.rb +1 -1
- data/lib/wx/core/icon.rb +1 -1
- data/lib/wx/core/image.rb +2 -2
- data/lib/wx/core/imagelist.rb +1 -1
- data/lib/wx/core/locale.rb +5 -5
- data/lib/wx/core/log.rb +8 -8
- data/lib/wx/core/menu.rb +3 -3
- data/lib/wx/core/module_ext.rb +16 -0
- data/lib/wx/core/owner_drawn_combobox.rb +3 -3
- data/lib/wx/core/pen_info.rb +1 -1
- data/lib/wx/core/persistence_manager.rb +2 -2
- data/lib/wx/core/rect.rb +1 -1
- data/lib/wx/core/secret_store.rb +1 -1
- data/lib/wx/core/simplehelpprovider.rb +1 -1
- data/lib/wx/core/sizer.rb +8 -8
- data/lib/wx/core/splash_screen.rb +1 -1
- data/lib/wx/core/standard_paths.rb +1 -1
- data/lib/wx/core/task_bar_button.rb +1 -1
- data/lib/wx/core/text_entry.rb +1 -1
- data/lib/wx/core/textctrl.rb +2 -2
- data/lib/wx/core/timer.rb +2 -2
- data/lib/wx/core/tree_ctrl.rb +1 -1
- data/lib/wx/core/v_list_box.rb +1 -1
- data/lib/wx/core/validator.rb +2 -2
- data/lib/wx/core/variant.rb +2 -2
- data/lib/wx/core/window.rb +48 -2
- data/lib/wx/core/xmlresource.rb +4 -4
- data/lib/wx/core.rb +2 -0
- data/lib/wx/doc/evthandler.rb +1 -23
- data/lib/wx/doc/tip_window.rb +22 -0
- data/lib/wx/grid/grid.rb +3 -3
- data/lib/wx/grid/require.rb +0 -2
- data/lib/wx/html/htmlhelpcontroller.rb +1 -1
- data/lib/wx/html/htmlwindow.rb +1 -1
- data/lib/wx/html/require.rb +0 -2
- data/lib/wx/html/simple_html_listbox.rb +3 -3
- data/lib/wx/keyword_ctors.rb +14 -7
- data/lib/wx/keyword_defs.rb +7 -7
- data/lib/wx/pg/pg_properties.rb +1 -1
- data/lib/wx/pg/pg_property.rb +3 -3
- data/lib/wx/pg/property_grid.rb +2 -2
- data/lib/wx/pg/property_grid_interface.rb +2 -2
- data/lib/wx/pg/require.rb +0 -2
- data/lib/wx/prt/previewframe.rb +1 -1
- data/lib/wx/prt/require.rb +0 -2
- data/lib/wx/rbn/ribbon_control.rb +1 -1
- data/lib/wx/rbn/ribbon_page.rb +1 -1
- data/lib/wx/rbn/ribbon_panel.rb +1 -1
- data/lib/wx/rtc/require.rb +0 -2
- data/lib/wx/rtc/rich_text_composite_object.rb +1 -1
- data/lib/wx/rtc/rich_text_ctrl.rb +1 -1
- data/lib/wx/rtc/rich_text_paragraph.rb +1 -1
- data/lib/wx/rtc/richtext_buffer.rb +3 -3
- data/lib/wx/rtc/richtext_formatting_dialog.rb +2 -2
- data/lib/wx/rtc/richtext_style_organiser_dialog.rb +1 -1
- data/lib/wx/rtc/symbol_picker_dialog.rb +1 -1
- data/lib/wx/stc/require.rb +0 -2
- data/lib/wx/stc/styled_text_ctrl.rb +1 -1
- data/lib/wx/version.rb +1 -1
- data/lib/wx/wxruby/base.rb +8 -2
- data/lib/wx/wxruby/cmd/setup.rb +61 -37
- data/rakelib/gem.rb +8 -4
- data/rakelib/lib/config/macosx.rb +31 -4
- data/rakelib/lib/config/mingw.rb +1 -1
- data/rakelib/lib/config/pkgman/linux.rb +9 -1
- data/rakelib/lib/core/package.rb +68 -49
- data/rakelib/lib/director/about_dialog_info.rb +1 -0
- data/rakelib/lib/director/aui_manager.rb +63 -57
- data/rakelib/lib/director/aui_notebook.rb +7 -0
- data/rakelib/lib/director/colour.rb +1 -1
- data/rakelib/lib/director/data_format.rb +1 -1
- data/rakelib/lib/director/event.rb +1 -0
- data/rakelib/lib/director/event_handler.rb +82 -46
- data/rakelib/lib/director/events.rb +5 -3
- data/rakelib/lib/director/functions.rb +0 -3
- data/rakelib/lib/director/grid_ctrl.rb +24 -0
- data/rakelib/lib/director/html_printout.rb +2 -0
- data/rakelib/lib/director/list_ctrl.rb +14 -10
- data/rakelib/lib/director/locale.rb +2 -0
- data/rakelib/lib/director/num_validator.rb +7 -0
- data/rakelib/lib/director/print_data.rb +7 -0
- data/rakelib/lib/director/printer.rb +2 -0
- data/rakelib/lib/director/richtext_printing.rb +2 -0
- data/rakelib/lib/director/splitter_window.rb +17 -0
- data/rakelib/lib/director/textctrl.rb +21 -4
- data/rakelib/lib/director/tip_window.rb +34 -0
- data/rakelib/lib/director/window.rb +9 -1
- data/rakelib/lib/director.rb +0 -1
- data/rakelib/lib/generate/doc/evt_handler.yaml +31 -12
- data/rakelib/lib/specs/interfaces.rb +9 -0
- data/rakelib/lib/typemap/print_page_range.rb +97 -0
- data/tests/test_combo_ctrl.rb +1 -0
- data/tests/test_event_handling.rb +158 -31
- metadata +7 -5
@@ -0,0 +1,97 @@
|
|
1
|
+
# Copyright (c) 2023 M.J.N. Corino, The Netherlands
|
2
|
+
#
|
3
|
+
# This software is released under the MIT license.
|
4
|
+
|
5
|
+
###
|
6
|
+
# wxRuby3 PrintPageRange array typemap definition
|
7
|
+
###
|
8
|
+
|
9
|
+
require_relative '../core/mapping'
|
10
|
+
|
11
|
+
module WXRuby3
|
12
|
+
|
13
|
+
module Typemap
|
14
|
+
|
15
|
+
# Typemaps for converting returned PGCell references to
|
16
|
+
# either the correct wxRuby class
|
17
|
+
module PrintPageRange
|
18
|
+
|
19
|
+
include Typemap::Module
|
20
|
+
|
21
|
+
define do
|
22
|
+
|
23
|
+
if Config.instance.wx_version >= '3.3.0'
|
24
|
+
map 'const std::vector<wxPrintPageRange> &' => 'Array<Wx::PRT::PrintPageRange>' do
|
25
|
+
map_out code: <<~__CODE
|
26
|
+
$result = rb_ary_new();
|
27
|
+
for (const wxPrintPageRange& range : *$1)
|
28
|
+
{
|
29
|
+
VALUE r_range = SWIG_NewPointerObj(new wxPrintPageRange(range), SWIGTYPE_p_wxPrintPageRange, SWIG_POINTER_OWN);
|
30
|
+
rb_ary_push($result, r_range);
|
31
|
+
}
|
32
|
+
__CODE
|
33
|
+
map_in temp: 'std::vector<wxPrintPageRange> tmp', code: <<~__CODE
|
34
|
+
if (TYPE($input) == T_ARRAY)
|
35
|
+
{
|
36
|
+
$1 = &tmp;
|
37
|
+
for (int i = 0; i < RARRAY_LEN($input); i++)
|
38
|
+
{
|
39
|
+
void *ptr;
|
40
|
+
VALUE r_range = rb_ary_entry($input, i);
|
41
|
+
int res = SWIG_ConvertPtr(r_range, &ptr, SWIGTYPE_p_wxPrintPageRange, 0);
|
42
|
+
if (!SWIG_IsOK(res) || !ptr) {
|
43
|
+
rb_raise(rb_eTypeError, "Expected Array of Wx::PRT::PrintPageRange for 1");
|
44
|
+
}
|
45
|
+
wxPrintPageRange *range = reinterpret_cast< wxPrintPageRange * >(ptr);
|
46
|
+
$1->push_back(*range);
|
47
|
+
}
|
48
|
+
}
|
49
|
+
else {
|
50
|
+
rb_raise(rb_eArgError, "Expected Array of Wx::PRT::PrintPageRange for 1");
|
51
|
+
}
|
52
|
+
__CODE
|
53
|
+
end
|
54
|
+
|
55
|
+
map 'std::vector<wxPrintPageRange> &' => 'Array<Wx::PRT::PrintPageRange>' do
|
56
|
+
|
57
|
+
map_in temp: 'std::vector<wxPrintPageRange> tmp_vector', code: '$1 = &tmp_vector;'
|
58
|
+
|
59
|
+
map_argout code: <<~__CODE
|
60
|
+
for (const wxPrintPageRange& range : *$1)
|
61
|
+
{
|
62
|
+
VALUE r_range = SWIG_NewPointerObj(new wxPrintPageRange(range), SWIGTYPE_p_wxPrintPageRange, SWIG_POINTER_OWN);
|
63
|
+
rb_ary_push($input, r_range);
|
64
|
+
}
|
65
|
+
__CODE
|
66
|
+
|
67
|
+
map_directorin code: '$input = rb_ary_new();'
|
68
|
+
|
69
|
+
map_directorargout code: <<~__CODE
|
70
|
+
for (int i = 0; i < RARRAY_LEN($result); i++)
|
71
|
+
{
|
72
|
+
void *ptr;
|
73
|
+
VALUE r_range = rb_ary_entry($result, i);
|
74
|
+
int res = SWIG_ConvertPtr(r_range, &ptr, SWIGTYPE_p_wxPrintPageRange, 0);
|
75
|
+
if (!SWIG_IsOK(res) || !ptr) {
|
76
|
+
Swig::DirectorTypeMismatchException::raise(swig_get_self(), "$symname", rb_eTypeError,
|
77
|
+
"expected Array of Wx::PRT::PrintPageRange in argument 1");
|
78
|
+
}
|
79
|
+
wxPrintPageRange *range = reinterpret_cast< wxPrintPageRange * >(ptr);
|
80
|
+
$1.push_back(*range);
|
81
|
+
}
|
82
|
+
__CODE
|
83
|
+
|
84
|
+
end
|
85
|
+
end
|
86
|
+
# Doc only mapping def
|
87
|
+
map 'std::vector<wxPrintPageRange> &' => 'Array<Wx::PRT::PrintPageRange>', swig: false do
|
88
|
+
map_in
|
89
|
+
end
|
90
|
+
|
91
|
+
end
|
92
|
+
|
93
|
+
end
|
94
|
+
|
95
|
+
end
|
96
|
+
|
97
|
+
end
|
data/tests/test_combo_ctrl.rb
CHANGED
@@ -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.
|
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.
|
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
|
-
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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
|
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
|
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
|
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.
|
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.
|
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.
|
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.
|
261
|
+
win.process_event(TestEvent.new(1))
|
209
262
|
end
|
210
263
|
assert(!win.test_event)
|
211
|
-
win.
|
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.
|
268
|
+
win.process_event(TestEvent.new(1))
|
216
269
|
end
|
217
270
|
assert(!win.test_event)
|
218
|
-
win.
|
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.
|
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.
|
375
|
+
win.child.process_event(TestEvent.new)
|
249
376
|
GC.start
|
250
377
|
assert(filter.filtered)
|
251
378
|
filter.filtered = false
|
252
|
-
win.child.
|
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.
|
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.
|
407
|
+
win.child.process_event(TestEvent.new)
|
281
408
|
GC.start
|
282
409
|
assert(MyEventFilter2.filtered)
|
283
410
|
MyEventFilter2.filtered = false
|
284
|
-
win.child.
|
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.
|
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.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Corino
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2025-01-30 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
|
@@ -818,6 +820,7 @@ files:
|
|
818
820
|
- rakelib/lib/typemap/pgprop_arg.rb
|
819
821
|
- rakelib/lib/typemap/pgproperty.rb
|
820
822
|
- rakelib/lib/typemap/points_list.rb
|
823
|
+
- rakelib/lib/typemap/print_page_range.rb
|
821
824
|
- rakelib/lib/typemap/richtext.rb
|
822
825
|
- rakelib/lib/typemap/tree_itemid.rb
|
823
826
|
- rakelib/lib/util/string.rb
|
@@ -1207,8 +1210,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1207
1210
|
- !ruby/object:Gem::Version
|
1208
1211
|
version: '0'
|
1209
1212
|
requirements: []
|
1210
|
-
rubygems_version: 3.
|
1211
|
-
signing_key:
|
1213
|
+
rubygems_version: 3.6.2
|
1212
1214
|
specification_version: 4
|
1213
1215
|
summary: wxWidgets extension for Ruby
|
1214
1216
|
test_files: []
|