wxruby3 1.3.0 → 1.4.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (139) 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/custom/director.swg +11 -3
  6. data/ext/wxruby3/swig/custom/rubyapi.swg +15 -1
  7. data/ext/wxruby3/swig/mark_free_impl.i +47 -11
  8. data/ext/wxruby3/swig/wx.i +30 -12
  9. data/lib/wx/aui/auifloatframe.rb +1 -1
  10. data/lib/wx/aui/auimanager.rb +50 -14
  11. data/lib/wx/aui/auinotebook.rb +1 -1
  12. data/lib/wx/aui/require.rb +0 -2
  13. data/lib/wx/core/acceleratortable.rb +1 -1
  14. data/lib/wx/core/animation.rb +2 -2
  15. data/lib/wx/core/app.rb +1 -1
  16. data/lib/wx/core/array_ext.rb +1 -0
  17. data/lib/wx/core/artprovider.rb +4 -4
  18. data/lib/wx/core/bitmap.rb +1 -1
  19. data/lib/wx/core/bitmap_combobox.rb +2 -2
  20. data/lib/wx/core/brush.rb +8 -0
  21. data/lib/wx/core/clientdc.rb +1 -1
  22. data/lib/wx/core/clipboard.rb +4 -4
  23. data/lib/wx/core/colour.rb +1 -1
  24. data/lib/wx/core/combobox.rb +1 -1
  25. data/lib/wx/core/config.rb +7 -7
  26. data/lib/wx/core/controlwithitems.rb +3 -3
  27. data/lib/wx/core/data_object.rb +4 -4
  28. data/lib/wx/core/dataformat.rb +9 -3
  29. data/lib/wx/core/defs.rb +49 -0
  30. data/lib/wx/core/dialog.rb +3 -2
  31. data/lib/wx/core/enum.rb +16 -3
  32. data/lib/wx/core/event.rb +3 -3
  33. data/lib/wx/core/evthandler.rb +317 -289
  34. data/lib/wx/core/file_dialog.rb +1 -1
  35. data/lib/wx/core/find_replace_dialog.rb +2 -2
  36. data/lib/wx/core/font.rb +14 -0
  37. data/lib/wx/core/functions.rb +1 -1
  38. data/lib/wx/core/genericdirctrl.rb +1 -1
  39. data/lib/wx/core/geometry.rb +2 -2
  40. data/lib/wx/core/graphics_pen_info.rb +1 -1
  41. data/lib/wx/core/hboxsizer.rb +24 -4
  42. data/lib/wx/core/helpprovider.rb +1 -1
  43. data/lib/wx/core/icon.rb +1 -1
  44. data/lib/wx/core/image.rb +2 -2
  45. data/lib/wx/core/imagelist.rb +1 -1
  46. data/lib/wx/core/locale.rb +5 -5
  47. data/lib/wx/core/log.rb +8 -8
  48. data/lib/wx/core/menu.rb +3 -3
  49. data/lib/wx/core/module_ext.rb +16 -0
  50. data/lib/wx/core/owner_drawn_combobox.rb +3 -3
  51. data/lib/wx/core/pen.rb +20 -0
  52. data/lib/wx/core/pen_info.rb +1 -1
  53. data/lib/wx/core/persistence_manager.rb +2 -2
  54. data/lib/wx/core/real_point.rb +1 -0
  55. data/lib/wx/core/rect.rb +1 -1
  56. data/lib/wx/core/secret_store.rb +1 -1
  57. data/lib/wx/core/simplehelpprovider.rb +1 -1
  58. data/lib/wx/core/sizer.rb +166 -39
  59. data/lib/wx/core/splash_screen.rb +1 -1
  60. data/lib/wx/core/standard_paths.rb +1 -1
  61. data/lib/wx/core/task_bar_button.rb +1 -1
  62. data/lib/wx/core/text_entry.rb +1 -1
  63. data/lib/wx/core/textctrl.rb +2 -2
  64. data/lib/wx/core/timer.rb +2 -2
  65. data/lib/wx/core/tree_ctrl.rb +1 -1
  66. data/lib/wx/core/v_list_box.rb +1 -1
  67. data/lib/wx/core/validator.rb +2 -2
  68. data/lib/wx/core/variant.rb +2 -2
  69. data/lib/wx/core/vboxsizer.rb +24 -4
  70. data/lib/wx/core/window.rb +48 -2
  71. data/lib/wx/core/xmlresource.rb +4 -4
  72. data/lib/wx/core.rb +2 -0
  73. data/lib/wx/doc/array_ext.rb +1 -0
  74. data/lib/wx/doc/aui/auimanager.rb +2 -0
  75. data/lib/wx/doc/enum.rb +26 -0
  76. data/lib/wx/doc/evthandler.rb +1 -0
  77. data/lib/wx/doc/gdi_common.rb +1 -0
  78. data/lib/wx/doc/tip_window.rb +22 -0
  79. data/lib/wx/grid/grid.rb +3 -3
  80. data/lib/wx/grid/require.rb +0 -2
  81. data/lib/wx/html/htmlhelpcontroller.rb +1 -1
  82. data/lib/wx/html/htmlwindow.rb +1 -1
  83. data/lib/wx/html/require.rb +0 -2
  84. data/lib/wx/html/simple_html_listbox.rb +3 -3
  85. data/lib/wx/keyword_ctors.rb +14 -7
  86. data/lib/wx/keyword_defs.rb +7 -7
  87. data/lib/wx/pg/pg_properties.rb +1 -1
  88. data/lib/wx/pg/pg_property.rb +3 -3
  89. data/lib/wx/pg/property_grid.rb +2 -2
  90. data/lib/wx/pg/property_grid_interface.rb +2 -2
  91. data/lib/wx/pg/require.rb +0 -2
  92. data/lib/wx/prt/previewframe.rb +1 -1
  93. data/lib/wx/prt/require.rb +0 -2
  94. data/lib/wx/rbn/ribbon_control.rb +1 -1
  95. data/lib/wx/rbn/ribbon_page.rb +1 -1
  96. data/lib/wx/rbn/ribbon_panel.rb +1 -1
  97. data/lib/wx/rtc/require.rb +0 -2
  98. data/lib/wx/rtc/rich_text_composite_object.rb +1 -1
  99. data/lib/wx/rtc/rich_text_ctrl.rb +1 -1
  100. data/lib/wx/rtc/rich_text_paragraph.rb +1 -1
  101. data/lib/wx/rtc/richtext_buffer.rb +3 -3
  102. data/lib/wx/rtc/richtext_formatting_dialog.rb +2 -2
  103. data/lib/wx/rtc/richtext_style_organiser_dialog.rb +1 -1
  104. data/lib/wx/rtc/symbol_picker_dialog.rb +1 -1
  105. data/lib/wx/stc/require.rb +0 -2
  106. data/lib/wx/stc/styled_text_ctrl.rb +1 -1
  107. data/lib/wx/version.rb +1 -1
  108. data/lib/wx/wxruby/base.rb +8 -2
  109. data/lib/wx/wxruby/cmd/setup.rb +61 -37
  110. data/rakelib/gem.rb +8 -4
  111. data/rakelib/lib/config/mingw.rb +1 -1
  112. data/rakelib/lib/core/include/swigrubyrun.inc +2 -2
  113. data/rakelib/lib/director/about_dialog_info.rb +1 -0
  114. data/rakelib/lib/director/aui_manager.rb +124 -3
  115. data/rakelib/lib/director/aui_notebook.rb +7 -0
  116. data/rakelib/lib/director/colour.rb +1 -1
  117. data/rakelib/lib/director/data_format.rb +1 -1
  118. data/rakelib/lib/director/dialog.rb +4 -2
  119. data/rakelib/lib/director/event.rb +1 -0
  120. data/rakelib/lib/director/event_handler.rb +82 -46
  121. data/rakelib/lib/director/functions.rb +0 -3
  122. data/rakelib/lib/director/list_ctrl.rb +14 -10
  123. data/rakelib/lib/director/locale.rb +2 -0
  124. data/rakelib/lib/director/num_validator.rb +7 -0
  125. data/rakelib/lib/director/pgproperties.rb +2 -2
  126. data/rakelib/lib/director/property_grid_interface.rb +4 -3
  127. data/rakelib/lib/director/textctrl.rb +7 -0
  128. data/rakelib/lib/director/tip_window.rb +34 -0
  129. data/rakelib/lib/director/variant.rb +2 -2
  130. data/rakelib/lib/director/window.rb +9 -1
  131. data/rakelib/lib/director.rb +0 -1
  132. data/rakelib/lib/extractor/function.rb +5 -0
  133. data/rakelib/lib/generate/doc/evt_handler.yaml +31 -12
  134. data/rakelib/lib/specs/interfaces.rb +1 -0
  135. data/rakelib/lib/typemap/common.rb +2 -2
  136. data/samples/dialogs/dialogs.rb +1 -1
  137. data/tests/test_combo_ctrl.rb +1 -0
  138. data/tests/test_event_handling.rb +158 -31
  139. metadata +7 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ed10da8feaf6d3e77a775f3386dd9970314810239e7e4ce1c2c447658f6f4106
