wxruby3 1.2.0 → 1.3.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/ext/wxruby3/swig/custom/director.swg +6 -20
- data/lib/wx/core/animation.rb +35 -14
- data/lib/wx/core/choicedlg.rb +7 -10
- data/lib/wx/core/colour.rb +10 -0
- data/lib/wx/core/dialog.rb +2 -2
- data/lib/wx/core/enum.rb +22 -5
- data/lib/wx/core/event.rb +7 -0
- data/lib/wx/core/file_dialog.rb +25 -0
- data/lib/wx/core/functions.rb +4 -10
- data/lib/wx/core/gdi_object.rb +24 -0
- data/lib/wx/core/object.rb +26 -11
- data/lib/wx/core/variant.rb +108 -51
- data/lib/wx/doc/animation_ctrl.rb +18 -0
- data/lib/wx/doc/colour.rb +12 -0
- data/lib/wx/doc/enum.rb +0 -11
- data/lib/wx/doc/evthandler.rb +6 -0
- data/lib/wx/doc/functions.rb +35 -3
- data/lib/wx/doc/gdi_object.rb +22 -0
- data/lib/wx/doc/object.rb +24 -0
- data/lib/wx/doc/variant.rb +8 -0
- data/lib/wx/helpers.rb +2 -3
- data/lib/wx/keyword_defs.rb +14 -1
- data/lib/wx/version.rb +1 -1
- data/rakelib/lib/config.rb +1 -1
- data/rakelib/lib/core/include/enum.inc +0 -80
- data/rakelib/lib/core/include/funcall.inc +9 -24
- data/rakelib/lib/core/include/swigdirector.inc +29 -11
- data/rakelib/lib/director/animation_ctrl.rb +11 -0
- data/rakelib/lib/director/defs.rb +3 -0
- data/rakelib/lib/director/dialog.rb +15 -7
- data/rakelib/lib/director/file_dialog_customize_hook.rb +77 -1
- data/rakelib/lib/director/functions.rb +0 -12
- data/rakelib/lib/director/validator.rb +7 -42
- data/rakelib/lib/generate/doc/credential_entry_dialog.yaml +10 -0
- data/rakelib/lib/generate/doc/generic_about_dialog.yaml +46 -0
- data/rakelib/lib/specs/interfaces.rb +2 -0
- data/rakelib/lib/swig_runner.rb +6 -3
- data/rakelib/lib/util/string.rb +7 -6
- data/samples/animate/anitest.rb +288 -0
- data/samples/animate/hourglass.ani +0 -0
- data/samples/animate/throbber.gif +0 -0
- data/samples/animate/throbber_2x.gif +0 -0
- data/samples/animate/tn_anitest.png +0 -0
- data/tests/lib/leaked_overload_exception_test.rb +25 -0
- data/tests/lib/leaked_process_event_exception_test.rb +33 -0
- data/tests/lib/leaked_queued_event_exception_test.rb +34 -0
- data/tests/lib/overload_type_exception_test.rb +25 -0
- data/tests/test_exceptions.rb +24 -24
- metadata +17 -2
@@ -0,0 +1,22 @@
|
|
1
|
+
# :stopdoc:
|
2
|
+
# Copyright (c) 2023 M.J.N. Corino, The Netherlands
|
3
|
+
#
|
4
|
+
# This software is released under the MIT license.
|
5
|
+
# :startdoc:
|
6
|
+
|
7
|
+
|
8
|
+
module Wx
|
9
|
+
|
10
|
+
class GDIObject < Object
|
11
|
+
|
12
|
+
# Returns a copy-constructed GDI object.
|
13
|
+
# @return [Wx::GDIObject] the duplicated GDI object
|
14
|
+
def dup; end
|
15
|
+
|
16
|
+
# Calls #dup.
|
17
|
+
# @return [Wx::GDIObject]
|
18
|
+
def clone; end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# :stopdoc:
|
2
|
+
# Copyright (c) 2023 M.J.N. Corino, The Netherlands
|
3
|
+
#
|
4
|
+
# This software is released under the MIT license.
|
5
|
+
# :startdoc:
|
6
|
+
|
7
|
+
|
8
|
+
module Wx
|
9
|
+
|
10
|
+
class Object
|
11
|
+
|
12
|
+
# By default Wx:::Object derived classes cannot be #dup-licated.
|
13
|
+
# Some derived classes (like GDIObject-s) may provide functional overloads.
|
14
|
+
# @return [nil]
|
15
|
+
def dup; end
|
16
|
+
|
17
|
+
# By default Wx::Object derived class instances cannot be cloned but instead return self.
|
18
|
+
# Derived classes (like the Event classes) may provide functional overloads.
|
19
|
+
# @return [self]
|
20
|
+
def clone; end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
data/lib/wx/doc/variant.rb
CHANGED
@@ -168,6 +168,14 @@ module Wx
|
|
168
168
|
# @return [true,false]
|
169
169
|
def object?(klass=Object) end
|
170
170
|
|
171
|
+
# Copy constructs a Variant instance.
|
172
|
+
# @return [Wx::Variant]
|
173
|
+
def dup; end
|
174
|
+
|
175
|
+
# Calls #dup.
|
176
|
+
# @return [Wx::Variant]
|
177
|
+
def clone; end
|
178
|
+
|
171
179
|
end
|
172
180
|
|
173
181
|
end
|
data/lib/wx/helpers.rb
CHANGED
@@ -27,9 +27,8 @@ module Wx
|
|
27
27
|
out_args = []
|
28
28
|
param_spec.each_with_index do | param, i |
|
29
29
|
# has supplied list arg or the keyword arg?
|
30
|
-
|
31
|
-
|
32
|
-
end
|
30
|
+
arg = mixed_args[i]
|
31
|
+
arg = kwa.delete(param.name) if arg.nil? && kwa.key?(param.name)
|
33
32
|
if Proc === param.default_or_proc
|
34
33
|
arg = param.default_or_proc.call(arg) # provides default or converts arg
|
35
34
|
elsif arg.nil?
|
data/lib/wx/keyword_defs.rb
CHANGED
@@ -267,6 +267,13 @@ Wx::define_keyword_ctors(Wx::PropertySheetDialog) do
|
|
267
267
|
wx_ctor_params :name => Wx::DIALOG_NAME_STR
|
268
268
|
end
|
269
269
|
|
270
|
+
# Credentials entry dialog
|
271
|
+
Wx::define_keyword_ctors(Wx::CredentialEntryDialog) do
|
272
|
+
wx_ctor_params :message => ''
|
273
|
+
wx_ctor_params :title => 'Enter credentials'
|
274
|
+
wx_ctor_params :cred => ->(cred) { cred || Wx::WebCredentials.new }
|
275
|
+
end
|
276
|
+
|
270
277
|
### CONTROLS
|
271
278
|
|
272
279
|
# Push button control, displaying text
|
@@ -530,7 +537,13 @@ Wx::define_keyword_ctors(Wx::SearchCtrl) do
|
|
530
537
|
end
|
531
538
|
|
532
539
|
Wx::define_keyword_ctors(Wx::AnimationCtrl) do
|
533
|
-
wx_ctor_params :id, :anim
|
540
|
+
wx_ctor_params :id, :anim => Wx::NULL_ANIMATION
|
541
|
+
wx_ctor_params :pos, :size, :style => Wx::AC_DEFAULT_STYLE
|
542
|
+
wx_ctor_params :name => Wx::ANIMATION_CTRL_NAME_STR
|
543
|
+
end
|
544
|
+
|
545
|
+
Wx::define_keyword_ctors(Wx::GenericAnimationCtrl) do
|
546
|
+
wx_ctor_params :id, :anim => Wx::NULL_ANIMATION
|
534
547
|
wx_ctor_params :pos, :size, :style => Wx::AC_DEFAULT_STYLE
|
535
548
|
wx_ctor_params :name => Wx::ANIMATION_CTRL_NAME_STR
|
536
549
|
end
|
data/lib/wx/version.rb
CHANGED
data/rakelib/lib/config.rb
CHANGED
@@ -360,7 +360,7 @@ module WXRuby3
|
|
360
360
|
test = File.join(Config.instance.test_dir, test)
|
361
361
|
test = Dir.glob(test+'.rb').shift || test unless File.exist?(test)
|
362
362
|
end
|
363
|
-
Rake.sh(Config.instance.exec_env,
|
363
|
+
Rake.sh(Config.instance.exec_env.merge({'RUBYLIB'=>rb_lib_path}), FileUtils::RUBY, test) { |ok,status| errors += 1 unless ok }
|
364
364
|
end
|
365
365
|
end
|
366
366
|
fail "ERRORS: ##{errors} test scripts failed." if errors>0
|
@@ -16,7 +16,6 @@ static const char * __iv_Enum_sc_enums = "@enums";
|
|
16
16
|
|
17
17
|
// instance variables for derived Enum class singleton classes
|
18
18
|
static const char * __iv_enum_klass_values = "@values"; // hash map of all value instances of derived Enum (by integer value)
|
19
|
-
static const char * __iv_enum_klass_values_by_name = "@values_by_name"; // hash map of all value instances of derived Enum
|
20
19
|
static const char * __iv_enum_klass_name = "@name"; // unscoped name of derived Enum
|
21
20
|
|
22
21
|
static VALUE wx_Enum_initialize(int argc, VALUE *argv, VALUE self)
|
@@ -149,55 +148,10 @@ static VALUE wx_Enum_to_int(int argc, VALUE *argv, VALUE self)
|
|
149
148
|
return rb_iv_get(self, __iv_cEnum_value);
|
150
149
|
}
|
151
150
|
|
152
|
-
static VALUE wx_Enum_sc_get_enum_class(int argc, VALUE *argv, VALUE self)
|
153
|
-
{
|
154
|
-
if ((argc < 1) || (argc > 1))
|
155
|
-
{
|
156
|
-
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)", argc); return Qnil;
|
157
|
-
}
|
158
|
-
return rb_hash_aref(rb_iv_get(cEnum_Singleton, __iv_Enum_sc_enums), rb_to_symbol(argv[0]));
|
159
|
-
}
|
160
|
-
|
161
|
-
static VALUE wx_Enum_sc_create_enum_class(int argc, VALUE *argv, VALUE self)
|
162
|
-
{
|
163
|
-
if ((argc < 2) || (argc > 2))
|
164
|
-
{
|
165
|
-
rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)", argc); return Qnil;
|
166
|
-
}
|
167
|
-
VALUE enum_name = rb_to_symbol(argv[0]);
|
168
|
-
if (TYPE(argv[1]) != T_HASH)
|
169
|
-
{
|
170
|
-
VALUE str = rb_inspect(argv[1]);
|
171
|
-
rb_raise(rb_eArgError,
|
172
|
-
"Invalid enum_values; expected Hash but got %s.",
|
173
|
-
StringValuePtr(str));
|
174
|
-
return Qnil;
|
175
|
-
}
|
176
|
-
ID id_new = rb_intern("new");
|
177
|
-
ID id_to_i = rb_intern("to_i");
|
178
|
-
ID id_const_set = rb_intern("const_set");
|
179
|
-
VALUE enum_klass = rb_funcall(rb_cClass, id_new, 1, cWxEnum, 0);
|
180
|
-
VALUE enum_singleton_klass = rb_funcall(enum_klass, rb_intern("singleton_class"), 0, 0);
|
181
|
-
VALUE enum_values = rb_funcall(argv[1], rb_intern("keys"), 0, 0);
|
182
|
-
for (int i=0; i<RARRAY_LEN(enum_values) ;++i)
|
183
|
-
{
|
184
|
-
VALUE enum_value_name = rb_ary_entry(enum_values, i);
|
185
|
-
VALUE enum_value_num = rb_funcall(rb_hash_aref(argv[1], enum_value_name), id_to_i, 0, 0);
|
186
|
-
VALUE enum_value = rb_funcall(enum_klass, id_new, 1, enum_value_num, 0);
|
187
|
-
rb_funcall(enum_klass, id_const_set, 2, enum_value_name, enum_value, 0);
|
188
|
-
rb_hash_aset(rb_iv_get(enum_singleton_klass, __iv_enum_klass_values), enum_value_num, enum_value);
|
189
|
-
rb_hash_aset(rb_iv_get(enum_singleton_klass, __iv_enum_klass_values_by_name), rb_to_symbol(enum_value_name), enum_value);
|
190
|
-
}
|
191
|
-
rb_hash_aset(rb_iv_get(cEnum_Singleton, __iv_Enum_sc_enums), enum_name, enum_klass);
|
192
|
-
return enum_klass;
|
193
|
-
}
|
194
|
-
|
195
151
|
static void wx_setup_Enum_singleton_class()
|
196
152
|
{
|
197
153
|
cEnum_Singleton = rb_funcall(cWxEnum, rb_intern("singleton_class"), 0, 0);
|
198
154
|
rb_iv_set(cEnum_Singleton, __iv_Enum_sc_enums, rb_hash_new());
|
199
|
-
rb_define_method(cEnum_Singleton, "create", VALUEFUNC(wx_Enum_sc_create_enum_class), -1);
|
200
|
-
rb_define_singleton_method(cWxEnum, "[]", VALUEFUNC(wx_Enum_sc_get_enum_class), -1);
|
201
155
|
}
|
202
156
|
|
203
157
|
static void wx_define_Enum_class()
|
@@ -223,44 +177,11 @@ WXRB_EXPORT_FLAG VALUE wxRuby_GetEnumClass(const char* enum_class_name_cstr)
|
|
223
177
|
return rb_hash_aref(enum_hash, rb_str_new2(enum_class_name_cstr));
|
224
178
|
}
|
225
179
|
|
226
|
-
static VALUE wx_Enum_sc_get_enum_value(int argc, VALUE *argv, VALUE self)
|
227
|
-
{
|
228
|
-
if ((argc < 1) || (argc > 1))
|
229
|
-
{
|
230
|
-
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)", argc); return Qnil;
|
231
|
-
}
|
232
|
-
VALUE enum_singleton_klass = rb_funcall(self, rb_intern("singleton_class"), 0, 0);
|
233
|
-
return rb_hash_aref(rb_iv_get(enum_singleton_klass, __iv_enum_klass_values_by_name), rb_to_symbol(argv[0]));
|
234
|
-
}
|
235
|
-
|
236
|
-
static VALUE wx_Enum_sc_get_enum_values(VALUE self)
|
237
|
-
{
|
238
|
-
VALUE enum_singleton_klass = rb_funcall(self, rb_intern("singleton_class"), 0, 0);
|
239
|
-
return rb_iv_get(enum_singleton_klass, __iv_enum_klass_values);
|
240
|
-
}
|
241
|
-
|
242
|
-
static VALUE wx_Enum_sc_get_enum_values_by_name(VALUE self)
|
243
|
-
{
|
244
|
-
VALUE enum_singleton_klass = rb_funcall(self, rb_intern("singleton_class"), 0, 0);
|
245
|
-
return rb_iv_get(enum_singleton_klass, __iv_enum_klass_values_by_name);
|
246
|
-
}
|
247
|
-
|
248
|
-
static VALUE wx_Enum_sc_get_enum_names_by_value(VALUE self)
|
249
|
-
{
|
250
|
-
VALUE enum_singleton_klass = rb_funcall(self, rb_intern("singleton_class"), 0, 0);
|
251
|
-
return rb_funcall(rb_iv_get(enum_singleton_klass, __iv_enum_klass_values_by_name), rb_intern("invert"), 0);
|
252
|
-
}
|
253
|
-
|
254
180
|
WXRB_EXPORT_FLAG VALUE wxRuby_CreateEnumClass(const char* enum_class_name_cstr)
|
255
181
|
{
|
256
182
|
VALUE enum_klass = rb_funcall(rb_cClass, rb_intern("new"), 1, cWxEnum, 0);
|
257
|
-
rb_define_singleton_method(enum_klass, "[]", VALUEFUNC(wx_Enum_sc_get_enum_value), -1);
|
258
|
-
rb_define_singleton_method(enum_klass, "values", VALUEFUNC(wx_Enum_sc_get_enum_values), 0);
|
259
|
-
rb_define_singleton_method(enum_klass, "values_by_name", VALUEFUNC(wx_Enum_sc_get_enum_values_by_name), 0);
|
260
|
-
rb_define_singleton_method(enum_klass, "names_by_value", VALUEFUNC(wx_Enum_sc_get_enum_names_by_value), 0);
|
261
183
|
VALUE enum_singleton_klass = rb_funcall(enum_klass, rb_intern("singleton_class"), 0, 0);
|
262
184
|
rb_iv_set(enum_singleton_klass, __iv_enum_klass_values, rb_hash_new());
|
263
|
-
rb_iv_set(enum_singleton_klass, __iv_enum_klass_values_by_name, rb_hash_new());
|
264
185
|
rb_iv_set(enum_singleton_klass, __iv_enum_klass_name, rb_str_new2(enum_class_name_cstr));
|
265
186
|
rb_hash_aset(rb_iv_get(cEnum_Singleton, __iv_Enum_sc_enums),
|
266
187
|
ID2SYM(rb_intern(enum_class_name_cstr)),
|
@@ -274,7 +195,6 @@ WXRB_EXPORT_FLAG VALUE wxRuby_AddEnumValue(VALUE enum_klass, const char* enum_va
|
|
274
195
|
VALUE enum_value = rb_funcall(enum_klass, rb_intern("new"), 1, enum_value_num, 0);
|
275
196
|
VALUE enum_singleton_klass = rb_funcall(enum_klass, rb_intern("singleton_class"), 0, 0);
|
276
197
|
rb_hash_aset(rb_iv_get(enum_singleton_klass, __iv_enum_klass_values), enum_value_num, enum_value);
|
277
|
-
rb_hash_aset(rb_iv_get(enum_singleton_klass, __iv_enum_klass_values_by_name), enum_value_name, enum_value);
|
278
198
|
rb_funcall(enum_klass, rb_intern("const_set"), 2, enum_value_name, enum_value, 0);
|
279
199
|
return enum_value;
|
280
200
|
}
|
@@ -14,36 +14,20 @@ typedef VALUE (*RUBY_INVOKE_FUNC) (VALUE);
|
|
14
14
|
VALUE rb_exc_set_backtrace(VALUE, VALUE);
|
15
15
|
VALUE rb_get_backtrace(VALUE);
|
16
16
|
|
17
|
-
|
18
|
-
{
|
19
|
-
class WXRB_EXPORT_FLAG DirectorRubyException : public DirectorException
|
20
|
-
{
|
21
|
-
public:
|
22
|
-
DirectorRubyException(VALUE error, VALUE rcvr, ID fn_id)
|
23
|
-
: DirectorException(Qnil)
|
24
|
-
{
|
25
|
-
VALUE msg = rb_sprintf("Caught exception in SWIG director method for %s#%s : ", rb_class2name(CLASS_OF(rcvr)), rb_id2name(fn_id));
|
26
|
-
rb_str_append(msg, rb_funcall(error, rb_intern("message"), 0));
|
27
|
-
this->swig_msg = StringValuePtr(msg);
|
28
|
-
swig_error = rb_exc_new_str(rb_eRuntimeError, msg);
|
29
|
-
VALUE bt = rb_funcall(error, rb_intern("backtrace"), 0);
|
30
|
-
rb_funcall(swig_error, rb_intern("set_backtrace"), 1, bt);
|
31
|
-
}
|
32
|
-
};
|
33
|
-
}
|
17
|
+
WXRB_EXPORT_FLAG void wxRuby_PrintException(VALUE err);
|
34
18
|
|
35
19
|
class WXRuby_RBFuncall
|
36
20
|
{
|
37
21
|
public:
|
38
|
-
WXRuby_RBFuncall (ID fnid, bool
|
22
|
+
WXRuby_RBFuncall (ID fnid, bool exit_on_ex=true)
|
39
23
|
: fn_id_ (fnid),
|
40
|
-
|
24
|
+
exit_on_ex_ (exit_on_ex),
|
41
25
|
ex_caught_ (false)
|
42
26
|
{
|
43
27
|
}
|
44
|
-
WXRuby_RBFuncall (const char* fn, bool
|
28
|
+
WXRuby_RBFuncall (const char* fn, bool exit_on_ex=true)
|
45
29
|
: fn_id_ (rb_intern (fn)),
|
46
|
-
|
30
|
+
exit_on_ex_ (exit_on_ex),
|
47
31
|
ex_caught_ (false)
|
48
32
|
{
|
49
33
|
}
|
@@ -89,11 +73,12 @@ protected:
|
|
89
73
|
&invoke_state);
|
90
74
|
if (invoke_state)
|
91
75
|
{
|
92
|
-
if (this->
|
76
|
+
if (this->exit_on_ex_)
|
93
77
|
{
|
94
78
|
// handle exception
|
95
79
|
VALUE rexc = this->get_exception ();
|
96
|
-
|
80
|
+
wxRuby_PrintException(rexc);
|
81
|
+
::exit(255);
|
97
82
|
}
|
98
83
|
else
|
99
84
|
{
|
@@ -158,7 +143,7 @@ protected:
|
|
158
143
|
|
159
144
|
private:
|
160
145
|
ID fn_id_;
|
161
|
-
bool
|
146
|
+
bool exit_on_ex_;
|
162
147
|
bool ex_caught_;
|
163
148
|
};
|
164
149
|
|
@@ -188,23 +188,23 @@ namespace Swig
|
|
188
188
|
|
189
189
|
DirectorTypeMismatchException(VALUE self, const char *method, VALUE error, const char *msg="");
|
190
190
|
|
191
|
-
static
|
192
|
-
{
|
193
|
-
throw DirectorTypeMismatchException(error, msg);
|
194
|
-
}
|
191
|
+
static void raise(VALUE error, const char *msg);
|
195
192
|
|
196
|
-
static
|
197
|
-
{
|
198
|
-
throw DirectorTypeMismatchException(msg);
|
199
|
-
}
|
193
|
+
static void raise(const char *msg);
|
200
194
|
|
201
|
-
static
|
195
|
+
static void raise(VALUE self, const char* method, VALUE error, const char *msg);
|
196
|
+
|
197
|
+
private:
|
198
|
+
static void print(const DirectorTypeMismatchException& ex)
|
202
199
|
{
|
203
|
-
|
200
|
+
VALUE bt = rb_eval_string("caller");
|
201
|
+
bt = rb_funcall(bt, rb_intern("join"), 1, rb_str_new2("\n\tfrom "));
|
202
|
+
std::cerr << std::endl
|
203
|
+
<< ' ' << ex.getMessage() << '(' << rb_class2name(ex.getType()) << ')' << std::endl
|
204
|
+
<< "\tfrom " << StringValuePtr(bt) << std::endl << std::endl;
|
204
205
|
}
|
205
206
|
};
|
206
207
|
|
207
|
-
|
208
208
|
DirectorTypeMismatchException::DirectorTypeMismatchException(VALUE self, const char *method, VALUE error, const char *msg)
|
209
209
|
: DirectorException(Qnil)
|
210
210
|
{
|
@@ -217,6 +217,24 @@ namespace Swig
|
|
217
217
|
this->setup_error(rb_eTypeError);
|
218
218
|
}
|
219
219
|
|
220
|
+
void DirectorTypeMismatchException::raise(VALUE error, const char *msg)
|
221
|
+
{
|
222
|
+
print(DirectorTypeMismatchException(error, msg));
|
223
|
+
::exit(254);
|
224
|
+
}
|
225
|
+
|
226
|
+
void DirectorTypeMismatchException::raise(const char *msg)
|
227
|
+
{
|
228
|
+
print(DirectorTypeMismatchException(msg));
|
229
|
+
::exit(254);
|
230
|
+
}
|
231
|
+
|
232
|
+
void DirectorTypeMismatchException::raise(VALUE self, const char* method, VALUE error, const char *msg)
|
233
|
+
{
|
234
|
+
print(DirectorTypeMismatchException(self, method, error, msg));
|
235
|
+
::exit(254);
|
236
|
+
}
|
237
|
+
|
220
238
|
/* Any Ruby exception that occurs during a director method call */
|
221
239
|
class WXRB_EXPORT_FLAG DirectorMethodException : public DirectorException
|
222
240
|
{
|
@@ -18,6 +18,9 @@ module WXRuby3
|
|
18
18
|
|
19
19
|
def setup
|
20
20
|
super
|
21
|
+
spec.items << 'wxGenericAnimationCtrl'
|
22
|
+
spec.include 'wx/animate.h'
|
23
|
+
spec.include 'wx/generic/animate.h'
|
21
24
|
if Config.instance.wx_version >= '3.3.0'
|
22
25
|
spec.items << 'wxAnimationBundle'
|
23
26
|
spec.ignore 'wxAnimationBundle::GetAll', ignore_doc: false
|
@@ -37,7 +40,15 @@ module WXRuby3
|
|
37
40
|
spec.map 'const std::vector<wxAnimation>&' => 'Array<Wx::Animation>', swig: false do
|
38
41
|
map_out code: ''
|
39
42
|
end
|
43
|
+
# adjust documentation for #set_animation argument
|
44
|
+
spec.map 'const wxAnimationBundle &animations', as: 'Wx::AnimationBundle,Wx::Animation', swig: false do
|
45
|
+
map_in code: ''
|
46
|
+
end
|
40
47
|
end
|
48
|
+
# replace method signature by one that provides a default argument to correctly provide
|
49
|
+
# the two overloads the Ruby way
|
50
|
+
spec.ignore 'wxGenericAnimationCtrl::Play'
|
51
|
+
spec.extend_interface 'wxGenericAnimationCtrl', 'bool Play(bool looped=true)'
|
41
52
|
spec.do_not_generate :variables, :enums, :defines, :functions
|
42
53
|
end
|
43
54
|
end # class AnimationCtrl
|
@@ -144,13 +144,6 @@ module WXRuby3
|
|
144
144
|
when 'wxMultiChoiceDialog'
|
145
145
|
# unnneeded and unwanted for Ruby
|
146
146
|
spec.ignore 'wxMultiChoiceDialog::wxMultiChoiceDialog(wxWindow *,const wxString &,const wxString &,int,const wxString *,long,const wxPoint &)'
|
147
|
-
# Wx's MultiChoiceDialog offers the possibility of attaching client
|
148
|
-
# data to each choice. However this would need memory management, and a
|
149
|
-
# pure ruby implementation is trivial and likely to be more convenient
|
150
|
-
# on a per-case basis so just ignore this argument for Ruby.
|
151
|
-
spec.map 'char** clientData' do
|
152
|
-
map_in ignore: true, code: '$1 = (char **)NULL;'
|
153
|
-
end
|
154
147
|
spec.do_not_generate(:functions, :enums, :defines)
|
155
148
|
when 'wxDirDialog'
|
156
149
|
when 'wxProgressDialog'
|
@@ -227,6 +220,21 @@ module WXRuby3
|
|
227
220
|
'wxWizard::GetCurrentPage',
|
228
221
|
'wxWizard::GetPageAreaSizer')
|
229
222
|
spec.do_not_generate(:variables, :enums, :defines, :functions)
|
223
|
+
when 'wxCredentialEntryDialog'
|
224
|
+
spec.items << 'wxWebCredentials'
|
225
|
+
spec.do_not_generate(:functions, :enums, :defines)
|
226
|
+
when 'wxGenericAboutDialog'
|
227
|
+
# inheritance chain missing from wxw docs
|
228
|
+
spec.override_inheritance_chain(spec.module_name, %w[wxDialog wxTopLevelWindow wxNonOwnedWindow wxWindow wxEvtHandler wxObject])
|
229
|
+
spec.gc_as_dialog(spec.module_name)
|
230
|
+
# regard protected methods
|
231
|
+
spec.regard 'wxGenericAboutDialog::DoAddCustomControls',
|
232
|
+
'wxGenericAboutDialog::AddControl',
|
233
|
+
'wxGenericAboutDialog::AddText',
|
234
|
+
'wxGenericAboutDialog::GetCustomControlParent'
|
235
|
+
if Config.instance.features_set?('USE_COLLPANE')
|
236
|
+
spec.regard 'wxGenericAboutDialog::AddCollapsiblePane'
|
237
|
+
end
|
230
238
|
end
|
231
239
|
end
|
232
240
|
|
@@ -17,9 +17,85 @@ module WXRuby3
|
|
17
17
|
def setup
|
18
18
|
super
|
19
19
|
spec.items << 'wxFileDialogCustomize'
|
20
|
-
spec.
|
20
|
+
spec.gc_as_object 'wxFileDialogCustomizeHook'
|
21
21
|
spec.gc_as_untracked 'wxFileDialogCustomize'
|
22
22
|
spec.make_abstract 'wxFileDialogCustomize'
|
23
|
+
spec.map_apply 'int n, const wxString* choices' => 'size_t n, const wxString *strings'
|
24
|
+
# make Ruby director and wrappers use custom implementation
|
25
|
+
spec.use_class_implementation('wxFileDialogCustomizeHook', 'wxRubyFileDialogCustomizeHook')
|
26
|
+
spec.make_concrete('wxFileDialogCustomizeHook')
|
27
|
+
# prevent director overload; custom impl handles this
|
28
|
+
spec.no_proxy 'wxFileDialogCustomizeHook::AddCustomControls',
|
29
|
+
'wxFileDialogCustomizeHook::UpdateCustomControls',
|
30
|
+
'wxFileDialogCustomizeHook::TransferDataFromCustomControls'
|
31
|
+
# do not wrap these
|
32
|
+
spec.ignore 'wxFileDialogCustomizeHook::AddCustomControls',
|
33
|
+
'wxFileDialogCustomizeHook::UpdateCustomControls',
|
34
|
+
'wxFileDialogCustomizeHook::TransferDataFromCustomControls',
|
35
|
+
ignore_doc: false
|
36
|
+
spec.add_header_code <<~__HEREDOC
|
37
|
+
class wxRubyFileDialogCustomizeHook : public wxFileDialogCustomizeHook
|
38
|
+
{
|
39
|
+
public:
|
40
|
+
wxRubyFileDialogCustomizeHook() : wxFileDialogCustomizeHook() {}
|
41
|
+
~wxRubyFileDialogCustomizeHook() {};
|
42
|
+
|
43
|
+
// from virtual void wxFileDialogCustomizeHook::AddCustomControls
|
44
|
+
virtual void AddCustomControls(wxFileDialogCustomize &customizer) override
|
45
|
+
{
|
46
|
+
VALUE obj0 = Qnil ;
|
47
|
+
VALUE SWIGUNUSED result;
|
48
|
+
|
49
|
+
obj0 = SWIG_NewPointerObj(SWIG_as_voidptr(&customizer), SWIGTYPE_p_wxFileDialogCustomize, 0 );
|
50
|
+
VALUE self = SWIG_RubyInstanceFor(this);
|
51
|
+
bool ex = false;
|
52
|
+
result = wxRuby_Funcall(ex, self, rb_intern("add_custom_controls"), 1,obj0);
|
53
|
+
if (ex)
|
54
|
+
{
|
55
|
+
wxRuby_PrintException(result);
|
56
|
+
}
|
57
|
+
}
|
58
|
+
|
59
|
+
// from virtual void wxFileDialogCustomizeHook::UpdateCustomControls
|
60
|
+
virtual void UpdateCustomControls() override
|
61
|
+
{
|
62
|
+
VALUE SWIGUNUSED result;
|
63
|
+
|
64
|
+
if (!this->finished_)
|
65
|
+
{
|
66
|
+
VALUE self = SWIG_RubyInstanceFor(this);
|
67
|
+
bool ex = false;
|
68
|
+
result = wxRuby_Funcall(ex, self, rb_intern("update_custom_controls"), 0, NULL);
|
69
|
+
if (ex)
|
70
|
+
{
|
71
|
+
wxRuby_PrintException(result);
|
72
|
+
}
|
73
|
+
}
|
74
|
+
}
|
75
|
+
|
76
|
+
// from virtual void wxFileDialogCustomizeHook::TransferDataFromCustomControls
|
77
|
+
virtual void TransferDataFromCustomControls() override
|
78
|
+
{
|
79
|
+
VALUE SWIGUNUSED result;
|
80
|
+
|
81
|
+
|
82
|
+
if (!this->finished_)
|
83
|
+
{
|
84
|
+
this->finished_ = true;
|
85
|
+
VALUE self = SWIG_RubyInstanceFor(this);
|
86
|
+
bool ex = false;
|
87
|
+
result = wxRuby_Funcall(ex, self, rb_intern("transfer_data_from_custom_controls"), 0, NULL);
|
88
|
+
if (ex)
|
89
|
+
{
|
90
|
+
wxRuby_PrintException(result);
|
91
|
+
}
|
92
|
+
}
|
93
|
+
}
|
94
|
+
|
95
|
+
private:
|
96
|
+
bool finished_ {};
|
97
|
+
};
|
98
|
+
__HEREDOC
|
23
99
|
end
|
24
100
|
end # class FileDialogCustomizeHook
|
25
101
|
|
@@ -208,18 +208,6 @@ module WXRuby3
|
|
208
208
|
wxWindow * wxGetActiveWindow();
|
209
209
|
|
210
210
|
// Dialog shortcuts
|
211
|
-
VOID_INT wxGetSelectedChoices(wxArrayInt& selections,
|
212
|
-
const wxString& message,
|
213
|
-
const wxString& caption,
|
214
|
-
int n, const wxString *choices,
|
215
|
-
wxWindow *parent = NULL,
|
216
|
-
int x = wxDefaultCoord,
|
217
|
-
int y = wxDefaultCoord,
|
218
|
-
bool centre = true,
|
219
|
-
int width = wxCHOICE_WIDTH,
|
220
|
-
int height = wxCHOICE_HEIGHT);
|
221
|
-
|
222
|
-
|
223
211
|
wxString wxFileSelector (const wxString &message,
|
224
212
|
const wxString &default_path=wxEmptyString,
|
225
213
|
const wxString &default_filename=wxEmptyString,
|
@@ -42,13 +42,8 @@ module WXRuby3
|
|
42
42
|
|
43
43
|
wxObject* wxRubyValidator::Clone() const
|
44
44
|
{
|
45
|
-
bool ex_caught = false;
|
46
45
|
VALUE self = const_cast<wxRubyValidator*> (this)->get_self();
|
47
|
-
VALUE rc = wxRuby_Funcall(
|
48
|
-
if (ex_caught)
|
49
|
-
{
|
50
|
-
throw Swig::DirectorRubyException(rc, self, clone_id());
|
51
|
-
}
|
46
|
+
VALUE rc = wxRuby_Funcall(self, clone_id(), 0);
|
52
47
|
void *ptr;
|
53
48
|
int res = SWIG_ConvertPtr(rc, &ptr, SWIGTYPE_p_wxValidator, 0);
|
54
49
|
if (!SWIG_IsOK(res))
|
@@ -77,22 +72,12 @@ module WXRuby3
|
|
77
72
|
|
78
73
|
VALUE wxRubyValidator::DoTransferFromWindow()
|
79
74
|
{
|
80
|
-
|
81
|
-
VALUE rc = wxRuby_Funcall(ex_caught, this->get_self(), do_transfer_from_window_id(), 0);
|
82
|
-
if (ex_caught)
|
83
|
-
{
|
84
|
-
throw Swig::DirectorRubyException(rc, this->get_self(), do_transfer_from_window_id());
|
85
|
-
}
|
75
|
+
VALUE rc = wxRuby_Funcall(this->get_self(), do_transfer_from_window_id(), 0);
|
86
76
|
return rc;
|
87
77
|
}
|
88
78
|
bool wxRubyValidator::DoTransferToWindow(VALUE data)
|
89
79
|
{
|
90
|
-
|
91
|
-
VALUE rc = wxRuby_Funcall(ex_caught, this->get_self(), do_transfer_to_window_id(), 1, data);
|
92
|
-
if (ex_caught)
|
93
|
-
{
|
94
|
-
throw Swig::DirectorRubyException(rc, this->get_self(), do_transfer_to_window_id());
|
95
|
-
}
|
80
|
+
VALUE rc = wxRuby_Funcall(this->get_self(), do_transfer_to_window_id(), 1, data);
|
96
81
|
return (rc == Qtrue);
|
97
82
|
}
|
98
83
|
|
@@ -111,22 +96,12 @@ module WXRuby3
|
|
111
96
|
|
112
97
|
bool wxRubyValidatorBinding::DoOnTransferFromWindow(VALUE data)
|
113
98
|
{
|
114
|
-
|
115
|
-
VALUE rc = wxRuby_Funcall(ex_caught, this->get_self(), do_on_transfer_from_window_id(), 1, data);
|
116
|
-
if (ex_caught)
|
117
|
-
{
|
118
|
-
throw Swig::DirectorRubyException(rc, this->get_self(), do_on_transfer_from_window_id());
|
119
|
-
}
|
99
|
+
VALUE rc = wxRuby_Funcall(this->get_self(), do_on_transfer_from_window_id(), 1, data);
|
120
100
|
return (rc == Qtrue);
|
121
101
|
}
|
122
102
|
VALUE wxRubyValidatorBinding::DoOnTransferToWindow()
|
123
103
|
{
|
124
|
-
|
125
|
-
VALUE rc = wxRuby_Funcall(ex_caught, this->get_self(), do_on_transfer_to_window_id(), 0);
|
126
|
-
if (ex_caught)
|
127
|
-
{
|
128
|
-
throw Swig::DirectorRubyException(rc, this->get_self(), do_on_transfer_to_window_id());
|
129
|
-
}
|
104
|
+
VALUE rc = wxRuby_Funcall(this->get_self(), do_on_transfer_to_window_id(), 0);
|
130
105
|
return rc;
|
131
106
|
}
|
132
107
|
|
@@ -134,12 +109,7 @@ module WXRuby3
|
|
134
109
|
{
|
135
110
|
if (!NIL_P(this->on_transfer_from_win_proc_))
|
136
111
|
{
|
137
|
-
|
138
|
-
VALUE rc = wxRuby_Funcall(ex_caught, this->on_transfer_from_win_proc_, call_id(), 1, data);
|
139
|
-
if (ex_caught)
|
140
|
-
{
|
141
|
-
throw Swig::DirectorRubyException(rc, this->on_transfer_from_win_proc_, call_id());
|
142
|
-
}
|
112
|
+
wxRuby_Funcall(this->on_transfer_from_win_proc_, call_id(), 1, data);
|
143
113
|
}
|
144
114
|
return true;
|
145
115
|
}
|
@@ -147,12 +117,7 @@ module WXRuby3
|
|
147
117
|
{
|
148
118
|
if (!NIL_P(this->on_transfer_to_win_proc_))
|
149
119
|
{
|
150
|
-
|
151
|
-
VALUE rc = wxRuby_Funcall(ex_caught, this->on_transfer_to_win_proc_, call_id(), 0);
|
152
|
-
if (ex_caught)
|
153
|
-
{
|
154
|
-
throw Swig::DirectorRubyException(rc, this->on_transfer_to_win_proc_, call_id());
|
155
|
-
}
|
120
|
+
VALUE rc = wxRuby_Funcall(this->on_transfer_to_win_proc_, call_id(), 0);
|
156
121
|
return rc;
|
157
122
|
}
|
158
123
|
return Qnil;
|