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
@@ -0,0 +1,108 @@
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 class is the base class of a hierarchy of classes capable of converting text strings between multibyte
11
+ # (SBCS or DBCS) encodings and Unicode.
12
+ #
13
+ # This is an abstract base class which defines the operations implemented by all different conversion classes.
14
+ #
15
+ # @note Note that in wxRuby these classes only provide types without any operations as these are not required
16
+ # as Ruby provides its own perfectly good encoding conversion methods. These types are therefor only required
17
+ # to provide as argument to certain methods of the wrapped wxWidgets classes (see for example {Wx::WEB::WebViewHandlerResponse}).
18
+ class MBConv
19
+ protected def initialize; end
20
+ end
21
+
22
+ # This class converts between any character set supported by the system and Unicode.
23
+ class CSConv < MBConv
24
+
25
+ end
26
+
27
+ # This class implements a Unicode to/from multibyte converter capable of automatically recognizing the encoding of the
28
+ # multibyte text on input.
29
+ #
30
+ # The logic used is very simple: the class uses the BOM (byte order mark) if it's present and tries to interpret the
31
+ # input as UTF-8 otherwise. If this fails, the input is interpreted as being in the default multibyte encoding which
32
+ # can be specified in the constructor of a {Wx::ConvAuto} instance and, in turn, defaults to a fallback encoding if not
33
+ # explicitly given.
34
+ #
35
+ # For the conversion from Unicode to multibyte, the same encoding as was previously used for multibyte to Unicode conversion is reused. If there had been no previous multibyte to Unicode conversion, UTF-8 is used by default. Notice that once the multibyte encoding is automatically detected, it doesn't change any more, i.e. it is entirely determined by the first use of wxConvAuto object in the multibyte-to-Unicode direction. However creating a copy of wxConvAuto object, either via the usual copy constructor or assignment operator, or using wxMBConv::Clone(), resets the automatically detected encoding so that the new copy will try to detect the encoding of the input on first use.
36
+ #
37
+ # This class is used by default in wxWidgets classes and functions reading text from files such as wxFile, wxFFile, wxTextFile, wxFileConfig and various stream classes so the encoding set with its SetFallbackEncoding() method will affect how these classes treat input files. In particular, use this method to change the fall-back multibyte encoding used to interpret the contents of the files whose contents isn't valid UTF-8 or to disallow it completely.
38
+ class ConvAuto < MBConv
39
+
40
+ # Constructs a new Wx::ConvAuto instance.
41
+ #
42
+ # The object will try to detect the input of the given multibyte text automatically but if the automatic detection
43
+ # of Unicode encodings fails, the fall-back encoding enc will be used to interpret it as multibyte text.
44
+ #
45
+ # The default value of enc, {Wx::FONTENCODING_DEFAULT}, means that the global default value (which can be set using
46
+ # {Wx::ConvAuto#set_fallback_encoding}) should be used. As with that method, passing Wx::FONTENCODING_MAX inhibits
47
+ # using this encoding completely so the input multibyte text will always be interpreted as UTF-8 in the absence of
48
+ # BOM and the conversion will fail if the input doesn't form valid UTF-8 sequence.
49
+ #
50
+ # Another special value is {Wx::FONTENCODING_SYSTEM} which means to use the encoding currently used on the user system,
51
+ # i.e. the encoding returned by {Wx::Locale#get_system_encoding}. Any other encoding will be used as is, e.g. passing
52
+ # {Wx::FONTENCODING_ISO8859_1} ensures that non-UTF-8 input will be treated as latin1.
53
+ # @param [Wx::FontEncoding] enc
54
+ def initialize(enc=Wx::FONTENCODING_DEFAULT); end
55
+
56
+ # Disable the use of the fallback encoding: if the input doesn't have a BOM and is not valid UTF-8, the conversion
57
+ # will fail.
58
+ def self.disable_fallback_encoding; end
59
+
60
+ # Returns the encoding used by default by {Wx::ConvAuto} if no other encoding is explicitly specified in constructor.
61
+ #
62
+ # By default, returns {Wx::FONTENCODING_ISO8859_1} but can be changed using #set_fallback_encoding.
63
+ # @return [Wx::FontEncoding]
64
+ def self.get_fallback_encoding; end
65
+
66
+ # Changes the encoding used by default by {Wx::ConvAuto} if no other encoding is explicitly specified in constructor.
67
+ #
68
+ # The default value, which can be retrieved using #get_fallback_encoding, is {Wx::FONTENCODING_ISO8859_1}.
69
+ #
70
+ # Special values of {Wx::FONTENCODING_SYSTEM} or {Wx::FONTENCODING_MAX} can be used for the enc parameter to use
71
+ # the encoding of the current user locale as fall back or not use any encoding for fall back at all, respectively
72
+ # (just as with the similar constructor parameter). However, {Wx::FONTENCODING_DEFAULT} can't be used here.
73
+ # @param [Wx::FontEncoding] enc
74
+ def self.set_fallback_encoding(enc); end
75
+ end
76
+
77
+ # This class is used to convert between multibyte encodings and UTF-16 Unicode encoding (also known as UCS-2).
78
+ #
79
+ # Unlike UTF-8 encoding, UTF-16 uses words and not bytes and hence depends on the byte ordering: big or little endian.
80
+ # Hence this class is provided in a little endian version and a big endian version. {Wx::MBConvUTF16} always provides
81
+ # the implementation native to the current platform (e.g. LE under Windows and BE under Mac).
82
+ class MBConvUTF16 < MBConv
83
+ def initialize; end
84
+ end
85
+
86
+ #This class is used to convert between multibyte encodings and UTF-32 Unicode encoding (also known as UCS-4).
87
+ #
88
+ # Unlike UTF-8 encoding, UTF-32 uses (double) words and not bytes and hence depends on the byte ordering: big or
89
+ # little endian. Hence this class is provided in in a little endian version and a big endian version. {Wx::MBConvUTF32}
90
+ # always provides the implementation native to the current platform (e.g. LE under Windows and BE under Mac).
91
+ class MBConvUTF32 < MBConv
92
+ def initialize; end
93
+ end
94
+
95
+ # This class converts between the UTF-7 encoding and Unicode.
96
+ #
97
+ # Notice that, unlike all the other conversion objects, this converter is stateful, and therefor <b>not</b> thread-safe.
98
+ # It has one predefined instance, Wx::ConvUTF7.
99
+ class MBConvUTF7 < MBConv
100
+ def initialize; end
101
+ end
102
+
103
+ # This class converts between the UTF-8 encoding and Unicode.
104
+ # It has one predefined instance, Wx::ConvUTF8.
105
+ class MBConvUTF8 < MBConv
106
+ def initialize; end
107
+ end
108
+ end
@@ -0,0 +1,49 @@
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
+ # Shared event handler methods documentation stubs.
8
+ # :startdoc:
9
+
10
+
11
+
12
+ module Wx
13
+
14
+ # The RT (Ruby|Ractor Threading) module provides the {RT::SharedEvtHandler} and {RT::ThreadEvent}
15
+ # classes which can be used provide thread-(or Ractor-)safe event messaging in wxRuby3.
16
+ module RT
17
+
18
+ # This class provides a threadsafe (Ractor shareable) reference to a {Wx:EvtHandler} providing
19
+ # only 2 methods; {RT::SharedEvtHandler#clone} and {RT::SharedEvtHandler#queue_event}
20
+ class SharedEvtHandler
21
+
22
+ # Returns a cloned instance referencing the same {Wx::EvtHandler}.
23
+ # @return [Wx::RT::SharedEvtHandler]
24
+ def clone; end
25
+
26
+ # Essentially the same functionality as {Wx::EvtHandler#queue_event} except that this method only
27
+ # accepts {Wx::RT::ThreadEvent} or derived instances.
28
+ # @note Note that this event will not maintain any Ruby state, i.e. the actual Ruby instance and/or any instance
29
+ # variables thereof will not be transferred through the event messaging system. Only state managed by the wrapped
30
+ # C\++ event instance will persist.
31
+ # @param [Wx::RT::ThreadEvent] evt event instance to be queued
32
+ # @return [void]
33
+ def queue_event(evt); end
34
+
35
+ end
36
+
37
+ end
38
+
39
+ class EvtHandler < Wx::Object
40
+
41
+ # Returns a Ractor-safe shareable event handler reference.
42
+ # @see Wx::RT::SharedEvtHandler
43
+ # @see Wx::RT::ThreadEvent
44
+ # @return [Wx::RTT::SharedEvtHandler]
45
+ def make_shared; end
46
+
47
+ end
48
+
49
+ end
@@ -0,0 +1,28 @@
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
+ # Shared event handler methods documentation stubs.
8
+ # :startdoc:
9
+
10
+
11
+
12
+ module Wx
13
+
14
+ module RT
15
+
16
+ class ThreadEvent < Event
17
+
18
+ # Constructor.
19
+ # @param eventType [Integer]
20
+ # @param id [Integer]
21
+ # @return [Wx::RT::ThreadEvent]
22
+ def initialize(eventType=Wx::EVT_THREAD, id=Wx::StandardID::ID_ANY) end
23
+
24
+ end
25
+
26
+ end
27
+
28
+ end
@@ -0,0 +1,40 @@
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
+ module WEB
11
+
12
+ class WebView < Wx::Control
13
+
14
+ # Sets emulation level.
15
+ #
16
+ # This function is useful to change the emulation level of the system browser control used for {Wx::WebView}
17
+ # implementation under MSW, rather than using the currently default, IE11-compatible, level (with wxRuby3).
18
+ #
19
+ # Please notice that this function works by modifying the per-user part of MSW registry, which has several
20
+ # implications: first, it is sufficient to call it only once (per user) as the changes done by it are persistent
21
+ # and, second, if you do not want them to be persistent, you need to call it with {Wx::WEB::WEBVIEWIE_EMU_DEFAULT}
22
+ # argument explicitly.
23
+ #
24
+ # In particular, this function should be called to allow {Wx::WEB::WebView#run_script} to work for JavaScript code
25
+ # returning arbitrary objects, which is not supported at the default emulation level.
26
+ #
27
+ # If set to a level higher than installed version, the highest available level will be used instead.
28
+ # {Wx::WEB::WEBVIEWIE_EMU_IE11} is recommended for best performance and experience.
29
+ #
30
+ # This function is MSW-specific and doesn't exist under other platforms.
31
+ #
32
+ # @param [Wx::WEB::WebViewIE_EmulationLevel] level
33
+ # @return [Boolean] true on success, false on failure (a warning message is also logged in the latter case).
34
+ # @wxrb_require WXMSW
35
+ def self.msw_set_ie_emulation_level(level=Wx::WEB::WEBVIEWIE_EMU_IE11); end
36
+ end
37
+
38
+ end
39
+
40
+ end
data/lib/wx/helpers.rb CHANGED
@@ -36,7 +36,7 @@ module Wx
36
36
  end
