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
@@ -0,0 +1,20 @@
1
+ ###
2
+ # wxRuby3 wxWidgets interface director
3
+ # Copyright (c) M.J.N. Corino, The Netherlands
4
+ ###
5
+
6
+ module WXRuby3
7
+
8
+ class Director
9
+
10
+ class EventFilter < Director
11
+
12
+ def setup
13
+ super
14
+ spec.gc_as_untracked # no tracking
15
+ end
16
+ end # class EventFilter
17
+
18
+ end # class Director
19
+
20
+ end # module WXRuby3
@@ -64,6 +64,32 @@ module WXRuby3
64
64
  $1 = wx_ev;
65
65
  __CODE
66
66
  end
67
+ # add special mapping for event filters so we can accept the app instance as well
68
+ # although Wx::App is not derived from Wx::EventFilter in wxRuby (no multiple inheritance)
69
+ spec.map 'wxEventFilter*' => 'Wx::EventFilter,Wx::App' do
70
+ map_in code: <<~__CODE
71
+ int res = SWIG_ERROR;
72
+ void *argp = 0;
73
+ if (rb_obj_is_kind_of($input, ((swig_class*)SWIGTYPE_p_wxEventFilter->clientdata)->klass))
74
+ {
75
+ res = SWIG_ConvertPtr($input, &argp, SWIGTYPE_p_wxEventFilter, 0);
76
+ if (SWIG_IsOK(res)) $1 = reinterpret_cast< wxEventFilter * >(argp);
77
+ }
78
+ else
79
+ {
80
+ VALUE app_klass = rb_eval_string("Wx::App");
81
+ if (rb_obj_is_kind_of($input, app_klass))
82
+ {
83
+ res = SWIG_ConvertPtr($input, &argp, wxRuby_GetSwigTypeForClass(app_klass), 0);
84
+ if (SWIG_IsOK(res)) $1 = reinterpret_cast< wxApp * >(argp);
85
+ }
86
+ }
87
+ if (!SWIG_IsOK(res))
88
+ {
89
+ SWIG_exception_fail(SWIG_ArgError(res), Ruby_Format_TypeError( "", "wxEventFilter *","wxEvtHandler::$symname", 1, $input));
90
+ }
91
+ __CODE
92
+ end
67
93
  spec.add_runtime_code <<~__HEREDOC
68
94
  static swig_class wxRuby_GetSwigClassWxEvtHandler();
69
95
  WXRUBY_EXPORT VALUE wxRuby_GetEventTypeClassMap();
@@ -324,8 +350,9 @@ module WXRuby3
324
350
  }
325
351
 
326
352
  WXRUBY_EXPORT VALUE wxRuby_GetEventTypeClassMap() {
327
- VALUE map_name = rb_str_new2("EVENT_TYPE_CLASS_MAP");
328
- return rb_const_get(wxRuby_GetSwigClassWxEvtHandler().klass, rb_to_id(map_name));
353
+ return rb_funcall(wxRuby_GetSwigClassWxEvtHandler().klass,
354
+ rb_intern("send"),
355
+ 1, ID2SYM(rb_intern("get_event_type_class_map")), 0);
329
356
  }
330
357
  __HEREDOC
331
358
  spec.do_not_generate :typedefs, :variables, :enums, :defines, :functions
@@ -13,7 +13,7 @@ module WXRuby3
13
13
 
14
14
  def setup
15
15
  super
16
- spec.add_swig_code '%feature("notabstract") wxFilePickerCtrl;'
16
+ spec.make_concrete 'wxFilePickerCtrl'
17
17
  spec.do_not_generate(:variables, :defines, :enums, :functions) # with FileDirPickerEvent
18
18
  end
19
19
  end # class FilePickerCtrl
@@ -11,6 +11,7 @@ module WXRuby3
11
11
 
12
12
  def setup
13
13
  super
14
+ spec.gc_as_object 'wxFindReplaceData'
14
15
  spec.do_not_generate(:variables, :enums)
15
16
  end
16
17
  end # class FindReplaceData
@@ -12,7 +12,8 @@ module WXRuby3
12
12
  def setup
13
13
  super
