wxruby3 0.9.0.pre.beta.14 → 0.9.0.pre.rc.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (214) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -0
  3. data/INSTALL.md +51 -22
  4. data/README.md +81 -6
  5. data/assets/hello_button-macos.png +0 -0
  6. data/assets/hello_button-msw.png +0 -0
  7. data/assets/hello_button.png +0 -0
  8. data/assets/hello_button_clicked-macos.png +0 -0
  9. data/assets/hello_button_clicked-msw.png +0 -0
  10. data/assets/hello_button_clicked.png +0 -0
  11. data/assets/hello_button_clicked_combi.png +0 -0
  12. data/assets/hello_world-macos.png +0 -0
  13. data/assets/hello_world-msw.png +0 -0
  14. data/assets/hello_world.png +0 -0
  15. data/assets/hello_world_combi.png +0 -0
  16. data/assets/repo-social-preview.png +0 -0
  17. data/ext/wxruby3/include/wxruby-runtime.h +1 -0
  18. data/ext/wxruby3/swig/memory_management.i +6 -10
  19. data/ext/wxruby3/swig/wx.i +17 -6
  20. data/lib/wx/core/art_locator.rb +2 -2
  21. data/lib/wx/core/artprovider.rb +2 -2
  22. data/lib/wx/core/bitmap.rb +6 -5
  23. data/lib/wx/core/bitmap_combobox.rb +34 -0
  24. data/lib/wx/core/brush.rb +6 -0
  25. data/lib/wx/core/controlwithitems.rb +52 -14
  26. data/lib/wx/core/cursor.rb +1 -1
  27. data/lib/wx/core/dc.rb +0 -20
  28. data/lib/wx/core/event_blocker.rb +14 -0
  29. data/lib/wx/core/evthandler.rb +48 -2
  30. data/lib/wx/core/find_replace_dialog.rb +24 -0
  31. data/lib/wx/core/font.rb +22 -14
  32. data/lib/wx/core/helpprovider.rb +2 -2
  33. data/lib/wx/core/icon.rb +1 -1
  34. data/lib/wx/core/image.rb +1 -1
  35. data/lib/wx/core/menu.rb +5 -0
  36. data/lib/wx/core/paintdc.rb +8 -0
  37. data/lib/wx/core/pen.rb +6 -0
  38. data/lib/wx/core/text_entry.rb +15 -0
  39. data/lib/wx/core/v_list_box.rb +13 -0
  40. data/lib/wx/core/window.rb +29 -2
  41. data/lib/wx/doc/app.rb +40 -0
  42. data/lib/wx/doc/brush.rb +17 -0
  43. data/lib/wx/doc/busy_info.rb +21 -0
  44. data/lib/wx/doc/client_dc.rb +28 -0
  45. data/lib/wx/doc/controlwithitems.rb +11 -0
  46. data/lib/wx/doc/dc.rb +0 -14
  47. data/lib/wx/doc/event_blocker.rb +27 -0
  48. data/lib/wx/doc/evthandler.rb +4 -0
  49. data/lib/wx/doc/extra/02_lifecycles.md +49 -0
  50. data/lib/wx/doc/extra/10_art.md +1 -1
  51. data/lib/wx/doc/extra/11_drawing_and_dc.md +62 -0
  52. data/lib/wx/doc/font.rb +27 -0
  53. data/lib/wx/doc/memory_dc.rb +75 -0
  54. data/lib/wx/doc/mirror_dc.rb +16 -0
  55. data/lib/wx/doc/pen.rb +17 -0
  56. data/lib/wx/doc/prt/printer_dc.rb +26 -0
  57. data/lib/wx/doc/radio_box.rb +20 -0
  58. data/lib/wx/doc/screen_dc.rb +10 -6
  59. data/lib/wx/doc/svg_file_dc.rb +20 -0
  60. data/lib/wx/doc/v_list_box.rb +9 -0
  61. data/lib/wx/doc/window.rb +27 -0
  62. data/lib/wx/doc/window_disabler.rb +10 -0
  63. data/lib/wx/html/keyword_defs.rb +6 -7
  64. data/lib/wx/html/require.rb +1 -0
  65. data/lib/wx/html/simple_html_listbox.rb +105 -0
  66. data/lib/wx/keyword_defs.rb +83 -75
  67. data/lib/wx/prt/keyword_defs.rb +5 -1
  68. data/lib/wx/version.rb +1 -1
  69. data/lib/wx/wxruby/cmd/test.rb +1 -1
  70. data/rakelib/install.rb +20 -7
  71. data/rakelib/lib/config/linux.rb +4 -2
  72. data/rakelib/lib/config/macosx.rb +120 -1
  73. data/rakelib/lib/config/mingw.rb +6 -1
  74. data/rakelib/lib/config/unixish.rb +26 -11
  75. data/rakelib/lib/config.rb +15 -6
  76. data/rakelib/lib/core/mapping.rb +5 -5
  77. data/rakelib/lib/core/package.rb +1 -1
  78. data/rakelib/lib/core/spec.rb +9 -5
  79. data/rakelib/lib/core/spec_helper.rb +9 -1
  80. data/rakelib/lib/director/accelerator.rb +1 -1
  81. data/rakelib/lib/director/app.rb +55 -4
  82. data/rakelib/lib/director/art_provider.rb +5 -1
  83. data/rakelib/lib/director/aui_pane_info.rb +1 -1
  84. data/rakelib/lib/director/aui_tab_ctrl.rb +1 -1
  85. data/rakelib/lib/director/aui_toolbar.rb +41 -0
  86. data/rakelib/lib/director/bitmap.rb +2 -1
  87. data/rakelib/lib/director/bitmap_combobox.rb +32 -0
  88. data/rakelib/lib/director/brush.rb +11 -1
  89. data/rakelib/lib/director/busy_info.rb +1 -1
  90. data/rakelib/lib/director/choice.rb +1 -0
  91. data/rakelib/lib/director/clipboard.rb +1 -1
  92. data/rakelib/lib/director/colour.rb +1 -0
  93. data/rakelib/lib/director/colour_picker_ctrl.rb +1 -1
  94. data/rakelib/lib/director/combobox.rb +2 -3
  95. data/rakelib/lib/director/context_help_button.rb +23 -0
  96. data/rakelib/lib/director/ctrl_with_items.rb +3 -0
  97. data/rakelib/lib/director/cursor.rb +1 -0
  98. data/rakelib/lib/director/data_object.rb +5 -7
  99. data/rakelib/lib/director/dc.rb +5 -1
  100. data/rakelib/lib/director/defs.rb +3 -0
  101. data/rakelib/lib/director/derived_dc.rb +278 -27
  102. data/rakelib/lib/director/dialog.rb +12 -3
  103. data/rakelib/lib/director/dir_picker_ctrl.rb +1 -1
  104. data/rakelib/lib/director/event.rb +3 -3
  105. data/rakelib/lib/director/event_blocker.rb +41 -0
  106. data/rakelib/lib/director/event_filter.rb +20 -0
  107. data/rakelib/lib/director/event_handler.rb +29 -2
  108. data/rakelib/lib/director/file_picker_ctrl.rb +1 -1
  109. data/rakelib/lib/director/find_replace_data.rb +1 -0
  110. data/rakelib/lib/director/font.rb +14 -4
  111. data/rakelib/lib/director/font_data.rb +1 -0
  112. data/rakelib/lib/director/font_picker_ctrl.rb +1 -1
  113. data/rakelib/lib/director/gdi_object.rb +1 -0
  114. data/rakelib/lib/director/graphics_context.rb +6 -6
  115. data/rakelib/lib/director/grid_table_message.rb +1 -1
  116. data/rakelib/lib/director/help_provider.rb +8 -10
  117. data/rakelib/lib/director/html_cell.rb +1 -1
  118. data/rakelib/lib/director/html_data_object.rb +5 -7
  119. data/rakelib/lib/director/html_listbox.rb +65 -1
  120. data/rakelib/lib/director/hyperlink_event.rb +22 -0
  121. data/rakelib/lib/director/icon.rb +2 -0
  122. data/rakelib/lib/director/listbox.rb +1 -0
  123. data/rakelib/lib/director/locale.rb +2 -1
  124. data/rakelib/lib/director/menu.rb +0 -3
  125. data/rakelib/lib/director/menu_bar.rb +3 -0
  126. data/rakelib/lib/director/palette.rb +1 -0
  127. data/rakelib/lib/director/pen.rb +12 -2
  128. data/rakelib/lib/director/pgproperties.rb +1 -1
  129. data/rakelib/lib/director/pgproperty.rb +1 -1
  130. data/rakelib/lib/director/pgvalidation_info.rb +1 -1
  131. data/rakelib/lib/director/platform_info.rb +1 -1
  132. data/rakelib/lib/director/popup_window.rb +18 -0
  133. data/rakelib/lib/director/print_data.rb +1 -1
  134. data/rakelib/lib/director/property_grid_interface.rb +1 -1
  135. data/rakelib/lib/director/property_grid_page_state.rb +1 -1
  136. data/rakelib/lib/director/radio_box.rb +15 -4
  137. data/rakelib/lib/director/region.rb +1 -0
  138. data/rakelib/lib/director/ribbon_art_provider.rb +1 -1
  139. data/rakelib/lib/director/richtext_buffer_data_object.rb +5 -7
  140. data/rakelib/lib/director/richtext_header_footer_data.rb +1 -1
  141. data/rakelib/lib/director/searchctrl.rb +25 -0
  142. data/rakelib/lib/director/sizer.rb +2 -2
  143. data/rakelib/lib/director/static_box.rb +1 -1
  144. data/rakelib/lib/director/styled_text_ctrl.rb +2 -0
  145. data/rakelib/lib/director/text_entry.rb +7 -2
  146. data/rakelib/lib/director/textctrl.rb +1 -1
  147. data/rakelib/lib/director/tree_ctrl.rb +6 -3
  148. data/rakelib/lib/director/uiaction_simulator.rb +20 -0
  149. data/rakelib/lib/director/variant.rb +1 -1
  150. data/rakelib/lib/director/vlistbox.rb +25 -0
  151. data/rakelib/lib/director/window.rb +37 -7
  152. data/rakelib/lib/director/with_images.rb +1 -1
  153. data/rakelib/lib/director/xml_node.rb +1 -1
  154. data/rakelib/lib/extractor/function.rb +5 -3
  155. data/rakelib/lib/generate/doc/about_dialog_info.yaml +46 -0
  156. data/rakelib/lib/generate/doc/accelerator.yaml +21 -0
  157. data/rakelib/lib/generate/doc/art_provider.yaml +35 -0
  158. data/rakelib/lib/generate/doc/bitmap.yaml +37 -0
  159. data/rakelib/lib/generate/doc/box_sizer.yaml +15 -0
  160. data/rakelib/lib/generate/doc/busy_info.yaml +74 -0
  161. data/rakelib/lib/generate/doc/client_dc.yaml +19 -0
  162. data/rakelib/lib/generate/doc/clipboard.yaml +43 -0
  163. data/rakelib/lib/generate/doc/collapsible_pane.yaml +21 -0
  164. data/rakelib/lib/generate/doc/colour_dialog.yaml +32 -0
  165. data/rakelib/lib/generate/doc/context_help_button.yaml +16 -0
  166. data/rakelib/lib/generate/doc/control.yaml +46 -0
  167. data/rakelib/lib/generate/doc/cursor.yaml +40 -0
  168. data/rakelib/lib/generate/doc/data_object.yaml +55 -0
  169. data/rakelib/lib/generate/doc/dc.yaml +14 -0
  170. data/rakelib/lib/generate/doc/dialog.yaml +36 -0
  171. data/rakelib/lib/generate/doc/dir_dialog.yaml +25 -0
  172. data/rakelib/lib/generate/doc/event_blocker.yaml +27 -0
  173. data/rakelib/lib/generate/doc/event_filter.yaml +47 -0
  174. data/rakelib/lib/generate/doc/events.yaml +152 -0
  175. data/rakelib/lib/generate/doc/evt_handler.yaml +63 -0
  176. data/rakelib/lib/generate/doc/file_dialog.yaml +68 -0
  177. data/rakelib/lib/generate/doc.rb +77 -14
  178. data/rakelib/lib/generate/interface.rb +22 -10
  179. data/rakelib/lib/specs/interfaces.rb +9 -5
  180. data/rakelib/lib/swig_runner.rb +3 -3
  181. data/rakelib/lib/typemap/common.rb +15 -3
  182. data/rakelib/lib/util/string.rb +1 -0
  183. data/rakelib/yard/yard/relative_markdown_links.rb +5 -1
  184. data/samples/aui/aui.rb +432 -363
  185. data/samples/bigdemo/wxArtProvider.rbw +5 -4
  186. data/samples/controls/controls.rb +2 -2
  187. data/samples/controls/htlbox.rb +411 -0
  188. data/samples/controls/tn_htlbox.png +0 -0
  189. data/samples/drawing/graphics_drawing.rb +1 -2
  190. data/samples/drawing/{svgtest.rb → image_prt.rb} +49 -18
  191. data/samples/drawing/tn_image_prt.png +0 -0
  192. data/samples/propgrid/propgrid.rb +26 -21
  193. data/samples/ribbon/ribbon.rb +47 -46
  194. data/samples/sampler/editor.rb +33 -25
  195. data/samples/sampler/sample.rb +2 -2
  196. data/samples/sampler/stc_editor.rb +4 -2
  197. data/tests/lib/item_container_tests.rb +82 -0
  198. data/tests/lib/text_entry_tests.rb +80 -0
  199. data/tests/lib/wxapp_runner.rb +15 -3
  200. data/tests/lib/wxframe_runner.rb +144 -0
  201. data/tests/test_app_event_filter.rb +74 -0
  202. data/tests/test_art_provider.rb +52 -0
  203. data/tests/test_clipboard.rb +2 -1
  204. data/tests/test_event_handling.rb +199 -16
  205. data/tests/test_events.rb +4 -11
  206. data/tests/test_ext_controls.rb +28 -0
  207. data/tests/test_font.rb +239 -0
  208. data/tests/test_gdi_object.rb +161 -0
  209. data/tests/test_intl.rb +16 -15
  210. data/tests/test_item_data.rb +33 -1
  211. data/tests/test_std_controls.rb +373 -0
  212. data/tests/test_window.rb +340 -0
  213. metadata +82 -4
  214. data/samples/drawing/tn_svgtest.png +0 -0
