wxruby3 1.3.1 → 1.4.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. checksums.yaml +4 -4
  2. data/INSTALL.md +16 -12
  3. data/README.md +4 -3
  4. data/ext/wxruby3/include/wxRubyApp.h +9 -9
  5. data/ext/wxruby3/swig/mark_free_impl.i +47 -11
  6. data/ext/wxruby3/swig/wx.i +30 -12
  7. data/lib/wx/aui/auifloatframe.rb +1 -1
  8. data/lib/wx/aui/auimanager.rb +5 -16
  9. data/lib/wx/aui/auinotebook.rb +1 -1
  10. data/lib/wx/aui/require.rb +0 -2
  11. data/lib/wx/core/acceleratortable.rb +1 -1
  12. data/lib/wx/core/animation.rb +2 -2
  13. data/lib/wx/core/app.rb +1 -1
  14. data/lib/wx/core/artprovider.rb +4 -4
  15. data/lib/wx/core/bitmap.rb +1 -1
  16. data/lib/wx/core/bitmap_combobox.rb +2 -2
  17. data/lib/wx/core/clientdc.rb +1 -1
  18. data/lib/wx/core/clipboard.rb +4 -4
  19. data/lib/wx/core/colour.rb +1 -1
  20. data/lib/wx/core/combobox.rb +1 -1
  21. data/lib/wx/core/config.rb +7 -7
  22. data/lib/wx/core/controlwithitems.rb +3 -3
  23. data/lib/wx/core/data_object.rb +4 -4
  24. data/lib/wx/core/dataformat.rb +9 -3
  25. data/lib/wx/core/dialog.rb +3 -2
  26. data/lib/wx/core/event.rb +3 -3
  27. data/lib/wx/core/evthandler.rb +317 -289
  28. data/lib/wx/core/file_dialog.rb +1 -1
  29. data/lib/wx/core/find_replace_dialog.rb +2 -2
  30. data/lib/wx/core/functions.rb +1 -1
  31. data/lib/wx/core/genericdirctrl.rb +1 -1
  32. data/lib/wx/core/geometry.rb +2 -2
  33. data/lib/wx/core/graphics_pen_info.rb +1 -1
  34. data/lib/wx/core/helpprovider.rb +1 -1
  35. data/lib/wx/core/icon.rb +1 -1
  36. data/lib/wx/core/image.rb +2 -2
  37. data/lib/wx/core/imagelist.rb +1 -1
  38. data/lib/wx/core/locale.rb +5 -5
  39. data/lib/wx/core/log.rb +8 -8
  40. data/lib/wx/core/menu.rb +3 -3
  41. data/lib/wx/core/module_ext.rb +16 -0
  42. data/lib/wx/core/owner_drawn_combobox.rb +3 -3
  43. data/lib/wx/core/pen_info.rb +1 -1
  44. data/lib/wx/core/persistence_manager.rb +2 -2
  45. data/lib/wx/core/rect.rb +1 -1
  46. data/lib/wx/core/secret_store.rb +1 -1
  47. data/lib/wx/core/simplehelpprovider.rb +1 -1
  48. data/lib/wx/core/sizer.rb +8 -8
  49. data/lib/wx/core/splash_screen.rb +1 -1
  50. data/lib/wx/core/standard_paths.rb +1 -1
  51. data/lib/wx/core/task_bar_button.rb +1 -1
  52. data/lib/wx/core/text_entry.rb +1 -1
  53. data/lib/wx/core/textctrl.rb +2 -2
  54. data/lib/wx/core/timer.rb +2 -2
  55. data/lib/wx/core/tree_ctrl.rb +1 -1
  56. data/lib/wx/core/v_list_box.rb +1 -1
  57. data/lib/wx/core/validator.rb +2 -2
  58. data/lib/wx/core/variant.rb +2 -2
  59. data/lib/wx/core/window.rb +48 -2
  60. data/lib/wx/core/xmlresource.rb +4 -4
  61. data/lib/wx/core.rb +2 -0
  62. data/lib/wx/doc/evthandler.rb +1 -0
  63. data/lib/wx/doc/tip_window.rb +22 -0
  64. data/lib/wx/grid/grid.rb +3 -3
  65. data/lib/wx/grid/require.rb +0 -2
  66. data/lib/wx/html/htmlhelpcontroller.rb +1 -1
  67. data/lib/wx/html/htmlwindow.rb +1 -1
  68. data/lib/wx/html/require.rb +0 -2
  69. data/lib/wx/html/simple_html_listbox.rb +3 -3
  70. data/lib/wx/keyword_ctors.rb +14 -7
  71. data/lib/wx/keyword_defs.rb +7 -7
  72. data/lib/wx/pg/pg_properties.rb +1 -1
  73. data/lib/wx/pg/pg_property.rb +3 -3
  74. data/lib/wx/pg/property_grid.rb +2 -2
  75. data/lib/wx/pg/property_grid_interface.rb +2 -2
  76. data/lib/wx/pg/require.rb +0 -2
  77. data/lib/wx/prt/previewframe.rb +1 -1
  78. data/lib/wx/prt/require.rb +0 -2
  79. data/lib/wx/rbn/ribbon_control.rb +1 -1
  80. data/lib/wx/rbn/ribbon_page.rb +1 -1
  81. data/lib/wx/rbn/ribbon_panel.rb +1 -1
  82. data/lib/wx/rtc/require.rb +0 -2
  83. data/lib/wx/rtc/rich_text_composite_object.rb +1 -1
  84. data/lib/wx/rtc/rich_text_ctrl.rb +1 -1
  85. data/lib/wx/rtc/rich_text_paragraph.rb +1 -1
  86. data/lib/wx/rtc/richtext_buffer.rb +3 -3
  87. data/lib/wx/rtc/richtext_formatting_dialog.rb +2 -2
  88. data/lib/wx/rtc/richtext_style_organiser_dialog.rb +1 -1
  89. data/lib/wx/rtc/symbol_picker_dialog.rb +1 -1
  90. data/lib/wx/stc/require.rb +0 -2
  91. data/lib/wx/stc/styled_text_ctrl.rb +1 -1
  92. data/lib/wx/version.rb +1 -1
  93. data/lib/wx/wxruby/base.rb +8 -2
  94. data/lib/wx/wxruby/cmd/setup.rb +61 -37
  95. data/rakelib/gem.rb +8 -4
  96. data/rakelib/lib/config/mingw.rb +1 -1
  97. data/rakelib/lib/director/about_dialog_info.rb +1 -0
  98. data/rakelib/lib/director/aui_manager.rb +63 -57
  99. data/rakelib/lib/director/aui_notebook.rb +7 -0
  100. data/rakelib/lib/director/colour.rb +1 -1
  101. data/rakelib/lib/director/data_format.rb +1 -1
  102. data/rakelib/lib/director/event.rb +1 -0
  103. data/rakelib/lib/director/event_handler.rb +82 -46
  104. data/rakelib/lib/director/functions.rb +0 -3
  105. data/rakelib/lib/director/list_ctrl.rb +14 -10
  106. data/rakelib/lib/director/locale.rb +2 -0
  107. data/rakelib/lib/director/num_validator.rb +7 -0
  108. data/rakelib/lib/director/tip_window.rb +34 -0
  109. data/rakelib/lib/director/window.rb +9 -1
  110. data/rakelib/lib/director.rb +0 -1
  111. data/rakelib/lib/generate/doc/evt_handler.yaml +31 -12
  112. data/rakelib/lib/specs/interfaces.rb +1 -0
  113. data/tests/test_combo_ctrl.rb +1 -0
  114. data/tests/test_event_handling.rb +158 -31
  115. metadata +6 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c43cace6f097af04e2d856782258313acd4e340719cf7794db36534e6d5e644b
