wxruby3 1.7.0 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (220) hide show
  1. checksums.yaml +4 -4
  2. data/INSTALL.md +27 -2
  3. data/README.md +15 -15
  4. data/ext/wxruby3/include/wxRubyApp.h +145 -46
  5. data/ext/wxruby3/include/wxruby-ComboPopup.h +25 -8
  6. data/ext/wxruby3/include/wxruby-GCTracking.h +262 -0
  7. data/ext/wxruby3/include/wxruby-MBConv.h +190 -0
  8. data/ext/wxruby3/include/wxruby-SharedEventHandler.h +183 -0
  9. data/ext/wxruby3/include/wxruby-SharedPtr.h +104 -0
  10. data/ext/wxruby3/include/wxruby-runtime.h +29 -0
  11. data/ext/wxruby3/swig/custom/rubytracking.swg +8 -22
  12. data/ext/wxruby3/swig/custom/wx_ruby_shared_ptr.i +434 -0
  13. data/ext/wxruby3/swig/custom/wx_shared_ptr.i +431 -0
  14. data/ext/wxruby3/swig/mark_free_impl.i +7 -132
  15. data/ext/wxruby3/swig/memory_management.i +8 -44
  16. data/ext/wxruby3/swig/wx.i +46 -73
  17. data/lib/wx/core/const.rb +0 -1
  18. data/lib/wx/core/context_help.rb +17 -0
  19. data/lib/wx/core/cursor.rb +1 -0
  20. data/lib/wx/core/helpcontrollerhelpprovider.rb +10 -2
  21. data/lib/wx/core/mbconv.rb +11 -0
  22. data/lib/wx/core/media_ctrl.rb +31 -0
  23. data/lib/wx/core/top_level_window.rb +7 -0
  24. data/lib/wx/core.rb +6 -0
  25. data/lib/wx/doc/art_provider.rb +17 -0
  26. data/lib/wx/doc/context_help.rb +42 -0
  27. data/lib/wx/doc/core.rb +0 -5
  28. data/lib/wx/doc/functions.rb +10 -0
  29. data/lib/wx/doc/gen/affine_matrix2d.rb +2 -0
  30. data/lib/wx/doc/gen/art_provider.rb +12 -0
  31. data/lib/wx/doc/gen/aui/aui_notebook_event.rb +15 -15
  32. data/lib/wx/doc/gen/aui/aui_pane_info.rb +8 -8
  33. data/lib/wx/doc/gen/aui/aui_tool_bar_event.rb +5 -5
  34. data/lib/wx/doc/gen/book_ctrl_base.rb +2 -1
  35. data/lib/wx/doc/gen/calendar_event.rb +5 -5
  36. data/lib/wx/doc/gen/choicebook.rb +2 -2
  37. data/lib/wx/doc/gen/collapsible_pane.rb +1 -1
  38. data/lib/wx/doc/gen/colour_dialog.rb +1 -1
  39. data/lib/wx/doc/gen/colour_picker_event.rb +3 -3
  40. data/lib/wx/doc/gen/context_help_button.rb +0 -53
  41. data/lib/wx/doc/gen/core.rb +4 -4
  42. data/lib/wx/doc/gen/credential_entry_dialog.rb +2 -2
  43. data/lib/wx/doc/gen/date_event.rb +2 -2
  44. data/lib/wx/doc/gen/dial_up_event.rb +2 -2
  45. data/lib/wx/doc/gen/dir_filter_list_ctrl.rb +2 -2
  46. data/lib/wx/doc/gen/event.rb +58 -58
  47. data/lib/wx/doc/gen/ext_help_controller.rb +62 -16
  48. data/lib/wx/doc/gen/file_ctrl.rb +4 -4
  49. data/lib/wx/doc/gen/file_dir_picker_event.rb +2 -2
  50. data/lib/wx/doc/gen/file_system.rb +1 -1
  51. data/lib/wx/doc/gen/find_dialog_event.rb +5 -5
  52. data/lib/wx/doc/gen/font_picker_event.rb +1 -1
  53. data/lib/wx/doc/gen/grid/grid_ctrl.rb +67 -32
  54. data/lib/wx/doc/gen/header_ctrl_event.rb +13 -13
  55. data/lib/wx/doc/gen/help_controller.rb +45 -2
  56. data/lib/wx/doc/gen/html/html_help_controller.rb +74 -32
  57. data/lib/wx/doc/gen/html/html_help_window.rb +3 -3
  58. data/lib/wx/doc/gen/html/html_window.rb +4 -4
  59. data/lib/wx/doc/gen/hyperlink_ctrl.rb +1 -1
  60. data/lib/wx/doc/gen/list_ctrl.rb +22 -22
  61. data/lib/wx/doc/gen/listbook.rb +2 -2
  62. data/lib/wx/doc/gen/mb_conv.rb +10 -0
  63. data/lib/wx/doc/gen/media_event.rb +6 -6
  64. data/lib/wx/doc/gen/notebook.rb +2 -2
  65. data/lib/wx/doc/gen/pg/pg_validation_info.rb +14 -14
  66. data/lib/wx/doc/gen/pg/property_grid_interface.rb +2 -2
  67. data/lib/wx/doc/gen/rbn/ribbon_art_provider.rb +19 -9
  68. data/lib/wx/doc/gen/rbn/ribbon_button_bar.rb +2 -2
  69. data/lib/wx/doc/gen/rbn/ribbon_gallery.rb +3 -3
  70. data/lib/wx/doc/gen/rbn/ribbon_panel.rb +2 -2
  71. data/lib/wx/doc/gen/rbn/ribbon_tool_bar.rb +2 -2
  72. data/lib/wx/doc/gen/rt/event_list.rb +17 -0
  73. data/lib/wx/doc/gen/rt/shared_evt_handler.rb +14 -0
  74. data/lib/wx/doc/gen/rt/thread_event.rb +71 -0
  75. data/lib/wx/doc/gen/rtc/rich_text_ctrl.rb +19 -19
  76. data/lib/wx/doc/gen/sash_event.rb +2 -2
  77. data/lib/wx/doc/gen/sash_layout_window.rb +2 -2
  78. data/lib/wx/doc/gen/search_ctrl.rb +2 -2
  79. data/lib/wx/doc/gen/spin_ctrl.rb +2 -2
  80. data/lib/wx/doc/gen/splitter_window.rb +6 -6
  81. data/lib/wx/doc/gen/stc/styled_text_event.rb +34 -34
  82. data/lib/wx/doc/gen/task_bar_icon_event.rb +10 -10
  83. data/lib/wx/doc/gen/text_ctrl.rb +4 -4
  84. data/lib/wx/doc/gen/toggle_button.rb +1 -1
  85. data/lib/wx/doc/gen/toolbook.rb +2 -2
  86. data/lib/wx/doc/gen/top_level_window.rb +19 -0
  87. data/lib/wx/doc/gen/tree_ctrl.rb +21 -21
  88. data/lib/wx/doc/gen/treebook.rb +4 -4
  89. data/lib/wx/doc/gen/utils.rb +2 -2
  90. data/lib/wx/doc/gen/web/event_list.rb +95 -0
  91. data/lib/wx/doc/gen/web/web_view.rb +1136 -0
  92. data/lib/wx/doc/gen/web/web_view_event.rb +210 -0
  93. data/lib/wx/doc/gen/web/web_view_handler.rb +318 -0
  94. data/lib/wx/doc/gen/window.rb +1 -1
  95. data/lib/wx/doc/gen/wizard_event.rb +7 -7
  96. data/lib/wx/doc/html/html_help_controller.rb +23 -1
  97. data/lib/wx/doc/mbconv.rb +108 -0
  98. data/lib/wx/doc/rt/shared_event_handler.rb +49 -0
  99. data/lib/wx/doc/rt/thread_event.rb +28 -0
  100. data/lib/wx/doc/webview.rb +40 -0
  101. data/lib/wx/helpers.rb +1 -1
  102. data/lib/wx/html/htmlhelpcontroller.rb +10 -0
  103. data/lib/wx/keyword_defs.rb +11 -0
  104. data/lib/wx/rt/events/evt_list.rb +8 -0
  105. data/lib/wx/rt/require.rb +8 -0
  106. data/lib/wx/rt/thread_event.rb +14 -0
  107. data/lib/wx/rt.rb +16 -0
  108. data/lib/wx/version.rb +1 -1
  109. data/lib/wx/web/events/evt_list.rb +74 -0
  110. data/lib/wx/web/require.rb +8 -0
  111. data/lib/wx/web/webview.rb +106 -0
  112. data/lib/wx/web.rb +17 -0
  113. data/lib/wx/wxruby/cmd/setup.rb +15 -0
  114. data/lib/wx.rb +2 -0
  115. data/rakelib/configure.rb +24 -0
  116. data/rakelib/gem.rb +3 -2
  117. data/rakelib/install.rb +54 -27
  118. data/rakelib/lib/config/macosx.rb +7 -5
  119. data/rakelib/lib/config/mingw.rb +66 -5
  120. data/rakelib/lib/config/pkgman/mingw.rb +1 -1
  121. data/rakelib/lib/config/unixish.rb +4 -2
  122. data/rakelib/lib/config.rb +37 -3
  123. data/rakelib/lib/core/include/client_data.inc +38 -17
  124. data/rakelib/lib/core/include/funcall.inc +1 -1
  125. data/rakelib/lib/core/include/swigdirector.inc +3 -3
  126. data/rakelib/lib/core/include/swigrubyrun.inc +14 -26
  127. data/rakelib/lib/core/package.rb +0 -2
  128. data/rakelib/lib/director/app.rb +1 -8
  129. data/rakelib/lib/director/art_provider.rb +7 -3
  130. data/rakelib/lib/director/comboctrl.rb +0 -7
  131. data/rakelib/lib/director/context_help_button.rb +35 -2
  132. data/rakelib/lib/director/event_handler.rb +32 -28
  133. data/rakelib/lib/director/fs_file.rb +15 -10
  134. data/rakelib/lib/director/functions.rb +8 -0
  135. data/rakelib/lib/director/grid_cell_attr.rb +1 -3
  136. data/rakelib/lib/director/grid_cell_editor.rb +14 -12
  137. data/rakelib/lib/director/grid_cell_renderer.rb +11 -8
  138. data/rakelib/lib/director/grid_ctrl.rb +140 -121
  139. data/rakelib/lib/director/help_controller.rb +70 -2
  140. data/rakelib/lib/director/mb_conv.rb +30 -0
  141. data/rakelib/lib/director/menu.rb +92 -42
  142. data/rakelib/lib/director/menu_bar.rb +84 -45
  143. data/rakelib/lib/director/menu_item.rb +2 -2
  144. data/rakelib/lib/director/persistence_manager.rb +3 -2
  145. data/rakelib/lib/director/preview_frame.rb +2 -2
  146. data/rakelib/lib/director/richtext_buffer.rb +5 -2
  147. data/rakelib/lib/director/shared_evt_handler.rb +30 -0
  148. data/rakelib/lib/director/sizer.rb +8 -17
  149. data/rakelib/lib/director/sizer_item.rb +3 -4
  150. data/rakelib/lib/director/task_bar_icon.rb +7 -7
  151. data/rakelib/lib/director/thread_event.rb +33 -0
  152. data/rakelib/lib/director/validator.rb +3 -1
  153. data/rakelib/lib/director/variant.rb +16 -12
  154. data/rakelib/lib/director/webview.rb +166 -0
  155. data/rakelib/lib/director/webview_event.rb +37 -0
  156. data/rakelib/lib/director/webview_handler.rb +63 -0
  157. data/rakelib/lib/generate/doc/thread_event.yaml +20 -0
  158. data/rakelib/lib/generate/doc/web_view.yaml +135 -0
  159. data/rakelib/lib/generate/doc/web_view_event.yaml +38 -0
  160. data/rakelib/lib/generate/doc/web_view_handler.yaml +58 -0
  161. data/rakelib/lib/specs/interfaces.rb +12 -0
  162. data/rakelib/lib/typemap/common.rb +34 -1
  163. data/rakelib/lib/typemap/mb_conv.rb +58 -0
  164. data/rakelib/prepost.rake +23 -31
  165. data/rakelib/prepost.rb +20 -0
  166. data/samples/event/threaded.rb +295 -42
  167. data/samples/event/tn_threaded.png +0 -0
  168. data/samples/help/doc/back.gif +0 -0
  169. data/samples/help/doc/contents.gif +0 -0
  170. data/samples/help/doc/cshelp.txt +9 -0
  171. data/samples/help/doc/doc.chm +0 -0
  172. data/samples/help/doc/doc.cnt +8 -0
  173. data/samples/help/doc/doc.h +7 -0
  174. data/samples/help/doc/doc.hhc +40 -0
  175. data/samples/help/doc/doc.hhk +31 -0
  176. data/samples/help/doc/doc.hhp +33 -0
  177. data/samples/help/doc/doc.hpj +21 -0
  178. data/samples/help/doc/doc.htm +27 -0
  179. data/samples/help/doc/doc1.htm +24 -0
  180. data/samples/help/doc/doc2.htm +12 -0
  181. data/samples/help/doc/doc3.htm +12 -0
  182. data/samples/help/doc/doc4.htm +12 -0
  183. data/samples/help/doc/doc5.htm +14 -0
  184. data/samples/help/doc/forward.gif +0 -0
  185. data/samples/help/doc/up.gif +0 -0
  186. data/samples/help/doc.chm +0 -0
  187. data/samples/help/doc.chw +0 -0
  188. data/samples/help/doc.zip +0 -0
  189. data/samples/help/help.rb +352 -0
  190. data/samples/help/tn_help.png +0 -0
  191. data/samples/webview/handler_advanced.html +55 -0
  192. data/samples/webview/tn_webview.png +0 -0
  193. data/samples/webview/webview.rb +1264 -0
  194. data/tests/assets/handler_advanced.html +55 -0
  195. data/tests/assets/test.css +1 -0
  196. data/tests/assets/test.html +9 -0
  197. data/tests/assets/test.zip +0 -0
  198. data/tests/lib/text_entry_tests.rb +2 -2
  199. data/tests/lib/wxapp_runner.rb +40 -0
  200. data/tests/lib/wxframe_runner.rb +17 -2
  201. data/tests/test_art.rb +8 -8
  202. data/tests/test_clipboard.rb +4 -4
  203. data/tests/test_config.rb +6 -6
  204. data/tests/test_exceptions.rb +8 -6
  205. data/tests/test_ext_controls.rb +3 -3
  206. data/tests/test_file_dialog.rb +5 -5
  207. data/tests/test_font.rb +7 -7
  208. data/tests/test_grid_ctrl.rb +133 -0
  209. data/tests/test_help.rb +88 -0
  210. data/tests/test_intl.rb +1 -1
  211. data/tests/test_media_ctrl.rb +14 -6
  212. data/tests/test_menu.rb +94 -86
  213. data/tests/test_persistence.rb +1 -1
  214. data/tests/test_proof_check.rb +5 -5
  215. data/tests/test_propgrid.rb +1 -1
  216. data/tests/test_shared_event_handler.rb +141 -0
  217. data/tests/test_std_controls.rb +5 -5
  218. data/tests/test_webview.rb +492 -0
  219. data/tests/test_window.rb +3 -3
  220. metadata +78 -2
