wxruby3 0.9.0.pre.rc.1 → 0.9.0.pre.rc.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/INSTALL.md +73 -22
- data/README.md +40 -8
- data/assets/hello_button-macos.png +0 -0
- data/assets/hello_button-msw.png +0 -0
- data/assets/hello_button_clicked-macos.png +0 -0
- data/assets/hello_button_clicked-msw.png +0 -0
- data/assets/hello_button_clicked_combi.png +0 -0
- data/assets/hello_world-macos.png +0 -0
- data/assets/hello_world-msw.png +0 -0
- data/assets/hello_world_combi.png +0 -0
- data/ext/wxruby3/swig/wx.i +2 -0
- data/lib/wx/core/brush.rb +6 -0
- data/lib/wx/core/event_loop.rb +7 -0
- data/lib/wx/core/evthandler.rb +12 -2
- data/lib/wx/core/font.rb +22 -14
- data/lib/wx/core/helpprovider.rb +2 -2
- data/lib/wx/core/image.rb +33 -0
- data/lib/wx/core/listctrl.rb +17 -13
- data/lib/wx/core/log.rb +90 -0
- data/lib/wx/core/menu.rb +5 -0
- data/lib/wx/core/pen.rb +6 -0
- data/lib/wx/core/window.rb +28 -1
- data/lib/wx/doc/app.rb +40 -0
- data/lib/wx/doc/bitmap.rb +11 -15
- data/lib/wx/doc/brush.rb +17 -0
- data/lib/wx/doc/event_loop.rb +7 -0
- data/lib/wx/doc/extra/00_starting.md +6 -6
- data/lib/wx/doc/extra/02_lifecycles.md +9 -8
- data/lib/wx/doc/extra/09_exceptions.md +1 -1
- data/lib/wx/doc/extra/11_drawing_and_dc.md +4 -4
- data/lib/wx/doc/font.rb +27 -0
- data/lib/wx/doc/functions.rb +51 -23
- data/lib/wx/doc/gc_dc.rb +1 -1
- data/lib/wx/doc/image.rb +42 -12
- data/lib/wx/doc/list_ctrl.rb +32 -0
- data/lib/wx/doc/log.rb +28 -0
- data/lib/wx/doc/pen.rb +17 -0
- data/lib/wx/doc/prt/printer_dc.rb +2 -2
- data/lib/wx/doc/radio_box.rb +20 -0
- data/lib/wx/doc/scaled_dc.rb +1 -1
- data/lib/wx/doc/text_validator.rb +12 -0
- data/lib/wx/doc/window.rb +27 -0
- data/lib/wx/keyword_defs.rb +77 -76
- data/lib/wx/prt/keyword_defs.rb +5 -1
- data/lib/wx/version.rb +1 -1
- data/rakelib/install.rb +17 -6
- data/rakelib/lib/config/linux.rb +4 -2
- data/rakelib/lib/config/macosx.rb +120 -1
- data/rakelib/lib/config/mingw.rb +6 -1
- data/rakelib/lib/config/unixish.rb +26 -11
- data/rakelib/lib/config.rb +15 -6
- data/rakelib/lib/core/mapping.rb +15 -10
- data/rakelib/lib/core/package.rb +4 -1
- data/rakelib/lib/core/spec.rb +23 -12
- data/rakelib/lib/core/spec_helper.rb +6 -0
- data/rakelib/lib/director/app.rb +30 -1
- data/rakelib/lib/director/aui_toolbar.rb +41 -0
- data/rakelib/lib/director/brush.rb +10 -1
- data/rakelib/lib/director/combobox.rb +1 -1
- data/rakelib/lib/director/context_help_button.rb +23 -0
- data/rakelib/lib/director/dialog.rb +33 -2
- data/rakelib/lib/director/event_loop.rb +26 -0
- data/rakelib/lib/director/font.rb +12 -3
- data/rakelib/lib/director/functions.rb +44 -48
- data/rakelib/lib/director/help_provider.rb +8 -10
- data/rakelib/lib/director/hyperlink_event.rb +22 -0
- data/rakelib/lib/director/image.rb +32 -0
- data/rakelib/lib/director/list_ctrl.rb +3 -2
- data/rakelib/lib/director/log.rb +64 -4
- data/rakelib/lib/director/menu.rb +0 -3
- data/rakelib/lib/director/menu_bar.rb +3 -0
- data/rakelib/lib/director/pen.rb +10 -1
- data/rakelib/lib/director/popup_window.rb +18 -0
- data/rakelib/lib/director/radio_box.rb +15 -4
- data/rakelib/lib/director/searchctrl.rb +2 -1
- data/rakelib/lib/director/static_box.rb +1 -1
- data/rakelib/lib/director/styled_text_ctrl.rb +1 -1
- data/rakelib/lib/director/text_entry.rb +30 -0
- data/rakelib/lib/director/text_validator.rb +8 -2
- data/rakelib/lib/director/textctrl.rb +1 -1
- data/rakelib/lib/director/variant.rb +17 -4
- data/rakelib/lib/director/window.rb +37 -1
- data/rakelib/lib/extractor/function.rb +7 -7
- data/rakelib/lib/extractor/variable.rb +6 -6
- data/rakelib/lib/generate/doc/aui_manager.yaml +21 -0
- data/rakelib/lib/generate/doc/context_help_button.yaml +16 -0
- data/rakelib/lib/generate/doc/event_blocker.yaml +27 -0
- data/rakelib/lib/generate/doc/event_filter.yaml +47 -0
- data/rakelib/lib/generate/doc/file_dialog.yaml +68 -0
- data/rakelib/lib/generate/doc/font.yaml +29 -0
- data/rakelib/lib/generate/doc/frame.yaml +23 -0
- data/rakelib/lib/generate/doc/fs_file.yaml +11 -0
- data/rakelib/lib/generate/doc/gdi_common.yaml +36 -0
- data/rakelib/lib/generate/doc/graphics_context.yaml +34 -0
- data/rakelib/lib/generate/doc/gui_event_loop.yaml +12 -0
- data/rakelib/lib/generate/doc/help_controller.yaml +24 -0
- data/rakelib/lib/generate/doc/icon.yaml +11 -0
- data/rakelib/lib/generate/doc/image.yaml +87 -0
- data/rakelib/lib/generate/doc/keyboard_state.yaml +19 -0
- data/rakelib/lib/generate/doc/list_ctrl.yaml +77 -0
- data/rakelib/lib/generate/doc/locale.yaml +12 -0
- data/rakelib/lib/generate/doc/log.yaml +86 -0
- data/rakelib/lib/generate/doc/mdi_frame.yaml +12 -0
- data/rakelib/lib/generate/doc/memory_dc.yaml +42 -0
- data/rakelib/lib/generate/doc/menu.yaml +17 -0
- data/rakelib/lib/generate/doc/menu_item.yaml +43 -0
- data/rakelib/lib/generate/doc/message_dialog.yaml +36 -0
- data/rakelib/lib/generate/doc/non_owned_window.yaml +14 -0
- data/rakelib/lib/generate/doc/notebook.yaml +18 -0
- data/rakelib/lib/generate/doc/pen.yaml +11 -0
- data/rakelib/lib/generate/doc/picker_base.yaml +19 -0
- data/rakelib/lib/generate/doc/platform_info.yaml +15 -0
- data/rakelib/lib/generate/doc/property_sheet_dialog.yaml +26 -0
- data/rakelib/lib/generate/doc/scroll_bar.yaml +11 -0
- data/rakelib/lib/generate/doc/scrolled_canvas.yaml +37 -0
- data/rakelib/lib/generate/doc/scrolled_control.yaml +37 -0
- data/rakelib/lib/generate/doc/scrolled_window.yaml +37 -0
- data/rakelib/lib/generate/doc/sizer.yaml +69 -0
- data/rakelib/lib/generate/doc/splash_screen.yaml +18 -0
- data/rakelib/lib/generate/doc/static_box.yaml +52 -0
- data/rakelib/lib/generate/doc/static_box_sizer.yaml +22 -0
- data/rakelib/lib/generate/doc/svg_file_dc.yaml +11 -0
- data/rakelib/lib/generate/doc/text_ctrl.yaml +19 -0
- data/rakelib/lib/generate/doc/text_entry.yaml +42 -0
- data/rakelib/lib/generate/doc/text_entry_dialog.yaml +17 -0
- data/rakelib/lib/generate/doc/timer_event.yaml +28 -0
- data/rakelib/lib/generate/doc/tool_bar.yaml +35 -0
- data/rakelib/lib/generate/doc/top_level_window.yaml +23 -0
- data/rakelib/lib/generate/doc/validator.yaml +12 -0
- data/rakelib/lib/generate/doc/variant.yaml +29 -0
- data/rakelib/lib/generate/doc/window.yaml +249 -0
- data/rakelib/lib/generate/doc/wizard_page_simple.yaml +14 -0
- data/rakelib/lib/generate/doc/xml_node.yaml +7 -0
- data/rakelib/lib/generate/doc/xml_resource.yaml +27 -0
- data/rakelib/lib/generate/doc.rb +36 -2
- data/rakelib/lib/generate/interface.rb +11 -10
- data/rakelib/lib/specs/interfaces.rb +5 -1
- data/rakelib/lib/swig_runner.rb +37 -0
- data/samples/aui/aui.rb +432 -363
- data/samples/propgrid/propgrid.rb +3 -0
- data/samples/sampler/editor.rb +33 -25
- data/samples/sampler/sample.rb +2 -2
- data/samples/sampler/stc_editor.rb +4 -2
- data/tests/lib/item_container_tests.rb +82 -0
- data/tests/lib/text_entry_tests.rb +80 -0
- data/tests/lib/wxapp_runner.rb +12 -0
- data/tests/lib/wxframe_runner.rb +89 -4
- data/tests/test_art.rb +9 -0
- data/tests/test_box_sizer.rb +161 -0
- data/tests/test_ext_controls.rb +28 -0
- data/tests/test_font.rb +239 -0
- data/tests/test_grid_sizer.rb +148 -0
- data/tests/test_intl.rb +5 -1
- data/tests/test_list_ctrl.rb +53 -0
- data/tests/test_log.rb +163 -0
- data/tests/test_std_controls.rb +321 -37
- data/tests/test_timer.rb +95 -0
- data/tests/test_window.rb +340 -0
- metadata +85 -2
@@ -3,4 +3,123 @@
|
|
3
3
|
# Copyright (c) M.J.N. Corino, The Netherlands
|
4
4
|
###
|
5
5
|
|
6
|
-
|
6
|
+
require_relative './unixish'
|
7
|
+
|
8
|
+
module WXRuby3
|
9
|
+
|
10
|
+
module Config
|
11
|
+
|
12
|
+
module Platform
|
13
|
+
|
14
|
+
def self.included(base)
|
15
|
+
base.class_eval do
|
16
|
+
include Config::UnixLike
|
17
|
+
|
18
|
+
def debug_command(*args)
|
19
|
+
args.unshift(FileUtils::RUBY)
|
20
|
+
args.unshift('--')
|
21
|
+
args.unshift('lldb')
|
22
|
+
args.join(' ')
|
23
|
+
end
|
24
|
+
|
25
|
+
def dll_mask
|
26
|
+
"{#{dll_ext},dylib}"
|
27
|
+
end
|
28
|
+
|
29
|
+
def get_rpath_origin
|
30
|
+
"@loader_path"
|
31
|
+
end
|
32
|
+
|
33
|
+
def check_rpath_patch
|
34
|
+
# no need to check anything; install_name_tool is part of XCode cmdline tools
|
35
|
+
# and without these we couldn't build anything
|
36
|
+
true
|
37
|
+
end
|
38
|
+
|
39
|
+
def patch_rpath(shlib, *rpath)
|
40
|
+
# don't leave old rpath-s behind
|
41
|
+
sh("install_name_tool -delete_rpath '@loader_path/../lib' #{shlib} 2>/dev/null", verbose: false) { |_,_| }
|
42
|
+
# add deployment rpath-s
|
43
|
+
sh("install_name_tool #{rpath.collect {|rp| "-add_rpath '#{rp}'"}.join(' ')} #{shlib} 2>/dev/null", verbose: false) { |_,_| }
|
44
|
+
true
|
45
|
+
end
|
46
|
+
|
47
|
+
def update_shlib_loadpaths(shlib, deplibs)
|
48
|
+
changes = deplibs.collect { |dl| "-change '#{dl}' '@rpath/#{File.basename(dl)}'"}
|
49
|
+
sh("install_name_tool #{changes.join(' ')} #{shlib} 2>/dev/null", verbose: false) { |_,_| }
|
50
|
+
true
|
51
|
+
end
|
52
|
+
|
53
|
+
def get_wx_libs
|
54
|
+
wx_libset = ::Set.new
|
55
|
+
lib_list = wx_config("--libs all").split(' ')
|
56
|
+
until lib_list.empty?
|
57
|
+
s = lib_list.shift
|
58
|
+
if s == '-framework'
|
59
|
+
wx_libset << "#{s} #{lib_list.shift}"
|
60
|
+
else
|
61
|
+
wx_libset << s
|
62
|
+
end
|
63
|
+
end
|
64
|
+
# some weird thing with this; at least sometimes '--libs all' will not output media library even if feature active
|
65
|
+
if features_set?('wxUSE_MEDIACTRL')
|
66
|
+
lib_list = wx_config("--libs media").split(' ')
|
67
|
+
until lib_list.empty?
|
68
|
+
s = lib_list.shift
|
69
|
+
if s == '-framework'
|
70
|
+
wx_libset << "#{s} #{lib_list.shift}"
|
71
|
+
else
|
72
|
+
wx_libset << s
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
wx_libset.collect { |s| s.dup }
|
77
|
+
end
|
78
|
+
|
79
|
+
def do_link(pkg)
|
80
|
+
objs = pkg.all_obj_files.collect { |o| File.join('..', o) }.join(' ') + ' '
|
81
|
+
sh "cd lib && #{WXRuby3.config.ld} #{WXRuby3.config.ldflags(pkg.lib_target)} #{objs} " +
|
82
|
+
"#{WXRuby3.config.libs} #{WXRuby3.config.link_output_flag}#{pkg.lib_target}"
|
83
|
+
end
|
84
|
+
|
85
|
+
private
|
86
|
+
|
87
|
+
def wx_configure
|
88
|
+
bash('./configure --disable-sys-libs --without-liblzma --prefix=`pwd`/install --disable-tests --without-subdirs --disable-debug_info')
|
89
|
+
end
|
90
|
+
|
91
|
+
def wx_make
|
92
|
+
bash('make -j$(sysctl -n hw.logicalcpu) && make install')
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
def init_platform
|
98
|
+
init_unix_platform
|
99
|
+
|
100
|
+
@dll_pfx = 'lib'
|
101
|
+
|
102
|
+
if @wx_version
|
103
|
+
@cpp.sub!(/-std=gnu\+\+11/, '-std=gnu++14')
|
104
|
+
@ld.sub!(/-o\s*\Z/, '')
|
105
|
+
|
106
|
+
@extra_cflags.concat %w[-Wno-unused-function -Wno-conversion-null -Wno-sometimes-uninitialized
|
107
|
+
-Wno-overloaded-virtual -Wno-deprecated-copy]
|
108
|
+
@extra_cflags << ' -Wno-deprecated-declarations' unless @no_deprecated
|
109
|
+
|
110
|
+
# create a .dylib binary
|
111
|
+
@extra_ldflags << '-dynamic -bundle'
|
112
|
+
|
113
|
+
unless @wx_path.empty?
|
114
|
+
libdirs = @wx_libs.select {|s| s.start_with?('-L')}.collect {|s| s.sub(/^-L/,'')}
|
115
|
+
@exec_env['DYLD_LIBRARY_PATH'] = "#{ENV['DYLD_LIBRARY_PATH']}:#{dest_dir}:#{libdirs.join(':')}"
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
private :init_platform
|
120
|
+
|
121
|
+
end
|
122
|
+
|
123
|
+
end
|
124
|
+
|
125
|
+
end
|
data/rakelib/lib/config/mingw.rb
CHANGED
@@ -21,8 +21,8 @@ module WXRuby3
|
|
21
21
|
module Platform
|
22
22
|
|
23
23
|
def self.included(base)
|
24
|
-
base.include Config::UnixLike
|
25
24
|
base.class_eval do
|
25
|
+
include Config::UnixLike
|
26
26
|
|
27
27
|
attr_reader :rescomp
|
28
28
|
|
@@ -52,6 +52,10 @@ module WXRuby3
|
|
52
52
|
|
53
53
|
private
|
54
54
|
|
55
|
+
def wx_make
|
56
|
+
bash('make && make install')
|
57
|
+
end
|
58
|
+
|
55
59
|
def wx_generate_xml
|
56
60
|
chdir(File.join(ext_path, 'wxWidgets', 'docs', 'doxygen')) do
|
57
61
|
sh({ 'WX_SKIP_DOXYGEN_VERSION_CHECK' => '1' }, 'regen.bat xml')
|
@@ -107,6 +111,7 @@ module WXRuby3
|
|
107
111
|
|
108
112
|
@ruby_ldflags.each { |flags| flags.sub!(' $(DEFFILE)', '') } # cleanup for older RubyInstaller versions
|
109
113
|
@ruby_ldflags.each { |flags| flags.gsub!(/-s(\s|\Z)/, '') } if @debug_build # do not strip debug symbols for debug build
|
114
|
+
@ruby_ldflags << '-s' if @release_build # strip debug symbols for release build
|
110
115
|
@ruby_cppflags << RB_CONFIG['debugflags'] if @debug_build
|
111
116
|
@ruby_cppflags.each { |flags| flags.gsub!(/-O\d/, '-O0') } if @debug_build # disable optimizations for debug build
|
112
117
|
|
@@ -52,6 +52,10 @@ module WXRuby3
|
|
52
52
|
"#{WXRuby3.config.libs} #{WXRuby3.config.link_output_flag}#{pkg.lib_target}"
|
53
53
|
end
|
54
54
|
|
55
|
+
def get_rpath_origin
|
56
|
+
"$ORIGIN"
|
57
|
+
end
|
58
|
+
|
55
59
|
private
|
56
60
|
|
57
61
|
def wx_checkout
|
@@ -76,6 +80,14 @@ module WXRuby3
|
|
76
80
|
end
|
77
81
|
end
|
78
82
|
|
83
|
+
def wx_configure
|
84
|
+
bash('./configure --prefix=`pwd`/install --disable-tests --without-subdirs --disable-debug_info')
|
85
|
+
end
|
86
|
+
|
87
|
+
def wx_make
|
88
|
+
bash('make -j$(nproc) && make install')
|
89
|
+
end
|
90
|
+
|
79
91
|
def wx_build
|
80
92
|
# initialize submodules
|
81
93
|
unless sh('git submodule update --init')
|
@@ -83,12 +95,12 @@ module WXRuby3
|
|
83
95
|
exit(1)
|
84
96
|
end
|
85
97
|
# configure wxWidgets
|
86
|
-
unless
|
98
|
+
unless wx_configure
|
87
99
|
STDERR.puts "ERROR: Failed to configure wxWidgets."
|
88
100
|
exit(1)
|
89
101
|
end
|
90
102
|
# make and install wxWidgets
|
91
|
-
unless
|
103
|
+
unless wx_make
|
92
104
|
STDERR.puts "ERROR: Failed to build wxWidgets libraries."
|
93
105
|
exit(1)
|
94
106
|
end
|
@@ -117,6 +129,16 @@ module WXRuby3
|
|
117
129
|
get_cfg_string('wxxml')
|
118
130
|
end
|
119
131
|
|
132
|
+
def get_wx_libs
|
133
|
+
wx_libset = ::Set.new
|
134
|
+
wx_libset.merge wx_config("--libs all").split(' ')
|
135
|
+
# some weird thing with this; at least sometimes '--libs all' will not output media library even if feature active
|
136
|
+
if features_set?('wxUSE_MEDIACTRL')
|
137
|
+
wx_libset.merge wx_config("--libs media").split(' ')
|
138
|
+
end
|
139
|
+
wx_libset.collect { |s| s.dup }
|
140
|
+
end
|
141
|
+
|
120
142
|
def init_unix_platform
|
121
143
|
# Allow specification of custom wxWidgets build (mostly useful for
|
122
144
|
# static wxRuby3 builds)
|
@@ -155,13 +177,7 @@ module WXRuby3
|
|
155
177
|
|
156
178
|
@cpp = wx_config("--cxx")
|
157
179
|
@ld = wx_config("--ld")
|
158
|
-
|
159
|
-
wx_libset.merge wx_config("--libs all").split(' ')
|
160
|
-
# some weird thing with this; at least sometimes '--libs all' will not output media library even if feature active
|
161
|
-
if features_set?('wxUSE_MEDIACTRL')
|
162
|
-
wx_libset.merge wx_config("--libs media").split(' ')
|
163
|
-
end
|
164
|
-
@wx_libs = wx_libset.collect { |s| s.dup }
|
180
|
+
@wx_libs = get_wx_libs
|
165
181
|
|
166
182
|
# remove all warning flags provided by Ruby config
|
167
183
|
@ruby_cppflags = @ruby_cppflags.collect { |flags| flags.split(' ') }.flatten.
|
@@ -169,8 +185,7 @@ module WXRuby3
|
|
169
185
|
@ruby_cppflags.concat %w[-Wall -Wextra -Wno-unused-parameter] # only keep these
|
170
186
|
# add include flags
|
171
187
|
@ruby_cppflags.concat ['-I.', *@ruby_includes.collect { |inc| "-I#{inc}" }]
|
172
|
-
@ruby_ldflags <<
|
173
|
-
@ruby_ldflags << "-Wl,-rpath,\\$ORIGIN/../lib" # add default rpath
|
188
|
+
@ruby_ldflags << "-Wl,-rpath,'#{get_rpath_origin}/../lib'" # add default rpath
|
174
189
|
@ruby_libs << "-L#{RB_CONFIG['libdir']}" # add ruby lib dir
|
175
190
|
# add ruby defined shared ruby lib(s); not any other flags
|
176
191
|
@ruby_libs.concat RB_CONFIG['LIBRUBYARG_SHARED'].split(' ').select { |s| s.start_with?('-l')}
|
data/rakelib/lib/config.rb
CHANGED
@@ -245,11 +245,19 @@ module WXRuby3
|
|
245
245
|
def do_link(_pkg)
|
246
246
|
end
|
247
247
|
|
248
|
+
def get_rpath_origin
|
249
|
+
''
|
250
|
+
end
|
251
|
+
|
248
252
|
def check_rpath_patch
|
249
253
|
true
|
250
254
|
end
|
251
255
|
|
252
|
-
def patch_rpath(_shlib,
|
256
|
+
def patch_rpath(_shlib, *)
|
257
|
+
true
|
258
|
+
end
|
259
|
+
|
260
|
+
def update_shlib_loadpaths(_shlib, _deplibs)
|
253
261
|
true
|
254
262
|
end
|
255
263
|
|
@@ -389,11 +397,12 @@ module WXRuby3
|
|
389
397
|
@rb_docgen_path = File.join(Config.wxruby_root, @rb_docgen_dir)
|
390
398
|
|
391
399
|
# Extra swig helper files to be built
|
392
|
-
@helper_modules =
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
400
|
+
@helper_modules = %w|RubyStockObjects|
|
401
|
+
# if macosx?
|
402
|
+
# %w|RubyStockObjects Mac|
|
403
|
+
# else
|
404
|
+
# %w|RubyStockObjects|
|
405
|
+
# end
|
397
406
|
# helper to initialize on startup (stock objects can only be initialized after App creation)
|
398
407
|
@helper_inits = @helper_modules - %w|RubyStockObjects|
|
399
408
|
|
data/rakelib/lib/core/mapping.rb
CHANGED
@@ -61,11 +61,16 @@ module WXRuby3
|
|
61
61
|
"VOID_#{ctype.tr(' ', '_').upcase}"
|
62
62
|
end
|
63
63
|
|
64
|
+
def self.strip_type_decl(ctype)
|
65
|
+
ctype = ctype.gsub(/const\s+/, '')
|
66
|
+
ctype.gsub!(/\s+(\*|&)/, '\1')
|
67
|
+
ctype.strip!
|
68
|
+
ctype.tr!('*&', '')
|
69
|
+
ctype
|
70
|
+
end
|
71
|
+
|
64
72
|
def self.wx_type_to_rb(typestr)
|
65
|
-
c_type = typestr
|
66
|
-
c_type.gsub!(/\s+(\*|&)/, '\1')
|
67
|
-
c_type.strip!
|
68
|
-
c_type.tr!('*&', '')
|
73
|
+
c_type = strip_type_decl(typestr)
|
69
74
|
(std_type_maps[c_type] || c_type).sub(/\Awx/, 'Wx::')
|
70
75
|
end
|
71
76
|
|
@@ -854,15 +859,15 @@ module WXRuby3
|
|
854
859
|
if @pattern.param_masks.first == parameters.first
|
855
860
|
# just 'map' the parameter to itself
|
856
861
|
param = parameters.shift # loose the 'mapped' parameter
|
857
|
-
return [RubyArg[
|
862
|
+
return [RubyArg[nil, param_offset], nil]
|
858
863
|
end
|
859
864
|
nil
|
860
865
|
end
|
861
866
|
|
862
867
|
def map_output(type)
|
863
|
-
if matches?(type)
|
864
|
-
|
865
|
-
end
|
868
|
+
# if matches?(type)
|
869
|
+
# return Typemap.wx_type_to_rb(type)
|
870
|
+
# end
|
866
871
|
nil
|
867
872
|
end
|
868
873
|
|
@@ -994,7 +999,7 @@ module WXRuby3
|
|
994
999
|
if result
|
995
1000
|
arg_in, arg_out = result
|
996
1001
|
else
|
997
|
-
arg_in = RubyArg.new(
|
1002
|
+
arg_in = RubyArg.new(nil, param_offset)
|
998
1003
|
parameters.shift # loose the mapped param
|
999
1004
|
end
|
1000
1005
|
# store mapped param
|
@@ -1009,7 +1014,7 @@ module WXRuby3
|
|
1009
1014
|
def map_output(type)
|
1010
1015
|
result = nil
|
1011
1016
|
list.reverse_each.detect { |map| result = map.map_output(type) }
|
1012
|
-
result
|
1017
|
+
result
|
1013
1018
|
end
|
1014
1019
|
|
1015
1020
|
def to_swig
|
data/rakelib/lib/core/package.rb
CHANGED
@@ -182,7 +182,7 @@ module WXRuby3
|
|
182
182
|
# any included mixins for this class?
|
183
183
|
!mixins.has_key?(cls) ||
|
184
184
|
# if so, are all initialized?
|
185
|
-
mixins[cls].all? do |modname|
|
185
|
+
mixins[cls].keys.all? do |modname|
|
186
186
|
# same package?
|
187
187
|
if modname.start_with?(cls_helper.package.fullname)
|
188
188
|
wx_name = "wx#{modname.split('::').last}"
|
@@ -585,6 +585,9 @@ module WXRuby3
|
|
585
585
|
# Integer constant reflecting the sub-release number of the wxWidgets release used to build wxRuby
|
586
586
|
WXWIDGETS_SUBRELEASE_NUMBER = \#{Wx::WXWIDGETS_SUBRELEASE_NUMBER}
|
587
587
|
|
588
|
+
# Integer constant reflecting the wxWidgets wxDEBUG_LEVEL
|
589
|
+
WXWIDGETS_DEBUG_LEVEL = \#{Wx::WXWIDGETS_DEBUG_LEVEL}
|
590
|
+
|
588
591
|
# Boolean constant indicating if wxRuby was build in debug (true) or release (false) mode
|
589
592
|
DEBUG = \#{Wx::DEBUG}
|
590
593
|
|
data/rakelib/lib/core/spec.rb
CHANGED
@@ -43,6 +43,7 @@ module WXRuby3
|
|
43
43
|
@interface_extensions = ::Hash.new
|
44
44
|
@folded_bases = ::Hash.new
|
45
45
|
@abstracts = ::Hash.new
|
46
|
+
@disowned_alloc = ::Set.new
|
46
47
|
@mixins = ::Set.new
|
47
48
|
@included_mixins = ::Hash.new
|
48
49
|
@items = [modname]
|
@@ -165,7 +166,7 @@ module WXRuby3
|
|
165
166
|
@gc_type = :GC_NEVER
|
166
167
|
else
|
167
168
|
@gc_type = ::Hash.new unless @gc_type.is_a?(::Hash)
|
168
|
-
names.each {|n| @gc_type[n] = :GC_NEVER }
|
169
|
+
names.flatten.each {|n| @gc_type[n] = :GC_NEVER }
|
169
170
|
end
|
170
171
|
self
|
171
172
|
end
|
@@ -175,7 +176,7 @@ module WXRuby3
|
|
175
176
|
@gc_type = :GC_MANAGE_AS_OBJECT
|
176
177
|
else
|
177
178
|
@gc_type = ::Hash.new unless @gc_type.is_a?(::Hash)
|
178
|
-
names.each {|n| @gc_type[n] = :GC_MANAGE_AS_OBJECT }
|
179
|
+
names.flatten.each {|n| @gc_type[n] = :GC_MANAGE_AS_OBJECT }
|
179
180
|
end
|
180
181
|
self
|
181
182
|
end
|
@@ -185,7 +186,7 @@ module WXRuby3
|
|
185
186
|
@gc_type = :GC_MANAGE_AS_WINDOW
|
186
187
|
else
|
187
188
|
@gc_type = ::Hash.new unless @gc_type.is_a?(::Hash)
|
188
|
-
names.each {|n| @gc_type[n] = :GC_MANAGE_AS_WINDOW }
|
189
|
+
names.flatten.each {|n| @gc_type[n] = :GC_MANAGE_AS_WINDOW }
|
189
190
|
end
|
190
191
|
self
|
191
192
|
end
|
@@ -195,7 +196,7 @@ module WXRuby3
|
|
195
196
|
@gc_type = :GC_MANAGE_AS_FRAME
|
196
197
|
else
|
197
198
|
@gc_type = ::Hash.new unless @gc_type.is_a?(::Hash)
|
198
|
-
names.each {|n| @gc_type[n] = :GC_MANAGE_AS_FRAME }
|
199
|
+
names.flatten.each {|n| @gc_type[n] = :GC_MANAGE_AS_FRAME }
|
199
200
|
end
|
200
201
|
self
|
201
202
|
end
|
@@ -205,7 +206,7 @@ module WXRuby3
|
|
205
206
|
@gc_type = :GC_MANAGE_AS_DIALOG
|
206
207
|
else
|
207
208
|
@gc_type = ::Hash.new unless @gc_type.is_a?(::Hash)
|
208
|
-
names.each {|n| @gc_type[n] = :GC_MANAGE_AS_DIALOG }
|
209
|
+
names.flatten.each {|n| @gc_type[n] = :GC_MANAGE_AS_DIALOG }
|
209
210
|
end
|
210
211
|
self
|
211
212
|
end
|
@@ -215,7 +216,7 @@ module WXRuby3
|
|
215
216
|
@gc_type = :GC_MANAGE_AS_EVENT
|
216
217
|
else
|
217
218
|
@gc_type = ::Hash.new unless @gc_type.is_a?(::Hash)
|
218
|
-
names.each {|n| @gc_type[n] = :GC_MANAGE_AS_EVENT }
|
219
|
+
names.flatten.each {|n| @gc_type[n] = :GC_MANAGE_AS_EVENT }
|
219
220
|
end
|
220
221
|
self
|
221
222
|
end
|
@@ -225,7 +226,7 @@ module WXRuby3
|
|
225
226
|
@gc_type = :GC_MANAGE_AS_SIZER
|
226
227
|
else
|
227
228
|
@gc_type = ::Hash.new unless @gc_type.is_a?(::Hash)
|
228
|
-
names.each {|n| @gc_type[n] = :GC_MANAGE_AS_SIZER }
|
229
|
+
names.flatten.each {|n| @gc_type[n] = :GC_MANAGE_AS_SIZER }
|
229
230
|
end
|
230
231
|
self
|
231
232
|
end
|
@@ -235,7 +236,7 @@ module WXRuby3
|
|
235
236
|
@gc_type = :GC_MANAGE_AS_REFCOUNTED
|
236
237
|
else
|
237
238
|
@gc_type = ::Hash.new unless @gc_type.is_a?(::Hash)
|
238
|
-
names.each {|n| @gc_type[n] = :GC_MANAGE_AS_REFCOUNTED }
|
239
|
+
names.flatten.each {|n| @gc_type[n] = :GC_MANAGE_AS_REFCOUNTED }
|
239
240
|
end
|
240
241
|
self
|
241
242
|
end
|
@@ -245,7 +246,7 @@ module WXRuby3
|
|
245
246
|
@gc_type = :GC_MANAGE_AS_UNTRACKED_REFCOUNTED
|
246
247
|
else
|
247
248
|
@gc_type = ::Hash.new unless @gc_type.is_a?(::Hash)
|
248
|
-
names.each {|n| @gc_type[n] = :GC_MANAGE_AS_UNTRACKED_REFCOUNTED }
|
249
|
+
names.flatten.each {|n| @gc_type[n] = :GC_MANAGE_AS_UNTRACKED_REFCOUNTED }
|
249
250
|
end
|
250
251
|
self
|
251
252
|
end
|
@@ -255,7 +256,7 @@ module WXRuby3
|
|
255
256
|
@gc_type = :GC_MANAGE_AS_UNTRACKED
|
256
257
|
else
|
257
258
|
@gc_type = ::Hash.new unless @gc_type.is_a?(::Hash)
|
258
|
-
names.each {|n| @gc_type[n] = :GC_MANAGE_AS_UNTRACKED }
|
259
|
+
names.flatten.each {|n| @gc_type[n] = :GC_MANAGE_AS_UNTRACKED }
|
259
260
|
end
|
260
261
|
self
|
261
262
|
end
|
@@ -283,6 +284,16 @@ module WXRuby3
|
|
283
284
|
self
|
284
285
|
end
|
285
286
|
|
287
|
+
def allocate_disowned(cls)
|
288
|
+
@disowned_alloc << cls
|
289
|
+
post_processors << :fix_disowned_alloc unless post_processors.include? :fix_disowned_alloc
|
290
|
+
self
|
291
|
+
end
|
292
|
+
|
293
|
+
def allocate_disowned?(cls)
|
294
|
+
@disowned_alloc.include?(cls)
|
295
|
+
end
|
296
|
+
|
286
297
|
def abstract?(cls)
|
287
298
|
@abstracts.has_key?(cls) && @abstracts[cls]
|
288
299
|
end
|
@@ -299,8 +310,8 @@ module WXRuby3
|
|
299
310
|
@mixins.include?(cls)
|
300
311
|
end
|
301
312
|
|
302
|
-
def include_mixin(cls,
|
303
|
-
(@included_mixins[cls] ||=
|
313
|
+
def include_mixin(cls, mixin_module)
|
314
|
+
(@included_mixins[cls] ||= {}).merge!(mixin_module.is_a?(::Hash) ? mixin_module : {mixin_module => nil})
|
304
315
|
self
|
305
316
|
end
|
306
317
|
|
@@ -171,6 +171,12 @@ module WXRuby3
|
|
171
171
|
ifspec.included_mixins
|
172
172
|
end
|
173
173
|
|
174
|
+
def allocate_disowned?(classdef_or_name)
|
175
|
+
class_def = (Extractor::ClassDef === classdef_or_name ?
|
176
|
+
classdef_or_name : classdef_for_name(classdef_or_name))
|
177
|
+
ifspec.allocate_disowned?(class_def.name)
|
178
|
+
end
|
179
|
+
|
174
180
|
def has_virtuals?(classdef_or_name)
|
175
181
|
class_def = (Extractor::ClassDef === classdef_or_name ?
|
176
182
|
classdef_or_name : classdef_for_name(classdef_or_name))
|
data/rakelib/lib/director/app.rb
CHANGED
@@ -71,6 +71,35 @@ module WXRuby3
|
|
71
71
|
return dynamic_cast<const wxRubyApp*>(self)->IsRunning();
|
72
72
|
}
|
73
73
|
__HEREDOC
|
74
|
+
if Config.platform == :macosx
|
75
|
+
# add accessor methods for the standard OSX menu items
|
76
|
+
spec.add_extend_code 'wxApp', <<~__HEREDOC
|
77
|
+
void set_mac_about_menu_itemid(long menu_itemid)
|
78
|
+
{
|
79
|
+
$self->s_macAboutMenuItemId = menu_itemid;
|
80
|
+
}
|
81
|
+
long get_mac_about_menu_itemid(long menu_itemid)
|
82
|
+
{
|
83
|
+
return $self->s_macAboutMenuItemId;
|
84
|
+
}
|
85
|
+
void set_mac_preferences_menu_itemid(long menu_itemid)
|
86
|
+
{
|
87
|
+
$self->s_macPreferencesMenuItemId = menu_itemid;
|
88
|
+
}
|
89
|
+
long get_mac_preferences_menu_itemid(long menu_itemid)
|
90
|
+
{
|
91
|
+
return $self->s_macPreferencesMenuItemId;
|
92
|
+
}
|
93
|
+
void set_mac_exit_menu_itemid(long menu_itemid)
|
94
|
+
{
|
95
|
+
$self->s_macExitMenuItemId = menu_itemid;
|
96
|
+
}
|
97
|
+
long get_mac_exit_menu_itemid(long menu_itemid)
|
98
|
+
{
|
99
|
+
return $self->s_macExitMenuItemId;
|
100
|
+
}
|
101
|
+
__HEREDOC
|
102
|
+
end
|
74
103
|
spec.ignore [
|
75
104
|
'wxEntry(int &,wxChar **)',
|
76
105
|
'wxEntry(HINSTANCE,HINSTANCE,char *,int)'
|
@@ -339,7 +368,7 @@ module WXRuby3
|
|
339
368
|
}
|
340
369
|
|
341
370
|
// actually implemented in ruby in classes/app.rb
|
342
|
-
virtual void OnAssertFailure(const wxChar *file, int line, const wxChar *func, const wxChar *cond, const wxChar *msg)
|
371
|
+
virtual void OnAssertFailure(const wxChar *file, int line, const wxChar *func, const wxChar *cond, const wxChar *msg) override
|
343
372
|
{
|
344
373
|
VALUE rb_app = SWIG_RubyInstanceFor(this);
|
345
374
|
if (rb_during_gc() || NIL_P(rb_app))
|
@@ -13,6 +13,47 @@ module WXRuby3
|
|
13
13
|
|
14
14
|
def setup
|
15
15
|
super
|
16
|
+
# for #set_custom_overflow_items
|
17
|
+
spec.map 'const wxAuiToolBarItemArray&' => 'Array<Wx::AUI::AuiToolbarItem>,nil' do
|
18
|
+
map_in temp: 'wxAuiToolBarItemArray tmp', code: <<~__CODE
|
19
|
+
if (!NIL_P($input))
|
20
|
+
{
|
21
|
+
if (TYPE($input) == T_ARRAY)
|
22
|
+
{
|
23
|
+
for (int i=0; i<RARRAY_LEN($input) ;++i)
|
24
|
+
{
|
25
|
+
VALUE rb_el = rb_ary_entry($input, i);
|
26
|
+
void* ptr = 0;
|
27
|
+
int res = SWIG_ConvertPtr(rb_el, &ptr, SWIGTYPE_p_wxAuiToolBarItem, 0);
|
28
|
+
if (!SWIG_IsOK(res) || ptr == 0)
|
29
|
+
{
|
30
|
+
const char* msg;
|
31
|
+
VALUE rb_msg;
|
32
|
+
if (ptr)
|
33
|
+
{
|
34
|
+
rb_msg = rb_inspect(rb_el);
|
35
|
+
msg = StringValuePtr(rb_msg);
|
36
|
+
}
|
37
|
+
else
|
38
|
+
{
|
39
|
+
msg = "null reference";
|
40
|
+
}
|
41
|
+
rb_raise(rb_eTypeError, "$symname : expected Wx::AUI::AuiToolbarItem for array element for $argnum but got %s",
|
42
|
+
msg);
|
43
|
+
}
|
44
|
+
tmp.Add(*reinterpret_cast< wxAuiToolBarItem * >(ptr));
|
45
|
+
}
|
46
|
+
}
|
47
|
+
else
|
48
|
+
{
|
49
|
+
VALUE msg = rb_inspect($input);
|
50
|
+
rb_raise(rb_eArgError, "$symname : expected array for $argnum but got %s",
|
51
|
+
StringValuePtr(msg));
|
52
|
+
}
|
53
|
+
}
|
54
|
+
$1 = &tmp;
|
55
|
+
__CODE
|
56
|
+
end
|
16
57
|
spec.do_not_generate(:variables, :defines, :enums, :functions) # with AuiToolBarEvent
|
17
58
|
end
|
18
59
|
end # class AuiToolBar
|
@@ -20,7 +20,16 @@ module WXRuby3
|
|
20
20
|
# these are defined and loaded in RubyStockObjects.i
|
21
21
|
spec.ignore %w[
|
22
22
|
wxBLUE_BRUSH wxGREEN_BRUSH wxYELLOW_BRUSH wxWHITE_BRUSH wxBLACK_BRUSH wxGREY_BRUSH
|
23
|
-
wxMEDIUM_GREY_BRUSH wxLIGHT_GREY_BRUSH wxTRANSPARENT_BRUSH wxCYAN_BRUSH wxRED_BRUSH
|
23
|
+
wxMEDIUM_GREY_BRUSH wxLIGHT_GREY_BRUSH wxTRANSPARENT_BRUSH wxCYAN_BRUSH wxRED_BRUSH]
|
24
|
+
# do not expose this
|
25
|
+
spec.ignore 'wxTheBrushList'
|
26
|
+
# provide it's functionality as a class method of Brush instead
|
27
|
+
spec.add_extend_code 'wxBrush', <<~__HEREDOC
|
28
|
+
static wxBrush* find_or_create_brush(const wxColour &colour, wxBrushStyle style=wxBRUSHSTYLE_SOLID)
|
29
|
+
{
|
30
|
+
return wxTheBrushList->FindOrCreateBrush(colour, style);
|
31
|
+
}
|
32
|
+
__HEREDOC
|
24
33
|
end
|
25
34
|
end # class Brush
|
26
35
|
|
@@ -15,7 +15,7 @@ module WXRuby3
|
|
15
15
|
super
|
16
16
|
setup_ctrl_with_items('wxComboBox')
|
17
17
|
# mixin TextEntry
|
18
|
-
spec.include_mixin 'wxComboBox', 'Wx::TextEntry'
|
18
|
+
spec.include_mixin 'wxComboBox', { 'Wx::TextEntry' => 'wxTextEntryBase' }
|
19
19
|
spec.override_inheritance_chain('wxComboBox',
|
20
20
|
%w[wxControlWithItems
|
21
21
|
wxControl
|
@@ -0,0 +1,23 @@
|
|
1
|
+
###
|
2
|
+
# wxRuby3 wxWidgets interface director
|
3
|
+
# Copyright (c) M.J.N. Corino, The Netherlands
|
4
|
+
###
|
5
|
+
|
6
|
+
require_relative './button'
|
7
|
+
|
8
|
+
module WXRuby3
|
9
|
+
|
10
|
+
class Director
|
11
|
+
|
12
|
+
class ContextHelpButton < Button
|
13
|
+
|
14
|
+
def setup
|
15
|
+
super
|
16
|
+
spec.items << 'wxContextHelp'
|
17
|
+
spec.no_proxy 'wxContextHelp'
|
18
|
+
end
|
19
|
+
end # class ContextHelpButton
|
20
|
+
|
21
|
+
end # class Director
|
22
|
+
|
23
|
+
end # module WXRuby3
|
@@ -28,10 +28,41 @@ module WXRuby3
|
|
28
28
|
}
|
29
29
|
__HEREDOC
|
30
30
|
when 'wxMessageDialog'
|
31
|
+
spec.ignore 'wxMessageDialog::ButtonLabel'
|
32
|
+
spec.map 'const ButtonLabel&' => 'String,Integer' do
|
33
|
+
add_header_code 'typedef wxMessageDialog::ButtonLabel ButtonLabel;'
|
34
|
+
map_in temp: 'std::unique_ptr<wxMessageDialog::ButtonLabel> tmp', code: <<~__CODE
|
35
|
+
if (TYPE($input) == T_STRING)
|
36
|
+
{
|
37
|
+
tmp = std::make_unique<wxMessageDialog::ButtonLabel> (RSTR_TO_WXSTR($input));
|
38
|
+
}
|
39
|
+
else if (TYPE($input) == T_FIXNUM || wxRuby_IsAnEnum($input))
|
40
|
+
{
|
41
|
+
tmp = std::make_unique<wxMessageDialog::ButtonLabel> (NUM2INT($input));
|
42
|
+
}
|
43
|
+
else
|
44
|
+
{
|
45
|
+
rb_raise(rb_eArgError, "Expected string or stock id for %d", $argnum-1);
|
46
|
+
}
|
47
|
+
$1 = tmp.get();
|
48
|
+
__CODE
|
49
|
+
map_directorin code: <<~__CODE
|
50
|
+
if ($1.GetStockId() != wxID_NONE)
|
51
|
+
{ $input = INT2NUM($1.GetStockId()); }
|
52
|
+
else
|
53
|
+
{ $input = WXSTR_TO_RSTR($1.GetAsString()); }
|
54
|
+
__CODE
|
55
|
+
end
|
31
56
|
when 'wxFontDialog'
|
32
57
|
# ignore the non-const version
|
33
|
-
|
34
|
-
|
58
|
+
if Config.platform == :macosx && Config.instance.wx_version < '3.3'
|
59
|
+
# MacOSX implementation is incorrect so we need to use
|
60
|
+
# the non-const definition here
|
61
|
+
spec.ignore 'wxFontDialog::GetFontData() const'
|
62
|
+
else
|
63
|
+
spec.ignore 'wxFontDialog::GetFontData'
|
64
|
+
spec.regard 'wxFontDialog::GetFontData() const'
|
65
|
+
end
|
35
66
|
when 'wxFileDialog'
|
36
67
|
# override the wxArrayString& typemap for GetFilenames and GetPaths
|
37
68
|
spec.map 'wxArrayString&' => 'Array<String>' do
|