37
37
  rescue
38
38
  Kernel.raise ArgumentError,
39
- "Bad arg composition of #{args.inspect}"
39
+ "Bad arg composition of #{args.inspect} (error = #{$!}, param spec = #{param_spec.inspect})"
40
40
  end
41
41
 
42
42
  unless kwargs.empty?
@@ -27,6 +27,16 @@ module Wx
27
27
 
28
28
  end
29
29
 
30
+ class << self
31
+
32
+ define_method :HtmlModalHelp do |parent, help_file, topic = '', style = Wx::HTML::HF_DEFAULT_STYLE|
33
+
34
+ html_modal_help(parent, help_file, topic, style)
35
+
36
+ end
37
+
38
+ end
39
+
30
40
  end
31
41
 
32
42
  end
@@ -240,6 +240,17 @@ Wx::define_keyword_ctors(Wx::TextEntryDialog) do
240
240
  wx_ctor_params :pos
241
241
  end
242
242
 
243
+ # Dialog to get a number from the user
244
+ Wx::define_keyword_ctors(Wx::NumberEntryDialog) do
245
+ wx_ctor_params :message => ''
246
+ wx_ctor_params :prompt => 'Number'
247
+ wx_ctor_params :caption => 'Please enter a number'
248
+ wx_ctor_params :value => 0
249
+ wx_ctor_params :min => 0
250
+ wx_ctor_params :max => 0
251
+ wx_ctor_params :pos
252
+ end
253
+
243
254
  # wxPasswordEntryDialog Dialog to get a password from the user