@@ -3,4 +3,123 @@
3
3
  # Copyright (c) M.J.N. Corino, The Netherlands
4
4
  ###
5
5
 
6
- raise "MacOSX platform is unsupported as yet."
6
+ require_relative './unixish'
7
+
8
+ module WXRuby3
9
+
10
+ module Config
11
+
12
+ module Platform
13
+
14
+ def self.included(base)
15
+ base.class_eval do
16
+ include Config::UnixLike
17
+
18
+ def debug_command(*args)
19
+ args.unshift(FileUtils::RUBY)
20
+ args.unshift('--')
21
+ args.unshift('lldb')
22
+ args.join(' ')
23
+ end
24
+
25
+ def dll_mask
26
+ "{#{dll_ext},dylib}"
27
+ end
28
+
29
+ def get_rpath_origin
30
+ "@loader_path"
31
+ end
32
+
33
+ def check_rpath_patch
34
+ # no need to check anything; install_name_tool is part of XCode cmdline tools
35
+ # and without these we couldn't build anything
36
+ true
37
+ end
38
+
39
+ def patch_rpath(shlib, *rpath)
40
+ # don't leave old rpath-s behind
41
+ sh("install_name_tool -delete_rpath '@loader_path/../lib' #{shlib} 2>/dev/null", verbose: false) { |_,_| }
42
+ # add deployment rpath-s
43
+ sh("install_name_tool #{rpath.collect {|rp| "-add_rpath '#{rp}'"}.join(' ')} #{shlib} 2>/dev/null", verbose: false) { |_,_| }
44
+ true
45
+ end
46
+
47
+ def update_shlib_loadpaths(shlib, deplibs)
48
+ changes = deplibs.collect { |dl| "-change '#{dl}' '@rpath/#{File.basename(dl)}'"}
49
+ sh("install_name_tool #{changes.join(' ')} #{shlib} 2>/dev/null", verbose: false) { |_,_| }
50
+ true
51
+ end
52
+
53
+ def get_wx_libs
54
+ wx_libset = ::Set.new
55
+ lib_list = wx_config("--libs all").split(' ')
56
+ until lib_list.empty?
57
+ s = lib_list.shift
58
+ if s == '-framework'
59
+ wx_libset << "#{s} #{lib_list.shift}"
60
+ else
61
+ wx_libset << s
62
+ end
63
+ end
64
+ # some weird thing with this; at least sometimes '--libs all' will not output media library even if feature active
65
+ if features_set?('wxUSE_MEDIACTRL')
66
+ lib_list = wx_config("--libs media").split(' ')
67
+ until lib_list.empty?
68
+ s = lib_list.shift
69
+ if s == '-framework'
70
+ wx_libset << "#{s} #{lib_list.shift}"
71
+ else
72
+ wx_libset << s
73
+ end
74
+ end
75
+ end
76
+ wx_libset.collect { |s| s.dup }
77
+ end
78
+
79
+ def do_link(pkg)
80
+ objs = pkg.all_obj_files.collect { |o| File.join('..', o) }.join(' ') + ' '
81
+ sh "cd lib && #{WXRuby3.config.ld} #{WXRuby3.config.ldflags(pkg.lib_target)} #{objs} " +
82
+ "#{WXRuby3.config.libs} #{WXRuby3.config.link_output_flag}#{pkg.lib_target}"
83
+ end
84
+
85
+ private
86
+
87
+ def wx_configure
88
+ bash('./configure --disable-sys-libs --without-liblzma --prefix=`pwd`/install --disable-tests --without-subdirs --disable-debug_info')
89
+ end
90
+
91
+ def wx_make
92
+ bash('make -j$(sysctl -n hw.logicalcpu) && make install')
93
+ end
94
+ end
95
+ end
96
+
97
+ def init_platform
98
+ init_unix_platform
99
+
100
+ @dll_pfx = 'lib'
101
+
102
+ if @wx_version
103
+ @cpp.sub!(/-std=gnu\+\+11/, '-std=gnu++14')
104
+ @ld.sub!(/-o\s*\Z/, '')
105
+
106
+ @extra_cflags.concat %w[-Wno-unused-function -Wno-conversion-null -Wno-sometimes-uninitialized
107
+ -Wno-overloaded-virtual -Wno-deprecated-copy]
108
+ @extra_cflags << ' -Wno-deprecated-declarations' unless @no_deprecated
109
+
110
+ # create a .dylib binary
111
+ @extra_ldflags << '-dynamic -bundle'
112
+
113
+ unless @wx_path.empty?
114
+ libdirs = @wx_libs.select {|s| s.start_with?('-L')}.collect {|s| s.sub(/^-L/,'')}
115
+ @exec_env['DYLD_LIBRARY_PATH'] = "#{ENV['DYLD_LIBRARY_PATH']}:#{dest_dir}:#{libdirs.join(':')}"
116
+ end
117
+ end
118
+ end
119
+ private :init_platform
120
+
121
+ end
122
+
123
+ end
124
+
125
+ end
@@ -21,8 +21,8 @@ module WXRuby3
21
21
  module Platform
