wxruby3 0.9.7 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (184) hide show
  1. checksums.yaml +4 -4
  2. data/INSTALL.md +183 -42
  3. data/README.md +40 -48
  4. data/ext/mkrf_conf_ext.rb +72 -0
  5. data/lib/wx/core/app.rb +16 -0
  6. data/lib/wx/core/colour.rb +36 -28
  7. data/lib/wx/core/const.rb +19 -0
  8. data/lib/wx/core/enum.rb +17 -1
  9. data/lib/wx/core/geometry.rb +121 -0
  10. data/lib/wx/core/graphics_pen_info.rb +18 -0
  11. data/lib/wx/core/image.rb +49 -0
  12. data/lib/wx/core/menu_bar.rb +11 -0
  13. data/lib/wx/core/paintdc.rb +9 -3
  14. data/lib/wx/core/secret_store.rb +38 -0
  15. data/lib/wx/doc/app.rb +97 -41
  16. data/lib/wx/doc/bitmap.rb +4 -0
  17. data/lib/wx/doc/client_dc.rb +2 -2
  18. data/lib/wx/doc/clipboard.rb +1 -1
  19. data/lib/wx/doc/colour.rb +12 -0
  20. data/lib/wx/doc/const.rb +16 -0
  21. data/lib/wx/doc/cursor.rb +4 -0
  22. data/lib/wx/doc/dc_overlay.rb +34 -0
  23. data/lib/wx/doc/enum.rb +7 -1
  24. data/lib/wx/doc/event_blocker.rb +1 -1
  25. data/lib/wx/doc/evthandler.rb +25 -3
  26. data/lib/wx/doc/functions.rb +3 -6
  27. data/lib/wx/doc/gc_dc.rb +13 -4
  28. data/lib/wx/doc/geometry.rb +136 -0
  29. data/lib/wx/doc/graphics_context.rb +25 -7
  30. data/lib/wx/doc/icon.rb +4 -0
  31. data/lib/wx/doc/image.rb +56 -0
  32. data/lib/wx/doc/list_ctrl.rb +6 -6
  33. data/lib/wx/doc/memory_dc.rb +2 -11
  34. data/lib/wx/doc/mirror_dc.rb +1 -1
  35. data/lib/wx/doc/pen.rb +26 -0
  36. data/lib/wx/doc/persistence_manager.rb +1 -1
  37. data/lib/wx/doc/persistent_object.rb +1 -1
  38. data/lib/wx/doc/pg/property_grid_interface.rb +3 -3
  39. data/lib/wx/doc/prt/printer_dc.rb +2 -2
  40. data/lib/wx/doc/region_iterator.rb +1 -1
  41. data/lib/wx/doc/scaled_dc.rb +1 -1
  42. data/lib/wx/doc/screen_dc.rb +1 -1
  43. data/lib/wx/doc/secret_store.rb +55 -0
  44. data/lib/wx/doc/svg_file_dc.rb +1 -1
  45. data/lib/wx/doc/textctrl.rb +1 -1
  46. data/lib/wx/doc/tree_ctrl.rb +2 -2
  47. data/lib/wx/doc/validator.rb +6 -6
  48. data/lib/wx/doc/variant.rb +2 -2
  49. data/lib/wx/doc/window.rb +5 -4
  50. data/lib/wx/grid/keyword_defs.rb +1 -1
  51. data/lib/wx/html/keyword_defs.rb +3 -3
  52. data/lib/wx/keyword_defs.rb +76 -71
  53. data/lib/wx/pg/keyword_defs.rb +2 -2
  54. data/lib/wx/pg/pg_property.rb +12 -0
  55. data/lib/wx/rbn/keyword_defs.rb +1 -1
  56. data/lib/wx/rtc/keyword_defs.rb +1 -1
  57. data/lib/wx/stc/keyword_defs.rb +1 -1
  58. data/lib/wx/version.rb +1 -1
  59. data/lib/wx/wxruby/base.rb +3 -5
  60. data/lib/wx/wxruby/cmd/check.rb +182 -0
  61. data/lib/wx/wxruby/cmd/sampler.rb +1 -1
  62. data/lib/wx/wxruby/cmd/setup.rb +9 -3
  63. data/lib/wx/wxruby/cmd/test.rb +1 -1
  64. data/rakelib/configure.rb +67 -52
  65. data/rakelib/gem.rake +97 -66
  66. data/rakelib/gem.rb +294 -41
  67. data/rakelib/install.rb +3 -3
  68. data/rakelib/lib/config/{cygwin.rb → freebsd.rb} +1 -1
  69. data/rakelib/lib/config/linux.rb +4 -2
  70. data/rakelib/lib/config/macosx.rb +42 -11
  71. data/rakelib/lib/config/mingw.rb +2 -2
  72. data/rakelib/lib/config/pkgman/{base.rb → linux.rb} +36 -61
  73. data/rakelib/lib/config/pkgman/macosx.rb +17 -78
  74. data/rakelib/lib/config/unixish.rb +17 -8
  75. data/rakelib/lib/config/{netbsd.rb → unknown.rb} +3 -2
  76. data/rakelib/lib/config.rb +74 -33
  77. data/rakelib/lib/core/include/enum.inc +31 -1
  78. data/rakelib/lib/director/affine_matrix.rb +51 -0
  79. data/rakelib/lib/director/app.rb +29 -13
  80. data/rakelib/lib/director/art_provider.rb +4 -0
  81. data/rakelib/lib/director/aui_manager.rb +1 -1
  82. data/rakelib/lib/director/cursor.rb +6 -2
  83. data/rakelib/lib/director/dc.rb +1 -6
  84. data/rakelib/lib/director/derived_dc.rb +88 -31
  85. data/rakelib/lib/director/geometry.rb +142 -0
  86. data/rakelib/lib/director/graphics_context.rb +3 -2
  87. data/rakelib/lib/director/graphics_object.rb +18 -25
  88. data/rakelib/lib/director/grid_ctrl.rb +2 -2
  89. data/rakelib/lib/director/image.rb +59 -0
  90. data/rakelib/lib/director/menu.rb +2 -3
  91. data/rakelib/lib/director/menu_bar.rb +0 -3
  92. data/rakelib/lib/director/pen.rb +1 -1
  93. data/rakelib/lib/director/richtext_composite_object.rb +2 -4
  94. data/rakelib/lib/director/richtext_ctrl.rb +1 -1
  95. data/rakelib/lib/director/secret_store.rb +117 -0
  96. data/rakelib/lib/director/system_settings.rb +1 -1
  97. data/rakelib/lib/director/tree_event.rb +2 -2
  98. data/rakelib/lib/director/window.rb +4 -3
  99. data/rakelib/lib/extractor/function.rb +1 -1
  100. data/rakelib/lib/generate/doc/animation_ctrl.yaml +10 -0
  101. data/rakelib/lib/generate/doc/banner_window.yaml +35 -0
  102. data/rakelib/lib/generate/doc/graphics_context.yaml +12 -0
  103. data/rakelib/lib/generate/doc/graphics_object.yaml +12 -0
  104. data/rakelib/lib/generate/doc/grid_ctrl.yaml +25 -0
  105. data/rakelib/lib/generate/doc/header_ctrl.yaml +91 -0
  106. data/rakelib/lib/generate/doc/icon.yaml +10 -0
  107. data/rakelib/lib/generate/doc/info_bar.yaml +27 -0
  108. data/rakelib/lib/generate/doc/log.yaml +1 -1
  109. data/rakelib/lib/generate/doc/media_ctrl.yaml +27 -0
  110. data/rakelib/lib/generate/doc/persistent_window.yaml +22 -0
  111. data/rakelib/lib/generate/doc/pg_editor.yaml +1 -1
  112. data/rakelib/lib/generate/doc/pg_property.yaml +4 -4
  113. data/rakelib/lib/generate/doc/rearrange_list.yaml +14 -0
  114. data/rakelib/lib/generate/doc/ribbon_panel.yaml +15 -0
  115. data/rakelib/lib/generate/doc/rich_text_formatting_dialog.yaml +26 -0
  116. data/rakelib/lib/generate/doc/secret_store.yaml +55 -0
  117. data/rakelib/lib/generate/doc/text_ctrl.yaml +1 -1
  118. data/rakelib/lib/generate/doc/wizard.yaml +27 -0
  119. data/rakelib/lib/generate/doc.rb +5 -5
  120. data/rakelib/lib/generate/interface.rb +1 -1
  121. data/rakelib/lib/specs/interfaces.rb +4 -0
  122. data/rakelib/lib/swig_runner.rb +24 -3
  123. data/rakelib/lib/typemap/common.rb +10 -0
  124. data/rakelib/lib/typemap/points_list.rb +8 -2
  125. data/rakelib/lib/typemap/richtext.rb +17 -0
  126. data/rakelib/prepost.rake +8 -1
  127. data/rakelib/yard/templates/default/fulldoc/html/css/wxruby3.css +4 -0
  128. data/rakelib/yard/templates/default/fulldoc/html/setup.rb +3 -3
  129. data/samples/dialogs/wizard.rb +20 -19
  130. data/samples/drawing/art/drawing/image.bmp +0 -0
  131. data/samples/drawing/art/drawing/mask.bmp +0 -0
  132. data/samples/drawing/art/drawing/pat35.bmp +0 -0
  133. data/samples/drawing/art/drawing/pat36.bmp +0 -0
  134. data/samples/drawing/art/drawing/pat4.bmp +0 -0
  135. data/samples/drawing/art/drawing/smile.xpm +42 -0
  136. data/samples/drawing/drawing.rb +2276 -0
  137. data/samples/drawing/tn_drawing.png +0 -0
  138. data/samples/html/html.rb +1 -1
  139. data/samples/propgrid/propgrid.rb +1 -1
  140. data/samples/propgrid/propgrid_minimal.rb +1 -1
  141. data/samples/propgrid/sample_props.rb +1 -1
  142. data/samples/sampler/editor.rb +13 -11
  143. data/samples/sampler/sample.rb +2 -0
  144. data/samples/sampler.rb +14 -10
  145. data/samples/text/richtext.rb +53 -0
  146. data/samples/text/scintilla.rb +1 -1
  147. data/samples/text/unicode.rb +4 -4
  148. data/tests/lib/wxapp_runner.rb +1 -1
  149. data/tests/test_config.rb +7 -4
  150. data/tests/test_ext_controls.rb +12 -5
  151. data/tests/test_secret_store.rb +83 -0
  152. data/tests/test_std_controls.rb +12 -12
  153. metadata +66 -47
  154. data/lib/wx/doc/extra/00_starting.md +0 -154
  155. data/lib/wx/doc/extra/01_packages.md +0 -180
  156. data/lib/wx/doc/extra/02_lifecycles.md +0 -166
  157. data/lib/wx/doc/extra/03_dialogs.md +0 -57
  158. data/lib/wx/doc/extra/04_enums.md +0 -143
  159. data/lib/wx/doc/extra/05_event-handling.md +0 -191
  160. data/lib/wx/doc/extra/06_geometry.md +0 -62
  161. data/lib/wx/doc/extra/07_colour_and_font.md +0 -52
  162. data/lib/wx/doc/extra/08_extensions.md +0 -144
  163. data/lib/wx/doc/extra/09_exceptions.md +0 -54
  164. data/lib/wx/doc/extra/10_art.md +0 -111
  165. data/lib/wx/doc/extra/11_drawing_and_dc.md +0 -62
  166. data/lib/wx/doc/extra/12_client_data.md +0 -89
  167. data/lib/wx/doc/extra/13_validators.md +0 -139
  168. data/lib/wx/doc/extra/14_config.md +0 -101
  169. data/lib/wx/doc/extra/15_persistence.md +0 -148
  170. data/rakefile +0 -14
  171. data/rakelib/lib/config/pkgman/arch.rb +0 -53
  172. data/rakelib/lib/config/pkgman/debian.rb +0 -66
  173. data/rakelib/lib/config/pkgman/rhel.rb +0 -54
  174. data/rakelib/lib/config/pkgman/suse.rb +0 -54
  175. data/samples/sampler/back.xpm +0 -21
  176. data/samples/sampler/copy.xpm +0 -44
  177. data/samples/sampler/cut.xpm +0 -46
  178. data/samples/sampler/filesave.xpm +0 -42
  179. data/samples/sampler/find.xpm +0 -62
  180. data/samples/sampler/findrepl.xpm +0 -63
  181. data/samples/sampler/forward.xpm +0 -21
  182. data/samples/sampler/paste.xpm +0 -46
  183. data/samples/sampler/redo.xpm +0 -58
  184. data/samples/sampler/undo.xpm +0 -58