4
- data.tar.gz: 2f93d3489b95ca1a49ce2734222088aab5574841dd337d19fef58ec7a84587fb
3
+ metadata.gz: db9a443c40a2d1cd6ea3d993fe894ad61d1ce737c2a871877ef88ca06d39a629
4
+ data.tar.gz: 43cd46e0283fb6c6706362caa9c6c098bc2cff55216e1d98509c04912afdcf6b
5
5
  SHA512:
6
- metadata.gz: 1db323073fdde9896d9ea6d8ffb9dee71e3f52f52d2836603ff5e6f7274003bb252bc4cff832574454ad4390686a79b1ef01467d5e3b7362aad36d464c67f5ac
7
- data.tar.gz: 0057e4f8462c5b4e2dd79e736ca417cea70305b38efdc796bcc32a8f22fd12d178824ebe92e5d4cca219e1e1dbcafcb9200b5d00d7052d89ddd8f905729af4a0
6
+ metadata.gz: 67d5f62560609aa87f68563a8a51304e87242ca9a084d74ce7f4b2bb65e8765a0d349530c04716d5e34a22e0d62a61e1a2f127fc4a6ebc05f0b4b1591357fd66
7
+ data.tar.gz: bafef4ef1d2f06912ccb0c0dad7d86ed236b6c81862c0309e05fad54de634448d18d78f78bef43d70d1952abaeb38fafb86c7624f015597e6ed5aa46e3dbc602
data/INSTALL.md CHANGED
@@ -14,13 +14,13 @@ The default gem installation command
14
14
  gem install wxruby3
15
15
  ```
16
16
 
17
- and the setup command
17
+ and the setup command (only needed for installations without matching prebuilt binary package)
18
18
 
19
19
  ```shell
20
20
  wxruby setup