4
- data.tar.gz: 125e2ddedb7148987456508b887dacae1262753a408cd39503faff80fe6435cc
3
+ metadata.gz: db9a443c40a2d1cd6ea3d993fe894ad61d1ce737c2a871877ef88ca06d39a629
4
+ data.tar.gz: 43cd46e0283fb6c6706362caa9c6c098bc2cff55216e1d98509c04912afdcf6b
5
5
  SHA512:
6
- metadata.gz: dbe29edc61e3c139efec7d90d5f80b17b3671c141f3f6f3421905320de87b2900e90785bd83550e6b9d502bb184bef4a58c5061c7271629dc5f83d4c2f55ac94
7
- data.tar.gz: 2b420414ee1c4b8eefa3fa797c5452e8490048876bfe2172fa14f8ffdd4937c907a4714c6af1650768e91cab08f4746881b5c19989bf66778f4ed4a1d2506020
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
@@ -189,6 +189,9 @@ namespace Swig {
189
189
  }
190
190
  };
191
191
 
192
+ // SWIG < 4.3.0
193
+ #if SWIG_VERSION < 0x040300
194
+
192
195
  /* Simple thread abstraction for pthreads on win32 */
193
196
  #ifdef __THREAD__
194
197
  # define __PTHREAD__
@@ -219,8 +222,14 @@ namespace Swig {
219
222
  }