@@ -9,31 +9,11 @@
9
9
  // This file, required by common.i defines a set of macros which are used
10
10
  // to specify memory management strategies for individual Wx classes.
11
11
 
12
- // Broadly speaking there are two different strategies:
13
- //
14
- // 1) For all classes which inherit from Wx::Window, including all Frames,
15
- // Dialogs and Controls: the C++ objects are managed by WxWidgets; when=
16
- // Frame is closed, it and all its contents are deleted. Therefore wxRuby
17
- // doesn't try to delete these objects as part of GC until they are known
18
- // to have been deleted. The instance of Wx::App watches for window
19
- // destruction, and in the GC-mark phase marks all Windows that are still
20
- // alive. [see App.i]
21
- //
22
- // 2) Almost all other classes are memory managed by wxRuby - that is, when
23
- // they have fallen out of scope and GC is run, the underlying C++ object
24
- // will be deleted too by the standard %freefunc.
25
-
26
-
27
12
  // These are implemented in swig/wx.i, so they are shared among all classes
28
13
  %{
29
- WXRUBY_EXPORT void GcNullFreeFunc(void *);
30
- WXRUBY_EXPORT void GcSizerFreeFunc(void *);
31
- WXRUBY_EXPORT void GcDialogFreeFunc(void *);
32
14
  WXRUBY_EXPORT void GcRefCountedFreeFunc(void *);
33
15
  WXRUBY_EXPORT void GC_mark_wxSizer(void *);
34
- WXRUBY_EXPORT void GC_mark_attached_wxMenu(void *);
35
16
  WXRUBY_EXPORT void GC_mark_wxWindow(void *);
36
- WXRUBY_EXPORT void GC_mark_wxFrame(void *);
37
17
  WXRUBY_EXPORT void GC_mark_wxEvent(void *);
38
18
  %}
