wxruby3 0.9.1 → 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +1 -0
- data/ext/wxruby3/include/wxRubyApp.h +338 -0
- data/ext/wxruby3/include/wxruby-Config.h +6 -6
- data/ext/wxruby3/swig/common.i +1 -1
- data/lib/wx/aui/aui_tab_ctrl.rb +18 -0
- data/lib/wx/aui/auinotebook.rb +6 -2
- data/lib/wx/aui/require.rb +1 -0
- data/lib/wx/core/app.rb +2 -2
- data/lib/wx/core/collapsible_pane.rb +1 -1
- data/lib/wx/core/controlwithitems.rb +8 -6
- data/lib/wx/core/menu.rb +10 -0
- data/lib/wx/core/notebook.rb +6 -2
- data/lib/wx/core/sizer.rb +11 -0
- data/lib/wx/core/task_bar_button.rb +19 -0
- data/lib/wx/core/textctrl.rb +11 -1
- data/lib/wx/core/{treectrl.rb → tree_ctrl.rb} +31 -12
- data/lib/wx/core/window.rb +10 -0
- data/lib/wx/doc/app.rb +48 -38
- data/lib/wx/doc/art_locator.rb +47 -43
- data/lib/wx/doc/aui/auimanager.rb +16 -8
- data/lib/wx/doc/aui/auinotebook.rb +20 -5
- data/lib/wx/doc/clipboard.rb +11 -7
- data/lib/wx/doc/colour_dialog.rb +14 -10
- data/lib/wx/doc/controlwithitems.rb +17 -7
- data/lib/wx/doc/data_object.rb +2 -2
- data/lib/wx/doc/evthandler.rb +113 -108
- data/lib/wx/doc/font.rb +1 -0
- data/lib/wx/doc/gc_dc.rb +6 -1
- data/lib/wx/doc/graphics_context.rb +1 -0
- data/lib/wx/doc/grid/grid.rb +22 -1
- data/lib/wx/doc/help_controller.rb +11 -7
- data/lib/wx/doc/html/html_help_controller.rb +12 -4
- data/lib/wx/doc/list_ctrl.rb +33 -29
- data/lib/wx/doc/menu.rb +20 -0
- data/lib/wx/doc/notebook.rb +21 -0
- data/lib/wx/doc/pg/events.rb +13 -9
- data/lib/wx/doc/pg/pg_property.rb +18 -0
- data/lib/wx/doc/progress_dialog.rb +36 -32
- data/lib/wx/doc/prt/page_setup_dialog.rb +20 -12
- data/lib/wx/doc/prt/print_data.rb +13 -5
- data/lib/wx/doc/prt/print_dialog.rb +31 -23
- data/lib/wx/doc/prt/printer.rb +20 -12
- data/lib/wx/doc/radio_box.rb +19 -15
- data/lib/wx/doc/rbn/ribbon_bar.rb +13 -5
- data/lib/wx/doc/rbn/ribbon_button_bar.rb +13 -5
- data/lib/wx/doc/rbn/ribbon_gallery.rb +13 -5
- data/lib/wx/doc/rbn/ribbon_tool_bar.rb +13 -5
- data/lib/wx/doc/region_iterator.rb +32 -28
- data/lib/wx/doc/rtc/rich_text_composite_object.rb +24 -0
- data/lib/wx/doc/rtc/rich_text_ctrl.rb +24 -0
- data/lib/wx/doc/rtc/rich_text_paragraph.rb +24 -0
- data/lib/wx/doc/rtc/richtext_buffer.rb +27 -19
- data/lib/wx/doc/rtc/richtext_printing.rb +17 -9
- data/lib/wx/doc/rtc/richtext_style_sheet.rb +17 -9
- data/lib/wx/doc/sizer.rb +20 -0
- data/lib/wx/doc/stc/styled_text_ctrl.rb +24 -0
- data/lib/wx/doc/stream.rb +39 -35
- data/lib/wx/doc/system_settings.rb +30 -26
- data/lib/wx/doc/text_validator.rb +12 -8
- data/lib/wx/doc/textctrl.rb +16 -0
- data/lib/wx/doc/tree_ctrl.rb +95 -0
- data/lib/wx/doc/treebook.rb +9 -5
- data/lib/wx/doc/v_list_box.rb +9 -5
- data/lib/wx/doc/variant.rb +164 -160
- data/lib/wx/doc/window.rb +57 -47
- data/lib/wx/doc/window_disabler.rb +10 -6
- data/lib/wx/grid/grid.rb +27 -4
- data/lib/wx/pg/pg_property.rb +22 -0
- data/lib/wx/rtc/require.rb +3 -0
- data/lib/wx/rtc/rich_text_composite_object.rb +25 -0
- data/lib/wx/rtc/rich_text_ctrl.rb +25 -0
- data/lib/wx/rtc/rich_text_paragraph.rb +25 -0
- data/lib/wx/stc/require.rb +1 -0
- data/lib/wx/stc/styled_text_ctrl.rb +25 -0
- data/lib/wx/version.rb +1 -1
- data/rakelib/lib/config/linux.rb +0 -3
- data/rakelib/lib/config/macosx.rb +2 -2
- data/rakelib/lib/config/mingw.rb +1 -1
- data/rakelib/lib/config/unixish.rb +1 -1
- data/rakelib/lib/config.rb +14 -4
- data/rakelib/lib/core/package.rb +14 -7
- data/rakelib/lib/core/spec.rb +6 -1
- data/rakelib/lib/director/accelerator.rb +2 -3
- data/rakelib/lib/director/accessible.rb +47 -0
- data/rakelib/lib/director/app.rb +12 -319
- data/rakelib/lib/director/app_traits.rb +10 -12
- data/rakelib/lib/director/ctrl_with_items.rb +17 -5
- data/rakelib/lib/director/data_format.rb +1 -1
- data/rakelib/lib/director/derived_dc.rb +1 -1
- data/rakelib/lib/director/dialog.rb +1 -0
- data/rakelib/lib/director/drag_image.rb +2 -3
- data/rakelib/lib/director/event.rb +2 -2
- data/rakelib/lib/director/frame.rb +1 -3
- data/rakelib/lib/director/gdicommon.rb +8 -10
- data/rakelib/lib/director/graphics_context.rb +2 -4
- data/rakelib/lib/director/grid_ctrl.rb +34 -3
- data/rakelib/lib/director/icon.rb +5 -2
- data/rakelib/lib/director/list_ctrl.rb +5 -6
- data/rakelib/lib/director/locale.rb +1 -3
- data/rakelib/lib/director/log.rb +1 -4
- data/rakelib/lib/director/media_ctrl.rb +54 -0
- data/rakelib/lib/director/menu.rb +16 -1
- data/rakelib/lib/director/menu_item.rb +2 -2
- data/rakelib/lib/director/pgproperties.rb +1 -1
- data/rakelib/lib/director/pgproperty.rb +24 -1
- data/rakelib/lib/director/property_grid_interface.rb +5 -10
- data/rakelib/lib/director/richtext_composite_object.rb +25 -0
- data/rakelib/lib/director/richtext_ctrl.rb +14 -4
- data/rakelib/lib/director/richtext_formatting_dialog.rb +7 -5
- data/rakelib/lib/director/richtext_paragraph_layout_box.rb +9 -7
- data/rakelib/lib/director/sizer.rb +15 -0
- data/rakelib/lib/director/static_box.rb +4 -5
- data/rakelib/lib/director/styled_text_ctrl.rb +12 -0
- data/rakelib/lib/director/task_bar_button.rb +30 -0
- data/rakelib/lib/director/task_bar_icon.rb +5 -13
- data/rakelib/lib/director/textctrl.rb +12 -1
- data/rakelib/lib/director/tool_tip.rb +1 -1
- data/rakelib/lib/director/top_level_window.rb +4 -5
- data/rakelib/lib/director/tree_ctrl.rb +5 -6
- data/rakelib/lib/director/variant.rb +1 -1
- data/rakelib/lib/director/window.rb +24 -5
- data/rakelib/lib/director.rb +4 -4
- data/rakelib/lib/extractor/function.rb +6 -6
- data/rakelib/lib/extractor.rb +34 -5
- data/rakelib/lib/generate/analyzer.rb +8 -3
- data/rakelib/lib/generate/doc/busy_info.yaml +0 -2
- data/rakelib/lib/generate/doc/clipboard.yaml +0 -2
- data/rakelib/lib/generate/doc/cursor.yaml +0 -2
- data/rakelib/lib/generate/doc/panel.yaml +7 -0
- data/rakelib/lib/generate/doc.rb +76 -14
- data/rakelib/lib/specs/interfaces.rb +161 -160
- data/rakelib/lib/typemap/common.rb +30 -1
- data/rakelib/yard/templates/default/fulldoc/html/css/wxruby3.css +74 -2
- data/rakelib/yard/templates/default/fulldoc/html/full_list.erb +38 -0
- data/rakelib/yard/templates/default/fulldoc/html/setup.rb +39 -0
- data/rakelib/yard/templates/default/tags/html/wxrb_require.erb +10 -0
- data/rakelib/yard/templates/default/tags/setup.rb +16 -0
- data/rakelib/yard/yard-custom-templates.rb +3 -0
- data/samples/treectrl/treectrl.rb +1 -1
- data/tests/media/beep_lo.wav +0 -0
- data/tests/test_list_ctrl.rb +1 -1
- data/tests/test_media_ctrl.rb +38 -0
- data/tests/test_menu.rb +69 -0
- data/tests/test_pg.rb +27 -0
- data/tests/test_richtext.rb +45 -0
- data/tests/test_sizer.rb +16 -0
- data/tests/test_std_controls.rb +42 -1
- data/tests/test_styled_text_ctrl.rb +46 -0
- data/tests/test_tree_ctrl.rb +138 -0
- data/tests/test_window.rb +12 -0
- data/tests/testapp_noframe.rb +1 -1
- metadata +31 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 94bf5f5a3d4107e4a77c02971756de87b044c3d9edfbedd0b0aa0fe3e95e6ae7
|
4
|
+
data.tar.gz: 83d78771dde19401cbb0e5f915c7eb86903bf76357f1a1d0be4d10edf1f0d4a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1ac191dac02b350104d6336d38af941126056f30da9d2bffa12d480592216f0059f7cc1e22fa4020898a26faeffbc64d71df09eefd2b3329956c5e70a97b23b
|
7
|
+
data.tar.gz: '08d86fdf568ef0b67d76c670ccd108194342c7c0d97710419f7e98e0c852d8a863540aa3c320052237c27adf1c37f4d92a7c927fb827fcbbc5d05a73789e40e1'
|
data/.yardopts
CHANGED
@@ -0,0 +1,338 @@
|
|
1
|
+
// Copyright (c) 2023 M.J.N. Corino, The Netherlands
|
2
|
+
//
|
3
|
+
// This software is released under the MIT license.
|
4
|
+
|
5
|
+
#include <memory>
|
6
|
+
|
7
|
+
/*
|
8
|
+
* WxRuby3 App class
|
9
|
+
*/
|
10
|
+
|
11
|
+
class wxRubyApp : public wxApp
|
12
|
+
{
|
13
|
+
private:
|
14
|
+
bool is_running_ = false;
|
15
|
+
VALUE self_ = Qnil;
|
16
|
+
public:
|
17
|
+
static wxRubyApp* GetInstance () { return dynamic_cast<wxRubyApp*> (wxApp::GetInstance()); }
|
18
|
+
|
19
|
+
virtual ~wxRubyApp()
|
20
|
+
{
|
21
|
+
#ifdef __WXTRACE__
|
22
|
+
std::wcout << "~wxRubyApp" << std::endl;
|
23
|
+
#endif
|
24
|
+
// unlink
|
25
|
+
if (this->self_ != Qnil)
|
26
|
+
{
|
27
|
+
DATA_PTR(this->self_) = 0;
|
28
|
+
}
|
29
|
+
this->self_ = Qnil;
|
30
|
+
}
|
31
|
+
|
32
|
+
// special event handler for destruction of windows which is done
|
33
|
+
// automatically by wxWidgets. Tag the object as having been destroyed
|
34
|
+
// by WxWidgets.
|
35
|
+
void OnWindowDestroy(wxWindowDestroyEvent &event)
|
36
|
+
{
|
37
|
+
wxObject* wx_obj = event.GetEventObject();
|
38
|
+
#ifdef __WXRB_DEBUG__
|
39
|
+
if (wxRuby_TraceLevel()>0)
|
40
|
+
std::wcout << "<= OnWindowDestroy [" << wx_obj << "]" << std::endl;
|
41
|
+
#endif
|
42
|
+
GC_SetWindowDeleted((void *)wx_obj);
|
43
|
+
event.Skip();
|
44
|
+
#ifdef __WXRB_DEBUG__
|
45
|
+
if (wxRuby_TraceLevel()>0)
|
46
|
+
std::wcout << "=> OnWindowDestroy [" << wx_obj << "]" << std::endl;
|
47
|
+
#endif
|
48
|
+
}
|
49
|
+
|
50
|
+
bool IsRunning() const { return this->is_running_; }
|
51
|
+
|
52
|
+
// When ruby's garbage collection runs, if the app is still active, it
|
53
|
+
// cycles through all currently known SWIG objects and calls this
|
54
|
+
// function on each to preserve still active Wx::Windows, and also
|
55
|
+
// pending Wx::Events which have been queued from the Ruby side (the
|
56
|
+
// only sort of events that will be in the tracking hash.
|
57
|
+
static void markIterate(void* ptr, VALUE rb_obj)
|
58
|
+
{
|
59
|
+
// Check if it's a valid object (sometimes SWIG doesn't return what we're
|
60
|
+
// expecting), a descendant of Wx::Window (but not a Dialog), and if it has not yet been
|
61
|
+
// deleted by WxWidgets; if so, mark it.
|
62
|
+
if ( TYPE(rb_obj) == T_DATA )
|
63
|
+
{
|
64
|
+
if ( rb_obj_is_kind_of(rb_obj, wxRuby_GetWindowClass()) )
|
65
|
+
{
|
66
|
+
rb_gc_mark(rb_obj);
|
67
|
+
}
|
68
|
+
else if (rb_obj_is_kind_of(rb_obj, wxRuby_GetDefaultEventClass()) )
|
69
|
+
rb_gc_mark(rb_obj);
|
70
|
+
}
|
71
|
+
else if (TYPE(rb_obj) == T_ARRAY )
|
72
|
+
{
|
73
|
+
VALUE proc = rb_ary_entry(rb_obj, 0);
|
74
|
+
if (rb_obj_is_kind_of(proc, rb_cProc) || rb_obj_is_kind_of(proc, rb_cMethod))
|
75
|
+
{
|
76
|
+
// keep the async call alive
|
77
|
+
rb_gc_mark(rb_obj);
|
78
|
+
}
|
79
|
+
}
|
80
|
+
}
|
81
|
+
|
82
|
+
// Implements GC protection across wxRuby. Always called because
|
83
|
+
// Wx::THE_APP is a constant so always checked in GC mark phase.
|
84
|
+
static void mark_wxRubyApp(void *ptr)
|
85
|
+
{
|
86
|
+
|
87
|
+
#ifdef __WXRB_DEBUG__
|
88
|
+
if (wxRuby_TraceLevel()>0)
|
89
|
+
std::wcout << "=== Starting App GC mark phase" << std::endl;
|
90
|
+
#endif
|
91
|
+
|
92
|
+
// If the App has ended, the ruby object will have been unlinked from
|
93
|
+
// the C++ one; this implies that all Windows have already been destroyed
|
94
|
+
// so there is no point trying to mark them, and doing so may cause
|
95
|
+
// errors.
|
96
|
+
if ( !wxRubyApp::GetInstance() || !wxRubyApp::GetInstance()->IsRunning() )
|
97
|
+
{
|
98
|
+
#ifdef __WXRB_DEBUG__
|
99
|
+
if (wxRuby_TraceLevel()>0)
|
100
|
+
std::wcout << "=== App not started yet or has ended, skipping mark phase" << std::endl;
|
101
|
+
#endif
|
102
|
+
return;
|
103
|
+
}
|
104
|
+
|
105
|
+
// Mark any active (tracked) log target
|
106
|
+
wxLog* curLog = wxLog::GetActiveTarget();
|
107
|
+
VALUE rb_cur_log = wxRuby_FindTracking(curLog);
|
108
|
+
if (!NIL_P(rb_cur_log))
|
109
|
+
{
|
110
|
+
rb_gc_mark(rb_cur_log);
|
111
|
+
}
|
112
|
+
|
113
|
+
// Mark evt handler procs associated with live windows - see
|
114
|
+
// classes/EvtHandler.i
|
115
|
+
wxRuby_MarkProtectedEvtHandlerProcs();
|
116
|
+
|
117
|
+
// run registered markers
|
118
|
+
for (wxVector<WXRBMarkFunction>::iterator it = WXRuby_Mark_List.begin();
|
119
|
+
it != WXRuby_Mark_List.end() ;++it)
|
120
|
+
{
|
121
|
+
(*it) ();
|
122
|
+
}
|
123
|
+
|
124
|
+
// To do the main marking, primarily of Windows, iterate over SWIG's
|
125
|
+
// list of tracked objects
|
126
|
+
wxRuby_IterateTracking(&wxRubyApp::markIterate);
|
127
|
+
|
128
|
+
#ifdef __WXRB_DEBUG__
|
129
|
+
if (wxRuby_TraceLevel()>0)
|
130
|
+
std::wcout << "=== App GC mark phase completed" << std::endl;
|
131
|
+
#endif
|
132
|
+
}
|
133
|
+
|
134
|
+
// This is the method run when main_loop is called in Ruby
|
135
|
+
// wxEntry calls the C++ App::OnInit method
|
136
|
+
int main_loop()
|
137
|
+
{
|
138
|
+
int rc = 0;
|
139
|
+
|
140
|
+
// There should ever only be only a single App instance running
|
141
|
+
if (rb_const_defined(mWxCore, rb_intern("THE_APP")))
|
142
|
+
{
|
143
|
+
rb_raise(rb_eRuntimeError, "There is already another App instance running");
|
144
|
+
return -1;
|
145
|
+
}
|
146
|
+
|
147
|
+
// Set self reference and global THE_APP constant
|
148
|
+
this->self_ = SWIG_RubyInstanceFor(this);
|
149
|
+
rb_define_const(mWxCore, "THE_APP", this->self_);
|
150
|
+
// Also cache the Ruby App reference on the stack here as after
|
151
|
+
// wxEntry returns the C++ App instance will have been destroyed
|
152
|
+
// and we cannot reference it (or it's members) anymore
|
153
|
+
VALUE the_app = this->self_;
|
154
|
+
|
155
|
+
this->Connect(wxEVT_DESTROY,
|
156
|
+
wxWindowDestroyEventHandler(wxRubyApp::OnWindowDestroy));
|
157
|
+
|
158
|
+
#ifdef __WXRB_DEBUG__
|
159
|
+
if (wxRuby_TraceLevel()>0)
|
160
|
+
std::wcout << "Calling wxEntry, this=" << this << std::endl;
|
161
|
+
#endif
|
162
|
+
|
163
|
+
// collect ruby app name and arguments array
|
164
|
+
VALUE rb_args = rb_get_argv();
|
165
|
+
int argc = 1 + RARRAY_LEN(rb_args);
|
166
|
+
std::unique_ptr<char*[]> argv_safe = std::make_unique<char*[]> (argc);
|
167
|
+
VALUE sval = rb_gv_get("$0");
|
168
|
+
argv_safe[0] = StringValuePtr(sval);
|
169
|
+
for (int i=0; i<RARRAY_LEN(rb_args) ;++i)
|
170
|
+
{
|
171
|
+
sval = rb_ary_entry(rb_args, i);
|
172
|
+
argv_safe[1+i] = StringValuePtr(sval);
|
173
|
+
}
|
174
|
+
// there is no need to copy the strings as we only need them until
|
175
|
+
// wxEntry returns
|
176
|
+
|
177
|
+
#ifdef __WXMSW__
|
178
|
+
wxApp::m_nCmdShow = SW_NORMAL;
|
179
|
+
#endif
|
180
|
+
rc = wxEntry(argc, argv_safe.get());
|
181
|
+
|
182
|
+
/*
|
183
|
+
At this point the C++ wxRubyApp instance has been destroyed so take care NOT to reference
|
184
|
+
it or any of it's members anymore but only unroll the callstack.
|
185
|
+
*/
|
186
|
+
|
187
|
+
#ifdef __WXRB_DEBUG__
|
188
|
+
if (wxRuby_TraceLevel()>0)
|
189
|
+
std::wcout << "returned from wxEntry..." << std::endl;
|
190
|
+
#endif
|
191
|
+
rb_gc_start();
|
192
|
+
#ifdef __WXRB_DEBUG__
|
193
|
+
if (wxRuby_TraceLevel()>0)
|
194
|
+
std::wcout << "survived gc" << std::endl;
|
195
|
+
#endif
|
196
|
+
|
197
|
+
rb_const_remove(mWxCore, rb_intern("THE_APP"));
|
198
|
+
|
199
|
+
VALUE exc = rb_iv_get(the_app, "@exception");
|
200
|
+
if (!NIL_P(exc))
|
201
|
+
{
|
202
|
+
rb_exc_raise(exc);
|
203
|
+
}
|
204
|
+
return rc;
|
205
|
+
}
|
206
|
+
|
207
|
+
// This method initializes the stock objects (Pens, Brushes, Fonts)
|
208
|
+
// before yielding to ruby by calling the App's on_init method.
|
209
|
+
// Note that as of wxWidget 2.8, the stock fonts in particular cannot
|
210
|
+
// be initialized any earlier than this without crashing
|
211
|
+
bool OnInit() override
|
212
|
+
{
|
213
|
+
#ifdef __WXRB_DEBUG__
|
214
|
+
if (wxRuby_TraceLevel()>0)
|
215
|
+
std::wcout << "OnInit..." << std::endl;
|
216
|
+
#endif
|
217
|
+
|
218
|
+
if (!wxApp::OnInit())
|
219
|
+
return false;
|
220
|
+
|
221
|
+
// Signal that we've started
|
222
|
+
this->is_running_ = true;
|
223
|
+
// Set up the GDI objects
|
224
|
+
Init_wxRubyStockObjects();
|
225
|
+
// Get the ruby representation of the App object, and call the
|
226
|
+
// ruby on_init method to set up the initial window state
|
227
|
+
bool ex_caught = false;
|
228
|
+
VALUE result = wxRuby_Funcall(ex_caught, this->self_, rb_intern("on_ruby_init"), 0, 0);
|
229
|
+
|
230
|
+
if (ex_caught)
|
231
|
+
{
|
232
|
+
#ifdef __WXRB_DEBUG__
|
233
|
+
wxRuby_PrintException(result);
|
234
|
+
#endif
|
235
|
+
rb_iv_set(this->self_, "@exception", result);
|
236
|
+
result = Qfalse; // exit app
|
237
|
+
}
|
238
|
+
|
239
|
+
// If on_init return any (ruby) true value, signal to wxWidgets to
|
240
|
+
// enter the main event loop by returning true, else return false
|
241
|
+
// which will make wxWidgets exit.
|
242
|
+
if ( result == Qfalse || result == Qnil )
|
243
|
+
{
|
244
|
+
this->is_running_ = false;
|
245
|
+
return false;
|
246
|
+
}
|
247
|
+
else
|
248
|
+
{
|
249
|
+
return true;
|
250
|
+
}
|
251
|
+
}
|
252
|
+
|
253
|
+
int OnExit() override
|
254
|
+
{
|
255
|
+
#ifdef __WXRB_DEBUG__
|
256
|
+
if (wxRuby_TraceLevel()>0)
|
257
|
+
std::wcout << "OnExit..." << std::endl;
|
258
|
+
#endif
|
259
|
+
|
260
|
+
// Get the ruby representation of the App object, and call the
|
261
|
+
// ruby on_exit method (if any) for application level cleanup
|
262
|
+
ID on_exit_id = rb_intern("on_exit");
|
263
|
+
if (rb_funcall(this->self_, rb_intern("respond_to?"), 1, ID2SYM(on_exit_id)) == Qtrue)
|
264
|
+
{
|
265
|
+
bool ex_caught = false;
|
266
|
+
VALUE rc = wxRuby_Funcall(ex_caught, this->self_, on_exit_id, 0, 0);
|
267
|
+
if (ex_caught)
|
268
|
+
{
|
269
|
+
#ifdef __WXRB_DEBUG__
|
270
|
+
wxRuby_PrintException(rc);
|
271
|
+
#endif
|
272
|
+
rb_iv_set(this->self_, "@exception", rc);
|
273
|
+
}
|
274
|
+
}
|
275
|
+
|
276
|
+
// perform wxRuby cleanup
|
277
|
+
_wxRuby_Cleanup();
|
278
|
+
|
279
|
+
// execute base wxWidgets functionality
|
280
|
+
return this->wxApp::OnExit();
|
281
|
+
}
|
282
|
+
|
283
|
+
// actually implemented in ruby in classes/app.rb
|
284
|
+
virtual void OnAssertFailure(const wxChar *file, int line, const wxChar *func, const wxChar *cond, const wxChar *msg) override
|
285
|
+
{
|
286
|
+
if (rb_during_gc() || NIL_P(this->self_))
|
287
|
+
{
|
288
|
+
std::wcerr << file << "(" << line << "): ASSERT " << cond
|
289
|
+
<< (NIL_P(this->self_) ? " fired without THE_APP in " : " fired during GC phase in ")
|
290
|
+
<< func << "() with message [" << msg << "]" << std::endl;
|
291
|
+
}
|
292
|
+
else
|
293
|
+
{
|
294
|
+
VALUE obj0 = Qnil ;
|
295
|
+
VALUE obj1 = Qnil ;
|
296
|
+
VALUE obj2 = Qnil ;
|
297
|
+
VALUE obj3 = Qnil ;
|
298
|
+
VALUE obj4 = Qnil ;
|
299
|
+
|
300
|
+
obj0 = rb_str_new2((const char *)wxString(file).utf8_str());
|
301
|
+
obj1 = INT2NUM(line);
|
302
|
+
obj2 = rb_str_new2((const char *)wxString(func).utf8_str());
|
303
|
+
obj3 = rb_str_new2((const char *)wxString(cond).utf8_str());
|
304
|
+
obj4 = rb_str_new2((const char *)wxString(msg).utf8_str());
|
305
|
+
(void)wxRuby_Funcall(this->self_, rb_intern("on_assert_failure"), 5,obj0,obj1,obj2,obj3,obj4);
|
306
|
+
}
|
307
|
+
}
|
308
|
+
|
309
|
+
void _wxRuby_Cleanup()
|
310
|
+
{
|
311
|
+
#ifdef __WXRB_DEBUG__
|
312
|
+
if (wxRuby_TraceLevel()>0)
|
313
|
+
std::wcout << "wxRuby_Cleanup..." << std::endl;
|
314
|
+
#endif
|
315
|
+
// Note in a global variable that the App has ended, so that we
|
316
|
+
// can skip any GC marking later
|
317
|
+
this->is_running_ = false;
|
318
|
+
|
319
|
+
// if a Ruby implemented logger has been installed clean that up
|
320
|
+
// before we exit, otherwise let wxWidgets handle things
|
321
|
+
wxLog *oldlog = wxLog::GetActiveTarget();
|
322
|
+
if (wxRuby_FindTracking(oldlog) != Qnil)
|
323
|
+
{
|
324
|
+
oldlog = wxLog::SetActiveTarget(new wxLogStderr);
|
325
|
+
}
|
326
|
+
else
|
327
|
+
{
|
328
|
+
oldlog = 0;
|
329
|
+
}
|
330
|
+
SetTopWindow(0);
|
331
|
+
if ( oldlog )
|
332
|
+
{
|
333
|
+
SWIG_RubyUnlinkObjects(oldlog);
|
334
|
+
SWIG_RubyRemoveTracking(oldlog);
|
335
|
+
delete oldlog;
|
336
|
+
}
|
337
|
+
}
|
338
|
+
};
|
@@ -456,7 +456,7 @@ protected:
|
|
456
456
|
}
|
457
457
|
|
458
458
|
#ifdef wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG
|
459
|
-
virtual bool DoReadLongLong(const wxString& key, wxLongLong_t *pll) const
|
459
|
+
virtual bool DoReadLongLong(const wxString& key, wxLongLong_t *pll) const override
|
460
460
|
{
|
461
461
|
wxConfigPathChanger path(this, key);
|
462
462
|
|
@@ -487,7 +487,7 @@ protected:
|
|
487
487
|
}
|
488
488
|
#endif // wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG
|
489
489
|
|
490
|
-
virtual bool DoReadDouble(const wxString& key, double* val) const
|
490
|
+
virtual bool DoReadDouble(const wxString& key, double* val) const override
|
491
491
|
{
|
492
492
|
wxConfigPathChanger path(this, key);
|
493
493
|
|
@@ -517,7 +517,7 @@ protected:
|
|
517
517
|
}
|
518
518
|
}
|
519
519
|
|
520
|
-
virtual bool DoReadBool(const wxString& key, bool* val) const
|
520
|
+
virtual bool DoReadBool(const wxString& key, bool* val) const override
|
521
521
|
{
|
522
522
|
wxConfigPathChanger path(this, key);
|
523
523
|
|
@@ -637,7 +637,7 @@ protected:
|
|
637
637
|
}
|
638
638
|
|
639
639
|
#ifdef wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG
|
640
|
-
virtual bool DoWriteLongLong(const wxString& key, wxLongLong_t value)
|
640
|
+
virtual bool DoWriteLongLong(const wxString& key, wxLongLong_t value) override
|
641
641
|
{
|
642
642
|
wxConfigPathChanger path(this, key);
|
643
643
|
wxString strName = path.Name();
|
@@ -675,7 +675,7 @@ protected:
|
|
675
675
|
}
|
676
676
|
#endif // wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG
|
677
677
|
|
678
|
-
virtual bool DoWriteDouble(const wxString& key, double value)
|
678
|
+
virtual bool DoWriteDouble(const wxString& key, double value) override
|
679
679
|
{
|
680
680
|
wxConfigPathChanger path(this, key);
|
681
681
|
wxString strName = path.Name();
|
@@ -712,7 +712,7 @@ protected:
|
|
712
712
|
return true;
|
713
713
|
}
|
714
714
|
|
715
|
-
virtual bool DoWriteBool(const wxString& key, bool value)
|
715
|
+
virtual bool DoWriteBool(const wxString& key, bool value) override
|
716
716
|
{
|
717
717
|
wxConfigPathChanger path(this, key);
|
718
718
|
wxString strName = path.Name();
|
data/ext/wxruby3/swig/common.i
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
# Copyright (c) 2023 M.J.N. Corino, The Netherlands
|
2
|
+
#
|
3
|
+
# This software is released under the MIT license.
|
4
|
+
|
5
|
+
class Wx::AUI::AuiTabCtrl
|
6
|
+
|
7
|
+
# Convenience method for iterating pages
|
8
|
+
def each_page
|
9
|
+
if block_given?
|
10
|
+
0.upto(get_page_count - 1) do | i |
|
11
|
+
yield get_page(i)
|
12
|
+
end
|
13
|
+
else
|
14
|
+
::Enumerator.new { |y| each_page { |pg| y << pg } }
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
data/lib/wx/aui/auinotebook.rb
CHANGED
@@ -19,8 +19,12 @@ class Wx::AUI::AuiNotebook
|
|
19
19
|
|
20
20
|
# Convenience method for iterating pages
|
21
21
|
def each_page
|
22
|
-
|
23
|
-
|
22
|
+
if block_given?
|
23
|
+
0.upto(get_page_count - 1) do | i |
|
24
|
+
yield get_page(i)
|
25
|
+
end
|
26
|
+
else
|
27
|
+
::Enumerator.new { |y| each_page { |pg| y << pg } }
|
24
28
|
end
|
25
29
|
end
|
26
30
|
end
|
data/lib/wx/aui/require.rb
CHANGED
data/lib/wx/core/app.rb
CHANGED
@@ -79,8 +79,8 @@ class Wx::App
|
|
79
79
|
# WxRuby. Such messages usually indicate that the API is being used
|
80
80
|
# incorrectly; the file/line reference points to the place in the
|
81
81
|
# WxWidgets source code where the assertion was made.
|
82
|
-
|
83
|
-
warn
|
82
|
+
def on_assert_failure(file, line, func, condition, message)
|
83
|
+
warn %Q{Wx WARNING: ASSERT #{condition} fired with "#{message}" at (#{func}@#{file}:#{line})}
|
84
84
|
end
|
85
85
|
|
86
86
|
# For use in development only, of no practical use in production code.
|
@@ -11,12 +11,14 @@
|
|
11
11
|
|
12
12
|
class Wx::ControlWithItems
|
13
13
|
|
14
|
-
#
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
14
|
+
# Overload to provide Enumerator without block
|
15
|
+
wx_each_string = instance_method :each_string
|
16
|
+
define_method :each_string do |&block|
|
17
|
+
if block
|
18
|
+
wx_each_string.bind(self).call(&block)
|
19
|
+
else
|
20
|
+
::Enumerator.new { |y| wx_each_string.bind(self).call { |ln| y << ln } }
|
21
|
+
end
|
20
22
|
end
|
21
23
|
|
22
24
|
# We need to cache client data in Ruby variables as we cannot access items
|
data/lib/wx/core/menu.rb
CHANGED
@@ -26,6 +26,16 @@ class Wx::Menu
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
+
# Overload to provide Enumerator without block
|
30
|
+
wx_each_item = instance_method :each_item
|
31
|
+
define_method :each_item do |&block|
|
32
|
+
if block
|
33
|
+
wx_each_item.bind(self).call(&block)
|
34
|
+
else
|
35
|
+
::Enumerator.new { |y| wx_each_item.bind(self).call { |mi| y << mi } }
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
29
39
|
# In the standard WxWidgets API, the methods append, prepend, insert
|
30
40
|
# (and their variants) require a constant integer id as the identifier
|
31
41
|
# of the menu item. This is then used in event handling.
|
data/lib/wx/core/notebook.rb
CHANGED
@@ -11,8 +11,12 @@
|
|
11
11
|
class Wx::Notebook
|
12
12
|
# Convenience method for iterating pages
|
13
13
|
def each_page
|
14
|
-
|
15
|
-
|
14
|
+
if block_given?
|
15
|
+
0.upto(get_page_count - 1) do | i |
|
16
|
+
yield get_page(i)
|
17
|
+
end
|
18
|
+
else
|
19
|
+
::Enumerator.new { |y| each_page { |pg| y << pg } }
|
16
20
|
end
|
17
21
|
end
|
18
22
|
end
|
data/lib/wx/core/sizer.rb
CHANGED
@@ -49,4 +49,15 @@ class Wx::Sizer
|
|
49
49
|
insert(idx, *full_args)
|
50
50
|
end
|
51
51
|
end
|
52
|
+
|
53
|
+
# Overload to provide Enumerator without block
|
54
|
+
wx_each_child = instance_method :each_child
|
55
|
+
define_method :each_child do |&block|
|
56
|
+
if block
|
57
|
+
wx_each_child.bind(self).call(&block)
|
58
|
+
else
|
59
|
+
::Enumerator.new { |y| wx_each_child.bind(self).call { |c| y << c } }
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
52
63
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# Copyright (c) 2023 M.J.N. Corino, The Netherlands
|
2
|
+
#
|
3
|
+
# This software is released under the MIT license.
|
4
|
+
|
5
|
+
|
6
|
+
module Wx
|
7
|
+
|
8
|
+
if Wx::PLATFORM == 'WXMSW'
|
9
|
+
class TaskBarButton
|
10
|
+
|
11
|
+
wx_remove_thumb_bar_button = instance_method :remove_thumb_bar_button
|
12
|
+
define_method :remove_thumb_bar_button do |button|
|
13
|
+
button = button.get_id if button.is_a?(Wx::ThumbBarButton)
|
14
|
+
wx_remove_thumb_bar_button.bind(self).call(button)
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/wx/core/textctrl.rb
CHANGED
@@ -59,10 +59,20 @@ module Wx
|
|
59
59
|
class TextCtrl
|
60
60
|
wx_op_append = instance_method :<<
|
61
61
|
define_method :<< do |o|
|
62
|
-
wx_op_append.bind(self).call(o)
|
62
|
+
wx_op_append.bind(self).call(o.to_s)
|
63
63
|
self
|
64
64
|
end
|
65
65
|
|
66
|
+
# Overload to provide Enumerator without block
|
67
|
+
wx_each_line = instance_method :each_line
|
68
|
+
define_method :each_line do |&block|
|
69
|
+
if block
|
70
|
+
wx_each_line.bind(self).call(&block)
|
71
|
+
else
|
72
|
+
::Enumerator.new { |y| wx_each_line.bind(self).call { |ln| y << ln } }
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
66
76
|
if Wx.has_feature?(:USE_SPELLCHECK)
|
67
77
|
|
68
78
|
protected :do_enable_proof_check
|
@@ -9,22 +9,41 @@
|
|
9
9
|
# Hierarchical control with items
|
10
10
|
|
11
11
|
class Wx::TreeCtrl
|
12
|
-
|
13
|
-
|
12
|
+
|
13
|
+
# Overload to provide Enumerator without block
|
14
|
+
wx_traverse = instance_method :traverse
|
15
|
+
define_method :traverse do |start_id=nil, &block|
|
16
|
+
if block
|
17
|
+
wx_traverse.bind(self).call(start_id, &block)
|
18
|
+
else
|
19
|
+
::Enumerator.new { |y| wx_traverse.bind(self).call(start_id) { |c| y << c } }
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
14
23
|
# Iterate over all items
|
15
24
|
alias :each :traverse
|
16
25
|
|
17
|
-
#
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
+
# Make these ruby enumerables so find, find_all, map etc are available
|
27
|
+
include Enumerable
|
28
|
+
|
29
|
+
# Iterate all children of parent_id
|
30
|
+
def each_item_child(parent_id, &block)
|
31
|
+
if block
|
32
|
+
rc = nil
|
33
|
+
child_id, cookie = get_first_child(parent_id)
|
34
|
+
while child_id && child_id.ok?
|
35
|
+
rc = block.call(child_id)
|
36
|
+
child_id, cookie = get_next_child(parent_id, cookie)
|
37
|
+
end
|
38
|
+
rc
|
39
|
+
else
|
40
|
+
::Enumerator.new { |y| each_item_child(parent_id) { |child_id| y << child_id } }
|
26
41
|
end
|
27
|
-
|
42
|
+
end
|
43
|
+
|
44
|
+
# Return the children of +parent+ as an array of TreeItemIDs.
|
45
|
+
def get_item_children(parent_id)
|
46
|
+
each_item_child(parent_id).to_a
|
28
47
|
end
|
29
48
|
|
30
49
|
# Returns a Wx::Rect corresponding to the edges of an individual tree
|
data/lib/wx/core/window.rb
CHANGED
@@ -79,6 +79,16 @@ class Wx::Window
|
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
82
|
+
# Overload to provide Enumerator without block
|
83
|
+
wx_each_child = instance_method :each_child
|
84
|
+
define_method :each_child do |&block|
|
85
|
+
if block
|
86
|
+
wx_each_child.bind(self).call(&block)
|
87
|
+
else
|
88
|
+
::Enumerator.new { |y| wx_each_child.bind(self).call { |c| y << c } }
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
82
92
|
# implement non-static variants of these
|
83
93
|
|
84
94
|
def from_dip(*args)
|