14
14
  spec.items << 'wxFontInfo'
15
- spec.gc_as_temporary 'wxFontInfo'
15
+ spec.gc_as_untracked 'wxFontInfo'
16
+ spec.gc_as_untracked 'wxFont'
16
17
  # all but the default ctor require a running App
17
18
  spec.require_app 'wxFont::wxFont(const wxFont &)',
18
19
  'wxFont::wxFont(const wxFontInfo &)',
@@ -23,9 +24,7 @@ module WXRuby3
23
24
  'wxFont::GetDefaultEncoding',
24
25
  'wxFont::SetDefaultEncoding'
25
26
  spec.rename_for_ruby 'create' => 'wxFont::New'
26
- spec.ignore %w[
27
- wxFont::SetNativeFontInfo wxFont::GetNativeFontInfo wxFont::operator!=
28
- ]
27
+ spec.ignore [ 'wxFont::SetNativeFontInfo(const wxNativeFontInfo &)', 'wxFont::GetNativeFontInfo', 'wxFont::operator!=' ]
29
28
  spec.ignore 'wxFont::wxFont(const wxNativeFontInfo &)'
30
29
  if Config.instance.wx_port == :wxQT
31
30
  # not implemented
@@ -86,6 +85,17 @@ module WXRuby3
86
85
  return SWIG_NewPointerObj(new wxFont(font), SWIGTYPE_p_wxFont, SWIG_POINTER_OWN);
87
86
  }
88
87
  __HEREDOC
88
+ # implement wxTheFontList methods as static methods of Wx::Font
89
+ spec.add_extend_code 'wxFont', <<~__HEREDOC
90
+ static wxFont * find_or_create_font(int point_size, wxFontFamily family, wxFontStyle style, wxFontWeight weight, bool underline=false, const wxString &facename=wxEmptyString, wxFontEncoding encoding=wxFONTENCODING_DEFAULT)
91
+ {
92
+ return wxTheFontList->FindOrCreateFont(point_size, family, style, weight, underline, facename, encoding);
93
+ }
94
+ static wxFont * find_or_create_font(const wxFontInfo &fontInfo)
95
+ {
96
+ return wxTheFontList->FindOrCreateFont(fontInfo);
97
+ }
98
+ __HEREDOC
89
99
  spec.do_not_generate :functions
90
100
  end
91
101
 
@@ -11,6 +11,7 @@ module WXRuby3
11
11
 
12
12
  def setup
13
13
  super
14
+ spec.gc_as_untracked 'wxFontData'
14
15
  # add copy ctor missing from XML docs
15
16
  spec.extend_interface 'wxFontData',
16
17
  'wxFontData(const wxFontData & other)'
@@ -13,7 +13,7 @@ module WXRuby3
13
13
 
14
14
  def setup
15
15
  super
16
- spec.add_swig_code '%feature("notabstract") wxFontPickerCtrl;'
16
+ spec.make_concrete 'wxFontPickerCtrl'
17
17
  spec.do_not_generate(:variables, :defines, :enums, :functions) # with FontPickerEvent
18
18
  end
19
19
  end # class FontPickerCtrl
@@ -12,6 +12,7 @@ module WXRuby3
12
12
  def setup
13
13
  spec.make_abstract('wxGDIObject')
14
14
  spec.no_proxy('wxGDIObject')
15
+ spec.gc_as_untracked 'wxGDIObject'
15
16
  super
16
17
  end
17
18
  end # class GDIObject
@@ -12,14 +12,16 @@ module WXRuby3
12
12
  def setup
13
13
  super
14
14
  spec.disable_proxies
15
- # these static creators require a running app
16
- spec.require_app 'wxGraphicsContext::Create',
17
- 'wxGraphicsContext::CreateFromUnknownDC'
15
+ # do not track GraphicContext objects as that causes problems probably for similar
16
+ # reasons as for DC objects
17
+ spec.gc_as_untracked
18
+ # ignore all these; wxRuby only supports the ::draw_on methods
18
19
  spec.ignore 'wxGraphicsContext::CreateFromNative',
19
20
  'wxGraphicsContext::CreateFromNativeWindow',