@@ -36,13 +36,8 @@ module WXRuby3
36
36
  'wxDC::GetLogicalOrigin(wxCoord *,wxCoord *) const',
37
37
  'wxDC::GetHandle'
38
38
  ]
39
- # ignore Matrix Transformation methods until someone asks for them
40
- # TODO : possibly wrap at a later time
41
- spec.ignore 'wxDC::SetTransformMatrix',
42
- 'wxDC::GetTransformMatrix',
43
- 'wxDC::ResetTransformMatrix',
44
- 'wxDC::CanUseTransformMatrix'
45
39
  spec.disable_proxies
40
+ spec.disown 'wxGraphicsContext *ctx'
46
41
  spec.rename_for_ruby({
47
42
  'GetDimensions' => 'wxDC::GetSize(wxCoord *, wxCoord *) const',
48
43
  'GetDimensionsMM' => 'wxDC::GetSizeMM(wxCoord *, wxCoord *) const',
@@ -16,7 +16,8 @@ module WXRuby3
16
16
  super
17
17
  spec.disable_proxies
18
18
  spec.gc_as_untracked spec.module_name
19
- if spec.module_name == 'wxScreenDC'
19
+ case spec.module_name
20
+ when 'wxScreenDC'
20
21
  spec.make_abstract 'wxScreenDC'
21
22
  # as a ScreenDC should always be a temporary stack object
22
23
  # we do not allow creation in Ruby but rather provide a class
@@ -41,7 +42,7 @@ module WXRuby3
41
42
  spec.ignore 'wxScreenDC::StartDrawingOnTop',
42
43
  'wxScreenDC::EndDrawingOnTop',
43
44
  'wxScreenDC::wxScreenDC'
44
- elsif spec.module_name == 'wxClientDC'
45
+ when 'wxClientDC'
45
46
  spec.make_abstract 'wxClientDC'
46
47
  spec.ignore 'wxClientDC::wxClientDC'
47
48
  # as a ClientDC should best always be a temporary stack object
@@ -63,19 +64,38 @@ module WXRuby3
63
64
  return rc;
64
65
  }
65
66
  __HEREDOC
66
- elsif spec.module_name == 'wxPaintDC'
67
+ when 'wxPaintDC'
67
68
  spec.make_abstract 'wxPaintDC'
68
69
  spec.ignore 'wxPaintDC::wxPaintDC'
69
- elsif spec.module_name == 'wxMemoryDC'
70
- spec.items << 'wxBufferedDC' << 'wxBufferedPaintDC' << 'wxAutoBufferedPaintDC'
70
+ spec.add_header_code <<~__HEREDOC
71
+ // we need this static method here because we do not want SWIG to parse the preprocessor
72
+ // statements (#if/#else/#endif) which it does in %extend blocks
73
+ #include "wx/dcbuffer.h"
74
+ static VALUE do_check_native_double_buffer()
75
+ {
76
+ #if wxALWAYS_NATIVE_DOUBLE_BUFFER
77
+ return Qtrue;
78
+ #else
79
+ return Qfalse;
80
+ #endif
81
+ }
82
+ __HEREDOC
83
+ spec.add_extend_code 'wxPaintDC', <<~__HEREDOC
84
+ #include "wx/dcbuffer.h"
85
+ static VALUE has_native_double_buffer()
86
+ {
87
+ return do_check_native_double_buffer();
88
+ }
89
+ __HEREDOC
90
+ when 'wxMemoryDC'
91
+ spec.items << 'wxBufferedDC' << 'wxBufferedPaintDC'
92
+ spec.gc_as_untracked %w[wxBufferedDC wxBufferedPaintDC]
71
93
  spec.make_abstract 'wxMemoryDC'
72
94
  spec.make_abstract 'wxBufferedDC'
73
95
  spec.make_abstract 'wxBufferedPaintDC'
74
- spec.make_abstract 'wxAutoBufferedPaintDC'
75
96
  spec.ignore 'wxMemoryDC::wxMemoryDC',
76
97
  'wxBufferedDC::wxBufferedDC',
77
- 'wxBufferedPaintDC::wxBufferedPaintDC',
78
- 'wxAutoBufferedPaintDC::wxAutoBufferedPaintDC'
98
+ 'wxBufferedPaintDC::wxBufferedPaintDC'
79
99
  # like all DC's these should best always be a temporary stack objects
80
100
  # we do not allow creation in Ruby but rather provide a class
81
101
  # method for block execution on a temp dc
@@ -197,23 +217,7 @@ module WXRuby3
197
217
  return rc;
198
218
  }