244
255
  Wx::define_keyword_ctors(Wx::PasswordEntryDialog) do
245
256
  wx_ctor_params :message => ''
@@ -0,0 +1,8 @@
1
+ #-------------------------------------------------------------------------
2
+ # This file is automatically generated by the WXRuby3 interface generator.
3
+ # Do not alter this file.
4
+ #-------------------------------------------------------------------------
5
+
6
+ class Wx::EvtHandler
7
+ # from wxThreadEvent
8
+ end
@@ -0,0 +1,8 @@
1
+ # Copyright (c) 2023 M.J.N. Corino, The Netherlands
2
+ #
3
+ # This software is released under the MIT license.
4
+
5
+ # Wx::RT sub package for wxRuby3
6
+
7
+ require_relative './events/evt_list'
8
+ require_relative './thread_event'
@@ -0,0 +1,14 @@
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
+ Wx::EvtHandler.register_event_type Wx::EvtHandler::EventType[
9
+ 'evt_thread', 1,
10
+ Wx::RT::EVT_THREAD,
11
+ Wx::RT::ThreadEvent
12
+ ]
13
+
14
+ end
data/lib/wx/rt.rb ADDED
@@ -0,0 +1,16 @@
1
+ # Copyright (c) 2023 M.J.N. Corino, The Netherlands
2
+ #
3
+ # This software is released under the MIT license.
4
+
5
+ # Wx::RT sub package loader for wxRuby3
6
+
7
+
8
+ require 'wx/core'
9
+
10
+ require 'wxruby_rt'
11
+
12
+ require 'wx/rt/require'
13
+
14
+ ::Wx.include(WxRubyStyleAccessors)
15
+
16
+ ::Wx.include(::Wx::RT) if defined?(::WX_GLOBAL_CONSTANTS) && ::WX_GLOBAL_CONSTANTS
data/lib/wx/version.rb CHANGED
@@ -3,5 +3,5 @@
3
3
  # This software is released under the MIT license.