39
19
 
@@ -43,7 +23,7 @@ WXRUBY_EXPORT void GC_mark_wxEvent(void *);
43
23
  // all Windows, including Frames and Dialogs
44
24
  %define GC_NEVER(kls)
45
25
  %trackobjects kls;
46
- %feature("freefunc") kls "GcNullFreeFunc";
26
+ %feature("freefunc") kls "SWIG_RubyRemoveTracking";
47
27
  %enddef
48
28
 
49
29
  // Strategy for windows that aren't top-level windows. Here, the C++
@@ -61,26 +41,21 @@ GC_NEVER(kls);
61
41
  %enddef
62
42
 
63
43
  // Strategy for top-level frames - these are destroyed
64
- // automatically. Marking is the same as for Windows, plus preservation
65
- // of the associated MenuBar, if reuqired.
44
+ // automatically. Marking is the same as for Windows.
66
45
  %define GC_MANAGE_AS_FRAME(kls)
67
- GC_NEVER(kls);
68
- // Mark any associated sizer
69
- %feature("markfunc") kls "GC_mark_wxFrame";
46
+ GC_MANAGE_AS_WINDOW(kls);
70
47
  %enddef
71
48
 
72
49
  // Strategy for dialogs - these are NOT destroyed automatically
73
50
  %define GC_MANAGE_AS_DIALOG(kls)