20
21
  'wxGraphicsContext::CreateFromNativeHDC',
22
+ 'wxGraphicsContext::CreateFromUnknownDC',
21
23
  'wxGraphicsContext::GetNativeContext',
22
- 'wxGraphicsContext::Create(const wxEnhMetaFileDC &)'
24
+ 'wxGraphicsContext::Create'
23
25
  # type mappings
24
26
  # Typemap to fix GraphicsContext#get_text_extent
25
27
  spec.map_apply 'double *OUTPUT' => [ 'wxDouble* width', 'wxDouble* height',
@@ -135,8 +137,6 @@ module WXRuby3
135
137
  }
136
138
  __CODE
137
139
  end
138
- spec.new_object 'wxGraphicsContext::Create',
139
- 'wxGraphicsContext::CreateFromUnknownDC'
140
140
  # add convenience method providing efficient gc memory management
141
141
  spec.add_extend_code 'wxGraphicsContext', <<~__HEREDOC
142
142
  static VALUE draw_on(wxWindow* win)
@@ -11,7 +11,7 @@ module WXRuby3
11
11
 
12
12
  def setup
13
13
  super
14
- spec.gc_as_temporary
14
+ spec.gc_as_untracked
15
15
  end
16
16
  end # class GridTableMessage
17
17
 
@@ -27,7 +27,7 @@ module WXRuby3
27
27
  public:
28
28
  // This is pure virtual in base Wx class, so won't compile unless an
29
29
  // implementation is provided
30
- wxString GetHelp(const wxWindowBase* window)
30
+ wxString GetHelp(const wxWindowBase* window) override
31
31
  {
32
32
  static WxRuby_ID get_help_id("get_help");
33
33
 
@@ -50,7 +50,7 @@ module WXRuby3
50
50
  // RemoveHelp is called by Wx after the window deletion event has been
51
51
  // handled. A standard director here re-wraps the already destroyed
52
52
  // object, which will cause rapid segfaults when it is later marked.
53
- void RemoveHelp(wxWindowBase* window)
53
+ void RemoveHelp(wxWindowBase* window) override
54
54
  {
55
55
  static WxRuby_ID remove_help_id("remove_help");
56
56
 
@@ -64,13 +64,8 @@ module WXRuby3
64
64
  };
65
65
  __HEREDOC
66
66
  spec.add_swig_code <<~__HEREDOC
67
+ GC_MANAGE_AS_OBJECT(wxRubyHelpProvider);
67
68
  typedef wxWindow wxWindowBase;
68
-
69
- %ignore wxHelpProvider::GetHelp; // Must be supplied in Ruby
70
-
71
- // Need to avoid standard director as it will call with destroyed
72
- // objects
73
- %feature("nodirector") wxHelpProvider::RemoveHelp;
74
69
  __HEREDOC
75
70
  spec.map 'wxWindowBase' => 'Wx::Window', swig: false do
76
71
  map_in
@@ -88,8 +83,11 @@ module WXRuby3
88
83
  static wxRubyHelpProvider* Get();
89
84
  virtual void AddHelp(wxWindowBase* window, const wxString& text);
90
85
  virtual void AddHelp(wxWindowID id, const wxString& text);
91
- virtual wxString GetHelp(const wxWindowBase* window);
92
- virtual void RemoveHelp(wxWindowBase* window);
86
+ // we do not include the declaration of GetHelp here because
87
+ // we do not want a default implementation or director as we have
88
+ // a fixed director implementation above and the rest is pure Ruby
89
+ // virtual wxString GetHelp(const wxWindowBase* window);
90
+ void RemoveHelp(wxWindowBase* window); // no virtual as we have fixed director impl above
93
91
  virtual bool ShowHelp(wxWindowBase* window);
94
92
  virtual bool ShowHelpAtPoint(wxWindowBase* window, const wxPoint point,
95
93
  wxHelpEvent::Origin origin);
@@ -20,7 +20,7 @@ module WXRuby3
20
20
  spec.make_abstract 'wxHtmlCell'
21
21
  spec.make_abstract 'wxHtmlLinkInfo'
22
22
  spec.make_abstract 'wxHtmlContainerCell'
23
- spec.gc_as_temporary 'wxHtmlLinkInfo' # no tracking
23
+ spec.gc_as_untracked 'wxHtmlLinkInfo' # no tracking
24
24
  spec.ignore 'wxHtmlCell::Find'
25
25
  # not useful for wxRuby as we do not support customizing these
26
26
  spec.ignore 'wxHtmlCell::AdjustPagebreak',
@@ -20,13 +20,11 @@ module WXRuby3
20
20
  # we only allow Ruby derivatives from wxDataObject but not of any of the C++ implemented
21
21
  # specializations
22
22
  spec.no_proxy 'wxHTMLDataObject'
23
- spec.add_swig_code <<~__HEREDOC
24
- // SWIG gets confused and doesn't realise that various virtual methods
25
- // from wxDataObject are implemented fully in this subclass, and so,
26
- // believing it to be abstract doesn't provide an allocator for this
27
- // class. This undocumented feature overrides this.
28
- %feature("notabstract") wxHTMLDataObject;
29
- __HEREDOC
23
+ # SWIG gets confused and doesn't realise that various virtual methods
24
+ # from wxDataObject are implemented fully in this subclass, and so,
25
+ # believing it to be abstract doesn't provide an allocator for this
26
+ # class. This overrides this.
27
+ spec.make_concrete 'wxHTMLDataObject'
30
28
 
31
29
  end
32
30
 
@@ -12,7 +12,7 @@ module WXRuby3
12
12
  class HtmlListBox < Window
13
13
 
14
14
  def setup
15
- spec.items << 'wxSimpleHtmlListBox'
15
+ spec.items << 'wxSimpleHtmlListBox' << 'wxItemContainer'
16
16
  super
17
17
  spec.override_inheritance_chain('wxHtmlListBox', %w[wxVListBox wxVScrolledWindow wxPanel wxWindow wxEvtHandler wxObject])
18
18
  spec.make_abstract 'wxHtmlListBox'
@@ -44,8 +44,72 @@ module WXRuby3
44
44
  $self->GetFileSystem().ChangePathTo(location, is_dir);
45
45
  }