220
223
  };
221
224
  # define SWIG_GUARD(mutex) Guard _guard(mutex)
225
+ # define SWIG_GUARD_DEFINITION(_cls, _mutex) pthread_mutex_t _cls::_mutex
226
+ # define SWIG_GUARD_DECLARATION(_mutex) static pthread_mutex_t _mutex
222
227
  #else
223
228
  # define SWIG_GUARD(mutex)
229
+ # define SWIG_GUARD_DEFINITION(_cls, _mutex)
230
+ # define SWIG_GUARD_DECLARATION(_mutex)
231
+ #endif
232
+
224
233
  #endif
225
234
 
226
235
  /* director base class */
@@ -258,9 +267,7 @@ namespace Swig {
258
267
  private:
259
268
  typedef std::map<void *, GCItem_var> swig_ownership_map;
260
269
  mutable swig_ownership_map swig_owner;
261
- #ifdef __PTHREAD__
262
- static pthread_mutex_t swig_mutex_own;
263
- #endif
270
+ SWIG_GUARD_DECLARATION(swig_mutex_own);
264
271
 
265
272
  public:
266
273
  template <typename Type>
@@ -287,4 +294,5 @@ namespace Swig {
287
294
 
288
295
  swig_ruby_owntype swig_release_ownership(void *vptr) const;
289
296
  };
297
+ SWIG_GUARD_DEFINITION(Director, swig_mutex_own);
290
298
  }
@@ -12,8 +12,22 @@ extern "C" {
12
12
  #endif
13
13
 
14
14
  WXRUBY_EXPORT VALUE
15
- SWIG_Ruby_AppendOutput(VALUE target, VALUE o);
15
+ SWIG_wxRuby_AppendOutput(VALUE target, VALUE o, int is_void);
16
16
 
17
17
  #ifdef __cplusplus
18
18
  }
19
19
  #endif