22
22
 
23
23
  def self.included(base)
24
- base.include Config::UnixLike
25
24
  base.class_eval do
25
+ include Config::UnixLike
26
26
 
27
27
  attr_reader :rescomp
28
28
 
@@ -52,6 +52,10 @@ module WXRuby3
52
52
 
53
53
  private
54
54
 
55
+ def wx_make
56
+ bash('make && make install')
57
+ end
58
+
55
59
  def wx_generate_xml
56
60
  chdir(File.join(ext_path, 'wxWidgets', 'docs', 'doxygen')) do
57
61
  sh({ 'WX_SKIP_DOXYGEN_VERSION_CHECK' => '1' }, 'regen.bat xml')
@@ -107,6 +111,7 @@ module WXRuby3
107
111
 
108
112
  @ruby_ldflags.each { |flags| flags.sub!(' $(DEFFILE)', '') } # cleanup for older RubyInstaller versions
109
113
  @ruby_ldflags.each { |flags| flags.gsub!(/-s(\s|\Z)/, '') } if @debug_build # do not strip debug symbols for debug build
114
+ @ruby_ldflags << '-s' if @release_build # strip debug symbols for release build
110
115
  @ruby_cppflags << RB_CONFIG['debugflags'] if @debug_build
111
116
  @ruby_cppflags.each { |flags| flags.gsub!(/-O\d/, '-O0') } if @debug_build # disable optimizations for debug build
