wxruby3 0.9.0.pre.rc.1 → 0.9.0.pre.rc.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/INSTALL.md +51 -22
- data/README.md +38 -6
- 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/lib/wx/core/brush.rb +6 -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/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/brush.rb +17 -0
- data/lib/wx/doc/font.rb +27 -0
- data/lib/wx/doc/pen.rb +17 -0
- data/lib/wx/doc/radio_box.rb +20 -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/package.rb +1 -1
- data/rakelib/lib/core/spec.rb +2 -2
- 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 +8 -2
- data/rakelib/lib/director/font.rb +12 -3
- data/rakelib/lib/director/help_provider.rb +8 -10
- data/rakelib/lib/director/hyperlink_event.rb +22 -0
- 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 +5 -0
- data/rakelib/lib/director/textctrl.rb +1 -1
- data/rakelib/lib/director/window.rb +37 -1
- 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.rb +1 -1
- data/rakelib/lib/generate/interface.rb +11 -10
- data/rakelib/lib/specs/interfaces.rb +4 -1
- 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_ext_controls.rb +28 -0
- data/tests/test_font.rb +239 -0
- data/tests/test_intl.rb +5 -1
- data/tests/test_std_controls.rb +263 -37
- data/tests/test_window.rb +340 -0
- metadata +28 -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/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}"
|
data/rakelib/lib/core/spec.rb
CHANGED
@@ -299,8 +299,8 @@ module WXRuby3
|
|
299
299
|
@mixins.include?(cls)
|
300
300
|
end
|
301
301
|
|
302
|
-
def include_mixin(cls,
|
303
|
-
(@included_mixins[cls] ||=
|
302
|
+
def include_mixin(cls, mixin_module)
|
303
|
+
(@included_mixins[cls] ||= {}).merge!(mixin_module.is_a?(::Hash) ? mixin_module : {mixin_module => nil})
|
304
304
|
self
|
305
305
|
end
|
306
306
|
|
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
|
@@ -30,8 +30,14 @@ module WXRuby3
|
|
30
30
|
when 'wxMessageDialog'
|
31
31
|
when 'wxFontDialog'
|
32
32
|
# ignore the non-const version
|
33
|
-
|
34
|
-
|
33
|
+
if Config.platform == :macosx && Config.instance.wx_version < '3.3'
|
34
|
+
# MacOSX implementation is incorrect so we need to use
|
35
|
+
# the non-const definition here
|
36
|
+
spec.ignore 'wxFontDialog::GetFontData() const'
|
37
|
+
else
|
38
|
+
spec.ignore 'wxFontDialog::GetFontData'
|
39
|
+
spec.regard 'wxFontDialog::GetFontData() const'
|
40
|
+
end
|
35
41
|
when 'wxFileDialog'
|
36
42
|
# override the wxArrayString& typemap for GetFilenames and GetPaths
|
37
43
|
spec.map 'wxArrayString&' => 'Array<String>' do
|
@@ -24,9 +24,7 @@ module WXRuby3
|
|
24
24
|
'wxFont::GetDefaultEncoding',
|
25
25
|
'wxFont::SetDefaultEncoding'
|
26
26
|
spec.rename_for_ruby 'create' => 'wxFont::New'
|
27
|
-
spec.ignore
|
28
|
-
wxFont::SetNativeFontInfo wxFont::GetNativeFontInfo wxFont::operator!=
|
29
|
-
]
|
27
|
+
spec.ignore [ 'wxFont::SetNativeFontInfo(const wxNativeFontInfo &)', 'wxFont::GetNativeFontInfo', 'wxFont::operator!=' ]
|
30
28
|
spec.ignore 'wxFont::wxFont(const wxNativeFontInfo &)'
|
31
29
|
if Config.instance.wx_port == :wxQT
|
32
30
|
# not implemented
|
@@ -87,6 +85,17 @@ module WXRuby3
|
|
87
85
|
return SWIG_NewPointerObj(new wxFont(font), SWIGTYPE_p_wxFont, SWIG_POINTER_OWN);
|
88
86
|
}
|
89
87
|
__HEREDOC
|
88
|
+
# implement wxTheFontList methods as static methods of Wx::Font
|
89
|
+
spec.add_extend_code 'wxFont', <<~__HEREDOC
|
90
|
+
static wxFont * find_or_create_font(int point_size, wxFontFamily family, wxFontStyle style, wxFontWeight weight, bool underline=false, const wxString &facename=wxEmptyString, wxFontEncoding encoding=wxFONTENCODING_DEFAULT)
|
91
|
+
{
|
92
|
+
return wxTheFontList->FindOrCreateFont(point_size, family, style, weight, underline, facename, encoding);
|
93
|
+
}
|
94
|
+
static wxFont * find_or_create_font(const wxFontInfo &fontInfo)
|
95
|
+
{
|
96
|
+
return wxTheFontList->FindOrCreateFont(fontInfo);
|
97
|
+
}
|
98
|
+
__HEREDOC
|
90
99
|
spec.do_not_generate :functions
|
91
100
|
end
|
92
101
|
|
@@ -27,7 +27,7 @@ module WXRuby3
|
|
27
27
|
public:
|
28
28
|
// This is pure virtual in base Wx class, so won't compile unless an
|
29
29
|
// implementation is provided
|
30
|
-
wxString GetHelp(const wxWindowBase* window)
|
30
|
+
wxString GetHelp(const wxWindowBase* window) override
|
31
31
|
{
|
32
32
|
static WxRuby_ID get_help_id("get_help");
|
33
33
|
|
@@ -50,7 +50,7 @@ module WXRuby3
|
|
50
50
|
// RemoveHelp is called by Wx after the window deletion event has been
|
51
51
|
// handled. A standard director here re-wraps the already destroyed
|
52
52
|
// object, which will cause rapid segfaults when it is later marked.
|
53
|
-
void RemoveHelp(wxWindowBase* window)
|
53
|
+
void RemoveHelp(wxWindowBase* window) override
|
54
54
|
{
|
55
55
|
static WxRuby_ID remove_help_id("remove_help");
|
56
56
|
|
@@ -64,13 +64,8 @@ module WXRuby3
|
|
64
64
|
};
|
65
65
|
__HEREDOC
|
66
66
|
spec.add_swig_code <<~__HEREDOC
|
67
|
+
GC_MANAGE_AS_OBJECT(wxRubyHelpProvider);
|
67
68
|
typedef wxWindow wxWindowBase;
|
68
|
-
|
69
|
-
%ignore wxHelpProvider::GetHelp; // Must be supplied in Ruby
|
70
|
-
|
71
|
-
// Need to avoid standard director as it will call with destroyed
|
72
|
-
// objects
|
73
|
-
%feature("nodirector") wxHelpProvider::RemoveHelp;
|
74
69
|
__HEREDOC
|
75
70
|
spec.map 'wxWindowBase' => 'Wx::Window', swig: false do
|
76
71
|
map_in
|
@@ -88,8 +83,11 @@ module WXRuby3
|
|
88
83
|
static wxRubyHelpProvider* Get();
|
89
84
|
virtual void AddHelp(wxWindowBase* window, const wxString& text);
|
90
85
|
virtual void AddHelp(wxWindowID id, const wxString& text);
|
91
|
-
|
92
|
-
|
86
|
+
// we do not include the declaration of GetHelp here because
|
87
|
+
// we do not want a default implementation or director as we have
|
88
|
+
// a fixed director implementation above and the rest is pure Ruby
|
89
|
+
// virtual wxString GetHelp(const wxWindowBase* window);
|
90
|
+
void RemoveHelp(wxWindowBase* window); // no virtual as we have fixed director impl above
|
93
91
|
virtual bool ShowHelp(wxWindowBase* window);
|
94
92
|
virtual bool ShowHelpAtPoint(wxWindowBase* window, const wxPoint point,
|
95
93
|
wxHelpEvent::Origin origin);
|
@@ -0,0 +1,22 @@
|
|
1
|
+
###
|
2
|
+
# wxRuby3 wxWidgets interface director
|
3
|
+
# Copyright (c) M.J.N. Corino, The Netherlands
|
4
|
+
###
|
5
|
+
|
6
|
+
require_relative './event'
|
7
|
+
|
8
|
+
module WXRuby3
|
9
|
+
|
10
|
+
class Director
|
11
|
+
|
12
|
+
class HyperlinkEvent < Event
|
13
|
+
|
14
|
+
def setup
|
15
|
+
super
|
16
|
+
spec.do_not_generate :variables, :enums, :defines, :functions # with HyperlinkCtrl
|
17
|
+
end
|
18
|
+
end # class HyperlinkEvent
|
19
|
+
|
20
|
+
end # class Director
|
21
|
+
|
22
|
+
end # module WXRuby3
|
@@ -30,9 +30,6 @@ module WXRuby3
|
|
30
30
|
__HEREDOC
|
31
31
|
# make Ruby director and wrappers use custom implementation
|
32
32
|
spec.use_class_implementation('wxMenu', 'wxRubyMenu')
|
33
|
-
spec.rename_for_ruby(
|
34
|
-
'AppendItem' =>
|
35
|
-
'wxMenu::Append(wxMenuItem *item)')
|
36
33
|
# ignore non-const version as that has no benefits in Ruby
|
37
34
|
spec.ignore 'wxMenu::GetMenuItems()'
|
38
35
|
# Fix for GetMenuItems - converts list of MenuItems to Array
|
@@ -19,6 +19,9 @@ module WXRuby3
|
|
19
19
|
'wxMenuBar::GetLabelTop',
|
20
20
|
'wxMenuBar::SetLabelTop',
|
21
21
|
'wxMenuBar::Refresh')
|
22
|
+
unless Config.instance.wx_version >= '3.3' || Config.instance.wx_abi_version > '3.0.0'
|
23
|
+
spec.ignore 'wxMenuBar::OSXGetAppleMenu'
|
24
|
+
end
|
22
25
|
super
|
23
26
|
end
|
24
27
|
end # class MenuBar
|
data/rakelib/lib/director/pen.rb
CHANGED
@@ -166,7 +166,16 @@ module WXRuby3
|
|
166
166
|
# these are defined and loaded in RubyStockObjects.i
|
167
167
|
spec.ignore %w[
|
168
168
|
wxRED_PEN wxBLUE_PEN wxCYAN_PEN wxGREEN_PEN wxYELLOW_PEN wxBLACK_PEN wxWHITE_PEN
|
169
|
-
wxTRANSPARENT_PEN wxBLACK_DASHED_PEN wxGREY_PEN wxMEDIUM_GREY_PEN wxLIGHT_GREY_PEN
|
169
|
+
wxTRANSPARENT_PEN wxBLACK_DASHED_PEN wxGREY_PEN wxMEDIUM_GREY_PEN wxLIGHT_GREY_PEN]
|
170
|
+
# do not expose this
|
171
|
+
spec.ignore 'wxThePenList'
|
172
|
+
# provide it's functionality as a class method of Pen instead
|
173
|
+
spec.add_extend_code 'wxPen', <<~__HEREDOC
|
174
|
+
static wxPen* find_or_create_pen(const wxColour &colour, int width=1, wxPenStyle style=wxPENSTYLE_SOLID)
|
175
|
+
{
|
176
|
+
return wxThePenList->FindOrCreatePen(colour, width, style);
|
177
|
+
}
|
178
|
+
__HEREDOC
|
170
179
|
end
|
171
180
|
end # class Pen
|
172
181
|
|
@@ -14,6 +14,24 @@ module WXRuby3
|
|
14
14
|
def setup
|
15
15
|
spec.items << 'wxPopupTransientWindow'
|
16
16
|
super
|
17
|
+
spec.items.each do |itm|
|
18
|
+
spec.no_proxy("#{itm}::ClearBackground",
|
19
|
+
"#{itm}::Enable",
|
20
|
+
"#{itm}::GetHelpTextAtPoint",
|
21
|
+
"#{itm}::GetMaxSize",
|
22
|
+
"#{itm}::GetMinSize",
|
23
|
+
"#{itm}::Refresh",
|
24
|
+
"#{itm}::Update")
|
25
|
+
end
|
26
|
+
# add these to the generated interface to be parsed by SWIG
|
27
|
+
# the wxWidgets docs are flawed in this respect that several reimplemented
|
28
|
+
# virtual methods are not documented at the reimplementing class as such
|
29
|
+
# that would cause them missing from the interface which would cause a problem
|
30
|
+
# for a SWIG director redirecting to the Ruby class as the SWIG wrappers
|
31
|
+
# redirect explicitly to the implementation at the same class level as the wrapper
|
32
|
+
# for upcalls
|
33
|
+
spec.extend_interface('wxPopupWindow',
|
34
|
+
'virtual bool Show(bool show = true) override')
|
17
35
|
end
|
18
36
|
|
19
37
|
end # class PopupWindow
|
@@ -14,22 +14,33 @@ module WXRuby3
|
|
14
14
|
spec.items << 'wxItemContainerImmutable'
|
15
15
|
spec.fold_bases('wxRadioBox' => 'wxItemContainerImmutable')
|
16
16
|
spec.override_inheritance_chain('wxRadioBox', %w[wxControl wxWindow wxEvtHandler wxObject])
|
17
|
-
# ignore
|
18
|
-
spec.ignore('wxRadioBox::Enable')
|
17
|
+
# ignore overloads hiding common Window method
|
18
|
+
spec.ignore('wxRadioBox::Enable', 'wxRadioBox::Show')
|
19
19
|
spec.add_extend_code 'wxRadioBox', <<~__HEREDOC
|
20
|
-
// add custom method to reach common Window method
|
20
|
+
// add custom method to reach common Window method overload
|
21
21
|
bool EnableWindow(bool enable=true)
|
22
22
|
{
|
23
|
-
return $self->
|
23
|
+
return $self->Enable(enable);
|
24
24
|
}
|
25
25
|
// add right method to enable/disable items
|
26
26
|
bool EnableItem(unsigned int n, bool enable=true)
|
27
27
|
{
|
28
28
|
return $self->Enable(n, enable);
|
29
29
|
}
|
30
|
+
// add custom method to reach common Window method overload
|
31
|
+
bool ShowWindow(bool show=true)
|
32
|
+
{
|
33
|
+
return $self->Show(show);
|
34
|
+
}
|
35
|
+
// add right method to show/hide items
|
36
|
+
bool ShowItem(unsigned int n, bool show=true)
|
37
|
+
{
|
38
|
+
return $self->Show(n, show);
|
39
|
+
}
|
30
40
|
__HEREDOC
|
31
41
|
# rename common method
|
32
42
|
spec.rename_for_ruby('Enable' => 'wxRadioBox::EnableWindow')
|
43
|
+
spec.rename_for_ruby('Show' => 'wxRadioBox::ShowWindow')
|
33
44
|
super
|
34
45
|
end
|
35
46
|
end # class Window
|