46
46
  __HEREDOC
47
+ # make sure protected methods are included
48
+ spec.regard 'wxHtmlListBox::OnGetItem',
49
+ 'wxHtmlListBox::OnGetItemMarkup',
50
+ 'wxHtmlListBox::GetSelectedTextColour',
51
+ 'wxHtmlListBox::GetSelectedTextBgColour',
52
+ 'wxHtmlListBox::OnLinkClicked'
53
+ # add missing protected overloads
54
+ spec.extend_interface 'wxHtmlListBox',
55
+ 'virtual void OnDrawItem(wxDC &dc, const wxRect &rect, size_t n) const',
56
+ 'virtual wxCoord OnMeasureItem(size_t n) const',
57
+ 'virtual void OnDrawBackground(wxDC &dc, const wxRect &rect, size_t n) const',
58
+ 'virtual void OnDrawSeparator(wxDC& dc, wxRect& rect, size_t n) const',
59
+ visibility: 'protected'
60
+
47
61
  # override inheritance chain
48
62
  spec.override_inheritance_chain('wxSimpleHtmlListBox', %w[wxHtmlListBox wxVListBox wxVScrolledWindow wxPanel wxWindow wxEvtHandler wxObject])
63
+ spec.fold_bases('wxSimpleHtmlListBox' => %w[wxItemContainer])
64
+ # override SWIG's confusion
65
+ spec.make_concrete 'wxSimpleHtmlListBox'
66
+ # not useful overload
67
+ spec.ignore 'wxSimpleHtmlListBox::wxSimpleHtmlListBox(wxWindow *, wxWindowID, const wxPoint &, const wxSize &, int, const wxString[], long, const wxValidator &, const wxString &)'
68
+ # add missing overloads
69
+ spec.extend_interface 'wxSimpleHtmlListBox',
70
+ 'virtual wxString GetString(unsigned int n) const',
71
+ 'virtual void SetString(unsigned int n, const wxString &string)'
72
+ spec.ignore([ 'wxItemContainer::Append(const wxString &, wxClientData *)',
73
+ 'wxItemContainer::Append(const std::vector< wxString > &)',
74
+ 'wxItemContainer::Append(const wxArrayString &, wxClientData **)',
75
+ 'wxItemContainer::Append(unsigned int, const wxString *)',
76
+ 'wxItemContainer::Append(unsigned int, const wxString *, void **)',
77
+ 'wxItemContainer::Append(unsigned int, const wxString *, wxClientData **)',
78
+ 'wxItemContainer::Insert(const wxString &, unsigned int, wxClientData *)',
79
+ 'wxItemContainer::Insert(const std::vector< wxString > &)',
80
+ 'wxItemContainer::Insert(const wxArrayString &, unsigned int, wxClientData **)',
81
+ 'wxItemContainer::Insert(unsigned int, const wxString *, unsigned int)',
82
+ 'wxItemContainer::Insert(unsigned int, const wxString *, unsigned int, void **)',
83
+ 'wxItemContainer::Insert(unsigned int, const wxString *, unsigned int, wxClientData **)',
84
+ 'wxItemContainer::Set(const std::vector< wxString > &)',
85
+ 'wxItemContainer::Set(const wxArrayString &, wxClientData **)',
86
+ 'wxItemContainer::Set(unsigned int, const wxString *)',
87
+ 'wxItemContainer::Set(unsigned int, const wxString *, void **)',
88
+ 'wxItemContainer::Set(unsigned int, const wxString *, wxClientData **)',
89
+ 'wxItemContainer::DetachClientObject',
90
+ 'wxItemContainer::HasClientObjectData',
91
+ 'wxItemContainer::GetClientObject',
92
+ 'wxItemContainer::SetClientObject',
93
+ 'wxItemContainer::HasClientUntypedData',
94
+ 'wxItemContainer::Clear'])
95
+ spec.ignore([ 'wxItemContainer::Append(const wxArrayString &, void **)',
96
+ 'wxItemContainer::Insert(const wxArrayString &, unsigned int, void **)',
97
+ 'wxItemContainer::Set(const wxArrayString &, void **)'], ignore_doc: false)
98
+ # for doc only
99
+ spec.map 'void** clientData' => 'Array', swig: false do
100
+ map_in code: ''
101
+ end
102
+ spec.ignore(%w[wxItemContainer::GetClientData wxItemContainer::SetClientData], ignore_doc: false) # keep docs
103
+ # Replace the old Wx definition of this method (which segfaults)
104
+ # Only need the setter as we cache data in Ruby and the getter
105
+ # therefor can be pure Ruby
106
+ spec.add_extend_code('wxSimpleHtmlListBox', <<~__HEREDOC
107
+ VALUE set_client_data(int n, VALUE item_data) {
108
+ self->SetClientData(n, (void *)item_data);
109
+ return item_data;
110
+ }
111
+ __HEREDOC
112
+ )
49
113
  end