74
- GC_NEVER(kls);
75
- // Mark any associated sizer
76
- %feature("markfunc") kls "GC_mark_wxWindow";
51
+ GC_MANAGE_AS_WINDOW(kls);
77
52
  %enddef
78
53
 
79
54
  // Events - most are created within wxWidgets C++ on the stack and thus
80
55
  // do not need deletion. These are passed into ruby via EvtHandler or
81
56
  // App methods, and are wrapped using wxRuby_WrapWxEventInRuby (see
82
- // wx.i). This gives them a void freefunc and markfunc and are NOT
83
- // tracked - they are treated as one-shot short-lived objects.
57
+ // wx.i). This gives them a null freefunc and markfunc and provides no
58
+ // tracking - they are treated as one-shot short-lived objects.
84
59
  //
85
60
  // However, custom events created on the ruby side need to be deleted to
86
61
  // avoid leakage as SWIG wrappers call C++ "new" to allocate the
@@ -113,15 +88,10 @@ GC_NEVER(kls);
113
88
  %define GC_MANAGE_AS_MARKED(kls)
114
89
  %enddef
115
90
 
116
- // Sizers attached to windows are automatically destroyed by wxWidgets,
117
- // so they should not be deleted.
118
- //
119
- // TODO - orphaned/unattached sizers are not automatically destroyed -
120
- // so the freefunc should check for this condition and do the delete if
121
- // required to prevent a memory leak.
91
+ // Attached sizers should only be marked by the window they are attached to.
122
92
  %define GC_MANAGE_AS_SIZER(kls)
123
93
  %trackobjects kls;
124
- %feature("freefunc") kls "GcSizerFreeFunc";
94
+ //%feature("freefunc") kls "GcSizerFreeFunc";
125
95
  %feature("markfunc") kls "GC_mark_wxSizer";
126
96
  %enddef
127
97
 
@@ -133,12 +103,6 @@ GC_NEVER(kls);
133
103
  %feature("freefunc") kls "GcRefCountedFreeFunc";
134
104
  %enddef
135
105
 
136
- // special refcounted for grid cell renderers/editors and attrs
137
- %define GC_MANAGE_AS_UNTRACKED_REFCOUNTED(kls)
138
- %feature("freefunc") kls "GcRefCountedFreeFunc";
139
- %enddef
140
-
141
-
142
106
  // All other classes - mainly helper classes (eg Sizer, GridCellxxx).
143
107
  // These are tracked but sometimes later disowned once passed into a
144
108
  // widget, and thenceforth managed by WxWidgets
@@ -17,13 +17,15 @@
17
17
 
18
18
  #include <wx/filesys.h>
19
19
  #include <wx/fs_zip.h>
20
+ #include <wx/utils.h>
20
21
 
21
22
  #include <unordered_map>
22
23
 
23
- WXRUBY_TRACE_GUARD(WxRubyTraceGCTrack, "GC_TRACK")
24
24
  WXRUBY_TRACE_GUARD(WxRubyTraceGCWrapEvents, "GC_WRAP_EVENTS")
25
25
  WXRUBY_TRACE_GUARD(WxRubyTraceGCWrapObject, "GC_WRAP_OBJECT")
26
26
 
27
+ // SWIG and wxRuby3 custom tracking support
28
+ #include "wxruby-GCTracking.h"
27
29
  %}
28
30
 
29
31
  // Some common functions
@@ -82,73 +84,6 @@ WXRUBY_EXPORT swig_type_info* wxRuby_GetSwigTypeForClassName(const char* clsname
82
84
  return wxRuby_GetSwigTypeForClass(rb_const_get(wxRuby_Core(), rb_intern(clsname)));
83
85
  }
84
86
 