4
4
 
5
5
  module Wx
6
- WXRUBY_VERSION = '1.7.0'
6
+ WXRUBY_VERSION = '1.8.0'
7
7
  end
@@ -0,0 +1,74 @@
1
+ #-------------------------------------------------------------------------
2
+ # This file is automatically generated by the WXRuby3 interface generator.
3
+ # Do not alter this file.
4
+ #-------------------------------------------------------------------------
5
+
6
+ class Wx::EvtHandler
7
+ # from wxWebViewEvent
8
+ self.register_event_type EventType[
9
+ 'evt_webview_created', 1,
10
+ Wx::WEB::EVT_WEBVIEW_CREATED,
11
+ Wx::WEB::WebViewEvent
12
+ ]
13
+ self.register_event_type EventType[
14
+ 'evt_webview_navigating', 1,
15
+ Wx::WEB::EVT_WEBVIEW_NAVIGATING,
16
+ Wx::WEB::WebViewEvent
17
+ ]
18
+ self.register_event_type EventType[
19
+ 'evt_webview_navigated', 1,
20
+ Wx::WEB::EVT_WEBVIEW_NAVIGATED,
21
+ Wx::WEB::WebViewEvent
22
+ ]
23
+ self.register_event_type EventType[
24
+ 'evt_webview_loaded', 1,
25
+ Wx::WEB::EVT_WEBVIEW_LOADED,
26
+ Wx::WEB::WebViewEvent
27
+ ]
28
+ self.register_event_type EventType[
29
+ 'evt_webview_error', 1,
30
+ Wx::WEB::EVT_WEBVIEW_ERROR,
31
+ Wx::WEB::WebViewEvent
32
+ ]
33
+ self.register_event_type EventType[
34
+ 'evt_webview_newwindow', 1,
35
+ Wx::WEB::EVT_WEBVIEW_NEWWINDOW,
36
+ Wx::WEB::WebViewEvent
37
+ ]
38
+ self.register_event_type EventType[
39
+ 'evt_webview_newwindow_features', 1,
40
+ Wx::WEB::EVT_WEBVIEW_NEWWINDOW_FEATURES,
41
+ Wx::WEB::WebViewEvent
42
+ ]
43
+ self.register_event_type EventType[
44
+ 'evt_webview_window_close_requested', 1,
45
+ Wx::WEB::EVT_WEBVIEW_WINDOW_CLOSE_REQUESTED,
46
+ Wx::WEB::WebViewEvent
47
+ ]
48
+ self.register_event_type EventType[
49
+ 'evt_webview_title_changed', 1,
50
+ Wx::WEB::EVT_WEBVIEW_TITLE_CHANGED,
51
+ Wx::WEB::WebViewEvent
52
+ ]
53
+ self.register_event_type EventType[
54
+ 'evt_webview_fullscreen_changed', 1,
55
+ Wx::WEB::EVT_WEBVIEW_FULLSCREEN_CHANGED,
56
+ Wx::WEB::WebViewEvent
57
+ ]
58
+ self.register_event_type EventType[
59
+ 'evt_webview_script_message_received', 1,
60
+ Wx::WEB::EVT_WEBVIEW_SCRIPT_MESSAGE_RECEIVED,
61
+ Wx::WEB::WebViewEvent
62
+ ]
63
+ self.register_event_type EventType[
64
+ 'evt_webview_script_result', 1,
65
+ Wx::WEB::EVT_WEBVIEW_SCRIPT_RESULT,
66
+ Wx::WEB::WebViewEvent
67
+ ]
68
+ self.register_event_type EventType[
69
+ 'evt_webview_browsing_data_cleared', 1,
70
+ Wx::WEB::EVT_WEBVIEW_BROWSING_DATA_CLEARED,
71
+ Wx::WEB::WebViewEvent
72
+ ]
73
+ # from wxWebView
74
+ end
@@ -0,0 +1,8 @@
1
+ # Copyright (c) 2023 M.J.N. Corino, The Netherlands
2
+ #
3
+ # This software is released under the MIT license.
4
+
5
+ # Wx::WEB sub package for wxRuby3
6
+
7
+ require_relative './events/evt_list'
8
+ require_relative './webview'
@@ -0,0 +1,106 @@
1
+ # Copyright (c) 2023 M.J.N. Corino, The Netherlands
2
+ #
3
+ # This software is released under the MIT license.
4
+ #
5
+ # Some parts are
6
+ # Copyright 2004-2007, wxRuby development team
7
+ # released under the MIT-like wxRuby2 license
8
+
9
+ module Wx
10
+
11
+ module WEB
12
+
13
+ WEBVIEW_DEFAULT_URL_STR = 'about:blank'
14
+ WEBVIEW_BACKEND_WEB_KIT = 'wxWebViewWebKit'
15
+ WEBVIEW_BACKEND_CHROMIUM = 'wxWebViewChromium'
16
+ WEBVIEW_BACKEND_EDGE = 'wxWebViewEdge'
17
+ WEBVIEW_BACKEND_IE = 'wxWebViewIE'
18
+ WEBVIEW_BACKEND_DEFAULT = case Wx::PLATFORM
19
+ when 'WXOSX'
20
+ if Wx.has_feature?(:USE_WEBVIEW_WEBKIT)
21
+ WEBVIEW_BACKEND_WEB_KIT
22
+ elsif Wx.has_feature?(:USE_WEBVIEW_CHROMIUM)
23
+ WEBVIEW_BACKEND_CHROMIUM
24
+ else
25
+ ''
26
+ end
27
+ when 'WXMSW'
28
+ if Wx.has_feature?(:USE_WEBVIEW_EDGE) || Wx.has_feature?(:USE_WEBVIEW_EDGE_STATIC)
29
+ WEBVIEW_BACKEND_EDGE
30
+ elsif Wx.has_feature?(:USE_WEBVIEW_CHROMIUM)
31
+ WEBVIEW_BACKEND_CHROMIUM
32
+ elsif Wx.has_feature?(:USE_WEBVIEW_IE)
33
+ WEBVIEW_BACKEND_IE
34
+ else
35
+ ''
36
+ end
37
+ when 'WXGTK'
38
+ if Wx.has_feature?(:USE_WEBVIEW_WEBKIT2) || Wx.has_feature?(:USE_WEBVIEW_WEBKIT)
39
+ WEBVIEW_BACKEND_WEB_KIT
40
+ elsif Wx.has_feature?(:USE_WEBVIEW_CHROMIUM)
41
+ WEBVIEW_BACKEND_CHROMIUM
42
+ else
43
+ ''
44
+ end
45
+ else
46
+ ''
47
+ end
48
+ WEBVIEW_NAME_STR = 'WebView'
49
+
50
+ class WebView < Wx::Control
51
+
52
+ class << self
53
+ # Redefine #new method to support positional and named
54
+ # arguments
55
+ WEBVIEW_NEW_PARAMS = [Wx::Parameter[:id, Wx::StandardID::ID_ANY],
56
+ Wx::Parameter[:url, WEBVIEW_DEFAULT_URL_STR],
57
+ Wx::Parameter[:pos, Wx::DEFAULT_POSITION],
58
+ Wx::Parameter[:size, Wx::DEFAULT_SIZE],
59
+ Wx::Parameter[:backend, WEBVIEW_BACKEND_DEFAULT],
60
+ Wx::Parameter[:style, 0],
61
+ Wx::Parameter[:name, WEBVIEW_NAME_STR]]
62
+
63
+ wx_new = instance_method(:new)
64
+ wx_redefine_method :new do |*args, **kwargs|
65
+
66
+ if args.size == 1 && args.first.is_a?(::String)
67
+ wx_new.bind(self).call(*args) # no need for keyword scanning
68
+ elsif ::Wx::WXWIDGETS_VERSION >= '3.3.0' && args.size == 1 && args.first.is_a?(Wx::WEB::WebViewConfiguration)
69
+ wx_new.bind(self).call(*args) # no need for keyword scanning
70
+ else
71
+ full_args = []
72
+
73
+ full_args << args.shift # get parent argument
74
+
75
+ begin
76
+ args = Wx::args_as_list(WEBVIEW_NEW_PARAMS, *args, **kwargs)
77
+ rescue => err
78
+ err.set_backtrace(caller)
79
+ Kernel.raise err
80
+ end
81
+
82
+ # update the full arguments list with the optional arguments
83
+ full_args.concat(args)
84
+
85
+ # Call original add with full args
86
+ wx_new.bind(self).call(*full_args)
87
+ end
88
+
89
+ end
90
+
91
+ end
92
+
93
+ # take care of GC protection for registered handlers
94
+ wx_register_handler = instance_method :register_handler
95
+ define_method(:register_handler) do |handler|
96
+ (@handlers ||= []) << handler
97
+ wx_register_handler.bind(self).call(handler)
98
+ end
99
+ end
100
+
101
+ if Wx::PLATFORM == 'WXMSW' && Wx.has_feature?(:USE_WEBVIEW_IE)
102
+ Wx::WEB::WebView.msw_set_ie_emulation_level # set emulation level to highest possible by default
103
+ end
104
+
105
+ end
106
+ end
data/lib/wx/web.rb ADDED
@@ -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
+ # Wx::WEB sub package loader for wxRuby3
6
+
7
+
8
+ require 'wx/core'
9
+
10
+ require 'wxruby_web'
11
+
12
+ require_relative './web/require'
13
+
14
+ ::Wx.include(WxRubyStyleAccessors)
15
+
16
+ ::Wx.include(::Wx::WEB) if defined?(::WX_GLOBAL_CONSTANTS) && ::WX_GLOBAL_CONSTANTS
17
+ ::Wx::WEB.include((defined?(::WX_GLOBAL_CONSTANTS) && ::WX_GLOBAL_CONSTANTS) ? WxGlobalConstants : WxEnumConstants)
@@ -42,6 +42,16 @@ module WxRuby
42
42
  raise "Invalid version #{v} specified. Version should be '<major>.<minor>.<release>'." unless v =~ /^\d+\.\d+\.\d+$/
