wxruby3 1.2.1 → 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/event.rb +7 -0
- data/lib/wx/core/file_dialog.rb +25 -0
- 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/colour.rb +12 -0
- 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 +7 -0
- data/lib/wx/version.rb +1 -1
- data/rakelib/lib/config.rb +1 -1
- 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 +6 -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 +13 -9
- 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 +11 -2
@@ -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
|
{
|
@@ -40,7 +40,13 @@ module WXRuby3
|
|
40
40
|
spec.map 'const std::vector<wxAnimation>&' => 'Array<Wx::Animation>', swig: false do
|
41
41
|
map_out code: ''
|
42
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
|
43
47
|
end
|
48
|
+
# replace method signature by one that provides a default argument to correctly provide
|
49
|
+
# the two overloads the Ruby way
|
44
50
|
spec.ignore 'wxGenericAnimationCtrl::Play'
|
45
51
|
spec.extend_interface 'wxGenericAnimationCtrl', 'bool Play(bool looped=true)'
|
46
52
|
spec.do_not_generate :variables, :enums, :defines, :functions
|
@@ -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;
|
@@ -0,0 +1,46 @@
|
|
1
|
+
---
|
2
|
+
:wxGenericAboutDialog:
|
3
|
+
:detail:
|
4
|
+
:pre:
|
5
|
+
:programlisting:
|
6
|
+
- :pattern: !ruby/regexp /.*/
|
7
|
+
:replace: |
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
class MyFrame < Wx::Frame
|
11
|
+
|
12
|
+
# declare custom about dialog class
|
13
|
+
class MyAboutDlg < Wx::GenericAboutDialog
|
14
|
+
|
15
|
+
def initialize(about_info, parent=nil)
|
16
|
+
super()
|
17
|
+
|
18
|
+
create(about_info, parent)
|
19
|
+
end
|
20
|
+
|
21
|
+
def do_add_custom_controls
|
22
|
+
# add custom controls ...
|
23
|
+
end
|
24
|
+
protected :do_add_custom_controls
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
# fill in MyFrame class ...
|
29
|
+
|
30
|
+
# handler for an About menu/button
|
31
|
+
def on_about(_evt)
|
32
|
+
aboutInfo = Wx::AboutDialogInfo.new
|
33
|
+
|
34
|
+
aboutInfo.set_name('MyApp')
|
35
|
+
aboutInfo.set_version(MY_APP_VERSION_STRING)
|
36
|
+
aboutInfo.set_description('My wxWidgets-based application!')
|
37
|
+
aboutInfo.set_copyright('(C) 1992-2024')
|
38
|
+
aboutInfo.set_web_site('http://myapp.org')
|
39
|
+
aboutInfo.add_developer('My Self')
|
40
|
+
|
41
|
+
MyFrame.MyAboutDlg(aboutInfo, self) do |dlgAbout|
|
42
|
+
dlgAbout.show_modal
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
```
|
@@ -237,6 +237,8 @@ module WXRuby3
|
|
237
237
|
Director.Spec(pkg, 'wxDCOverlay', director: Director::DerivedDC)
|
238
238
|
Director.Spec(pkg, 'wxGeometry', requirements: %w[USE_GEOMETRY])
|
239
239
|
Director.Spec(pkg, 'wxAffineMatrix2D', requirements: %w[USE_GEOMETRY])
|
240
|
+
Director.Spec(pkg, 'wxCredentialEntryDialog', director: Director::Dialog, requirements: %w[USE_CREDENTIALDLG])
|
241
|
+
Director.Spec(pkg, 'wxGenericAboutDialog', director: Director::Dialog, requirements: %w[USE_ABOUTDLG])
|
240
242
|
}
|
241
243
|
|
242
244
|
Director.Package('Wx::PRT', 'USE_PRINTING_ARCHITECTURE') do |pkg|
|
data/rakelib/lib/swig_runner.rb
CHANGED
@@ -726,20 +726,23 @@ module WXRuby3
|
|
726
726
|
elsif wrapper_re =~ line
|
727
727
|
class_nm = $1
|
728
728
|
mtd_nm = $2
|
729
|
+
if /(\w+)__SWIG_.+/ =~ mtd_nm # in case of method overloads
|
730
|
+
mtd_nm = $1
|
731
|
+
end
|
729
732
|
at_wrapper = true
|
730
733
|
if (mdef = member_map[class_nm].detect { |m| Extractor::MethodDef === m && (m.rb_name || m.name) == mtd_nm })
|
731
734
|
matched_wrapper = true
|
732
735
|
mtd_call_re = /(\s*)\S.*arg1\)?->#{mtd_nm}(\(.*\));/
|
733
|
-
line = [line, ' bool fpa_upcall = false;', ' Swig::Director
|
736
|
+
line = [line, ' bool SWIGUNUSED fpa_upcall = false;', ' Swig::Director* SWIGUNUSED fpa_dir = 0;']
|
734
737
|
elsif (mdef = member_map[class_nm].detect { |m| Extractor::MemberVarDef === m && "#{m.rb_name || m.name}_get" == mtd_nm })
|
735
738
|
matched_wrapper = true
|
736
739
|
mtd_call_re = /(\s*)\S.*arg1\)?->#{mdef.name}\)?;/
|
737
|
-
line = [line, ' bool fpa_upcall = false;', ' Swig::Director
|
740
|
+
line = [line, ' bool SWIGUNUSED fpa_upcall = false;', ' Swig::Director* SWIGUNUSED fpa_dir = 0;']
|
738
741
|
elsif (mdef = member_map[class_nm].detect { |m| Extractor::MemberVarDef === m && "#{m.rb_name || m.name}_set" == mtd_nm })
|
739
742
|
matched_wrapper = true
|
740
743
|
at_setter = true;
|
741
744
|
mtd_call_re = /(\s*)\S.*arg1\)?->#{mdef.name}(\s*=\s*.*);/
|
742
|
-
line = [line, ' bool fpa_upcall = false;', ' Swig::Director
|
745
|
+
line = [line, ' bool SWIGUNUSED fpa_upcall = false;', ' Swig::Director* SWIGUNUSED fpa_dir = 0;']
|
743
746
|
end
|
744
747
|
elsif /rb_define_method\(SwigClassWx(#{cls_re_txt}).klass\s*,\s*"(\w+)(=)?"\s*,\s*VALUEFUNC/ =~ line
|
745
748
|
class_nm = $1
|
data/rakelib/lib/util/string.rb
CHANGED
@@ -107,9 +107,10 @@ module WXRuby3
|
|
107
107
|
end
|
108
108
|
|
109
109
|
def rb_constant_expression(exp, const_xref)
|
110
|
-
exp.gsub(/(\w+(::\w+)*)(\s*\()?/) do |s|
|
110
|
+
exp.gsub(/(\w+(::\w+)*)(\s*\((\))?)?/) do |s|
|
111
111
|
idstr = $1
|
112
|
-
|
112
|
+
call_bracket = $3
|
113
|
+
is_empty_call = !!$4
|
113
114
|
is_scoped = false
|
114
115
|
ids = idstr.split('::')
|
115
116
|
if ids.size > 1
|
@@ -120,18 +121,18 @@ module WXRuby3
|
|
120
121
|
end
|
121
122
|
end
|
122
123
|
idstr = ids.shift
|
123
|
-
if
|
124
|
+
if call_bracket
|
124
125
|
# object ctor or static method call
|
125
126
|
if is_scoped
|
126
127
|
# static method
|
127
|
-
"#{scoped_name}.#{rb_method_name(idstr)}
|
128
|
+
"#{scoped_name}.#{rb_method_name(idstr)}#{call_bracket}"
|
128
129
|
else
|
129
130
|
# ctor
|
130
131
|
case idstr
|
131
132
|
when 'wxString'
|
132
|
-
'
|
133
|
+
is_empty_call ? "''" : call_bracket
|
133
134
|
else
|
134
|
-
"#{idstr.start_with?('wx') ? 'Wx::' : ''}#{rb_wx_name(idstr)}.new
|
135
|
+
"#{idstr.start_with?('wx') ? 'Wx::' : ''}#{rb_wx_name(idstr)}.new#{call_bracket}"
|
135
136
|
end
|
136
137
|
end
|
137
138
|
else
|
data/samples/animate/anitest.rb
CHANGED
@@ -81,16 +81,20 @@ module AniTest
|
|
81
81
|
|
82
82
|
@animation_ctrl = Wx::AnimationCtrl.new(self, Wx::ID_ANY)
|
83
83
|
|
84
|
-
|
84
|
+
if Wx::WXWIDGETS_VERSION >= '3.3.0'
|
85
|
+
animations = Wx::AnimationBundle.new
|
85
86
|
|
86
|
-
|
87
|
-
|
87
|
+
throbber = Wx::Animation.new(File.join(__dir__, 'throbber.gif'))
|
88
|
+
animations.add(throbber) if throbber.ok?
|
88
89
|
|
89
|
-
|
90
|
-
|
90
|
+
throbber2x = Wx::Animation.new(File.join(__dir__, 'throbber_2x.gif'))
|
91
|
+
animations.add(throbber2x) if throbber2x.ok?
|
91
92
|
|
92
|
-
|
93
|
-
|
93
|
+
if animations.ok?
|
94
|
+
@animation_ctrl.set_animation(animations)
|
95
|
+
@animation_ctrl.play
|
96
|
+
end
|
97
|
+
elsif @animation_ctrl.load('throbber.gif')
|
94
98
|
@animation_ctrl.play
|
95
99
|
end
|
96
100
|
|
@@ -137,7 +141,7 @@ module AniTest
|
|
137
141
|
end
|
138
142
|
|
139
143
|
def on_set_null_animation(_event)
|
140
|
-
@animation_ctrl.set_animation(Wx::
|
144
|
+
@animation_ctrl.set_animation(Wx::NULL_ANIMATION)
|
141
145
|
end
|
142
146
|
|
143
147
|
def on_set_inactive_bitmap(event)
|
@@ -195,7 +199,7 @@ module AniTest
|
|
195
199
|
return
|
196
200
|
end
|
197
201
|
|
198
|
-
@animation_ctrl.set_animation(
|
202
|
+
@animation_ctrl.set_animation(temp)
|
199
203
|
@animation_ctrl.play
|
200
204
|
|
201
205
|
get_sizer.layout
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# Copyright (c) 2023 M.J.N. Corino, The Netherlands
|
2
|
+
#
|
3
|
+
# This software is released under the MIT license.
|
4
|
+
|
5
|
+
require_relative './wxframe_runner'
|
6
|
+
|
7
|
+
class DirectorOverloadExceptionTests < WxRuby::Test::GUITests
|
8
|
+
|
9
|
+
class ExceptionSizer < Wx::BoxSizer
|
10
|
+
|
11
|
+
def calc_min
|
12
|
+
raise RuntimeError, 'AnyThing'
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_exception_in_overload
|
18
|
+
szr = ExceptionSizer.new(Wx::Orientation::VERTICAL)
|
19
|
+
szr.add(Wx::Button.new(frame_win, name: 'button'), Wx::Direction::TOP)
|
20
|
+
frame_win.sizer = szr
|
21
|
+
frame_win.layout
|
22
|
+
frame_win.sizer = nil
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# Copyright (c) 2023 M.J.N. Corino, The Netherlands
|
2
|
+
#
|
3
|
+
# This software is released under the MIT license.
|
4
|
+
|
5
|
+
require_relative './wxapp_runner'
|
6
|
+
|
7
|
+
class ProcessEventHandlingExceptionTests < Test::Unit::TestCase
|
8
|
+
|
9
|
+
class TestEvent < Wx::Event
|
10
|
+
EVT_TEST_EVENT = Wx::EvtHandler.register_class(self, nil, 'evt_test_event', 0)
|
11
|
+
def initialize(id=0)
|
12
|
+
super(EVT_TEST_EVENT, id)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
class TestFrame < Wx::Frame
|
17
|
+
|
18
|
+
def initialize
|
19
|
+
super(nil, size: [300,300])
|
20
|
+
|
21
|
+
evt_test_event { |_evt| raise RuntimeError, 'Whatever' }
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_process_event
|
27
|
+
win = TestFrame.new
|
28
|
+
win.process_event(TestEvent.new)
|
29
|
+
win.destroy
|
30
|
+
10.times { Wx.get_app.yield }
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# Copyright (c) 2023 M.J.N. Corino, The Netherlands
|
2
|
+
#
|
3
|
+
# This software is released under the MIT license.
|
4
|
+
|
5
|
+
require_relative './wxapp_runner'
|
6
|
+
|
7
|
+
class QueuedEventHandlingExceptionTests < Test::Unit::TestCase
|
8
|
+
|
9
|
+
class TestEvent < Wx::Event
|
10
|
+
EVT_TEST_EVENT = Wx::EvtHandler.register_class(self, nil, 'evt_test_event', 0)
|
11
|
+
def initialize(id=0)
|
12
|
+
super(EVT_TEST_EVENT, id)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
class TestFrame < Wx::Frame
|
17
|
+
|
18
|
+
def initialize
|
19
|
+
super(nil, size: [300,300])
|
20
|
+
|
21
|
+
evt_test_event { |_evt| raise RuntimeError, 'Whatever' }
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_queue_event
|
27
|
+
win = TestFrame.new
|
28
|
+
win.queue_event(TestEvent.new)
|
29
|
+
Wx.get_app.yield
|
30
|
+
win.destroy
|
31
|
+
10.times { Wx.get_app.yield }
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|