85
- // Overriding standard SWIG tracking.
86
- // We don't want to use any functionality that could interfere with
87
- // Ruby GC handling so we use standard C++ hash maps.
88
- typedef std::unordered_map<void*, VALUE> PtrToRbObjHash;
89
- PtrToRbObjHash Global_Ptr_Map;
90
-
91
- // Add a tracking from ptr -> object
92
- WXRUBY_EXPORT void wxRuby_AddTracking(void* ptr, VALUE object)
93
- {
94
- WXRUBY_TRACE_IF(WxRubyTraceGCTrack, 2)
95
- WXRUBY_TRACE_WITH(VALUE clsname = rb_mod_name(CLASS_OF(object)))
96
- WXRUBY_TRACE("> wxRuby_AddTracking" << std::flush <<
97
- "(" << ptr << ":{"
98
- << (clsname != Qnil ? StringValueCStr(clsname) : "<noname>")
99
- << "}, " << object << ")")
100
- WXRUBY_TRACE_END
101
-
102
- // Check if an 'old' tracking registry exists.
103
- if (Global_Ptr_Map.count(ptr) == 1)
104
- {
105
- // This can happen if the C++ referenced by a Ruby object is managed by
106
- // a wxWidgets object and deleted without unlinking the Ruby object.
107
- // In these cases we unlink the previously linked Ruby object here
108
- // (if not the same Ruby object which should not be possible).
109
- // This will prevent SIGSEGV when attempting to call anything for
110
- // these objects but instead cause more informative exceptions.
111
- VALUE old_obj = Global_Ptr_Map[ptr];
112
- if (!NIL_P(old_obj) && old_obj != object)
113
- {
114
- DATA_PTR(old_obj) = 0;
115
- }
116
-
117
- }
118
- Global_Ptr_Map[ptr] = object;
119
- }
120
-
121
- // Return the ruby object for ptr
122
- WXRUBY_EXPORT VALUE wxRuby_FindTracking(void* ptr)
123
- {
124
- if ( Global_Ptr_Map.count(ptr) == 0 )
125
- return Qnil;
126
- else
127
- return Global_Ptr_Map[ptr];
128
- }
129
-
130
- // Remove the tracking for ptr
131
- WXRUBY_EXPORT void wxRuby_RemoveTracking(void* ptr)
132
- {
133
- WXRUBY_TRACE_IF(WxRubyTraceGCTrack, 2)
134
- WXRUBY_TRACE("< wxRuby_RemoveTracking(" << ptr << ") -> " << wxRuby_FindTracking(ptr))
135
- WXRUBY_TRACE_END
136
- Global_Ptr_Map.erase(ptr);
137
- }
138
-
139
- // Iterate over all the trackings, calling the passed-in method on each
140
- WXRUBY_EXPORT void wxRuby_IterateTracking( void(*meth)(void* ptr, VALUE obj) )
141
- {
142
- PtrToRbObjHash::iterator it;
143
- for( it = Global_Ptr_Map.begin(); it != Global_Ptr_Map.end(); ++it )
144
- {
145
- void* ptr = it->first;
146
- VALUE obj = it->second;
147
- (*meth)(ptr, obj);
148
- }
149
- }
150
-
151
-
152
87
  // Returns a ruby object wrapped around a wxObject. This is used for
153
88
  // methods whose return type is a generic C++ class (eg wxWindow), but
154
89
  // whose return values are actually instances of specific C++ classes
@@ -259,6 +194,18 @@ WXRUBY_EXPORT VALUE wxRuby_WrapWxObjectInRuby(wxObject *wx_obj)
259
194
  static VALUE Evt_Type_Map = NULL;
260
195
  static VALUE WxRuby_cAsyncProcCallEvent = Qnil;
261
196
 
197
+ inline VALUE _get_ThreadEventClass()
198
+ {
199
+ static VALUE __cThreadEvent = Qnil;
200
+
201
+ if (RB_NIL_P(__cThreadEvent))
202
+ {
203
+ VALUE module = rb_const_get(wxRuby_Core(), rb_intern("RT"));
204
+ if (!RB_NIL_P(module)) __cThreadEvent = rb_const_get(module, rb_intern("ThreadEvent"));
205
+ }
206
+ return __cThreadEvent;
207
+ }
208
+
262
209
  #ifdef __WXRB_DEBUG__
263
210
  WXRUBY_EXPORT VALUE wxRuby_WrapWxEventInRuby(void* rcvr, wxEvent *wx_event)
264
211
  #else
@@ -338,17 +285,41 @@ WXRUBY_EXPORT VALUE wxRuby_WrapWxEventInRuby(wxEvent *wx_event)
338
285
  DATA_PTR(rb_event) = wx_event;
339
286
  // do not forget to mark the instance with the mangled swig type name
340
287
  // (as there is no swig_type for the Wx::AsyncProcCallEvent class use it's base Wx::Event)
341
- swig_type_info* type = wx_event->GetEventType() == wxEVT_ASYNC_METHOD_CALL ?
342
- wxRuby_GetSwigTypeForClass(wxRuby_GetDefaultEventClass()) :
343
- wxRuby_GetSwigTypeForClass(rb_event_class);
344
- rb_iv_set(rb_event, "@__swigtype__", rb_str_new2(type->name));
288
+ swig_type_info* type;
289
+ if (wx_event->GetEventType() == wxEVT_ASYNC_METHOD_CALL)
290
+ {
291
+ type = wxRuby_GetSwigTypeForClass(wxRuby_GetDefaultEventClass());
292
+ }
293
+ else
294
+ {
295
+ type = wxRuby_GetSwigTypeForClass(rb_event_class);
296
+ if (!type)
297
+ {
298
+ // could be derived ThreadEvent
299
+ VALUE klass = _get_ThreadEventClass();
300
+ if (!RB_NIL_P(klass) && rb_class_inherited_p(rb_event_class, klass))
301
+ {
302
+ type = wxRuby_GetSwigTypeForClass(klass);
303
+ }
304
+ }
305
+ }
306
+ // type should never be null but let's be paranoid
307
+ if (type) rb_iv_set(rb_event, "@__swigtype__", rb_str_new2(type->name));
345
308
 