50
114
  end # class HtmlListBox
51
115
 
@@ -0,0 +1,22 @@
1
+ ###
2
+ # wxRuby3 wxWidgets interface director
3
+ # Copyright (c) M.J.N. Corino, The Netherlands
4
+ ###
5
+
6
+ require_relative './event'
7
+
8
+ module WXRuby3
9
+
10
+ class Director
11
+
12
+ class HyperlinkEvent < Event
13
+
14
+ def setup
15
+ super
16
+ spec.do_not_generate :variables, :enums, :defines, :functions # with HyperlinkCtrl
17
+ end
18
+ end # class HyperlinkEvent
19
+
20
+ end # class Director
21
+
22
+ end # module WXRuby3
@@ -13,6 +13,8 @@ module WXRuby3
13
13
 
14
14
  def setup
15
15
  spec.items << 'wxIconBundle'
16
+ spec.gc_as_untracked 'wxIcon'
17
+ spec.gc_as_untracked 'wxIconBundle'
16
18
  spec.disable_proxies
17
19
  spec.require_app 'wxIcon', 'wxIconBundle'
18
20
  # disable as there is no way to distinguish char*/[] from wxString in Ruby
@@ -23,6 +23,7 @@ module WXRuby3
23
23
  wxEvtHandler
24
24
  wxObject])
