wxruby3 1.2.1 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/wxruby3/swig/custom/director.swg +16 -22
- data/ext/wxruby3/swig/custom/rubyapi.swg +15 -1
- data/lib/wx/aui/auimanager.rb +61 -14
- data/lib/wx/core/animation.rb +35 -14
- data/lib/wx/core/array_ext.rb +1 -0
- data/lib/wx/core/brush.rb +8 -0
- data/lib/wx/core/choicedlg.rb +7 -10
- data/lib/wx/core/colour.rb +10 -0
- data/lib/wx/core/defs.rb +49 -0
- data/lib/wx/core/dialog.rb +2 -2
- data/lib/wx/core/enum.rb +16 -3
- data/lib/wx/core/event.rb +7 -0
- data/lib/wx/core/file_dialog.rb +25 -0
- data/lib/wx/core/font.rb +14 -0
- data/lib/wx/core/gdi_object.rb +24 -0
- data/lib/wx/core/hboxsizer.rb +24 -4
- data/lib/wx/core/object.rb +26 -11
- data/lib/wx/core/pen.rb +20 -0
- data/lib/wx/core/real_point.rb +1 -0
- data/lib/wx/core/sizer.rb +166 -39
- data/lib/wx/core/variant.rb +108 -51
- data/lib/wx/core/vboxsizer.rb +24 -4
- data/lib/wx/doc/array_ext.rb +1 -0
- data/lib/wx/doc/aui/auimanager.rb +2 -0
- data/lib/wx/doc/colour.rb +12 -0
- data/lib/wx/doc/enum.rb +26 -0
- data/lib/wx/doc/evthandler.rb +6 -0
- data/lib/wx/doc/functions.rb +35 -3
- data/lib/wx/doc/gdi_common.rb +1 -0
- 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/core/include/swigrubyrun.inc +2 -2
- data/rakelib/lib/director/animation_ctrl.rb +6 -0
- data/rakelib/lib/director/aui_manager.rb +118 -3
- data/rakelib/lib/director/defs.rb +3 -0
- data/rakelib/lib/director/dialog.rb +17 -7
- data/rakelib/lib/director/file_dialog_customize_hook.rb +77 -1
- data/rakelib/lib/director/functions.rb +0 -12
- data/rakelib/lib/director/pgproperties.rb +2 -2
- data/rakelib/lib/director/property_grid_interface.rb +4 -3
- data/rakelib/lib/director/textctrl.rb +7 -0
- data/rakelib/lib/director/validator.rb +7 -42
- data/rakelib/lib/director/variant.rb +2 -2
- data/rakelib/lib/extractor/function.rb +5 -0
- 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/typemap/common.rb +2 -2
- data/rakelib/lib/util/string.rb +7 -6
- data/samples/animate/anitest.rb +13 -9
- data/samples/dialogs/dialogs.rb +1 -1
- 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 +13 -3
@@ -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
|
{
|
@@ -59,9 +59,9 @@ extern "C" {
|
|
59
59
|
#endif
|
60
60
|
|
61
61
|
WXRB_EXPORT_FLAG VALUE
|
62
|
-
|
62
|
+
SWIG_wxRuby_AppendOutput(VALUE target, VALUE o, int is_void)
|
63
63
|
{
|
64
|
-
if (NIL_P(target))
|
64
|
+
if (NIL_P(target) && is_void != 0)
|
65
65
|
{
|
66
66
|
target = o;
|
67
67
|
}
|
@@ -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
|
@@ -16,7 +16,98 @@ module WXRuby3
|
|
16
16
|
|
17
17
|
def setup
|
18
18
|
super
|
19
|
-
spec.gc_as_object
|
19
|
+
spec.gc_as_object 'wxAuiManager'
|
20
|
+
if Config.instance.wx_version >= '3.3.0'
|
21
|
+
spec.items << 'wxAuiSerializer' << 'wxAuiDockInfo' << 'wxAuiDeserializer'
|
22
|
+
spec.gc_as_untracked 'wxAuiSerializer', 'wxAuiDockInfo'
|
23
|
+
spec.regard 'wxAuiDockInfo::rect',
|
24
|
+
'wxAuiDockInfo::dock_direction',
|
25
|
+
'wxAuiDockInfo::dock_layer',
|
26
|
+
'wxAuiDockInfo::dock_row',
|
27
|
+
'wxAuiDockInfo::size',
|
28
|
+
'wxAuiDockInfo::min_size',
|
29
|
+
'wxAuiDockInfo::resizable',
|
30
|
+
'wxAuiDockInfo::toolbar',
|
31
|
+
'wxAuiDockInfo::fixed',
|
32
|
+
'wxAuiDockInfo::reserved1'
|
33
|
+
spec.make_readonly 'wxAuiDockInfo::rect',
|
34
|
+
'wxAuiDockInfo::dock_direction',
|
35
|
+
'wxAuiDockInfo::dock_layer',
|
36
|
+
'wxAuiDockInfo::dock_row',
|
37
|
+
'wxAuiDockInfo::size',
|
38
|
+
'wxAuiDockInfo::min_size',
|
39
|
+
'wxAuiDockInfo::resizable',
|
40
|
+
'wxAuiDockInfo::toolbar',
|
41
|
+
'wxAuiDockInfo::fixed',
|
42
|
+
'wxAuiDockInfo::reserved1'
|
43
|
+
spec.add_extend_code 'wxAuiDockInfo', <<~__HEREDOC
|
44
|
+
VALUE each_pane()
|
45
|
+
{
|
46
|
+
wxAuiPaneInfoPtrArray panes = self->panes;
|
47
|
+
VALUE rc = Qnil;
|
48
|
+
for (wxAuiPaneInfo* pane : panes)
|
49
|
+
{
|
50
|
+
VALUE r_pane = SWIG_NewPointerObj(pane, SWIGTYPE_p_wxAuiPaneInfo, 0);
|
51
|
+
rc = rb_yield(r_pane);
|
52
|
+
}
|
53
|
+
return rc;
|
54
|
+
}
|
55
|
+
__HEREDOC
|
56
|
+
spec.map 'std::vector<wxAuiPaneInfo>' => 'Array<Wx::AuiPaneInfo>' do
|
57
|
+
map_out code: <<~__CODE
|
58
|
+
$result = rb_ary_new();
|
59
|
+
std::vector<wxAuiPaneInfo>& panes = (std::vector<wxAuiPaneInfo>&)$1;
|
60
|
+
for (const wxAuiPaneInfo& pane : panes)
|
61
|
+
{
|
62
|
+
VALUE r_pane = SWIG_NewPointerObj(new wxAuiPaneInfo(pane), SWIGTYPE_p_wxAuiPaneInfo, SWIG_POINTER_OWN);
|
63
|
+
rb_ary_push($result, r_pane);
|
64
|
+
}
|
65
|
+
__CODE
|
66
|
+
map_directorout code: <<~__CODE
|
67
|
+
if (TYPE($input) == T_ARRAY)
|
68
|
+
{
|
69
|
+
for (int i = 0; i < RARRAY_LEN($input); i++)
|
70
|
+
{
|
71
|
+
void *ptr;
|
72
|
+
VALUE r_pane = rb_ary_entry($input, i);
|
73
|
+
int res = SWIG_ConvertPtr(r_pane, &ptr, SWIGTYPE_p_wxAuiPaneInfo, 0);
|
74
|
+
if (!SWIG_IsOK(res) || !ptr) {
|
75
|
+
Swig::DirectorTypeMismatchException::raise(swig_get_self(), "load_panes", rb_eTypeError, "in return value. Expected Array of Wx::AuiPaneInfo");
|
76
|
+
}
|
77
|
+
wxAuiPaneInfo *pane = reinterpret_cast< wxAuiPaneInfo * >(ptr);
|
78
|
+
$result.push_back(*pane);
|
79
|
+
}
|
80
|
+
}
|
81
|
+
__CODE
|
82
|
+
end
|
83
|
+
spec.map 'std::vector<wxAuiDockInfo>' => 'Array<Wx::AuiDockInfo>' do
|
84
|
+
map_out code: <<~__CODE
|
85
|
+
$result = rb_ary_new();
|
86
|
+
std::vector<wxAuiDockInfo>& docks = (std::vector<wxAuiDockInfo>&)$1;
|
87
|
+
for (const wxAuiDockInfo& dock : docks)
|
88
|
+
{
|
89
|
+
VALUE r_dock = SWIG_NewPointerObj(new wxAuiDockInfo(dock), SWIGTYPE_p_wxAuiDockInfo, SWIG_POINTER_OWN);
|
90
|
+
rb_ary_push($result, r_dock);
|
91
|
+
}
|
92
|
+
__CODE
|
93
|
+
map_directorout code: <<~__CODE
|
94
|
+
if (TYPE($input) == T_ARRAY)
|
95
|
+
{
|
96
|
+
for (int i = 0; i < RARRAY_LEN($input); i++)
|
97
|
+
{
|
98
|
+
void *ptr;
|
99
|
+
VALUE r_dock = rb_ary_entry($input, i);
|
100
|
+
int res = SWIG_ConvertPtr(r_dock, &ptr, SWIGTYPE_p_wxAuiDockInfo, 0);
|
101
|
+
if (!SWIG_IsOK(res) || !ptr) {
|
102
|
+
Swig::DirectorTypeMismatchException::raise(swig_get_self(), "load_docks", rb_eTypeError, "in return value. Expected Array of Wx::AuiDockInfo");
|
103
|
+
}
|
104
|
+
wxAuiDockInfo *dock = reinterpret_cast< wxAuiDockInfo * >(ptr);
|
105
|
+
$result.push_back(*dock);
|
106
|
+
}
|
107
|
+
}
|
108
|
+
__CODE
|
109
|
+
end
|
110
|
+
end
|
20
111
|
# need a custom implementation to handle (event handler proc) cleanup
|
21
112
|
spec.add_header_code <<~__HEREDOC
|
22
113
|
#include "wx/aui/aui.h"
|
@@ -80,7 +171,7 @@ module WXRuby3
|
|
80
171
|
rb_gc_mark( rb_art_prov );
|
81
172
|
}
|
82
173
|
}
|
83
|
-
|
174
|
+
__HEREDOC
|
84
175
|
spec.add_swig_code '%markfunc wxAuiManager "GC_mark_wxAuiManager";'
|
85
176
|
# provide pure Ruby implementation based on use custom alternative provided below
|
86
177
|
spec.ignore('wxAuiManager::GetAllPanes')
|
@@ -110,12 +201,36 @@ module WXRuby3
|
|
110
201
|
WXRubyAuiManager* aui_mng = dynamic_cast<WXRubyAuiManager*> (self);
|
111
202
|
managedWnd->Bind(wxEVT_CLOSE_WINDOW, &WXRubyAuiManager::OnManagedWindowClose, aui_mng);
|
112
203
|
}
|
113
|
-
|
204
|
+
__HEREDOC
|
114
205
|
spec.suppress_warning(473, 'wxAuiManager::CreateFloatingFrame')
|
115
206
|
spec.do_not_generate(:variables, :defines, :enums, :functions) # with AuiPaneInfo
|
116
207
|
end
|
208
|
+
|
209
|
+
def doc_generator
|
210
|
+
AuiManagerDocGenerator.new(self)
|
211
|
+
end
|
117
212
|
end # class AuiManager
|
118
213
|
|
214
|
+
class AuiManagerDocGenerator < DocGenerator
|
215
|
+
|
216
|
+
def gen_class_doc_members(fdoc, clsdef, cls_members, alias_methods)
|
217
|
+
super
|
218
|
+
if Config.instance.wx_version >= '3.3.0' && clsdef.name == 'wxAuiDockInfo'
|
219
|
+
fdoc.doc.puts 'Yield each pane to the given block.'
|
220
|
+
fdoc.doc.puts 'If no block passed returns an Enumerator.'
|
221
|
+
fdoc.doc.puts '@yieldparam [Wx::AUI::AuiPaneInfo] pane the Aui pane info yielded'
|
222
|
+
fdoc.doc.puts '@return [::Object, ::Enumerator] result of last block execution or enumerator'
|
223
|
+
fdoc.puts 'def each_pane; end'
|
224
|
+
fdoc.puts
|
225
|
+
fdoc.doc.puts 'Returns an array of Wx::AuiPaneInfo for all panes managed by the frame manager.'
|
226
|
+
fdoc.doc.puts '@return [Array<Wx::AUI::AuiPaneInfo>] info for all managed panes'
|
227
|
+
fdoc.puts 'def get_panes; end'
|
228
|
+
fdoc.puts 'alias_method :panes, :get_panes'
|
229
|
+
end
|
230
|
+
end
|
231
|
+
|
232
|
+
end
|
233
|
+
|
119
234
|
end # class Director
|
120
235
|
|
121
236
|
end # module WXRuby3
|
@@ -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,23 @@ 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
|
+
if Config.instance.wx_version >= '3.3.0'
|
235
|
+
spec.regard 'wxGenericAboutDialog::GetCustomControlParent'
|
236
|
+
end
|
237
|
+
if Config.instance.features_set?('USE_COLLPANE')
|
238
|
+
spec.regard 'wxGenericAboutDialog::AddCollapsiblePane'
|
239
|
+
end
|
230
240
|
end
|
231
241
|
end
|
232
242
|
|
@@ -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,
|
@@ -141,7 +141,7 @@ module WXRuby3
|
|
141
141
|
spec.map_apply 'int * OUTPUT' => 'int* pIndex'
|
142
142
|
end
|
143
143
|
# for UIntProperty and IntProperty
|
144
|
-
if Config.instance.features_set?('USE_LONGLONG')
|
144
|
+
if Config.instance.features_set?('USE_LONGLONG') || Config.instance.wx_version >= '3.3.0'
|
145
145
|
# wxLongLong mapping to be considered before considering 'long' (see typecheck precedence)
|
146
146
|
spec.map 'const wxLongLong&' => 'Integer' do
|
147
147
|
map_in temp: 'wxLongLong tmp', code: <<~__CODE
|
@@ -162,7 +162,7 @@ module WXRuby3
|
|
162
162
|
end
|
163
163
|
else
|
164
164
|
spec.ignore 'wxUIntProperty::wxUIntProperty(const wxString &, const wxString &, const wxULongLong &)',
|
165
|
-
'wxIntProperty::
|
165
|
+
'wxIntProperty::wxIntProperty(const wxString &, const wxString &, const wxLongLong &)'
|
166
166
|
end
|
167
167
|
spec.new_object 'wxArrayStringProperty::CreateEditorDialog'
|
168
168
|
spec.suppress_warning(473, 'wxArrayStringProperty::CreateEditorDialog')
|
@@ -39,9 +39,10 @@ module WXRuby3
|
|
39
39
|
spec.extend_interface 'wxPropertyGridInterface',
|
40
40
|
'void SetPropertyValues(const wxVariant &list, const wxPGPropArgCls& defaultCategory = 0)'
|
41
41
|
# optionals
|
42
|
-
|
43
|
-
|
44
|
-
|
42
|
+
unless Config.instance.features_set?('USE_LONGLONG') || Config.instance.wx_version >= '3.3.0'
|
43
|
+
spec.ignore_unless 'wxPropertyGridInterface::GetPropertyValueAsLongLong',
|
44
|
+
'wxPropertyGridInterface::GetPropertyValueAsULongLong'
|
45
|
+
end
|
45
46
|
spec.ignore_unless 'USE_DATETIME', 'wxPropertyGridInterface::GetPropertyValueAsDateTime'
|
46
47
|
spec.ignore_unless 'USE_VALIDATORS', 'wxPropertyGridInterface::GetPropertyValidator'
|
47
48
|
# fix incorrect XML documentation
|
@@ -24,6 +24,13 @@ module WXRuby3
|
|
24
24
|
spec.ignore 'wxTextCtrl::GTKGetTextBuffer',
|
25
25
|
'wxTextCtrl::GTKGetEditable'
|
26
26
|
end
|
27
|
+
if Config.instance.wx_version >= '3.3.0' && Config.instance.wx_port == :wxmsw
|
28
|
+
spec.items << 'wxTextSearch' << 'wxTextSearchResult'
|
29
|
+
spec.regard 'wxTextSearchResult::m_start', 'wxTextSearchResult::m_end'
|
30
|
+
spec.make_readonly 'wxTextSearchResult::m_start', 'wxTextSearchResult::m_end'
|
31
|
+
spec.rename_for_ruby 'start' => 'wxTextSearchResult::m_start',
|
32
|
+
'end' => 'wxTextSearchResult::m_end'
|
33
|
+
end
|
27
34
|
if Config.instance.wx_port == :wxqt
|
28
35
|
# not implemented
|
29
36
|
spec.ignore 'wxTextCtrl::OnDropFiles'
|
@@ -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;
|
@@ -142,7 +142,7 @@ module WXRuby3
|
|
142
142
|
{
|
143
143
|
return wxVariant(TYPE(rbval) == T_TRUE);
|
144
144
|
}
|
145
|
-
#
|
145
|
+
#if !defined(wxUSE_LONGLONG) || (wxUSE_LONGLONG == 1)
|
146
146
|
if ((sizeof(long) < 8) && (TYPE(rbval) == T_BIGNUM) && (rb_big_sign(rbval) == 0))
|
147
147
|
{
|
148
148
|
wxLongLong_t ll = rb_big2ll(rbval);
|
@@ -227,7 +227,7 @@ module WXRuby3
|
|
227
227
|
$1 = rb_obj_is_kind_of($input, rb_const_get(mWxPG, var_ColourPropertyValue_id()));
|
228
228
|
__CODE
|
229
229
|
end
|
230
|
-
if Config.instance.features_set?('USE_LONGLONG')
|
230
|
+
if Config.instance.features_set?('USE_LONGLONG') || Config.instance.wx_version >= '3.3.0'
|
231
231
|
# wxLongLong mapping to be considered before considering 'long' (see typecheck precedence)
|
232
232
|
spec.map 'wxLongLong' => 'Integer' do
|
233
233
|
map_in code: <<~__CODE
|
@@ -49,6 +49,9 @@ module WXRuby3
|
|
49
49
|
@template_params << txt
|
50
50
|
end
|
51
51
|
@args_string = element.at_xpath('argsstring').text
|
52
|
+
# transform unified initializers to ctor form (SWIG does not like unified initializers)
|
53
|
+
# (also see ParamDef#extract)
|
54
|
+
@args_string.gsub!(/(\w+(::\w+)*)\s*{([^}]*)}/) { |_| "#{$1}(#{$3})"}
|
52
55
|
check_deprecated
|
53
56
|
element.xpath('param').each do |node|
|
54
57
|
p = ParamDef.new(node)
|
@@ -370,6 +373,8 @@ module WXRuby3
|
|
370
373
|
end
|
371
374
|
if element.at_xpath('defval')
|
372
375
|
@default = BaseDef.flatten_node(element.at_xpath('defval'))
|
376
|
+
# transform unified initializers to ctor form (SWIG does not like unified initializers)
|
377
|
+
@default.sub!(/(\w+(::\w+)*)\s*{([^}]*)}/) { |_| "#{$1}(#{$3})"}
|
373
378
|
end
|
374
379
|
end
|
375
380
|
rescue Exception
|