112
117
 
@@ -52,6 +52,10 @@ module WXRuby3
52
52
  "#{WXRuby3.config.libs} #{WXRuby3.config.link_output_flag}#{pkg.lib_target}"
53
53
  end
54
54
 
55
+ def get_rpath_origin
56
+ "$ORIGIN"
57
+ end
58
+
55
59
  private
56
60
 
57
61
  def wx_checkout
@@ -76,6 +80,14 @@ module WXRuby3
76
80
  end
77
81
  end
78
82
 
83
+ def wx_configure
84
+ bash('./configure --prefix=`pwd`/install --disable-tests --without-subdirs --disable-debug_info')
85
+ end
86
+
87
+ def wx_make
88
+ bash('make -j$(nproc) && make install')
89
+ end
90
+
79
91
  def wx_build
80
92
  # initialize submodules
81
93
  unless sh('git submodule update --init')
@@ -83,12 +95,12 @@ module WXRuby3
83
95
  exit(1)
84
96
  end
85
97
  # configure wxWidgets
86
- unless bash('./configure --prefix=`pwd`/install --disable-tests --without-subdirs --disable-debug_info')
98
+ unless wx_configure
87
99
  STDERR.puts "ERROR: Failed to configure wxWidgets."
88
100
  exit(1)
89
101
  end
90
102
  # make and install wxWidgets
91
- unless bash('make && make install')
103
+ unless wx_make
92
104
  STDERR.puts "ERROR: Failed to build wxWidgets libraries."
93
105
  exit(1)
94
106
  end
@@ -117,6 +129,16 @@ module WXRuby3
117
129
  get_cfg_string('wxxml')
118
130
  end
119
131
 