199
219
  __HEREDOC
200
- spec.add_extend_code 'wxAutoBufferedPaintDC', <<~__HEREDOC
201
- static VALUE draw_on(wxWindow* tgt)
202
- {
203
- if (!wxRuby_IsAppRunning())
204
- rb_raise(rb_eRuntimeError, "A running Wx::App is required.");
205
- VALUE rc = Qnil;
206
- if (rb_block_given_p ())
207
- {
208
- wxAutoBufferedPaintDC dc(tgt);
209
- wxAutoBufferedPaintDC* dc_ptr = &dc;
210
- VALUE rb_dc = SWIG_NewPointerObj(SWIG_as_voidptr(dc_ptr), SWIGTYPE_p_wxAutoBufferedPaintDC, 0);
211
- rc = rb_yield(rb_dc);
212
- }
213
- return rc;
214
- }
215
- __HEREDOC
216
- elsif spec.module_name == 'wxMirrorDC'
220
+ when 'wxMirrorDC'
217
221
  spec.make_abstract 'wxMirrorDC'
218
222
  spec.ignore 'wxMirrorDC::wxMirrorDC'
219
223
  # as a MirrorDC should best always be a temporary stack object
@@ -235,7 +239,7 @@ module WXRuby3
235
239
  return rc;
236
240
  }