346
309
  WXRUBY_TRACE_IF(WxRubyTraceGCWrapEvents, 2)
347
- WXRUBY_TRACE("< wxRuby_WrapWxEventInRuby - wrapped transitory event " << wx_event << "{" << type->name << "}")
310
+ WXRUBY_TRACE("< wxRuby_WrapWxEventInRuby - wrapped transitory event " << wx_event << "{" << (type ? type->name : rb_class2name(rb_event_class)) << "}")
348
311
  WXRUBY_TRACE_END
349
312
 
350
313
  return rb_event;
351
314
  }
315
+
316
+ static VALUE wxruby_get_wx_prefix(int argc, VALUE *argv, VALUE self)
317
+ {
318
+ if ((argc < 0) || (argc > 0)) {
319
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); return Qnil;
320
+ }
321
+ return WXSTR_TO_RSTR(wxGetInstallPrefix());
322
+ }
352
323
  %}
353
324
 
354
325
  %constant int wxWXWIDGETS_DEBUG_LEVEL = wxDEBUG_LEVEL;
@@ -364,4 +335,6 @@ WXRUBY_EXPORT VALUE wxRuby_WrapWxEventInRuby(wxEvent *wx_event)
364
335
 
365
336
  // This is needed so HtmlHelp can load docs from a zip file
366
337
  wxFileSystem::AddHandler(new wxArchiveFSHandler);
338
+
339
+ rb_define_module_function(mWxruby3, "get_wx_prefix", VALUEFUNC(wxruby_get_wx_prefix), -1);
367
340
  %}
data/lib/wx/core/const.rb CHANGED
@@ -23,7 +23,6 @@ module Wx
23
23
  FRAME_NAME_STR = 'frame'
24
24
  STATUS_LINE_NAME_STR = 'status_line'
25
25
  STATIC_BITMAP_NAME_STR = 'staticBitmap'
26
- WEB_VIEW_NAME_STR = 'wxWebView'
27
26
  ANIMATION_CTRL_NAME_STR = 'animationctrl'
28
27
  TOOL_BAR_NAME_STR = 'toolbar'
29
28
  TEXT_CTRL_NAME_STR = 'text'
@@ -0,0 +1,17 @@
1
+ # Copyright (c) 2023 M.J.N. Corino, The Netherlands
2
+ #
3
+ # This software is released under the MIT license.
4
+
5
+ module Wx
6
+
7
+ class << self
8
+
9
+ define_method :ContextHelp do |window = nil|
10
+
11
+ context_help(window)
12
+
13
+ end
14
+
15
+ end
16
+
17
+ end
@@ -24,6 +24,7 @@ module Wx
24
24
 
25
25
  wx_set_cursor = instance_method :set_cursor
26
26
  wx_redefine_method :set_cursor do |cursor|
27
+ cursor = Wx::Cursor.new(cursor) if cursor.is_a?(Wx::StockCursor)
27
28
  wx_set_cursor.bind(self).call(cursor.is_a?(Wx::Cursor) ? Wx::CursorBundle.new(cursor) : cursor)
28
29
  end
29
30
  end
@@ -12,17 +12,25 @@
12
12
  require_relative './simplehelpprovider'
13
13
 
14
14
  class Wx::HelpControllerHelpProvider < Wx::SimpleHelpProvider
15
- def initialize(help_controller)
15
+ def initialize(help_controller = nil)
16
16
  super()
17
17
  @hc = help_controller
18
18
  end
19
19
 
20
+ def get_help_controller
21
+ @hc
22
+ end
23
+
24
+ def set_help_controller(help_controller)
25
+ @hc = help_controller
26
+ end
27
+
20
28
  # Show help for +win+; if the help text for +win+ is a string with a
21
29
  # single integer only, treats that as a section id for help and shows
22
30
  # that, otherwise shows a popup (native-style on Windows) of the text.
23
31
  def show_help(win)
24
32
  help_text = get_help(win)
25
- return false if help_text.empty?
33
+ return false if help_text.empty? || @hc.nil?
26
34
  if help_text =~ /\A\d+\z/
27
35
  @hc.display_context_popup(help_text.to_i)
28
36
  else
@@ -0,0 +1,11 @@
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
+ ConvUTF8 = MBConvUTF8.new
9
+ ConvUTF7 = MBConvUTF7.new
10
+
11
+ end
@@ -0,0 +1,31 @@
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
+
9
+ class MediaCtrl < Wx::Control
10
+
11
+ if Wx::PLATFORM == 'WXMSW'
12
+
13
+ wx_load = instance_method :load
14
+ wx_redefine_method :load do |*args|
15
+ uri_or_path = args.shift
16
+ if args.empty? && uri_or_path.is_a?(::URI) && uri_or_path.scheme == 'file'
17
+ if uri_or_path.host.empty?
18
+ wx_load.bind(self).call("#{uri_or_path.path}")
19
+ else
20
+ wx_load.bind(self).call("#{uri_or_path.host}:#{uri_or_path.path}")
21
+ end
22
+ else
23
+ wx_load.bind(self).call(uri_or_path, *args)
24
+ end
25
+ end
26
+
27
+ end
28
+
29
+ end
30
+
31
+ end
@@ -11,6 +11,13 @@ module Wx
11
11
  PersistentTLW.new(self)
12
12
  end
13
13
 
14
+ # fix missing method on some platforms/wxw versions
15
+ unless method_defined? :enable_full_screen_view
16
+ def enable_full_screen_view
17
+ false
18
+ end
19
+ end
20
+
14
21
  end
15
22
 
16
23
  end
data/lib/wx/core.rb CHANGED
@@ -26,6 +26,12 @@ Wx::WXWIDGETS_VERSION = '%i.%i.%i' % [ Wx::WXWIDGETS_MAJOR_VERSION,
26
26
  Wx::WXWIDGETS_MINOR_VERSION,
27
27
  Wx::WXWIDGETS_RELEASE_NUMBER ]