132
+ def get_wx_libs
133
+ wx_libset = ::Set.new
134
+ wx_libset.merge wx_config("--libs all").split(' ')
135
+ # some weird thing with this; at least sometimes '--libs all' will not output media library even if feature active
136
+ if features_set?('wxUSE_MEDIACTRL')
137
+ wx_libset.merge wx_config("--libs media").split(' ')
138
+ end
139
+ wx_libset.collect { |s| s.dup }
140
+ end
141
+
120
142
  def init_unix_platform
121
143
  # Allow specification of custom wxWidgets build (mostly useful for
122
144
  # static wxRuby3 builds)
@@ -155,13 +177,7 @@ module WXRuby3
155
177
 
156
178
  @cpp = wx_config("--cxx")
157
179
  @ld = wx_config("--ld")
158
- wx_libset = ::Set.new
159
- wx_libset.merge wx_config("--libs all").split(' ')
160
- # some weird thing with this; at least sometimes '--libs all' will not output media library even if feature active
161
- if features_set?('wxUSE_MEDIACTRL')
162
- wx_libset.merge wx_config("--libs media").split(' ')
163
- end
164
- @wx_libs = wx_libset.collect { |s| s.dup }
180
+ @wx_libs = get_wx_libs
165
181
 
166
182
  # remove all warning flags provided by Ruby config
167
183
  @ruby_cppflags = @ruby_cppflags.collect { |flags| flags.split(' ') }.flatten.
@@ -169,8 +185,7 @@ module WXRuby3
169
185
  @ruby_cppflags.concat %w[-Wall -Wextra -Wno-unused-parameter] # only keep these
170
186
  # add include flags
171
187
  @ruby_cppflags.concat ['-I.', *@ruby_includes.collect { |inc| "-I#{inc}" }]
172
- @ruby_ldflags << '-s' if @release_build # strip debug symbols for release build
173
- @ruby_ldflags << "-Wl,-rpath,\\$ORIGIN/../lib" # add default rpath
188
+ @ruby_ldflags << "-Wl,-rpath,'#{get_rpath_origin}/../lib'" # add default rpath
174
189
  @ruby_libs << "-L#{RB_CONFIG['libdir']}" # add ruby lib dir
175
190
  # add ruby defined shared ruby lib(s); not any other flags
176
191
  @ruby_libs.concat RB_CONFIG['LIBRUBYARG_SHARED'].split(' ').select { |s| s.start_with?('-l')}
@@ -245,11 +245,19 @@ module WXRuby3
245
245
  def do_link(_pkg)
246
246
  end
247
247
 
248
+ def get_rpath_origin
249
+ ''
250
+ end
251
+
248
252
  def check_rpath_patch
249
253
  true
250
254
  end
251
255
 
252
- def patch_rpath(_shlib, _rpath)
256
+ def patch_rpath(_shlib, *)
257
+ true
258
+ end
259
+
260
+ def update_shlib_loadpaths(_shlib, _deplibs)
253
261
  true
254
262
  end
255
263
 
@@ -389,11 +397,12 @@ module WXRuby3
389
397
  @rb_docgen_path = File.join(Config.wxruby_root, @rb_docgen_dir)
390
398
 
391
399
  # Extra swig helper files to be built
392
- @helper_modules = if macosx?
393
- %w|RubyStockObjects Mac|
394
- else
395
- %w|RubyStockObjects|
396
- end
400
+ @helper_modules = %w|RubyStockObjects|
401
+ # if macosx?
402
+ # %w|RubyStockObjects Mac|
403
+ # else
404
+ # %w|RubyStockObjects|
405
+ # end
397
406
  # helper to initialize on startup (stock objects can only be initialized after App creation)
398
407
  @helper_inits = @helper_modules - %w|RubyStockObjects|
399
408
 
@@ -223,13 +223,13 @@ module WXRuby3
223
223
  def map_to(typedef)
224
224
  if ::Hash === typedef
225
225
  typedef.each_pair do |argmasks, type|
226
- pattern = @patterns.detect { |ps| ps == argmasks }
226
+ pattern = @map.patterns.detect { |ps| ps == argmasks }
227
227
  raise "Unknown parameter set [#{argmasks}] for [#{@map}]" unless pattern
228
- @to[pattern] = type
228
+ @to[pattern] = _get_mapped_type(type)
229
229
  end
230
230
  else
231
- @patterns.inject(@to) do |map, pattern|
232
- map[pattern] = typedef
231
+ @map.patterns.inject(@to) do |map, pattern|
232
+ map[pattern] = _get_mapped_type(typedef)
233
233
  map
234
234
  end
235
235
  end
@@ -422,7 +422,7 @@ module WXRuby3
422
422
  end
423
423
 
424
424
  def map_out(ignore: nil, to: nil, temp: nil, code: nil, &block)
425
- @out = Out.new(self, ignore: ignore, to: nil, temp: temp, code: code, &block)
425
+ @out = Out.new(self, ignore: ignore, to: to, temp: temp, code: code, &block)
426
426
  end
427
427
 
428
428
  def map_freearg(temp: nil, code: nil, &block)
@@ -182,7 +182,7 @@ module WXRuby3
182
182
  # any included mixins for this class?
183
183
  !mixins.has_key?(cls) ||
184
184
  # if so, are all initialized?
185
- mixins[cls].all? do |modname|
185
+ mixins[cls].keys.all? do |modname|
186
186
  # same package?
187
187
  if modname.start_with?(cls_helper.package.fullname)
188
188
  wx_name = "wx#{modname.split('::').last}"
@@ -250,12 +250,12 @@ module WXRuby3
250
250
  self
251
251
  end
252
252
 
