wxruby3 1.3.1 → 1.5.0
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.
- 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
data/lib/wx/core/file_dialog.rb
CHANGED
|
@@ -13,7 +13,7 @@ module Wx
|
|
|
13
13
|
class FileDialog
|
|
14
14
|
|
|
15
15
|
wx_set_customize_hook = instance_method :set_customize_hook
|
|
16
|
-
|
|
16
|
+
wx_redefine_method :set_customize_hook do |hook|
|
|
17
17
|
wx_set_customize_hook.bind(self).call(hook)
|
|
18
18
|
@hook = hook # cache hook to prevent premature GC collection
|
|
19
19
|
end
|
|
@@ -15,13 +15,13 @@ module Wx
|
|
|
15
15
|
# the data object so we need to keep it alive here
|
|
16
16
|
|
|
17
17
|
wx_initialize = instance_method :initialize
|
|
18
|
-
|
|
18
|
+
wx_redefine_method :initialize do |parent, data, *args|
|
|
19
19
|
wx_initialize.bind(self).call(parent, data, *args)
|
|
20
20
|
@fr_data = data
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
wx_set_data = instance_method :set_data
|
|
24
|
-
|
|
24
|
+
wx_redefine_method :set_data do |data|
|
|
25
25
|
wx_set_data.bind(self).call(data)
|
|
26
26
|
@fr_data = data
|
|
27
27
|
end
|
data/lib/wx/core/functions.rb
CHANGED
|
@@ -13,7 +13,7 @@ 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
|
-
|
|
16
|
+
wx_redefine_method(:about_box) do | info, parent=nil |
|
|
17
17
|
case info
|
|
18
18
|
when Wx::AboutDialogInfo
|
|
19
19
|
ab_info = info
|
data/lib/wx/core/geometry.rb
CHANGED
|
@@ -23,7 +23,7 @@ module Wx
|
|
|
23
23
|
private :add, :sub, :mul, :div
|
|
24
24
|
|
|
25
25
|
wx_assign = instance_method :assign
|
|
26
|
-
|
|
26
|
+
wx_redefine_method :assign do |pt|
|
|
27
27
|
wx_assign.bind(self).call(pt)
|
|
28
28
|
self
|
|
29
29
|
end
|
|
@@ -76,7 +76,7 @@ module Wx
|
|
|
76
76
|
private :add, :sub, :mul, :div
|
|
77
77
|
|
|
78
78
|
wx_assign = instance_method :assign
|
|
79
|
-
|
|
79
|
+
wx_redefine_method :assign do |pt|
|
|
80
80
|
wx_assign.bind(self).call(pt)
|
|
81
81
|
self
|
|
82
82
|
end
|
data/lib/wx/core/helpprovider.rb
CHANGED
|
@@ -16,7 +16,7 @@ class Wx::HelpProvider
|
|
|
16
16
|
# easiest way is to make the currently set one an instance variable
|
|
17
17
|
# of this class
|
|
18
18
|
wx_set = instance_method :set
|
|
19
|
-
|
|
19
|
+
wx_redefine_method(:set) do | help_provider |
|
|
20
20
|
wx_set.bind(self).call(help_provider)
|
|
21
21
|
@__hp__ = help_provider
|
|
22
22
|
end
|
data/lib/wx/core/icon.rb
CHANGED
|
@@ -44,7 +44,7 @@ module Wx
|
|
|
44
44
|
# just carries on with an empty icon, which may cause faults
|
|
45
45
|
# later. Also guess icon type from filename, if not specified.
|
|
46
46
|
wx_init = self.instance_method(:initialize)
|
|
47
|
-
|
|
47
|
+
wx_redefine_method(:initialize) do | *args |
|
|
48
48
|
if args[0].kind_of? String
|
|
49
49
|
if not File.exist?( File.expand_path(args[0]) )
|
|
50
50
|
Kernel.raise(ArgumentError, "Icon file does not exist: #{args[0]}")
|
data/lib/wx/core/image.rb
CHANGED
|
@@ -58,7 +58,7 @@ module Wx
|
|
|
58
58
|
# later. Also, if loading from a file, and the type is not specified,
|
|
59
59
|
# try to guess it from the filename extension
|
|
60
60
|
wx_init = self.instance_method(:initialize)
|
|
61
|
-
|
|
61
|
+
wx_redefine_method(:initialize) do | *args |
|
|
62
62
|
if args[0].kind_of? String
|
|
63
63
|
if not File.exist?( File.expand_path(args[0]) )
|
|
64
64
|
Kernel.raise(ArgumentError, "Image file does not exist: #{args[0]}")
|
|
@@ -103,7 +103,7 @@ module Wx
|
|
|
103
103
|
end
|
|
104
104
|
|
|
105
105
|
wx_compute_histogram = instance_method :compute_histogram
|
|
106
|
-
|
|
106
|
+
wx_redefine_method :compute_histogram do
|
|
107
107
|
hist_hash = wx_compute_histogram.bind(self).call
|
|
108
108
|
hist_hash.extend Histogram
|
|
109
109
|
hist_hash
|
data/lib/wx/core/imagelist.rb
CHANGED
|
@@ -10,7 +10,7 @@ class Wx::ImageList
|
|
|
10
10
|
|
|
11
11
|
# provide seamless support for adding icons on all platforms
|
|
12
12
|
wx_add = instance_method :add
|
|
13
|
-
|
|
13
|
+
wx_redefine_method :add do |*args|
|
|
14
14
|
if Wx::PLATFORM == 'WXMSW' && args.size == 1 && Wx::Icon === args.first
|
|
15
15
|
args[0] = args.first.to_bitmap
|
|
16
16
|
end
|
data/lib/wx/core/locale.rb
CHANGED
|
@@ -32,22 +32,22 @@ class Wx::Locale
|
|
|
32
32
|
# as wxWidgets defines an enum wxLanguage but still uses a mix of enum args and int args
|
|
33
33
|
# to specify languages we need to fix some things here to make that easier
|
|
34
34
|
wx_is_available = Wx::Locale.method(:is_available)
|
|
35
|
-
|
|
35
|
+
wx_redefine_method :is_available do |lang|
|
|
36
36
|
wx_is_available.call(lang.to_i)
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
wx_get_language_info = Wx::Locale.method(:get_language_info)
|
|
40
|
-
|
|
40
|
+
wx_redefine_method :get_language_info do |lang|
|
|
41
41
|
wx_get_language_info.call(lang.to_i)
|
|
42
42
|
end
|
|
43
43
|
|
|
44
44
|
wx_get_language_name = Wx::Locale.method(:get_language_name)
|
|
45
|
-
|
|
45
|
+
wx_redefine_method :get_language_name do |lang|
|
|
46
46
|
wx_get_language_name.call(lang.to_i)
|
|
47
47
|
end
|
|
48
48
|
|
|
49
49
|
wx_get_language_canonical_name = Wx::Locale.method(:get_language_canonical_name)
|
|
50
|
-
|
|
50
|
+
wx_redefine_method :get_language_canonical_name do |lang|
|
|
51
51
|
wx_get_language_canonical_name.call(lang.to_i)
|
|
52
52
|
end
|
|
53
53
|
end
|
|
@@ -66,7 +66,7 @@ class Wx::Locale
|
|
|
66
66
|
# as wxWidgets defines an enum wxLanguage but still uses a mix of enum args and int args
|
|
67
67
|
# to specify languages we need to fix some things here to make that easier
|
|
68
68
|
wx_init = instance_method(:init)
|
|
69
|
-
|
|
69
|
+
wx_redefine_method :init do |*args|
|
|
70
70
|
if args.empty? || ::String === args.first
|
|
71
71
|
wx_init.bind(self).call(*args)
|
|
72
72
|
else
|
data/lib/wx/core/log.rb
CHANGED
|
@@ -48,13 +48,13 @@ module Wx
|
|
|
48
48
|
class LogChain
|
|
49
49
|
|
|
50
50
|
wx_initialize = instance_method :initialize
|
|
51
|
-
|
|
51
|
+
wx_redefine_method :initialize do |new_log|
|
|
52
52
|
wx_initialize.bind(self).call(new_log)
|
|
53
53
|
@new_log = new_log # cache to prevent premature GC collection; old_log managed in C++ wrapper
|
|
54
54
|
end
|
|
55
55
|
|
|
56
56
|
wx_set_log = instance_method :set_log
|
|
57
|
-
|
|
57
|
+
wx_redefine_method :set_log do |new_log|
|
|
58
58
|
wx_set_log.bind(self).call(new_log)
|
|
59
59
|
@new_log = new_log # cache to prevent premature GC collection; old_log managed in C++ wrapper
|
|
60
60
|
end
|
|
@@ -100,32 +100,32 @@ module Wx
|
|
|
100
100
|
private :setup_log_info
|
|
101
101
|
|
|
102
102
|
wx_log_generic = self.instance_method :log_generic
|
|
103
|
-
|
|
103
|
+
wx_redefine_method :log_generic do |lvl, fmt, *args, filename: nil, line: 0, func: nil, component: nil|
|
|
104
104
|
wx_log_generic.bind(self).call(lvl, *setup_log_info(fmt, args, filename, line, func, component))
|
|
105
105
|
end
|
|
106
106
|
|
|
107
107
|
wx_log_info = self.instance_method :log_info
|
|
108
|
-
|
|
108
|
+
wx_redefine_method :log_info do |fmt, *args, filename: nil, line: 0, func: nil, component: nil|
|
|
109
109
|
wx_log_info.bind(self).call(*setup_log_info(fmt, args, filename, line, func, component))
|
|
110
110
|
end
|
|
111
111
|
|
|
112
112
|
wx_log_verbose = self.instance_method :log_verbose
|
|
113
|
-
|
|
113
|
+
wx_redefine_method :log_verbose do |fmt, *args, filename: nil, line: 0, func: nil, component: nil|
|
|
114
114
|
wx_log_verbose.bind(self).call(*setup_log_info(fmt, args, filename, line, func, component))
|
|
115
115
|
end
|
|
116
116
|
|
|
117
117
|
wx_log_message = self.instance_method :log_message
|
|
118
|
-
|
|
118
|
+
wx_redefine_method :log_message do |fmt, *args, filename: nil, line: 0, func: nil, component: nil|
|
|
119
119
|
wx_log_message.bind(self).call(*setup_log_info(fmt, args, filename, line, func, component))
|
|
120
120
|
end
|
|
121
121
|
|
|
122
122
|
wx_log_warning = self.instance_method :log_warning
|
|
123
|
-
|
|
123
|
+
wx_redefine_method :log_warning do |fmt, *args, filename: nil, line: 0, func: nil, component: nil|
|
|
124
124
|
wx_log_warning.bind(self).call(*setup_log_info(fmt, args, filename, line, func, component))
|
|
125
125
|
end
|
|
126
126
|
|
|
127
127
|
wx_log_error = self.instance_method :log_error
|
|
128
|
-
|
|
128
|
+
wx_redefine_method :log_error do |fmt, *args, filename: nil, line: 0, func: nil, component: nil|
|
|
129
129
|
wx_log_error.bind(self).call(*setup_log_info(fmt, args, filename, line, func, component))
|
|
130
130
|
end
|
|
131
131
|
|
data/lib/wx/core/menu.rb
CHANGED
|
@@ -28,7 +28,7 @@ class Wx::Menu
|
|
|
28
28
|
|
|
29
29
|
# Overload to provide Enumerator without block
|
|
30
30
|
wx_each_item = instance_method :each_item
|
|
31
|
-
|
|
31
|
+
wx_redefine_method :each_item do |&block|
|
|
32
32
|
if block
|
|
33
33
|
wx_each_item.bind(self).call(&block)
|
|
34
34
|
else
|
|
@@ -56,7 +56,7 @@ class Wx::Menu
|
|
|
56
56
|
class_eval do
|
|
57
57
|
meth_names.each do | meth |
|
|
58
58
|
old_meth = instance_method(meth)
|
|
59
|
-
|
|
59
|
+
wx_redefine_method(meth) do | *args |
|
|
60
60
|
case args.first
|
|
61
61
|
when Integer, Wx::Enum then old_meth.bind(self).call(*args)
|
|
62
62
|
when String then old_meth.bind(self).call(Wx::ID_ANY, *args)
|
|
@@ -79,7 +79,7 @@ class Wx::Menu
|
|
|
79
79
|
class_eval do
|
|
80
80
|
meth_names.each do | meth |
|
|
81
81
|
old_meth = instance_method(meth)
|
|
82
|
-
|
|
82
|
+
wx_redefine_method(meth) do | pos, *args |
|
|
83
83
|
case args.first
|
|
84
84
|
when Integer, Wx::Enum then old_meth.bind(self).call(pos, *args)
|
|
85
85
|
when String then old_meth.bind(self).call(pos, Wx::ID_ANY, *args)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Copyright (c) 2023 M.J.N. Corino, The Netherlands
|
|
2
|
+
#
|
|
3
|
+
# This software is released under the MIT license.
|
|
4
|
+
|
|
5
|
+
module Kernel
|
|
6
|
+
|
|
7
|
+
def wx_redefine_method(mtd, &block)
|
|
8
|
+
warn_lvl = $VERBOSE
|
|
9
|
+
$VERBOSE = nil
|
|
10
|
+
undef_method(mtd)
|
|
11
|
+
define_method(mtd, &block)
|
|
12
|
+
ensure
|
|
13
|
+
$VERBOSE = warn_lvl
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
end
|
|
@@ -8,7 +8,7 @@ module Wx
|
|
|
8
8
|
|
|
9
9
|
# make sure to honor the inherited common overloads
|
|
10
10
|
wx_get_client_object = instance_method :get_client_object
|
|
11
|
-
|
|
11
|
+
wx_redefine_method :get_client_object do |*args|
|
|
12
12
|
if args.empty?
|
|
13
13
|
super()
|
|
14
14
|
else
|
|
@@ -16,7 +16,7 @@ module Wx
|
|
|
16
16
|
end
|
|
17
17
|
end
|
|
18
18
|
wx_set_client_object = instance_method :set_client_object
|
|
19
|
-
|
|
19
|
+
wx_redefine_method :set_client_object do |*args|
|
|
20
20
|
if args.size < 2
|
|
21
21
|
super(*args)
|
|
22
22
|
else
|
|
@@ -32,7 +32,7 @@ module Wx
|
|
|
32
32
|
|
|
33
33
|
# Overload to provide Enumerator without block
|
|
34
34
|
wx_each_string = instance_method :each_string
|
|
35
|
-
|
|
35
|
+
wx_redefine_method :each_string do |&block|
|
|
36
36
|
if block
|
|
37
37
|
wx_each_string.bind(self).call(&block)
|
|
38
38
|
else
|
data/lib/wx/core/pen_info.rb
CHANGED
|
@@ -22,12 +22,12 @@ module Wx
|
|
|
22
22
|
# Cache the global instance to keep it safe from GC
|
|
23
23
|
|
|
24
24
|
wx_get = instance_method :get
|
|
25
|
-
|
|
25
|
+
wx_redefine_method :get do
|
|
26
26
|
@the_manager ||= wx_get.bind(self).call
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
wx_set = instance_method :set
|
|
30
|
-
|
|
30
|
+
wx_redefine_method :set do |pman|
|
|
31
31
|
wx_set.bind(self).call(pman)
|
|
32
32
|
@the_manager = pman
|
|
33
33
|
end
|
data/lib/wx/core/rect.rb
CHANGED
data/lib/wx/core/secret_store.rb
CHANGED
|
@@ -19,7 +19,7 @@ module Wx
|
|
|
19
19
|
|
|
20
20
|
# Redefine the initialize method to auto-convert UTF-16/-32 strings to UTF-8 if possible.
|
|
21
21
|
wx_init = self.instance_method(:initialize)
|
|
22
|
-
|
|
22
|
+
wx_redefine_method(:initialize) do | *args |
|
|
23
23
|
if args.size == 1 && ::String === args.first
|
|
24
24
|
unless args.first.encoding == ::Encoding::UTF_8 || args.first.encoding == ::Encoding::ASCII_8BIT
|
|
25
25
|
# convert in place unless frozen
|
data/lib/wx/core/sizer.rb
CHANGED
|
@@ -52,7 +52,7 @@ module Wx
|
|
|
52
52
|
|
|
53
53
|
# Overload to provide Enumerator without block
|
|
54
54
|
wx_each_child = instance_method :each_child
|
|
55
|
-
|
|
55
|
+
wx_redefine_method :each_child do |&block|
|
|
56
56
|
if block
|
|
57
57
|
wx_each_child.bind(self).call(&block)
|
|
58
58
|
else
|
|
@@ -65,7 +65,7 @@ module Wx
|
|
|
65
65
|
class BoxSizer < Sizer
|
|
66
66
|
|
|
67
67
|
wx_initialize = instance_method :initialize
|
|
68
|
-
|
|
68
|
+
wx_redefine_method :initialize do |*args, &block|
|
|
69
69
|
wx_initialize.bind(self).call(*args)
|
|
70
70
|
if block
|
|
71
71
|
if block.arity == -1 or block.arity == 0
|
|
@@ -84,7 +84,7 @@ module Wx
|
|
|
84
84
|
class WrapSizer < BoxSizer
|
|
85
85
|
|
|
86
86
|
wx_initialize = instance_method :initialize
|
|
87
|
-
|
|
87
|
+
wx_redefine_method :initialize do |*args, &block|
|
|
88
88
|
wx_initialize.bind(self).call(*args)
|
|
89
89
|
if block
|
|
90
90
|
if block.arity == -1 or block.arity == 0
|
|
@@ -103,7 +103,7 @@ module Wx
|
|
|
103
103
|
class StaticBoxSizer < BoxSizer
|
|
104
104
|
|
|
105
105
|
wx_initialize = instance_method :initialize
|
|
106
|
-
|
|
106
|
+
wx_redefine_method :initialize do |*args, &block|
|
|
107
107
|
wx_initialize.bind(self).call(*args)
|
|
108
108
|
if block
|
|
109
109
|
if block.arity == -1 or block.arity == 0
|
|
@@ -122,7 +122,7 @@ module Wx
|
|
|
122
122
|
class StdDialogButtonSizer < BoxSizer
|
|
123
123
|
|
|
124
124
|
wx_initialize = instance_method :initialize
|
|
125
|
-
|
|
125
|
+
wx_redefine_method :initialize do |*args, &block|
|
|
126
126
|
wx_initialize.bind(self).call(*args)
|
|
127
127
|
if block
|
|
128
128
|
if block.arity == -1 or block.arity == 0
|
|
@@ -141,7 +141,7 @@ module Wx
|
|
|
141
141
|
class GridSizer < Sizer
|
|
142
142
|
|
|
143
143
|
wx_initialize = instance_method :initialize
|
|
144
|
-
|
|
144
|
+
wx_redefine_method :initialize do |*args, &block|
|
|
145
145
|
wx_initialize.bind(self).call(*args)
|
|
146
146
|
self.instance_eval(&block) if block
|
|
147
147
|
end
|
|
@@ -151,7 +151,7 @@ module Wx
|
|
|
151
151
|
class FlexGridSizer < GridSizer
|
|
152
152
|
|
|
153
153
|
wx_initialize = instance_method :initialize
|
|
154
|
-
|
|
154
|
+
wx_redefine_method :initialize do |*args, &block|
|
|
155
155
|
wx_initialize.bind(self).call(*args)
|
|
156
156
|
if block
|
|
157
157
|
if block.arity == -1 or block.arity == 0
|
|
@@ -170,7 +170,7 @@ module Wx
|
|
|
170
170
|
class GridBagSizer < FlexGridSizer
|
|
171
171
|
|
|
172
172
|
wx_initialize = instance_method :initialize
|
|
173
|
-
|
|
173
|
+
wx_redefine_method :initialize do |*args, &block|
|
|
174
174
|
wx_initialize.bind(self).call(*args)
|
|
175
175
|
if block
|
|
176
176
|
if block.arity == -1 or block.arity == 0
|
|
@@ -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
|
-
|
|
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
|
|
@@ -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
|
-
|
|
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
|
data/lib/wx/core/text_entry.rb
CHANGED
|
@@ -11,7 +11,7 @@ module Wx
|
|
|
11
11
|
module TextEntry
|
|
12
12
|
|
|
13
13
|
wx_auto_complete = instance_method :auto_complete
|
|
14
|
-
|
|
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
|
data/lib/wx/core/textctrl.rb
CHANGED
|
@@ -58,14 +58,14 @@ module Wx
|
|
|
58
58
|
|
|
59
59
|
class TextCtrl
|
|
60
60
|
wx_op_append = instance_method :<<
|
|
61
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
data/lib/wx/core/tree_ctrl.rb
CHANGED
|
@@ -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
|
-
|
|
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
|
data/lib/wx/core/v_list_box.rb
CHANGED
data/lib/wx/core/validator.rb
CHANGED
|
@@ -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.
|
|
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.
|
|
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
|
data/lib/wx/core/variant.rb
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
36
|
+
wx_redefine_method :to_s do
|
|
37
37
|
unless null?
|
|
38
38
|
case type
|
|
39
39
|
when 'list'
|
data/lib/wx/core/window.rb
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
126
|
+
wx_redefine_method :each_child do |&block|
|
|
81
127
|
if block
|
|
82
128
|
wx_each_child.bind(self).call(&block)
|
|
83
129
|
else
|
data/lib/wx/core/xmlresource.rb
CHANGED
|
@@ -9,14 +9,14 @@
|
|
|
9
9
|
class Wx::XmlResource
|
|
10
10
|
class << self
|
|
11
11
|
wx_get = self.instance_method(:get)
|
|
12
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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,
|