237
241
  __HEREDOC
238
- elsif spec.module_name == 'wxSVGFileDC'
242
+ when 'wxSVGFileDC'
239
243
  spec.items.concat %w[wxSVGBitmapHandler wxSVGBitmapFileHandler wxSVGBitmapEmbedHandler]
240
244
  spec.make_abstract 'wxSVGFileDC'
241
245
  spec.ignore 'wxSVGFileDC::wxSVGFileDC'
@@ -272,7 +276,7 @@ module WXRuby3
272
276
  'wxSVGFileDC::EndDoc',
273
277
  'wxSVGFileDC::StartPage',
274
278
  'wxSVGFileDC::EndPage'
275
- elsif spec.module_name == 'wxGCDC'
279
+ when 'wxGCDC'
276
280
  spec.make_abstract 'wxGCDC'
277
281
  spec.ignore 'wxGCDC::wxGCDC'
278
282
  # like all DC this should best always be a temporary stack object
@@ -301,6 +305,24 @@ module WXRuby3
301
305
  __HEREDOC
302
306
  end
303
307
  spec.add_extend_code 'wxGCDC', <<~__HEREDOC
308
+ static VALUE draw_on()
309
+ {
310
+ if (!wxRuby_IsAppRunning())
311
+ rb_raise(rb_eRuntimeError, "A running Wx::App is required.");
312
+ VALUE rc = Qnil;
313
+ if (rb_block_given_p ())
314
+ {
315
+ // Somehow there seems to be a problem with the Ruby GCDC value
316
+ // being GC-ed unless we block GC for the duration of the block
317
+ // execution. Unclear why. We have similar code for other objects
318
+ // where this issue does not come up.
319
+ wxGCDC gc_dc;
320
+ wxGCDC* dc_ptr = &gc_dc;
321
+ VALUE rb_dc = SWIG_NewPointerObj(SWIG_as_voidptr(dc_ptr), SWIGTYPE_p_wxGCDC, 0);
322
+ rc = rb_yield(rb_dc);
323
+ }
324
+ return rc;
325
+ }
304
326
  static VALUE draw_on(const wxWindowDC& dc)
305
327
  {
306
328
  if (!wxRuby_IsAppRunning())
@@ -355,9 +377,10 @@ module WXRuby3
355
377
  }
356
378
  return rc;
357
379
  }
358
- __HEREDOC
380
+ __HEREDOC
381
+ spec.disown 'wxGraphicsContext *gc'
359
382
  spec.ignore 'wxGCDC::wxGCDC(const wxEnhMetaFileDC &)'
360
- elsif spec.module_name == 'wxScaledDC'
383
+ when 'wxScaledDC'
361
384
  spec.items.clear # wxRuby extension; no XML docs
362
385
  spec.override_inheritance_chain('wxScaledDC', %w[wxDC wxObject])
363
386
  # as there are no dependencies parsed from XML make sure we're initialized after Wx::DC
@@ -398,7 +421,7 @@ module WXRuby3
398
421
  wxScaledDC(wxDC& target, double scale);
399
422
  };
400
423
  __HEREDOC
401
- elsif spec.module_name == 'wxPrinterDC'
424
+ when 'wxPrinterDC'
402
425
  spec.make_abstract 'wxPrinterDC'