28
28
 
29
+ # except when in debug mode or when a user defined diagnostics level is defined
30
+ # suppress all diagnostics from GTK
31
+ unless Wx::DEBUG || ENV['WXSUPPRESS_GTK_DIAGNOSTICS'] || Wx::PLATFORM != 'WXGTK'
32
+ Wx::App.gtk_suppress_diagnostics
33
+ end
34
+
29
35
  # Helper functions
30
36
  require 'wx/helpers'
31
37
 
@@ -0,0 +1,17 @@
1
+ # :stopdoc:
2
+ # Copyright (c) 2023 M.J.N. Corino, The Netherlands
3
+ #
4
+ # This software is released under the MIT license.
5
+
6
+
7
+ # This module provides and standardizes support for locating application art files.
8
+ #
9
+ # :startdoc:
10
+
11
+
12
+ module Wx
13
+
14
+ ART_STOP = "wxART_STOP"
15
+ ART_REFRESH = "wxART_REFRESH"
16
+
17
+ end
@@ -0,0 +1,42 @@
1
+ # :stopdoc:
2
+ # Copyright (c) 2023 M.J.N. Corino, The Netherlands
3
+ #
4
+ # This software is released under the MIT license.
5
+ # :startdoc:
6
+
7
+
8
+ module Wx
9
+
10
+ # This method changes the cursor to a query and puts the application into a 'context-sensitive help mode'.
11
+ #
12
+ # When the user left-clicks on a window within the specified window, a Wx::EVT_HELP event is sent to that control,
13
+ # and the application may respond to it by popping up some help.
14
+ # The method returns after the left-click.
15
+ #
16
+ # For example:
17
+ #
18
+ # ```ruby
19
+ # Wx.context_help(myWindow)
20
+ # ```
21
+ #
22
+ # There are a couple of ways to invoke this behaviour implicitly:
23
+ #
24
+ # - Use the Wx::DIALOG_EX_CONTEXTHELP style for a dialog (WXMSW only). This will put a question mark in the titlebar,
25
+ # and Windows will put the application into context-sensitive help mode automatically, without further programming.
26
+ # - Create a Wx::ContextHelpButton, whose predefined behaviour is to create a context help object. Normally you will
27
+ # write your application so that this button is only added to a dialog for non-Windows platforms (use
28
+ # Wx::DIALOG_EX_CONTEXTHELP on WXMSW).
29
+ #
30
+ # Note that on macOS, the cursor does not change when in context-sensitive help mode.
31
+ #
32
+ # @param [Wx::Window] window the window which will be used to catch events; if nullptr, the top window will be used.
33
+ # @return [void]
34
+ def self.context_help(window = nil); end
35
+
36
+ # Convenience alias for {Wx.context_help} similarly named as the wxWidgets wxContextHelp class.
37
+ #
38
+ # @param [Wx::Window] window the window which will be used to catch events; if nullptr, the top window will be used.
39
+ # @return [void]
40
+ def self.ContextHelp(window = nil); end
41
+
42
+ end
data/lib/wx/doc/core.rb CHANGED
@@ -8,11 +8,6 @@
8
8
  module Wx
9
9
 
10
10
  class << self
11
- # Returns trace level (always 0 if #wxrb_debug returns false)
12
- # In case #wxrb_debug returns true #wxrb_trace_level= is also defined)
13
- # @return [Integer]
14
- attr_reader :wrb_trace_level
15
-
16
11
  # Returns true if WXWIDGETS_VERSION >= ver
17
12
  # @param [String,Array(Integer)] ver version string or integer array (1-3)
18
13
  # @return [Boolean] true if WXWIDGETS_VERSION >= ver, false otherwise
@@ -36,6 +36,16 @@ module Wx
36
36
  # @return [void]
37
37
  def self.log_info(fmt, *args, filename: nil, line: 0, func: nil, component: nil) end
38
38
 
39
+ # Log a Wx error informational message to the current Wx log output and abort (exit code 3)
40
+ # @param fmt [String] message (formatting) string
41
+ # @param args [Array<Object>] optional message arguments
42
+ # @param filename [String] optional file name for log info
43
+ # @param line [Integer] optional line number for log info
44
+ # @param func [String] optional function name for log info
45
+ # @param component [String] optional component name for log info
46
+ # @return [void]
47
+ def self.log_fatal_error(fmt, *args, filename: nil, line: 0, func: nil, component: nil) end
48
+
39
49
  # Log a Wx Informational message to the current Wx log output
40
50
  # @param fmt [String] message (formatting) string
41
51
  # @param args [Array<Object>] optional message arguments
@@ -133,6 +133,8 @@ module Wx
133
133
  def initialize; end
134
134
 
135
135
  # Get the component values of the matrix.
136
+ #
137
+ # At least one of the parameters must be non-NULL.
136
138
  # @return [Array(Wx::Matrix2D,Wx::Point2DDouble)]
137
139
  def get; end
138
140
 
@@ -266,6 +266,14 @@ module Wx
266
266
  #
267
267
  ART_WX_LOGO = "wxART_WX_LOGO"
268
268
 
269
+ #
270
+ #
271
+ ART_STOP = "wxART_STOP"
272
+
273
+ #
274
+ #
275
+ ART_REFRESH = "wxART_REFRESH"
276
+
269
277
  # {Wx::ArtProvider} class is used to customize the look of wxWidgets application.
270
278
  #
271
279
  # When wxWidgets needs to display an icon or a bitmap (e.g. in the standard file dialog), it does not use a hard-coded resource but asks {Wx::ArtProvider} for it instead. This way users can plug in their own {Wx::ArtProvider} class and easily replace standard art with their own version.