253
- def gc_as_temporary(*names)
253
+ def gc_as_untracked(*names)
254
254
  if names.empty?
255
- @gc_type = :GC_MANAGE_AS_TEMP
255
+ @gc_type = :GC_MANAGE_AS_UNTRACKED
256
256
  else
257
257
  @gc_type = ::Hash.new unless @gc_type.is_a?(::Hash)
258
- names.each {|n| @gc_type[n] = :GC_MANAGE_AS_TEMP }
258
+ names.each {|n| @gc_type[n] = :GC_MANAGE_AS_UNTRACKED }
259
259
  end
260
260
  self
261
261
  end
@@ -291,12 +291,16 @@ module WXRuby3
291
291
  @abstracts.has_key?(cls) && !@abstracts[cls]
292
292
  end
293
293
 
294
+ def concretes
295
+ @abstracts.keys.select { |cls| concrete?(cls) }
296
+ end
297
+
294
298
  def mixin?(cls)
295
299
  @mixins.include?(cls)
296
300
  end
297
301
 
298
- def include_mixin(cls, *module_names)
299
- (@included_mixins[cls] ||= ::Set.new).merge module_names.flatten
302
+ def include_mixin(cls, mixin_module)
303
+ (@included_mixins[cls] ||= {}).merge!(mixin_module.is_a?(::Hash) ? mixin_module : {mixin_module => nil})
300
304
  self
301
305
  end
302
306
 
@@ -153,6 +153,10 @@ module WXRuby3
153
153
  ifspec.abstract?(class_def.name) || (class_def.abstract && !ifspec.concrete?(class_def.name))
154
154
  end
155
155
 
156
+ def explicit_concretes
157
+ ifspec.concretes
158
+ end
159
+
156
160
  def mixins
157
161
  ifspec.mixins
158
162
  end
@@ -183,12 +187,16 @@ module WXRuby3
183
187
  return :GC_MANAGE_AS_SIZER if classdef.is_derived_from?('wxSizer') || classdef.name == 'wxSizer'
184
188
  return :GC_MANAGE_AS_REFCOUNTED if classdef.is_derived_from?('wxRefCounter')
185
189
  return :GC_MANAGE_AS_OBJECT if classdef.is_derived_from?('wxObject') || classdef.name == 'wxObject'
186
- return :GC_MANAGE_AS_TEMP
190
+ return :GC_MANAGE_AS_UNTRACKED
187
191
  end
188
192
  end
189
193
  ifspec.gc_type(classdef.name) || :GC_NEVER
190
194
  end
191
195
 
196
+ def is_tracked?(classdef)
197
+ gc_type(classdef) != :GC_MANAGE_AS_UNTRACKED
198
+ end
199
+
192
200
  def includes
193
201
  ifspec.includes
194
202
  end
@@ -37,7 +37,7 @@ module WXRuby3
37
37
  }
38
38
  }
39
39
  __HEREDOC
40
- spec.map 'int keyCode' => 'Integer' do
40
+ spec.map 'int keyCode' => 'Integer,String' do
41
41
  map_in code: '$1 = wxRuby_RubyStringOrIntToKeyCode($input);'
42
42
  map_typecheck precedence: 'INT32', code: <<~__CODE