403
426
  spec.ignore 'wxPrinterDC::wxPrinterDC'
404
427
  # as a PrinterDC should best always be a temporary stack object
@@ -420,7 +443,7 @@ module WXRuby3
420
443
  return rc;
421
444
  }
422
445
  __HEREDOC
423
- elsif spec.module_name == 'wxPostScriptDC'
446
+ when 'wxPostScriptDC'
424
447
  spec.make_abstract 'wxPostScriptDC'
425
448
  spec.ignore 'wxPostScriptDC::wxPostScriptDC'
426
449
  # as a PostScriptDC should best always be a temporary stack object
@@ -442,6 +465,40 @@ module WXRuby3
442
465
  return rc;
443
466
  }
444
467
  __HEREDOC
468
+ when 'wxDCOverlay'
469
+ spec.items << 'wxOverlay'
470
+ spec.make_abstract 'wxDCOverlay'
471
+ spec.ignore 'wxDCOverlay::wxDCOverlay'
472
+ spec.add_extend_code 'wxDCOverlay', <<~__HEREDOC
473
+ static VALUE draw_on(wxOverlay &overlay, wxDC *dc)
474
+ {
475
+ if (!wxRuby_IsAppRunning())
476
+ rb_raise(rb_eRuntimeError, "A running Wx::App is required.");
477
+ VALUE rc = Qnil;
478
+ if (rb_block_given_p ())
479
+ {
480
+ wxDCOverlay ovl_dc(overlay, dc);
481
+ wxDCOverlay* ovl_dc_ptr = &ovl_dc;
482
+ VALUE rb_dc = SWIG_NewPointerObj(SWIG_as_voidptr(ovl_dc_ptr), SWIGTYPE_p_wxDCOverlay, 0);
483
+ rc = rb_yield(rb_dc);
484
+ }
485
+ return rc;
486
+ }
487
+ static VALUE draw_on(wxOverlay &overlay, wxDC *dc, int x, int y, int width, int height)
488
+ {
489
+ if (!wxRuby_IsAppRunning())
490
+ rb_raise(rb_eRuntimeError, "A running Wx::App is required.");
491
+ VALUE rc = Qnil;
492
+ if (rb_block_given_p ())
493
+ {
494
+ wxDCOverlay ovl_dc(overlay, dc, x, y, width, height);
495
+ wxDCOverlay* ovl_dc_ptr = &ovl_dc;
496
+ VALUE rb_dc = SWIG_NewPointerObj(SWIG_as_voidptr(ovl_dc_ptr), SWIGTYPE_p_wxDCOverlay, 0);
497
+ rc = rb_yield(rb_dc);
498
+ }
499
+ return rc;
500
+ }
501
+ __HEREDOC
445
502
  else
446
503
  # ctors of all other derived DC require a running App
447
504
  spec.require_app spec.module_name
@@ -0,0 +1,142 @@
1
+ # Copyright (c) 2023 M.J.N. Corino, The Netherlands
2
+ #
3
+ # This software is released under the MIT license.
4
+
5
+ ###
6
+ # wxRuby3 wxWidgets interface director
7
+ ###
8
+
9
+ module WXRuby3
10
+
11
+ class Director
12
+
13
+ class Geometry < Director
14
+
15
+ def setup
16
+ spec.items.replace %w{wxPoint2DInt wxPoint2DDouble}
17
+
18
+ spec.ignore 'wxPoint2DInt::m_x', 'wxPoint2DInt::m_y',
19
+ 'wxPoint2DDouble::m_x', 'wxPoint2DDouble::m_y'
20
+
21
+ spec.add_extend_code 'wxPoint2DInt', <<~__HEREDOC
22
+ wxInt32 get_x()
23
+ {
24
+ return $self->m_x;
25
+ }
26
+ wxInt32 set_x(wxInt32 v)
27
+ {
28
+ return ($self->m_x = v);
29
+ }
30
+ wxInt32 get_y()
31
+ {
32
+ return $self->m_y;
33
+ }
34
+ wxInt32 set_y(wxInt32 v)
35
+ {
36
+ return ($self->m_y = v);
37
+ }
38
+ void assign(const wxPoint2DInt& pt)
39
+ {
40
+ (*$self) = pt;
41
+ }
42
+ void add(const wxPoint2DInt& pt)
43
+ {
44
+ (*$self) += pt;
45
+ }
46
+ void sub(const wxPoint2DInt& pt)
47
+ {
48
+ (*$self) -= pt;
49
+ }
50
+ void mul(const wxPoint2DInt& pt)
51
+ {
52
+ (*$self) *= pt;
53
+ }
54
+ void mul(wxDouble v)
55
+ {
56
+ $self->m_x *= v; $self->m_y *= v;
57
+ }
58
+ void mul(wxInt32 v)
59
+ {
60
+ $self->m_x *= v; $self->m_y *= v;
61
+ }
62
+ void div(const wxPoint2DInt& pt)
63
+ {
64
+ (*$self) /= pt;
65
+ }
66
+ void div(wxDouble v)
67
+ {
68
+ $self->m_x /= v; $self->m_y /= v;
69
+ }
70
+ void div(wxInt32 v)
71
+ {
72
+ $self->m_x /= v; $self->m_y /= v;
73
+ }
74
+ __HEREDOC
75
+
76
+ spec.add_extend_code 'wxPoint2DDouble', <<~__HEREDOC
77
+ wxDouble get_x()
78
+ {
79
+ return $self->m_x;
80
+ }
81
+ wxDouble set_x(wxDouble v)
82
+ {
83
+ return ($self->m_x = v);
84
+ }
85
+ wxDouble get_y()
86
+ {
87
+ return $self->m_y;
88
+ }
89
+ wxDouble set_y(wxDouble v)
90
+ {
91
+ return ($self->m_y = v);
92
+ }
93
+ void assign(const wxPoint2DDouble& pt)
94
+ {
95
+ (*$self) = pt;
96
+ }
97
+ void add(const wxPoint2DDouble& pt)
98
+ {
99
+ (*$self) += pt;
100
+ }
101
+ void sub(const wxPoint2DDouble& pt)
102
+ {
103
+ (*$self) -= pt;
104
+ }
105
+ void mul(const wxPoint2DDouble& pt)
106
+ {
107
+ (*$self) *= pt;
108
+ }
109
+ void mul(wxDouble v)
110
+ {
111
+ $self->m_x *= v; $self->m_y *= v;
112
+ }
113
+ void mul(wxInt32 v)
114
+ {
115
+ $self->m_x *= v; $self->m_y *= v;
116
+ }
117
+ void div(const wxPoint2DDouble& pt)
118
+ {
119
+ (*$self) /= pt;
120
+ }
121
+ void div(wxDouble v)
122
+ {
123
+ $self->m_x /= v; $self->m_y /= v;
124
+ }
125
+ void div(wxInt32 v)
126
+ {
127
+ $self->m_x /= v; $self->m_y /= v;
128
+ }
129
+ __HEREDOC
130
+
131
+ spec.map_apply 'int * OUTPUT' => 'wxInt32 *'
132
+
133
+ # ignore all friend operators
134
+ spec.do_not_generate :functions
135
+
136
+ end
137
+
138
+ end
139
+
140
+ end
141
+
142
+ end
@@ -29,12 +29,13 @@ module WXRuby3
29
29
  'wxGraphicsContext::CreateFromNativeHDC',