43
43
  Setup.options['wxversion'] = v
44
44
  end
45
+ opts.on('--without-webview',
46
+ 'disable including wxWidgets WebView library (only valid with --with-wxwin)') { |v|
47
+ Setup.options['with-webview'] = false
48
+ }
49
+ opts.on('--with-webview[=backend]',
50
+ 'include wxWidgets WebView library (only valid with --with-wxwin)',
51
+ 'backend = (comma separated list of) backend(s) to include',
52
+ 'without backend(s) specified only the default backend for the platform is included') { |v|
53
+ Setup.options['with-webview'] = v ? v : true
54
+ }
45
55
  opts.on('--swig=path',
46
56
  "the path to swig executable [swig]") {|v| Setup.options['swig'] = v}
47
57
  opts.on('--doxygen=path',
@@ -81,6 +91,11 @@ module WxRuby
81
91
  cfg_args << "--wxxml=#{Setup.options['wxxml']}" if Setup.options['wxxml']
82
92
  cfg_args << '--with-wxwin' if Setup.options['with-wxwin']
83
93
  cfg_args << '--with-wxhead' if Setup.options['with-wxhead']
94
+ if Setup.options['with-webview'] == false
95
+ cfg_args << '--without-webview'
96
+ elsif Setup.options['with-webview']
97
+ cfg_args << "--with-webview#{Setup.options['with-webview'] == true ? '' : "=#{Setup.options['with-webview']}"}"
98
+ end
84
99
  cfg_args << "--wxversion=#{Setup.options['wxversion']}" if Setup.options['wxversion']
85
100
  cfg_args << "--swig=#{Setup.options['swig']}" if Setup.options['swig']
86
101
  cfg_args << "--doxygen=#{Setup.options['doxygen']}" if Setup.options['doxygen']
data/lib/wx.rb CHANGED
@@ -7,6 +7,7 @@
7
7
  WX_GLOBAL_CONSTANTS=true unless defined? WX_GLOBAL_CONSTANTS
8
8
 
9
9
  require 'wx/core'
10
+ require 'wx/rt'
10
11
  require 'wx/prt' if Wx.has_feature?(:USE_PRINTING_ARCHITECTURE)
11
12
  require 'wx/rtc' if Wx.has_feature?(:USE_RICHTEXT)
12
13
  require 'wx/stc' if Wx.has_feature?(:USE_STC)
@@ -15,3 +16,4 @@ require 'wx/html' if Wx.has_feature?(:USE_HTML)
15
16
  require 'wx/aui' if Wx.has_feature?(:USE_AUI)
16
17
  require 'wx/pg' if Wx.has_feature?(:USE_PROPGRID)
17
18
  require 'wx/rbn' if Wx.has_feature?(:USE_RIBBON)
19
+ require 'wx/web' if Wx.has_feature?(:USE_WEBVIEW)
data/rakelib/configure.rb CHANGED
@@ -91,6 +91,17 @@ module WXRuby3
91
91
  CONFIG['wxversion'] = v
92
92
  CONFIG['with-wxhead'] = false
93
93
  }