25
25
  spec.ignore('wxListBox::InsertItems(unsigned int,const wxString *,unsigned int)')
26
+ spec.ignore('wxListBox::IsSorted') # provided by ControlWithItems
26
27
  end
27
28
 
28
29
  end # class ListBox
@@ -14,7 +14,8 @@ module WXRuby3
14
14
  spec.disable_proxies
15
15
  spec.items << 'wxLanguageInfo' << 'language.h'
16
16
  spec.gc_as_object('wxLocale')
17
- spec.gc_as_temporary('wxLanguageInfo')
17
+ spec.gc_as_untracked('wxLanguageInfo')
18
+ spec.make_concrete 'wxLanguageInfo'
18
19
  spec.regard %w[
19
20
  wxLanguageInfo::Language
20
21
  wxLanguageInfo::LocaleTag
@@ -30,9 +30,6 @@ module WXRuby3
30
30
  __HEREDOC
31
31
  # make Ruby director and wrappers use custom implementation
32
32
  spec.use_class_implementation('wxMenu', 'wxRubyMenu')
33
- spec.rename_for_ruby(
34
- 'AppendItem' =>
35
- 'wxMenu::Append(wxMenuItem *item)')
36
33
  # ignore non-const version as that has no benefits in Ruby
37
34
  spec.ignore 'wxMenu::GetMenuItems()'
38
35
  # Fix for GetMenuItems - converts list of MenuItems to Array
@@ -19,6 +19,9 @@ module WXRuby3
19
19
  'wxMenuBar::GetLabelTop',
20
20
  'wxMenuBar::SetLabelTop',
21
21
  'wxMenuBar::Refresh')
22
+ unless Config.instance.wx_version >= '3.3' || Config.instance.wx_abi_version > '3.0.0'
23
+ spec.ignore 'wxMenuBar::OSXGetAppleMenu'
24
+ end
22
25
  super
23
26
  end
24
27
  end # class MenuBar
@@ -12,6 +12,7 @@ module WXRuby3
12
12
  def setup
13
13
  super
14
14
  spec.disable_proxies
15
+ spec.gc_as_untracked 'wxPalette'
15
16
  if Config.instance.wx_port == :wxQT
16
17
  # mismatched implementation which does nothing anyway
17
18
  spec.ignore 'wxPalette::wxPalette(int, const unsigned char *, const unsigned char *, const unsigned char *)'
@@ -12,7 +12,8 @@ module WXRuby3
12
12
  def setup
13
13
  super
14
14
  spec.items << 'wxPenInfo'
15
- spec.gc_as_temporary 'wxPenInfo'
15
+ spec.gc_as_untracked 'wxPenInfo'
16
+ spec.gc_as_untracked 'wxPen'
16
17
  spec.disable_proxies
17
18
  spec.add_header_code <<~__HEREDOC
18
19
  // special free funcs are needed to clean up Dashes array if it has been
@@ -165,7 +166,16 @@ module WXRuby3
165
166
  # these are defined and loaded in RubyStockObjects.i
166
167
  spec.ignore %w[
167
168
  wxRED_PEN wxBLUE_PEN wxCYAN_PEN wxGREEN_PEN wxYELLOW_PEN wxBLACK_PEN wxWHITE_PEN
168
- wxTRANSPARENT_PEN wxBLACK_DASHED_PEN wxGREY_PEN wxMEDIUM_GREY_PEN wxLIGHT_GREY_PEN wxThePenList]
169
+ wxTRANSPARENT_PEN wxBLACK_DASHED_PEN wxGREY_PEN wxMEDIUM_GREY_PEN wxLIGHT_GREY_PEN]
170
+ # do not expose this
171
+ spec.ignore 'wxThePenList'
172
+ # provide it's functionality as a class method of Pen instead
173
+ spec.add_extend_code 'wxPen', <<~__HEREDOC
174
+ static wxPen* find_or_create_pen(const wxColour &colour, int width=1, wxPenStyle style=wxPENSTYLE_SOLID)
175
+ {
176
+ return wxThePenList->FindOrCreatePen(colour, width, style);
177
+ }
178
+ __HEREDOC
169
179
  end