30
30
  'wxGraphicsContext::CreateFromUnknownDC',
31
31
  'wxGraphicsContext::GetNativeContext',
32
- 'wxGraphicsContext::Create',
32
+ 'wxGraphicsContext::Create(const wxEnhMetaFileDC &)',
33
33
  'wxGraphicsContext::CreateMatrix(const wxAffineMatrix2DBase &) const',
34
34
  'wxGraphicsContext::DrawLines(size_t, const wxPoint2DDouble *, wxPolygonFillMode)',
35
35
  'wxGraphicsContext::StrokeLines(size_t, const wxPoint2DDouble *)',
36
36
  'wxGraphicsContext::StrokeLines (size_t, const wxPoint2DDouble *, const wxPoint2DDouble *)'
37
37
  spec.ignore_unless(Config::AnyOf.new('WXMSW', 'WXOSX', 'USE_GTKPRINT'), 'wxGraphicsContext::Create(const wxPrinterDC &)')
38
+ spec.new_object 'wxGraphicsContext::Create'
38
39
  spec.add_header_code <<~__HEREDOC
39
40
  // special free funcs are needed to clean up Dashes array if it has been
40
41
  // set; wxWidgets does not do this automatically so will leak if not
@@ -55,7 +56,7 @@ module WXRuby3
55
56
  # dealt with below - these require special handling because of the use
56
57
  # of wxDash array, which cannot be freed until the peninfo is disposed of
57
58
  # or until a new dash pattern is specified.
58
- spec.ignore(%w[wxGraphicsPenInfo::GetDashes wxGraphicsPenInfo::Dashes], ignore_doc: false)
59
+ spec.ignore(%w[wxGraphicsPenInfo::GetDashes wxGraphicsPenInfo::Dashes])
59
60
  spec.ignore 'wxGraphicsPenInfo::GetDash'
60
61
  spec.add_extend_code 'wxGraphicsPenInfo', <<~__HEREDOC
61
62
  // Returns a ruby array with the dash lengths
@@ -14,43 +14,36 @@ module WXRuby3
14
14
 
15
15
  def setup
16
16
  super
17
- spec.items.concat %w[wxGraphicsPen wxGraphicsBrush wxGraphicsPath wxGraphicsFont wxGraphicsMatrix wxGraphicsBitmap]
17
+ spec.items.concat %w[wxGraphicsPen wxGraphicsBrush wxGraphicsPath wxGraphicsFont wxGraphicsMatrix wxGraphicsBitmap wxGraphicsRenderer]
18
18
  spec.disable_proxies
19
- spec.ignore 'wxGraphicsObject::GetRenderer'
20
19
  spec.ignore 'wxGraphicsMatrix::Concat(const wxGraphicsMatrix &)'
21
20
  spec.ignore 'wxGraphicsMatrix::IsEqual(const wxGraphicsMatrix &)'
22
21
  spec.ignore 'wxGraphicsMatrix::GetNativeMatrix'
23
22
  spec.ignore 'wxGraphicsBitmap::GetNativeBitmap'
24
23
  spec.ignore 'wxGraphicsPath::GetNativePath',