20
+
21
+ /* SWIG >= 4.3.0 version */
22
+ inline VALUE
23
+ SWIG_Ruby_AppendOutput(VALUE target, VALUE o, int is_void)
24
+ {
25
+ return SWIG_wxRuby_AppendOutput(target, o, is_void);
26
+ }
27
+
28
+ /* SWIG < 4.3.0 version */
29
+ inline VALUE
30
+ SWIG_Ruby_AppendOutput(VALUE target, VALUE o)
31
+ {
32
+ return SWIG_wxRuby_AppendOutput(target, o, -1);
33
+ }
@@ -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
@@ -2,19 +2,55 @@
2
2
  #
3
3
  # This software is released under the MIT license.
4
4
 
5
- class Wx::AUI::AuiManager
6
- def get_all_panes
7
- ::Enumerator.new { |y| each_pane { |p| y << p } }
8
- end
9
- alias :all_panes :get_all_panes
10
-
11
- unless Wx::EvtHandler.event_type_for_name(:evt_aui_find_manager)
12
- # missing from XML API refs
13
- Wx::EvtHandler.register_event_type Wx::EvtHandler::EventType[
14
- 'evt_aui_find_manager', 0,
15
- Wx::AUI::EVT_AUI_FIND_MANAGER,
16
- Wx::AUI::AuiManagerEvent
17
- ] if Wx::AUI.const_defined?(:EVT_AUI_FIND_MANAGER)
18
- end
5
+ module Wx
6
+ module AUI
7
+
8
+ class AuiManager
9
+
10
+ wx_each_pane = instance_method(:each_pane)
11
+ wx_redefine_method(:each_pane) do |&block|
12
+ if block
13
+ wx_each_pane.bind(self).call(&block)
14
+ else
15
+ ::Enumerator.new { |y| wx_each_pane.bind(self).call { |p| y << p } }
16
+ end
17
+ end
18
+
19
+ def get_all_panes
20
+ each_pane.to_a
21
+ end
22
+ alias :all_panes :get_all_panes
23
+
24
+ unless Wx::EvtHandler.event_type_for_name(:evt_aui_find_manager)
25
+ # missing from XML API refs
26
+ Wx::EvtHandler.register_event_type Wx::EvtHandler::EventType[
27
+ 'evt_aui_find_manager', 0,
28
+ Wx::AUI::EVT_AUI_FIND_MANAGER,
29
+ Wx::AUI::AuiManagerEvent
30
+ ] if Wx::AUI.const_defined?(:EVT_AUI_FIND_MANAGER)
31
+ end
32
+ end
33
+
34
+ if WXWIDGETS_VERSION >= '3.3.0'
35
+
36
+ class AuiTabLayoutInfo < AuiDockLayoutInfo
19
37
 
38
+ alias :pages :get_pages
39
+ alias :pages= :set_pages
40
+
41
+ end
42
+
43
+ class AuiDeserializer
44
+
45
+ wx_initialize = instance_method(:initialize)
46
+ wx_redefine_method(:initialize) do |manager|
47
+ wx_initialize.bind(self).call(manager)
48
+ @manager = manager # prevent GC for lifetime of deserializer
49
+ end
50
+
51
+ end
52
+
53
+ end
54
+
55
+ end
20
56
  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
 
@@ -25,6 +25,7 @@ module Wx
25
25
  x, y = self
26
26
  Wx::RealPoint.new(x || Wx::DEFAULT_COORD, y || Wx::DEFAULT_COORD)
27
27
  end
28
+ alias :to_real :to_real_point
28
29
 
29
30
  end
30
31
 
@@ -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
data/lib/wx/core/brush.rb CHANGED
@@ -6,8 +6,16 @@
6
6
  # Copyright 2004-2007, wxRuby development team
7
7
  # released under the MIT-like wxRuby2 license
8
8
 
9
+ require_relative './enum'
10
+
9
11
  module Wx
10
12
 
11
13
  TheBrushList = Wx::Brush
12
14
 
15
+ class BrushStyle < Wx::Enum
16
+
17
+ set_non_distinct(%i[BRUSHSTYLE_INVALID BRUSHSTYLE_FIRST_HATCH BRUSHSTYLE_LAST_HATCH])
18
+
19
+ end
20
+
13
21
  end
@@ -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