94
+ opts.on('--without-webview',
95
+ 'disable including wxWidgets WebView library (only valid with --with-wxwin)') { |v|
96
+ CONFIG['with-webview'] = false
97
+ }
98
+ opts.on('--with-webview[=backend]',
99
+ 'include wxWidgets WebView library (only valid with --with-wxwin)',
100
+ 'backend = (comma separated list of) backend(s) to include',
101
+ 'without backend(s) specified only the default backend for the platform is included') { |v|
102
+ val = v ? v.split(',') : true
103
+ CONFIG['with-webview'] = val
104
+ }
94
105
  opts.on('--with-debug',
95
106
  "build with debugger support [#{instance.get_config('with-debug')}]") {|v| CONFIG['with-debug'] = true}
96
107
  opts.on('--swig=path',
@@ -161,6 +172,19 @@ module WXRuby3
161
172
  # else we're assumed to build wxWidgets ourselves so cannot test anything yet
162
173
  end
163
174
 
175
+ # embedded wxWidgets?
176
+ if get_config('with-wxwin') && get_config('with-webview').is_a?(Array)
177
+ # check validity of backends
178
+ if (v = get_config('with-webview')).is_a?(Array)
179
+ backends = WX_WEBVIEW_BACKENDS[instance.platform]
180
+ err = v.reject { |b| backends.include?(b) }
181
+ unless err.empty?
182
+ STDERR.puts "ERROR: '#{err.join("' and '")}' #{err.size>1 ? 'are not valid WebView backends' : 'is not a valid WebView backend'} for this platform."
183
+ exit(1)
184
+ end
185
+ end
186
+ end
187
+
164
188
  if get_cfg_string('wxxml').empty? && !get_cfg_string('wxwin').empty?
165
189
  # in case of a custom wxWidgets build and no explicit xml path check if the custom build holds this
166
190
  xml_path = File.join(get_cfg_string('wxwin'), 'docs', 'doxygen', 'out', 'xml')
data/rakelib/gem.rb CHANGED
@@ -74,7 +74,8 @@ module WXRuby3
74
74
  manifest.include 'lib/wx/**/events/*.rb', 'lib/wx/**/ext/*.rb', 'lib/wx/core/font/*.rb'
75
75
  manifest.include "lib/wx/doc/gen/**/*.rb"
76
76
  if WXRuby3.config.get_config('with-wxwin')
77
- manifest.include "ext/*.#{WXRuby3.config.dll_mask}"
77
+ manifest.include "ext/lib/*.#{WXRuby3.config.dll_mask}"
78
+ manifest.include "ext/lib/#{WXRuby3.config.wx_plugin_path}/**/*.#{WXRuby3.config.dll_mask}" # possible plugin libs
78
79
  end
79
80
  manifest
80
81
  end
@@ -299,7 +300,7 @@ module WXRuby3
299
300
  registry.each do |entry|
300
301
  path, mode, size, symlink = entry
301
302
  if symlink
302
- FileUtils.mkdir_p(File.dirname(symlink))
303
+ FileUtils.mkdir_p(File.dirname(path))
303
304
  FileUtils.ln_s(symlink, path)
304
305
  else
305
306
  FileUtils.mkdir_p(File.dirname(path))