170
180
  end # class Pen
171
181
 
@@ -26,7 +26,7 @@ module WXRuby3
26
26
  'wxEnumProperty::wxEnumProperty(const wxString &, const wxString &, const wxChar *const *, const long *, wxPGChoices *, int)'
27
27
  spec.ignore 'wxEditEnumProperty::wxEditEnumProperty(const wxString &, const wxString &, const wxChar *const *, const long *, const wxString&)',
28
28
  'wxEditEnumProperty::wxEditEnumProperty(const wxString &, const wxString &, const wxChar *const *, const long *, wxPGChoices *, const wxString&)'
29
- spec.gc_as_temporary 'wxColourPropertyValue'
29
+ spec.gc_as_untracked 'wxColourPropertyValue'
30
30
  spec.regard 'wxColourPropertyValue::m_type',
31
31
  'wxColourPropertyValue::m_colour'
32
32
  spec.regard 'wxSystemColourProperty::Init',
@@ -29,7 +29,7 @@ module WXRuby3
29
29
  'drawn_height' => 'wxPGPaintData::m_drawnHeight'
30
30
  # wxPGChoices are always returned by value and never transfer ownership
31
31
  # so we do not need tracking or special free function
32
- spec.gc_as_temporary 'wxPGChoices'
32
+ spec.gc_as_untracked 'wxPGChoices'
33
33
  # prevent exposure of wxPGChoicesData; not of any real use in wxRuby
34
34
  spec.ignore 'wxPGChoices::wxPGChoices(wxPGChoicesData*)',
35
35
  'wxPGChoices::AssignData',
@@ -12,7 +12,7 @@ module WXRuby3
12
12
  def setup
13
13
  super
14
14
  spec.items << 'propgrid/propgrid.h'
15
- spec.gc_as_temporary 'wxPGValidationInfo'
15
+ spec.gc_as_untracked 'wxPGValidationInfo'
16
16
  if Config.instance.wx_version < '3.3.0'
17
17
  spec.ignore 'wxPGVFBFlags' # not a constant but a rather a clumsy typedef
18
18
  end
@@ -11,7 +11,7 @@ module WXRuby3
11
11
 
12
12
  def setup
13
13
  super
14
- spec.gc_as_temporary
14
+ spec.gc_as_untracked
15
15
  spec.make_abstract('wxPlatformInfo')
16
16
  spec.ignore 'wxPlatformInfo::wxPlatformInfo',
17
17
  'wxPlatformInfo::operator==',
@@ -14,6 +14,24 @@ module WXRuby3
14
14
  def setup
15
15
  spec.items << 'wxPopupTransientWindow'
16
16
  super
17
+ spec.items.each do |itm|
18
+ spec.no_proxy("#{itm}::ClearBackground",
19
+ "#{itm}::Enable",
20
+ "#{itm}::GetHelpTextAtPoint",
21
+ "#{itm}::GetMaxSize",
22
+ "#{itm}::GetMinSize",
23
+ "#{itm}::Refresh",
24
+ "#{itm}::Update")
25
+ end
26
+ # add these to the generated interface to be parsed by SWIG
27
+ # the wxWidgets docs are flawed in this respect that several reimplemented
28
+ # virtual methods are not documented at the reimplementing class as such
29
+ # that would cause them missing from the interface which would cause a problem
30
+ # for a SWIG director redirecting to the Ruby class as the SWIG wrappers
31
+ # redirect explicitly to the implementation at the same class level as the wrapper
32
+ # for upcalls
33
+ spec.extend_interface('wxPopupWindow',
34
+ 'virtual bool Show(bool show = true) override')
17
35
  end
18
36
 
19
37
  end # class PopupWindow
@@ -11,7 +11,7 @@ module WXRuby3
11
11
 
12
12
  def setup
13
13
  super
14
- spec.gc_as_temporary
14
+ spec.gc_as_untracked
15
15
  spec.disable_proxies # fixed and final data structures
16
16
  spec.items << 'wxPrintDialogData' << 'wxPageSetupDialogData'