21
21
  ```
22
22
 
23
- for installations without prebuilt binary packages should always result in a successfully installed wxRuby3 version.
23
+ should always result in a successfully installed wxRuby3 version.
24
24
 
25
25
  > **NOTE**<br>
26
26
  > Currently installing the wxRuby3 gem for the system supplied Ruby on MacOSX systems does not work.<br>
@@ -71,16 +71,15 @@ The standard release artifacts at [Github](https://github.com/mcorino/wxRuby3/re
71
71
  packages for all supported OS platforms which are automatically built and uploaded for every release.<br>
72
72
  The following tables lists the packages provided by the current wxRuby3 release process:
73
73
 
74
- | OS | Distributions | Architectures | Rubies |
75
- |---------|-------------------------------|-------------------------|----------------------------------------------------|
76
- | Linux | OpenSuSE Leap (latest stable) | x86_64 <b>and</b> ARM64 | Distro provided Ruby <b>and</b> Latest stable Ruby |
77
- | Linux | Fedora (latest stable) | x86_64 <b>and</b> ARM64 | Distro provided Ruby <b>and</b> Latest stable Ruby |
78
- | Linux | Debian (latest stable) | x86_64 <b>and</b> ARM64 | Distro provided Ruby <b>and</b> Latest stable Ruby |
79
- | Linux | Ubuntu (latest stable) | x86_64 <b>and</b> ARM64 | Distro provided Ruby <b>and</b> Latest stable Ruby |
80
- | Windows | NA | x86_64 | Latest stable Ruby |
81
- | OSX | MacOSX 12 | x86_64 <b>and</b> ARM64 | Latest stable Ruby |
82
- | OSX | MacOSX 13 | x86_64 <b>and</b> ARM64 | Latest stable Ruby |
83
- | OSX | MacOSX 14 | ARM64 | Latest stable Ruby |
74
+ | OS | Distributions | Architectures | Rubies |
75
+ |---------|----------------------------------------|-------------------------|----------------------------------------------------|
76
+ | Linux | OpenSuSE Leap (at least latest stable) | x86_64 <b>and</b> ARM64 | Distro provided Ruby <b>and</b> Latest stable Ruby |
77
+ | Linux | Fedora (at least latest stable) | x86_64 <b>and</b> ARM64 | Distro provided Ruby <b>and</b> Latest stable Ruby |
78
+ | Linux | Debian (at least latest stable) | x86_64 <b>and</b> ARM64 | Distro provided Ruby <b>and</b> Latest stable Ruby |
79
+ | Linux | Ubuntu (at least latest stable) | x86_64 <b>and</b> ARM64 | Distro provided Ruby <b>and</b> Latest stable Ruby |
80
+ | Windows | NA | x86_64 | Latest stable Ruby |
81
+ | OSX | MacOSX 13 | x86_64 <b>and</b> ARM64 | Latest stable Ruby |
82
+ | OSX | MacOSX 14 | ARM64 | Latest stable Ruby |
84
83
 
85
84
  ### User created packages
86
85
 
@@ -300,6 +299,11 @@ The initial message shown (between lines starting with '---' ) is indicative of
300
299
  on options passed to the setup command.<br>
301
300
  Building the wxRuby3 native extensions and generating reference documentation will always happen.
302
301
 
302
+ Depending on your configuration the `setup` command will take quite a while. On a recent, modern PC with multicore
303
+ high-end CPU and plenty of memory doing a full source build (both wxWidgets and wxRuby3 libraries) typically takes
304
+ 10-15 minutes. For PC's with older CPU's this could however take up to a full hour (of which the larger part is take
305
+ up by building the wxWidgets libraries).
306
+
303
307
  #### Disable prompting for automatic install
304
308
 
305
309
  To prevent having the setup procedure asking consent the setup procedure can be started with the `--autoinstall` option
data/README.md CHANGED
@@ -17,8 +17,8 @@ Reviving wxRuby
17
17
 
18
18
  wxRuby3 is a cross-platform GUI library for Ruby, based on the mature [wxWidgets](https://wxwidgets.org)
19
19
  GUI toolkit for C++. It uses native widgets wherever possible, providing
20
- the correct look, feel and behaviour to GUI applications on Windows, OS
21
- X and Linux/GTK. wxRuby aims to provide a comprehensive solution to
20
+ the correct look, feel and behaviour to GUI applications on Windows, macOS
21
+ and Linux/GTK. wxRuby aims to provide a comprehensive solution to
22
22
  developing professional-standard desktop applications in Ruby.
23
23
 
24
24
  ## Usage examples
@@ -136,7 +136,8 @@ wxruby setup
136
136
  This last command is a fully automated setup procedure provided by the wxRuby3 **CLI** installed with the gem. This
137
137
  procedure (by default) will analyze your system and install (after asking your consent) any missing software
138
138
  requirements and build the wxRuby3 extension libraries (including a embedded copy of wxWidgets if necessary). It may
139
- take quite a while depending on your system but you can mostly sit back and relax.
139
+ take quite a while depending on your system (around 10-15 minutes on a modern PC but could be significantly longer
140
+ on 'older' PC's) but you can mostly sit back and relax.
140
141
 
141
142
  > **NOTE**<br>
142
143
  > A source based installation requires the availability of the Ruby development headers. User installed Rubies in most cases
@@ -68,15 +68,15 @@ public:
68
68
  else if (rb_obj_is_kind_of(rb_obj, wxRuby_GetDefaultEventClass()) )
69
69
  rb_gc_mark(rb_obj);
70
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
- }
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
80
  }
81
81
 
82
82
  // Implements GC protection across wxRuby. Always called because
@@ -50,6 +50,21 @@ WXRUBY_EXPORT void GC_SetWindowDeleted(void *ptr)
50
50
  // garbage collected at next phase
51
51
  wxRuby_ReleaseEvtHandlerProcs(ptr);
52
52
 
53
+ // wxWidgets requires any pushed event handlers to be popped before
54
+ // the window gets destroyed. Handle this automatically in wxRuby3.
55
+ wxWindowBase* wxwin = (wxWindowBase*)ptr;
56
+ wxEvtHandler* wxevh = wxwin->GetEventHandler();
57
+ while (wxevh && wxevh != wxwin)
58
+ {
59
+ wxEvtHandler* wxevh_next = wxevh->GetNextHandler();
60
+ VALUE rb_evh = SWIG_RubyInstanceFor(wxevh);
61
+ // only remove tracked Ruby instantiated handlers since others are
62
+ // handlers internally set by wxWidgets C++ code and will be removed there
63
+ if (!NIL_P(rb_evh))
64
+ wxwin->RemoveEventHandler(wxevh); // remove and forget
65
+ wxevh = wxevh_next;
66
+ }
67
+
53
68
  // Wx calls this by standard after the window destroy event is
54
69
  // handled, but we need to call it before while the object link is
55
70
  // still around
@@ -219,10 +234,27 @@ WXRUBY_EXPORT void GC_mark_wxWindow(void *ptr)
219
234
  std::wcout << "* GC_mark_wxWindow - found sizer" << std::endl;
220
235
  #endif
221
236
  VALUE rb_sizer = SWIG_RubyInstanceFor(wx_sizer);
222
- if ( rb_sizer != Qnil )
237
+ if ( rb_sizer != Qnil )
223
238
  GC_mark_SizerBelongingToWindow(wx_sizer, rb_sizer);
224
239
  }
225
240
 
241
+ // mark any pushed event handlers
242
+ #ifdef __WXRB_DEBUG__
243
+ if (wxRuby_TraceLevel()>2)
244
+ std::wcout << "* GC_mark_wxWindow - getting event handler" << std::endl;
245
+ #endif
246
+ wxEvtHandler* evh = wx_win->GetEventHandler();
247
+ while (evh && evh != wx_win)
248
+ {
249
+ #ifdef __WXRB_DEBUG__
250
+ if (wxRuby_TraceLevel()>2)
251
+ std::wcout << "* GC_mark_wxWindow - marking event handler" << std::endl;
252
+ #endif
253
+ VALUE rb_evh = SWIG_RubyInstanceFor(evh);
254
+ rb_gc_mark(rb_evh);
255
+ evh = evh->GetNextHandler();
256
+ }
257
+
226
258
  #ifdef __WXRB_DEBUG__
227
259
  if (wxRuby_TraceLevel()>2)
228
260
  std::wcout << "* GC_mark_wxWindow - getting caret" << std::endl;
@@ -235,22 +267,26 @@ WXRUBY_EXPORT void GC_mark_wxWindow(void *ptr)
235
267
  std::wcout << "* GC_mark_wxWindow - found caret" << std::endl;
236
268
  #endif
237
269
  VALUE rb_caret = SWIG_RubyInstanceFor(wx_caret);
238
- rb_gc_mark(rb_caret);
270
+ rb_gc_mark(rb_caret);
239
271
  }
240
272
 
241
- #ifdef __WXRB_DEBUG__
242
- if (wxRuby_TraceLevel()>2)
243
- std::wcout << "* GC_mark_wxWindow - getting droptarget" << std::endl;
244
- #endif
245
- wxDropTarget* wx_droptarget = wx_win->GetDropTarget();
246
- if ( wx_droptarget )
273
+ // be careful; getting drop target may require fully created window (default ctors do not call Create())
274
+ if (wx_win->GetId() != wxID_ANY) // any fully created window has an Id != wxID_ANY
247
275
  {
248
276
  #ifdef __WXRB_DEBUG__
249
277
  if (wxRuby_TraceLevel()>2)
250
- std::wcout << "* GC_mark_wxWindow - found droptarget" << std::endl;
278
+ std::wcout << "* GC_mark_wxWindow - getting droptarget" << std::endl;
251
279
  #endif
252
- VALUE rb_droptarget = SWIG_RubyInstanceFor(wx_droptarget);
253
- rb_gc_mark(rb_droptarget);
280
+ wxDropTarget* wx_droptarget = wx_win->GetDropTarget();
281
+ if ( wx_droptarget )
282
+ {
283
+ #ifdef __WXRB_DEBUG__
284
+ if (wxRuby_TraceLevel()>2)
285
+ std::wcout << "* GC_mark_wxWindow - found droptarget" << std::endl;
286
+ #endif
287
+ VALUE rb_droptarget = SWIG_RubyInstanceFor(wx_droptarget);
288
+ rb_gc_mark(rb_droptarget);
289
+ }
254
290
  }
255
291
 
256
292
  #ifdef __WXRB_DEBUG__
@@ -222,6 +222,7 @@ WXRUBY_EXPORT VALUE wxRuby_WrapWxObjectInRuby(wxObject *wx_obj)
222
222
  // generated on the C++ side.
223
223
  // Cached reference to EvtHandler evt_type_id -> ruby_event_class map
224
224
  static VALUE Evt_Type_Map = NULL;
225
+ static VALUE WxRuby_cAsyncProcCallEvent = Qnil;
225
226
 
226
227
  #ifdef __WXRB_DEBUG__
227
228
  WXRUBY_EXPORT VALUE wxRuby_WrapWxEventInRuby(void* rcvr, wxEvent *wx_event)
@@ -240,17 +241,31 @@ WXRUBY_EXPORT VALUE wxRuby_WrapWxEventInRuby(wxEvent *wx_event)
240
241
  std::wcout << "* wxRuby_WrapWxEventInRuby(rcvr=" << rcvr << ", " << wx_event << ":{" << wx_event->GetEventType() << "@" << wx_event->GetEventObject() << "})" << std::endl;
241
242
  #endif
242
243
 
243
- // Then, look up the event type in this hash (MUCH faster than calling
244
- // EvtHandler.evt_class_for_type method)
245
- VALUE rb_event_type_id = INT2NUM( wx_event->GetEventType() );
246
- VALUE rb_event_class = rb_hash_aref(Evt_Type_Map, rb_event_type_id);
247
-
248
- // Check we have a valid class; warn and map to default Wx::Event if not
249
- if ( NIL_P(rb_event_class) )
244
+ VALUE rb_event_type_id = INT2NUM(wx_event->GetEventType());
245
+ VALUE rb_event_class = Qnil;
246
+ // wxEVT_ASYNC_METHOD_CALL is a special case which has no Ruby class mapping registered
247
+ if (wx_event->GetEventType() == wxEVT_ASYNC_METHOD_CALL)
250
248
  {
251
- rb_event_class = wxRuby_GetDefaultEventClass ();
252
- wxString class_name( wx_event->GetClassInfo()->GetClassName() );
253
- rb_warning("Unmapped event type %i (%s)", wx_event->GetEventType(), (const char *)class_name.mb_str());
249
+ if (WxRuby_cAsyncProcCallEvent == Qnil)
250
+ {
251
+ WxRuby_cAsyncProcCallEvent = rb_eval_string("Wx::AsyncProcCallEvent");
252
+ }
253
+ rb_event_class = WxRuby_cAsyncProcCallEvent;
254
+ }
255
+ else
256
+ {
257
+ // Then, look up the event type in this hash (MUCH faster than calling
258
+ // EvtHandler.evt_class_for_type method)
259
+ rb_event_type_id = INT2NUM( wx_event->GetEventType());
260
+ rb_event_class = rb_hash_aref(Evt_Type_Map, rb_event_type_id);
261
+
262
+ // Check we have a valid class; warn and map to default Wx::Event if not
263
+ if (NIL_P(rb_event_class))
264
+ {
265
+ rb_event_class = wxRuby_GetDefaultEventClass ();
266
+ wxString class_name( wx_event->GetClassInfo()->GetClassName() );
267
+ rb_warning("Unmapped event type %i (%s)", wx_event->GetEventType(), (const char *)class_name.mb_str());
268
+ }
254
269
  }
255
270
 
256
271
  // Now, see if we have a tracked instance of this object already
@@ -264,7 +279,7 @@ WXRUBY_EXPORT VALUE wxRuby_WrapWxEventInRuby(wxEvent *wx_event)
264
279
  // really the right thing, and not some stale reference.
265
280
  if ( rb_event != Qnil )
266
281
  {
267
- if ( rb_obj_is_kind_of(rb_event, rb_event_class ) )
282
+ if (rb_obj_is_kind_of(rb_event, rb_event_class))
268
283
  return rb_event; // OK
269
284
  else
270
285
  SWIG_RubyRemoveTracking((void *)wx_event); // Remove stale ref
@@ -275,7 +290,10 @@ WXRUBY_EXPORT VALUE wxRuby_WrapWxEventInRuby(wxEvent *wx_event)
275
290
  rb_event = Data_Wrap_Struct(rb_event_class, 0, 0, 0);
276
291
  DATA_PTR(rb_event) = wx_event;
277
292
  // do not forget to mark the instance with the mangled swig type name
278
- swig_type_info* type = wxRuby_GetSwigTypeForClass(rb_event_class);
293
+ // (as there is no swig_type for the Wx::AsyncProcCallEvent class use it's base Wx::Event)
294
+ swig_type_info* type = wx_event->GetEventType() == wxEVT_ASYNC_METHOD_CALL ?
295
+ wxRuby_GetSwigTypeForClass(wxRuby_GetDefaultEventClass()) :
296
+ wxRuby_GetSwigTypeForClass(rb_event_class);
279
297
  rb_iv_set(rb_event, "@__swigtype__", rb_str_new2(type->name));
280
298
 
281
299
  #if __WXRB_DEBUG__
@@ -11,7 +11,7 @@ class Wx::AUI::AuiFloatingFrame
11
11
  # that designates the event skipped.
12
12
  if Wx::WXWIDGETS_VERSION < '3.3'
13
13
  wx_initialize = instance_method :initialize
14
- define_method :initialize do |*args|
14
+ wx_redefine_method :initialize do |*args|
15
15
  wx_initialize.bind(self).call(*args)
16
16
  evt_window_destroy { |evt| evt.skip }
17
17
  end
@@ -8,7 +8,7 @@ module Wx
8
8
  class AuiManager
9
9
 
10
10
  wx_each_pane = instance_method(:each_pane)
11
- define_method(:each_pane) do |&block|
11
+ wx_redefine_method(:each_pane) do |&block|
12
12
  if block
13
13
  wx_each_pane.bind(self).call(&block)
14
14
  else
@@ -33,28 +33,17 @@ module Wx
33
33
 
34
34
  if WXWIDGETS_VERSION >= '3.3.0'
35
35
 
36
- class AuiDockInfo
36
+ class AuiTabLayoutInfo < AuiDockLayoutInfo
37
37
 
38
- wx_each_pane = instance_method(:each_pane)
39
- define_method(:each_pane) do |&block|
40
- if block
41
- wx_each_pane.bind(self).call(&block)
42
- else
43
- ::Enumerator.new { |y| wx_each_pane.bind(self).call { |p| y << p } }
44
- end
45
- end
46
-
47
- def get_panes
48
- each_pane.to_a
49
- end
50
- alias :panes :get_panes
38
+ alias :pages :get_pages
39
+ alias :pages= :set_pages
51
40
 
52
41
  end
53
42
 
54
43
  class AuiDeserializer
55
44
 
56
45
  wx_initialize = instance_method(:initialize)
57
- define_method(:initialize) do |manager|
46
+ wx_redefine_method(:initialize) do |manager|
58
47
  wx_initialize.bind(self).call(manager)
59
48
  @manager = manager # prevent GC for lifetime of deserializer
60
49
  end
@@ -11,7 +11,7 @@ class Wx::AUI::AuiNotebook
11
11
  # that designates the event skipped.
12
12
  if Wx::WXWIDGETS_VERSION < '3.3'
13
13
  wx_initialize = instance_method :initialize
14
- define_method :initialize do |*args|
14
+ wx_redefine_method :initialize do |*args|
15
15
  wx_initialize.bind(self).call(*args)
16
16
  evt_window_destroy { |evt| evt.skip }
17
17
  end
@@ -10,5 +10,3 @@ require_relative './auimanager'
10
10
  require_relative './auinotebook'
11
11
  require_relative './auifloatframe'
12
12
  require_relative './aui_tab_ctrl'
13
-
14
- Wx::Dialog.setup_dialog_functors(Wx::AUI)
@@ -16,7 +16,7 @@ class Wx::AcceleratorTable
16
16
  # and allow entries to be specified in terser form [mod, key, id]
17
17
  # rather than full AcceleratorEntry.new call.
18
18
  wx_init = self.instance_method(:initialize)
19
- define_method(:initialize) do | *args |
19
+ wx_redefine_method(:initialize) do | *args |
20
20
  # Test for old-style arg passing in a single array
21
21
  if args.length == 1 and args.first.kind_of?(Array) and
22
22
  args.first.all? { | e | e.kind_of?(Wx::AcceleratorEntry) }
@@ -13,7 +13,7 @@ module Wx
13
13
  # non-existent file is given to the constructor; otherwise, wx Widgets
14
14
  # just carries on with an empty bitmap, which may cause faults later
15
15
  wx_init = self.instance_method(:initialize)
16
- define_method(:initialize) do | *args |
16
+ wx_redefine_method(:initialize) do | *args |
17
17
  if args[0].kind_of? String
18
18
  if not File.exist?( File.expand_path(args[0]) )
19
19
  Kernel.raise( ArgumentError,
@@ -33,7 +33,7 @@ module Wx
33
33
 
34
34
  # Redefine this method to accept either a single animation or an animation bundle
35
35
  wx_set_animation = self.instance_method(:set_animation)
36
- define_method(:set_animation) do | arg |
36
+ wx_redefine_method(:set_animation) do | arg |
37
37
  if Wx::Animation === arg
38
38
  arg = Wx::AnimationBundle.new(arg)
39
39
  end
data/lib/wx/core/app.rb CHANGED
@@ -95,7 +95,7 @@ class Wx::App
95
95
  # WxRuby. Such messages usually indicate that the API is being used
96
96
  # incorrectly; the file/line reference points to the place in the
97
97
  # WxWidgets source code where the assertion was made.
98
- def on_assert_failure(file, line, func, condition, message)
98
+ wx_redefine_method :on_assert_failure do |file, line, func, condition, message|
99
99
  warn %Q{Wx WARNING: ASSERT #{condition} fired with "#{message}" at (#{func}@#{file}:#{line})}
100
100
  end
101
101
 
@@ -14,25 +14,25 @@ class Wx::ArtProvider
14
14
 
15
15
  class << self
16
16
  wx_push_back = instance_method(:push_back)
17
- define_method(:push_back) do | art_prov |
17
+ wx_redefine_method(:push_back) do | art_prov |
18
18
  wx_push_back.bind(self).call(art_prov)
19
19
  @__art_provs.push(art_prov)
20
20
  end
21
21
 
22
22
  wx_pop = instance_method(:pop)
23
- define_method(:pop) do
23
+ wx_redefine_method(:pop) do
24
24
  wx_pop.bind(self).call
25
25
  @__art_provs.pop
26
26
  end
27
27
 
28
28
  wx_push = instance_method(:push)
29
- define_method(:push) do | art_prov |
29
+ wx_redefine_method(:push) do | art_prov |
30
30
  wx_push.bind(self).call(art_prov)
31
31
  @__art_provs.unshift(art_prov)
32
32
  end
33
33
 
34
34
  wx_delete = instance_method(:delete)
35
- define_method(:delete) do | art_prov |
35
+ wx_redefine_method(:delete) do | art_prov |
36
36
  wx_delete.bind(self).call(art_prov)
37
37
  @__art_provs.delete(art_prov)
38
38
  end
@@ -78,7 +78,7 @@ module Wx
78
78
  # later. Also, be helpful and try to guess the bitmap type from the
79
79
  # filename if it's not specified
80
80
  wx_init = self.instance_method(:initialize)
81
- define_method(:initialize) do | *args |
81
+ wx_redefine_method(:initialize) do | *args |
82
82
  # If creating from a file, check it exists
83
83
  if args[0].kind_of? String
84
84
  if not File.exist?( File.expand_path(args[0]) )
@@ -11,7 +11,7 @@ module Wx
11
11
  class BitmapComboBox < Wx::ComboBox
12
12
 
13
13
  wx_append = instance_method :append
14
- define_method :append do |item, *rest| #bitmap=Wx::NULL_BITMAP, data=nil|
14
+ wx_redefine_method :append do |item, *rest| #bitmap=Wx::NULL_BITMAP, data=nil|
15
15
  if ::Array === item
16
16
  super(item, *rest)
17
17
  elsif rest.empty? || Wx::Bitmap === rest.first
@@ -22,7 +22,7 @@ module Wx
22
22
  end
23
23
 
24
24
  wx_insert = instance_method :insert
25
- define_method :insert do |item, *rest| # bitmap, pos, data=nil|
25
+ wx_redefine_method :insert do |item, *rest| # bitmap, pos, data=nil|
26
26
  if ::Array === item
27
27
  super(item, *rest)
28
28
  elsif rest.empty? || Wx::Bitmap === rest.first
@@ -14,7 +14,7 @@ class Wx::ClientDC
14
14
  # always be used via Window#paint, which takes a block receiving the
15
15
  # DC. This ensures that the DC is cleaned up at the correct time,
16
16
  # avoiding errors and segfaults on exit.
17
- define_method(:initialize) do | *args |
17
+ wx_redefine_method(:initialize) do | *args |
18
18
  Kernel.raise RuntimeError,
19
19
  "Do not instantiate ClientDC directly; use Window#paint",
20
20
  caller[1..-1]
@@ -29,7 +29,7 @@ class Wx::Clipboard
29
29
  Kernel.raise "Could not open clipboard"
30
30
  end
31
31
  yield clip
32
- ensure
32
+ ensure
33
33
  clip.close if clip
34
34
  end
35
35
  end
@@ -41,19 +41,19 @@ class Wx::Clipboard
41
41
  # These methods affect the clipboard contents; each time, update the
42
42
  # record with the changed data contents
43
43
  wx_add_data = instance_method(:add_data)
44
- define_method(:add_data) do | the_data |
44
+ wx_redefine_method(:add_data) do | the_data |
45
45
  @@__clip_data << the_data
46
46
  wx_add_data.bind(self).call(the_data)
47
47
  end
48
48
 
49
49
  wx_clear = instance_method(:clear)
50
- define_method(:clear) do
50
+ wx_redefine_method(:clear) do
51
51
  wx_clear.bind(self).call
52
52
  @@__clip_data.clear
53
53
  end
54
54
 
55
55
  wx_set_data = instance_method(:set_data)
56
- define_method(:set_data) do | the_data |
56
+ wx_redefine_method(:set_data) do | the_data |
57
57
  @@__clip_data = [ the_data ]
58
58
  wx_set_data.bind(self).call(the_data)
59
59
  end
@@ -17,7 +17,7 @@ module Wx
17
17
  # invalid colour value is given. This might be an unknown colour
18
18
  # string (eg 'dark blue') or out-of-bounds integer values (<0 or >255)
19
19
  wx_init = self.instance_method(:initialize)
20
- define_method(:initialize) do | *args |
20
+ wx_redefine_method(:initialize) do | *args |
21
21
  begin
22
22
  wx_init.bind(self).call(*args)
23
23
  # Invalid integer values raise SWIG 'no matching func'
@@ -15,7 +15,7 @@ module Wx
15
15
  # redefine #clear method to take care of client data and to call the proper #clear_items method
16
16
  # (not the #clear method inherited from the TextEntry mixin)
17
17
  wx_clear = instance_method :clear_items
18
- define_method :clear do
18
+ wx_redefine_method :clear do
19
19
  wx_clear.bind(self).call
20
20
  end
21
21
 
@@ -42,7 +42,7 @@ module Wx
42
42
 
43
43
  # add protection against exceptions raised in blocks
44
44
  wx_for_path = instance_method :for_path
45
- define_method :for_path do |path, &block|
45
+ wx_redefine_method :for_path do |path, &block|
46
46
  if block
47
47
  ex = nil
48
48
  rc = wx_for_path.bind(self).call(path) do |cfg, key|
@@ -64,7 +64,7 @@ module Wx
64
64
  # add Enumerator support
65
65
 
66
66
  wx_each_entry = instance_method :each_entry
67
- define_method :each_entry do |&block|
67
+ wx_redefine_method :each_entry do |&block|
68
68
  if block_given?
69
69
  wx_each_entry.bind(self).call { |k| block.call(k, read(k)) }
70
70
  else
@@ -73,7 +73,7 @@ module Wx
73
73
  end
74
74
 
75
75
  wx_each_group = instance_method :each_group
76
- define_method :each_group do |&block|
76
+ wx_redefine_method :each_group do |&block|
77
77
  if block_given?
78
78
  wx_each_group.bind(self).call { |k| block.call(k, Group.new(self, self.path.dup.push(k))) }
79
79
  else
@@ -83,20 +83,20 @@ module Wx
83
83
 
84
84
  # make this return a path array
85
85
  wx_path = instance_method :path
86
- define_method :path do
86
+ wx_redefine_method :path do
87
87
  wx_path.bind(self).call.split(ConfigBase::SEPARATOR)
88
88
  end
89
89
 
90
90
  # protect against attempts to rename complete paths
91
91
  wx_rename = instance_method :rename
92
- define_method :rename do |old_key, new_key|
92
+ wx_redefine_method :rename do |old_key, new_key|
93
93
  raise ArgumentError, 'No paths allowed' if old_key.index(ConfigBase::SEPARATOR) || new_key.index(ConfigBase::SEPARATOR)
94
94
  wx_rename.bind(self).call(old_key, new_key)
95
95
  end
96
96
 
97
97
  # fix recursive number_of_xxx methods as wxRegConfig does not support this currently
98
98
  wx_number_of_entries = instance_method :number_of_entries
99
- define_method :number_of_entries do |recurse=false|
99
+ wx_redefine_method :number_of_entries do |recurse=false|
100
100
  if recurse
101
101
  each_group.inject(wx_number_of_entries.bind(self).call) { |c, (_, g)| c + g.number_of_entries(true) }
102
102
  else
@@ -105,7 +105,7 @@ module Wx
105
105
  end
106
106
 
107
107
  wx_number_of_groups = instance_method :number_of_groups
108
- define_method :number_of_groups do |recurse=false|
108
+ wx_redefine_method :number_of_groups do |recurse=false|
109
109
  if recurse
110
110
  each_group.inject(wx_number_of_groups.bind(self).call) { |c, (_, g)| c + g.number_of_groups(true) }
111
111
  else
@@ -15,7 +15,7 @@ module Wx
15
15
 
16
16
  # make sure to honor the inherited common overloads
17
17
  wx_get_client_object = instance_method :get_client_object
18
- define_method :get_client_object do |*args|
18
+ wx_redefine_method :get_client_object do |*args|
19
19
  if args.empty?
20
20
  super()
21
21
  else
@@ -23,7 +23,7 @@ module Wx
23
23
  end
24
24
  end
25
25
  wx_set_client_object = instance_method :set_client_object
26
- define_method :set_client_object do |*args|
26
+ wx_redefine_method :set_client_object do |*args|
27
27
  if args.size < 2
28
28
  super(*args)
29
29
  else
@@ -45,7 +45,7 @@ module Wx
45
45
 
46
46
  # Overload to provide Enumerator without block
47
47
  wx_each_string = instance_method :each_string
48
- define_method :each_string do |&block|
48
+ wx_redefine_method :each_string do |&block|
49
49
  if block
50
50
  wx_each_string.bind(self).call(&block)
51
51
  else
@@ -25,17 +25,17 @@ module Wx
25
25
  # using pure Ruby
26
26
 
27
27
  wx_get_data_size = instance_method :get_data_size
28
- define_method :get_data_size do |format = nil|
28
+ wx_redefine_method :get_data_size do |format = nil|
29
29
  wx_get_data_size.bind(self).call(format || self.get_format)
30
30
  end
31
31
 
32
32
  wx_get_data_here = instance_method :get_data_here
33
- define_method :get_data_here do |format = nil|
33
+ wx_redefine_method :get_data_here do |format = nil|
34
34
  wx_get_data_here.bind(self).call(format || self.get_format)
35
35
  end
36
36
 
37
37
  wx_set_data = instance_method :set_data
38
- define_method :set_data do |*args|
38
+ wx_redefine_method :set_data do |*args|
39
39
  if args.size>1
40
40
  format, buf = args
41
41
  else
@@ -66,7 +66,7 @@ module Wx
66
66
  self._set_data(buf)
67
67
  end
68
68
 
69
- def _get_data_size
69
+ wx_redefine_method :_get_data_size do
70
70
  (_get_data || '').bytesize
71
71
  end
72
72
  protected :_get_data_size
@@ -11,10 +11,16 @@
11
11
 
12
12
  class Wx::DataFormat
13
13
  def ==(other)
14
- if self.get_type > Wx::DataFormatId::DF_INVALID
15
- self.get_type == other.get_type
14
+ if other.is_a?(Wx::DataFormatId)
15
+ self.get_type == other
16
+ elsif other.is_a?(self.class)
17
+ if self.get_type > Wx::DataFormatId::DF_INVALID
18
+ self.get_type == other.get_type
19
+ else
20
+ self.id == other.id
21
+ end
16
22
  else
17
- self.id == other.id
23
+ false
18
24
  end
19
25
  end
20
26
  end