@@ -403,6 +411,10 @@ module Wx
403
411
  #
404
412
  # - {Wx::ART_WX_LOGO} (since 3.1.6)
405
413
  #
414
+ # - {Wx::ART_STOP} (since 3.1.6)
415
+ #
416
+ # - {Wx::ART_REFRESH} (since 3.1.6)
417
+ #
406
418
  # <div class="wxrb-note">
407
419
  # <b>Note:</b>
408
420
  # <p>When running under GTK+ 2, GTK+ stock item IDs (e.g. <code>"gtk-cdrom"</code>) may be used as well:
@@ -112,63 +112,63 @@ module Wx
112
112
 
113
113
  #
114
114
  #
115
- EVT_AUINOTEBOOK_PAGE_CLOSE = 10351
115
+ EVT_AUINOTEBOOK_PAGE_CLOSE = 10354
116
116
 
117
117
  #
118
118
  #
119
- EVT_AUINOTEBOOK_PAGE_CHANGED = 10354
119
+ EVT_AUINOTEBOOK_PAGE_CHANGED = 10357
120
120
 
121
121
  #
122
122
  #
123
- EVT_AUINOTEBOOK_PAGE_CHANGING = 10353
123
+ EVT_AUINOTEBOOK_PAGE_CHANGING = 10356
124
124
 
125
125
  #
126
126
  #
127
- EVT_AUINOTEBOOK_PAGE_CLOSED = 10352
127
+ EVT_AUINOTEBOOK_PAGE_CLOSED = 10355
128
128
 
129
129
  #
130
130
  #
131
- EVT_AUINOTEBOOK_BUTTON = 10355
131
+ EVT_AUINOTEBOOK_BUTTON = 10358
132
132
 
133
133
  #
134
134
  #
135
- EVT_AUINOTEBOOK_BEGIN_DRAG = 10356
135
+ EVT_AUINOTEBOOK_BEGIN_DRAG = 10359
136
136
 
137
137
  #
138
138
  #
139
- EVT_AUINOTEBOOK_END_DRAG = 10357
139
+ EVT_AUINOTEBOOK_END_DRAG = 10360
140
140
 
141
141
  #
142
142
  #
143
- EVT_AUINOTEBOOK_DRAG_MOTION = 10359
143
+ EVT_AUINOTEBOOK_DRAG_MOTION = 10362
144
144
 
145
145
  #
146
146
  #
147
- EVT_AUINOTEBOOK_ALLOW_DND = 10360
147
+ EVT_AUINOTEBOOK_ALLOW_DND = 10363
148
148
 
149
149
  #
150
150
  #
151
- EVT_AUINOTEBOOK_TAB_MIDDLE_DOWN = 10364
151
+ EVT_AUINOTEBOOK_TAB_MIDDLE_DOWN = 10367
152
152
 
153
153
  #
154
154
  #
155
- EVT_AUINOTEBOOK_TAB_MIDDLE_UP = 10363
155
+ EVT_AUINOTEBOOK_TAB_MIDDLE_UP = 10366
156
156
 
157
157
  #
158
158
  #
159
- EVT_AUINOTEBOOK_TAB_RIGHT_DOWN = 10366
159
+ EVT_AUINOTEBOOK_TAB_RIGHT_DOWN = 10369
160
160
 
161
161
  #
162
162
  #
163
- EVT_AUINOTEBOOK_TAB_RIGHT_UP = 10365
163
+ EVT_AUINOTEBOOK_TAB_RIGHT_UP = 10368
164
164
 
165
165
  #
166
166
  #
167
- EVT_AUINOTEBOOK_DRAG_DONE = 10362
167
+ EVT_AUINOTEBOOK_DRAG_DONE = 10365
168
168
 
169
169
  #
170
170
  #
171
- EVT_AUINOTEBOOK_BG_DCLICK = 10361
171
+ EVT_AUINOTEBOOK_BG_DCLICK = 10364
172
172
 
173
173
  # This class is used by the events generated by {Wx::AUI::AuiNotebook}.
174
174
  #
@@ -125,35 +125,35 @@ module Wx
125
125
 
126
126
  #
127
127
  #
128
- EVT_AUI_PANE_BUTTON = 10343
128
+ EVT_AUI_PANE_BUTTON = 10346
129
129
 
130
130
  #
131
131
  #
132
- EVT_AUI_PANE_CLOSE = 10344
132
+ EVT_AUI_PANE_CLOSE = 10347
133
133
 
134
134
  #
135
135
  #
136
- EVT_AUI_PANE_MINIMIZE = 10345
136
+ EVT_AUI_PANE_MINIMIZE = 10348
137
137
 
138
138
  #
139
139
  #
140
- EVT_AUI_PANE_MAXIMIZE = 10346
140
+ EVT_AUI_PANE_MAXIMIZE = 10349
141
141
 
142
142
  #
143
143
  #
144
- EVT_AUI_PANE_RESTORE = 10347
144
+ EVT_AUI_PANE_RESTORE = 10350
145
145
 
146
146
  #
147
147
  #
148
- EVT_AUI_PANE_ACTIVATED = 10348
148
+ EVT_AUI_PANE_ACTIVATED = 10351
149
149
 
150
150
  #
151
151
  #
152
- EVT_AUI_RENDER = 10349
152
+ EVT_AUI_RENDER = 10352
153
153
 
154
154
  #
155
155
  #
156
- EVT_AUI_FIND_MANAGER = 10350
156
+ EVT_AUI_FIND_MANAGER = 10353
157
157
 
158
158
  # {Wx::AUI::AuiPaneInfo} is part of the {Wx::AUI} class framework.
159
159
  #