17
17
  spec.ignore 'wxPrintDialogData::SetSetupDialog' # deprecated since 2.5.4
@@ -19,7 +19,7 @@ module WXRuby3
19
19
 
20
20
  def setup
21
21
  super
22
- spec.gc_as_temporary 'wxPropertyGridInterface' # actually no GC control necessary as this is a mixin only
22
+ spec.gc_as_untracked 'wxPropertyGridInterface' # actually no GC control necessary as this is a mixin only
23
23
  # turn wxPropertyGridInterface into a mixin module
24
24
  spec.make_mixin 'wxPropertyGridInterface'
25
25
  # add typedef to work around flaky define in wxWidgets
@@ -13,7 +13,7 @@ module WXRuby3
13
13
  super
14
14
  spec.items << 'wxPropertyGridHitTestResult'
15
15
  spec.gc_never 'wxPropertyGridPageState'
16
- spec.gc_as_temporary 'wxPropertyGridHitTestResult'
16
+ spec.gc_as_untracked 'wxPropertyGridHitTestResult'
17
17
  spec.make_abstract 'wxPropertyGridPageState'
18
18
  spec.disable_proxies
19
19
  spec.ignore 'wxPropertyGridPageState::DoDelete',
@@ -14,22 +14,33 @@ module WXRuby3
14
14
  spec.items << 'wxItemContainerImmutable'
15
15
  spec.fold_bases('wxRadioBox' => 'wxItemContainerImmutable')
16
16
  spec.override_inheritance_chain('wxRadioBox', %w[wxControl wxWindow wxEvtHandler wxObject])
17
- # ignore overload hiding common Window method
18
- spec.ignore('wxRadioBox::Enable')
17
+ # ignore overloads hiding common Window method
18
+ spec.ignore('wxRadioBox::Enable', 'wxRadioBox::Show')
19
19
  spec.add_extend_code 'wxRadioBox', <<~__HEREDOC
20
- // add custom method to reach common Window method
20
+ // add custom method to reach common Window method overload
21
21
  bool EnableWindow(bool enable=true)
22
22
  {
23
- return $self->wxWindow::Enable(enable);
23
+ return $self->Enable(enable);
24
24
  }
25
25
  // add right method to enable/disable items
26
26
  bool EnableItem(unsigned int n, bool enable=true)
27
27
  {
28
28
  return $self->Enable(n, enable);
29
29
  }
30
+ // add custom method to reach common Window method overload
31
+ bool ShowWindow(bool show=true)
32
+ {
33
+ return $self->Show(show);
34
+ }
35
+ // add right method to show/hide items
36
+ bool ShowItem(unsigned int n, bool show=true)
37
+ {
38
+ return $self->Show(n, show);
39
+ }
30
40
  __HEREDOC
31
41
  # rename common method
32
42
  spec.rename_for_ruby('Enable' => 'wxRadioBox::EnableWindow')
43
+ spec.rename_for_ruby('Show' => 'wxRadioBox::ShowWindow')
33
44
  super
34
45
  end
35
46
  end # class Window
@@ -15,6 +15,7 @@ module WXRuby3
15
15
  super
16
16
  spec.require_app 'wxRegion'
17
17
  spec.disable_proxies
18
+ spec.gc_as_untracked
18
19
  spec.ignore 'wxNullRegion' # does not exist in code
19
20
  spec.map_apply 'int n, wxPoint points[]' => [ 'size_t, const wxPoint *']
20
21
  end
@@ -13,7 +13,7 @@ module WXRuby3
13
13
  spec.items << 'wxRibbonPageTabInfo' << 'wxRibbonMSWArtProvider' << 'wxRibbonAUIArtProvider'
14
14
  super
15
15
  spec.gc_as_object 'wxRibbonArtProvider'
16
- spec.gc_as_temporary 'wxRibbonPageTabInfo'
16
+ spec.gc_as_untracked 'wxRibbonPageTabInfo'
17
17
  spec.suppress_warning(473,
18
18
  'wxRibbonArtProvider::Clone',
19
19
  'wxRibbonMSWArtProvider::Clone',