43
43
  $1 = ( (TYPE($input) == T_FIXNUM) || wxRuby_IsAnEnum($input) ||
@@ -12,8 +12,8 @@ module WXRuby3
12
12
  class App < EvtHandler
13
13
 
14
14
  def setup
15
- spec.items << 'wxAppConsole'
16
- spec.fold_bases('wxApp' => 'wxAppConsole')
15
+ spec.items << 'wxAppConsole' << 'wxEventFilter'
16
+ spec.fold_bases('wxApp' => 'wxAppConsole', 'wxAppConsole' => 'wxEventFilter')
17
17
  spec.override_inheritance_chain('wxApp', %w[wxEvtHandler wxObject])
18
18
  spec.ignore %w{
19
19
  wxApp.ProcessMessage
@@ -71,6 +71,35 @@ module WXRuby3
71
71
  return dynamic_cast<const wxRubyApp*>(self)->IsRunning();
72
72
  }
73
73
  __HEREDOC
74
+ if Config.platform == :macosx
75
+ # add accessor methods for the standard OSX menu items
76
+ spec.add_extend_code 'wxApp', <<~__HEREDOC
77
+ void set_mac_about_menu_itemid(long menu_itemid)
78
+ {
79
+ $self->s_macAboutMenuItemId = menu_itemid;
80
+ }
81
+ long get_mac_about_menu_itemid(long menu_itemid)
82
+ {
83
+ return $self->s_macAboutMenuItemId;
84
+ }
85
+ void set_mac_preferences_menu_itemid(long menu_itemid)
86
+ {
87
+ $self->s_macPreferencesMenuItemId = menu_itemid;
88
+ }
89
+ long get_mac_preferences_menu_itemid(long menu_itemid)
90
+ {
91
+ return $self->s_macPreferencesMenuItemId;
92
+ }
93
+ void set_mac_exit_menu_itemid(long menu_itemid)
94
+ {
95
+ $self->s_macExitMenuItemId = menu_itemid;
96
+ }
97
+ long get_mac_exit_menu_itemid(long menu_itemid)
98
+ {
99
+ return $self->s_macExitMenuItemId;
100
+ }
101
+ __HEREDOC
102
+ end
74
103
  spec.ignore [
75
104
  'wxEntry(int &,wxChar **)',
76
105
  'wxEntry(HINSTANCE,HINSTANCE,char *,int)'
@@ -78,6 +107,7 @@ module WXRuby3
78
107
  spec.no_proxy %w{
79
108
  wxApp::GetDisplayMode
80
109
  wxApp::GetTopWindow
110
+ wxApp::OnAssertFailure
81
111
  }
82
112
  spec.include %w{
83
113
  wx/init.h
@@ -338,9 +368,30 @@ module WXRuby3
338
368
  }
339
369
 
340
370
  // actually implemented in ruby in classes/app.rb
341
- virtual void OnAssertFailure(const wxChar *file, int line, const wxChar *func, const wxChar *cond, const wxChar *msg)
371
+ virtual void OnAssertFailure(const wxChar *file, int line, const wxChar *func, const wxChar *cond, const wxChar *msg) override
342
372
  {
343
- std::wcout << "ASSERT fired" << std::endl;
373
+ VALUE rb_app = SWIG_RubyInstanceFor(this);
374
+ if (rb_during_gc() || NIL_P(rb_app))
375
+ {
376
+ std::wcout << file << "(" << line << "): ASSERT " << cond
377
+ << (NIL_P(rb_app) ? " fired without THE_APP in " : " fired during GC phase in ")
378
+ << func << "() with message [" << msg << "]" << std::endl;
379
+ }
380
+ else
381
+ {
382
+ VALUE obj0 = Qnil ;
383
+ VALUE obj1 = Qnil ;
384
+ VALUE obj2 = Qnil ;
385
+ VALUE obj3 = Qnil ;
386
+ VALUE obj4 = Qnil ;
387
+
388
+ obj0 = rb_str_new2((const char *)wxString(file).utf8_str());
389
+ obj1 = INT2NUM(line);
390
+ obj2 = rb_str_new2((const char *)wxString(func).utf8_str());
391
+ obj3 = rb_str_new2((const char *)wxString(cond).utf8_str());
392
+ obj4 = rb_str_new2((const char *)wxString(msg).utf8_str());
393
+ (void)wxRuby_Funcall(rb_app, rb_intern("on_assert_failure"), 5,obj0,obj1,obj2,obj3,obj4);
394
+ }
344
395
  }
345
396
 
346
397
  void _wxRuby_Cleanup()
@@ -15,7 +15,11 @@ module WXRuby3
15
15
  spec.use_class_implementation('wxArtProvider', 'wxRubyArtProvider')
16
16
  spec.ignore('wxArtProvider::Insert') # deprecated and problematic
17
17
  spec.ignore('wxArtProvider::Remove') # problematic as adding disowns the art provider, use Delete
18
- spec.no_proxy('wxArtProvider')
18
+ # regard protected methods
19
+ spec.regard 'wxArtProvider::DoGetSizeHint',
20
+ 'wxArtProvider::CreateBitmap',
21
+ 'wxArtProvider::CreateBitmapBundle',
22
+ 'wxArtProvider::CreateIconBundle'
19
23
  spec.include('wx/artprov.h')
20
24
  spec.add_swig_code <<~__HEREDOC
21
25
  // ArtId and ArtClient are basically just strings ...
@@ -11,7 +11,7 @@ module WXRuby3
11
11
 
12
12
  def setup
13
13
  spec.disable_proxies
14
- spec.gc_as_temporary
14
+ spec.gc_as_untracked
15
15
  spec.regard %w[
16
16
  wxAuiPaneInfo::name
17
17
  wxAuiPaneInfo::caption
@@ -16,7 +16,7 @@ module WXRuby3
16
16
  super
17
17
  # now replace items because wxAuiTabCtrl is actually not documented (!!!)
18
18
  spec.items.replace %w[wxAuiTabContainerButton]
19
- spec.gc_as_temporary 'wxAuiTabContainerButton'
19
+ spec.gc_as_untracked 'wxAuiTabContainerButton'
20
20
  spec.no_proxy %w[wxAuiTabCtrl wxAuiTabContainerButton]
21
21
  spec.swig_import %w[swig/classes/include/wxObject.h swig/classes/include/wxEvtHandler.h swig/classes/include/wxWindow.h swig/classes/include/wxControl.h]
22
22
  # cannot use #add_extend_code because we do not have an actual parsed XML item
@@ -13,6 +13,47 @@ module WXRuby3
13
13
 
14
14
  def setup
15
15
  super
16
+ # for #set_custom_overflow_items
17
+ spec.map 'const wxAuiToolBarItemArray&' => 'Array<Wx::AUI::AuiToolbarItem>,nil' do
18
+ map_in temp: 'wxAuiToolBarItemArray tmp', code: <<~__CODE
19
+ if (!NIL_P($input))
20
+ {
21
+ if (TYPE($input) == T_ARRAY)
22
+ {
23
+ for (int i=0; i<RARRAY_LEN($input) ;++i)
24
+ {
25
+ VALUE rb_el = rb_ary_entry($input, i);
26
+ void* ptr = 0;
27
+ int res = SWIG_ConvertPtr(rb_el, &ptr, SWIGTYPE_p_wxAuiToolBarItem, 0);
28
+ if (!SWIG_IsOK(res) || ptr == 0)
29
+ {
30
+ const char* msg;
31
+ VALUE rb_msg;
32
+ if (ptr)
33
+ {
34
+ rb_msg = rb_inspect(rb_el);
35
+ msg = StringValuePtr(rb_msg);
36
+ }
37
+ else
38
+ {
39
+ msg = "null reference";
40
+ }
41
+ rb_raise(rb_eTypeError, "$symname : expected Wx::AUI::AuiToolbarItem for array element for $argnum but got %s",
42
+ msg);
43
+ }
44
+ tmp.Add(*reinterpret_cast< wxAuiToolBarItem * >(ptr));
45
+ }
46
+ }
47
+ else
48
+ {
49
+ VALUE msg = rb_inspect($input);
50
+ rb_raise(rb_eArgError, "$symname : expected array for $argnum but got %s",
51
+ StringValuePtr(msg));
52
+ }
53
+ }
54
+ $1 = &tmp;
55
+ __CODE
56
+ end
16
57
  spec.do_not_generate(:variables, :defines, :enums, :functions) # with AuiToolBarEvent
17
58
  end
18
59
  end # class AuiToolBar
@@ -11,7 +11,8 @@ module WXRuby3
11
11
 
12
12
  def setup
13
13
  spec.items << 'wxBitmapBundle' << 'wxMask'
14
- spec.gc_as_object 'wxBitmapBundle'
14
+ spec.gc_as_untracked 'wxBitmap'
15
+ spec.gc_as_untracked 'wxBitmapBundle'
15
16
  spec.require_app 'wxBitmap',
16
17
  'wxBitmapBundle',
17
18
  'wxMask'
@@ -0,0 +1,32 @@
1
+ ###
2
+ # wxRuby3 wxWidgets interface director
3
+ # Copyright (c) M.J.N. Corino, The Netherlands
4
+ ###
5
+
6
+ require_relative './ctrl_with_items'
7
+
8
+ module WXRuby3
9
+
10
+ class Director
11
+
12
+ class BitmapComboBox < ControlWithItems
13
+
14
+ def setup
15
+ super
16
+ setup_ctrl_with_items('wxBitmapComboBox')
17
+ spec.override_inheritance_chain('wxBitmapComboBox',
18
+ %w[wxComboBox
19
+ wxControlWithItems
20
+ wxControl
21
+ wxWindow
22
+ wxEvtHandler
23
+ wxObject])
24
+ spec.ignore 'wxBitmapComboBox::Insert(const wxString &, const wxBitmap &, unsigned int, wxClientData *)',
25
+ 'wxBitmapComboBox::Append(const wxString &, const wxBitmap &, wxClientData *)'
26
+ end
27
+
28
+ end # class BitmapComboBox
29
+
30
+ end # class Director
31
+
32
+ end # module WXRuby3
@@ -12,6 +12,7 @@ module WXRuby3
12
12
  def setup
13
13
  super
14
14
  spec.disable_proxies
15
+ spec.gc_as_untracked 'wxBrush'
15
16
  # all but the default ctor require a running App
16
17
  spec.require_app 'wxBrush::wxBrush(const wxColour &colour, wxBrushStyle style)',
17
18
  'wxBrush::wxBrush(const wxBitmap &stippleBitmap)',
@@ -19,7 +20,16 @@ module WXRuby3
19
20
  # these are defined and loaded in RubyStockObjects.i
20
21
  spec.ignore %w[
21
22
  wxBLUE_BRUSH wxGREEN_BRUSH wxYELLOW_BRUSH wxWHITE_BRUSH wxBLACK_BRUSH wxGREY_BRUSH
22
- wxMEDIUM_GREY_BRUSH wxLIGHT_GREY_BRUSH wxTRANSPARENT_BRUSH wxCYAN_BRUSH wxRED_BRUSH wxTheBrushList]
23
+ wxMEDIUM_GREY_BRUSH wxLIGHT_GREY_BRUSH wxTRANSPARENT_BRUSH wxCYAN_BRUSH wxRED_BRUSH]
24
+ # do not expose this
25
+ spec.ignore 'wxTheBrushList'
26
+ # provide it's functionality as a class method of Brush instead
27
+ spec.add_extend_code 'wxBrush', <<~__HEREDOC
28
+ static wxBrush* find_or_create_brush(const wxColour &colour, wxBrushStyle style=wxBRUSHSTYLE_SOLID)
29
+ {
30
+ return wxTheBrushList->FindOrCreateBrush(colour, style);
31
+ }
32
+ __HEREDOC
23
33
  end
24
34
  end # class Brush
25
35
 
@@ -13,7 +13,7 @@ module WXRuby3
13
13
  super
14
14
  spec.items << 'wxBusyInfoFlags'
15
15
  spec.disable_proxies
16
- spec.gc_as_temporary 'wxBusyInfo', 'wxBusyInfoFlags'
16
+ spec.gc_as_untracked 'wxBusyInfo', 'wxBusyInfoFlags'
17
17
  # again C++ type guards do not work with Ruby
18
18
  # need to Rubify this
19
19
  spec.make_abstract 'wxBusyInfo'
@@ -23,6 +23,7 @@ module WXRuby3
23
23
  # redundant with good typemaps
24
24
  spec.ignore('wxChoice::wxChoice(wxWindow *,wxWindowID,const wxPoint &,const wxSize &,int,const wxString[],long,const wxValidator &,const wxString &)')
25
25
  spec.ignore('wxChoice::Create(wxWindow *,wxWindowID,const wxPoint &,const wxSize &,int,const wxString[],long,const wxValidator &,const wxString &)')
26
+ spec.ignore('wxChoice::IsSorted') # provided by ControlWithItems
26
27
  end
27
28
 
28
29
  end # class Choice
@@ -13,7 +13,7 @@ module WXRuby3
13
13
 
14
14
  def setup
15
15
  super
16
- spec.gc_as_temporary # don't even track Clipboard objects
16
+ spec.gc_as_untracked # don't even track Clipboard objects
17
17
  # there is no need or support for clipboard derivatives
18
18
  # not least because wxRuby only ever allows a single global clipboard
19
19
  spec.disable_proxies
@@ -10,6 +10,7 @@ module WXRuby3
10
10
  class Colour < Director
11
11
 
12
12
  def setup
13
+ spec.gc_as_untracked('wxColour')
13
14
  spec.require_app 'wxColour::wxColour(const wxColour&)'
14
15
  spec.ignore(%w[
15
16
  wxColour::GetPixel wxTransparentColour wxColour::operator!=