25
- 'wxGraphicsPath::UnGetNativePath',
26
- 'wxGraphicsPath::AddCurveToPoint(const wxPoint2DDouble &, const wxPoint2DDouble &, const wxPoint2DDouble &)',
27
- 'wxGraphicsPath::AddLineToPoint(const wxPoint2DDouble &)',
28
- 'wxGraphicsPath::Contains(const wxPoint2DDouble &, wxPolygonFillMode) const',
29
- 'wxGraphicsPath::GetCurrentPoint',
30
- 'wxGraphicsPath::MoveToPoint(const wxPoint2DDouble &)',
31
- 'wxGraphicsPath::AddArc(const wxPoint2DDouble &, wxDouble, wxDouble, wxDouble, bool)'
24
+ 'wxGraphicsPath::UnGetNativePath'
25
+ spec.ignore 'wxGraphicsRenderer::CreateContextFromNativeHDC',
26
+ 'wxGraphicsRenderer::CreateBitmapFromNativeBitmap',
27
+ 'wxGraphicsRenderer::CreateContextFromNativeContext',
28
+ 'wxGraphicsRenderer::CreateContextFromNativeWindow',
29
+ 'wxGraphicsRenderer::CreateContext(const wxEnhMetaFileDC&)'
30
+ unless Config.instance.features_set?('USE_CAIRO')
31
+ spec.ignore 'wxGraphicsRenderer::GetCairoRenderer'
32
+ end
33
+ unless Config.instance.features_set?('WXMSW')
34
+ spec.ignore 'wxGraphicsRenderer::GetGDIPlusRenderer',
35
+ 'wxGraphicsRenderer::GetDirect2DRenderer'
36
+ end
37
+ spec.new_object 'wxGraphicsRenderer::CreateContext'
32
38
  # Deal with GraphicsMatrix#get method
33
39
  spec.map_apply 'double *OUTPUT' => [ 'wxDouble *a', 'wxDouble *b',
34
40
  'wxDouble *c', 'wxDouble *d',
35
41
  'wxDouble *tx' , 'wxDouble *ty' ]
36
- # type mapping for GraphicsPath wxPoint2DDouble args
37
- spec.map 'const wxPoint2DDouble&' => 'Array<Float,Float>' do
38
- map_in temp: 'wxPoint2DDouble tmp_pt', code: <<~__CODE
39
- if (TYPE($input) == T_ARRAY && RARRAY_LEN($input) == 2)
40
- {
41
- tmp_pt = wxPoint2DDouble(NUM2DBL(rb_ary_entry($input, 0)),
42
- NUM2DBL(rb_ary_entry($input, 1)));
43
- $1 = &tmp_pt;
44
- }
45
- else
46
- {
47
- rb_raise(rb_eTypeError, "Wrong type for %i", $argnum-1);
48
- }
49
- __CODE
50
- end
51
42
  spec.ignore 'wxGraphicsPath::GetBox() const',
52
- 'wxGraphicsPath::GetCurrentPoint() const'
43
+ 'wxGraphicsPath::GetCurrentPoint(wxDouble*,wxDouble*) const'
53
44
  spec.map_apply 'double * OUTPUT' => 'wxDouble *'
45
+ # wxGraphicsRenderer::GetVersion
46
+ spec.map_apply 'int * OUTPUT' => ['int *major', 'int *minor', 'int *micro']
54
47
  if Config.platform == :mingw
55
48
  # it seems for WXMSW there is a problem cleaning up GraphicsObjects in GC after
56
49
  # the wxApp has ended (probably because some other wxWidgets cleanup already
@@ -237,9 +237,9 @@ module WXRuby3
237
237
  static const rb_data_type_t __wxGridWindow_type = {
238
238
  "GridWindow",
239
239
  #if RUBY_API_VERSION_MAJOR >= 3
240
- { NULL, NULL, __wxGridWindow_size, 0, 0},
240
+ { NULL, NULL, __wxGridWindow_size, 0, {}},
241
241
  #else
242
- { NULL, NULL, __wxGridWindow_size, 0},
242
+ { NULL, NULL, __wxGridWindow_size, {}},
243
243
  #endif
244
244
  NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
245
245
  };
@@ -212,6 +212,65 @@ module WXRuby3
212
212
  return rb_img_hist;
213
213
  }
214
214
  __HEREDOC
215
+ # make sure to wrap the public attributes
216
+ spec.regard 'wxImage::HSVValue::hue',
217
+ 'wxImage::HSVValue::saturation',
218
+ 'wxImage::HSVValue::value',
219
+ 'wxImage::RGBValue::red',
220
+ 'wxImage::RGBValue::green',
221
+ 'wxImage::RGBValue::blue'
222
+ # ignore these and add customs
223
+ spec.ignore 'wxImage::HSVtoRGB',
224
+ 'wxImage::RGBtoHSV'
225
+ spec.add_extend_code 'wxImage', <<~__HEREDOC
226
+ static wxImage::RGBValue hsv_to_rgb(VALUE arg)
227
+ {
228
+ std::unique_ptr<wxImage::HSVValue> tmp;
229
+ wxImage::HSVValue* p_hsv;
230
+ if ( TYPE(arg) == T_DATA )
231
+ {
232
+ void* argp;
233
+ SWIG_ConvertPtr(arg, &argp, SWIGTYPE_p_wxImage__HSVValue, 0);
234
+ p_hsv = reinterpret_cast< wxImage::HSVValue * >(argp);
235
+ }
236
+ else if ( TYPE(arg) == T_ARRAY && RARRAY_LEN(arg) == 3 )
237
+ {
238
+ p_hsv = new wxImage::HSVValue( NUM2DBL( rb_ary_entry(arg, 0) ),
239
+ NUM2DBL( rb_ary_entry(arg, 1) ),
240
+ NUM2DBL( rb_ary_entry(arg, 2) ) );
241
+ tmp.reset(p_hsv); // auto destruct when method scope ends
242
+ }
243
+ else
244
+ {
245
+ rb_raise(rb_eArgError, "Expected either Array(Float,Float,Float) or Wx::Image::HSVValue for #0");
246
+ }
247
+ return wxImage::HSVtoRGB(*p_hsv);
248
+ }
249
+
250
+ static wxImage::HSVValue rgb_to_hsv(VALUE arg)
251
+ {
252
+ std::unique_ptr<wxImage::RGBValue> tmp;
253
+ wxImage::RGBValue* p_rgb;
254
+ if ( TYPE(arg) == T_DATA )
255
+ {
256
+ void* argp;
257
+ SWIG_ConvertPtr(arg, &argp, SWIGTYPE_p_wxImage__RGBValue, 0);
258
+ p_rgb = reinterpret_cast< wxImage::RGBValue * >(argp);
259
+ }
260
+ else if ( TYPE(arg) == T_ARRAY && RARRAY_LEN(arg) == 3 )
261
+ {
262
+ p_rgb = new wxImage::RGBValue( NUM2DBL( rb_ary_entry(arg, 0) ),
263
+ NUM2DBL( rb_ary_entry(arg, 1) ),
264
+ NUM2DBL( rb_ary_entry(arg, 2) ) );
265
+ tmp.reset(p_rgb); // auto destruct when method scope ends
266
+ }
267
+ else
268
+ {
269
+ rb_raise(rb_eArgError, "Expected either Array(Float,Float,Float) or Wx::Image::RGBValue for #0");
270
+ }
271
+ return wxImage::RGBtoHSV(*p_rgb);
272
+ }
273
+ __HEREDOC
215
274
  spec.do_not_generate(:functions)
216
275
  end
217
276
  end # class Image
@@ -90,9 +90,8 @@ module WXRuby3
90
90
  # fix SWIG's problems with const& return value
91
91
  spec.ignore('wxMenu::GetTitle', ignore_doc: false) # keep doc
92
92
  spec.add_extend_code 'wxMenu', <<~__HEREDOC
93
- wxString* GetTitle() const {
94
- wxString const& title = $self->GetTitle();
95
- return &const_cast<wxString&> (title);
93
+ wxString GetTitle() const {
94
+ return $self->GetTitle();
96
95
  }
97
96
 
98
97
  VALUE each_item()
@@ -23,9 +23,6 @@ module WXRuby3
23
23
  'wxMenuBar::GetLabelTop',
24
24
  'wxMenuBar::SetLabelTop',
25
25
  'wxMenuBar::Refresh')
26
- unless Config.instance.wx_version >= '3.3' || Config.instance.wx_abi_version > '3.0.0'
27
- spec.ignore 'wxMenuBar::OSXGetAppleMenu'
28
- end
29
26
  # for FindItem
30
27
  spec.map 'wxMenu **' => 'Wx::Menu' do
31
28
  map_in ignore: true, temp: 'wxMenu *tmp', code: '$1 = &tmp;'
@@ -79,7 +79,7 @@ module WXRuby3
79
79
  # dealt with below - these require special handling because of the use
80
80
  # of wxDash array, which cannot be freed until the pen(info) is disposed of
81
81
  # or until a new dash pattern is specified.
82
- spec.ignore(%w[wxPen::GetDashes wxPen::SetDashes wxPenInfo::GetDashes wxPenInfo::Dashes], ignore_doc: false)
82
+ spec.ignore(%w[wxPen::GetDashes wxPen::SetDashes wxPenInfo::GetDashes wxPenInfo::Dashes])
83
83
  spec.ignore 'wxPenInfo::GetDash'
84
84
  spec.add_extend_code 'wxPen', <<~__HEREDOC
85
85
  // Returns a ruby array with the dash lengths
@@ -93,9 +93,9 @@ module WXRuby3
93
93
  static const rb_data_type_t __wxRichTextFloatCollector_type = {
94
94
  "RichTextFloatCollector",
95
95
  #if RUBY_API_VERSION_MAJOR >= 3
96
- { NULL, NULL, __wxRichTextFloatCollector_size, 0, 0},
96
+ { NULL, NULL, __wxRichTextFloatCollector_size, 0, {}},
97
97
  #else
98
- { NULL, NULL, __wxRichTextFloatCollector_size, 0},
98
+ { NULL, NULL, __wxRichTextFloatCollector_size, {}},
99
99
  #endif
100
100
  NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
101
101
  };
@@ -177,12 +177,10 @@ module WXRuby3
177
177
  {
178
178
  VALUE rc = Qnil;
179
179
  const wxRichTextLineVector &lines = $self->GetLines();
180
- int lnr = 0;
181
180
  for (const wxRichTextLine* line : lines)
182
181
  {
183
182
  VALUE rb_ln = SWIG_NewPointerObj(SWIG_as_voidptr(const_cast<wxRichTextLine*> (line)), SWIGTYPE_p_wxRichTextLine, 0);
184
183
  rc = rb_yield(rb_ln);
185
- ++lnr;
186
184
  }
187
185
  return rc;
188
186
  }
@@ -146,7 +146,7 @@ module WXRuby3
146
146
  {
147
147
  if (TYPE(result) == T_FIXNUM)
148
148
  {
149
- *newPos = NUM2LONG(result);
149
+ if (newPos) *newPos = NUM2LONG(result);
150
150
  c_result = true;
151
151
  }
152
152
  else