wxruby3 1.5.4 → 1.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. checksums.yaml +4 -4
  2. data/INSTALL.md +2 -2
  3. data/README.md +3 -3
  4. data/ext/wxruby3/swig/RubyStockObjects.i +1 -0
  5. data/ext/wxruby3/swig/mark_free_impl.i +2 -0
  6. data/lib/wx/aui/auifloatframe.rb +1 -1
  7. data/lib/wx/aui/auimanager.rb +1 -1
  8. data/lib/wx/aui/auinotebook.rb +2 -2
  9. data/lib/wx/core/animation.rb +1 -1
  10. data/lib/wx/core/cursor.rb +10 -0
  11. data/lib/wx/core/dataformat.rb +1 -1
  12. data/lib/wx/core/file_dialog.rb +1 -1
  13. data/lib/wx/core/geometry.rb +34 -0
  14. data/lib/wx/core/hboxsizer.rb +22 -0
  15. data/lib/wx/core/hyperlink_ctrl.rb +18 -0
  16. data/lib/wx/core/position.rb +58 -0
  17. data/lib/wx/core/variant.rb +6 -0
  18. data/lib/wx/core/vboxsizer.rb +22 -0
  19. data/lib/wx/doc/aui/auimanager.rb +6 -3
  20. data/lib/wx/doc/aui/auinotebook.rb +6 -3
  21. data/lib/wx/doc/config.rb +14 -8
  22. data/lib/wx/doc/controlwithitems.rb +7 -3
  23. data/lib/wx/doc/core.rb +21 -0
  24. data/lib/wx/doc/geometry.rb +47 -7
  25. data/lib/wx/doc/graphics_object.rb +24 -0
  26. data/lib/wx/doc/grid/grid.rb +18 -9
  27. data/lib/wx/doc/hboxsizer.rb +41 -5
  28. data/lib/wx/doc/list_ctrl.rb +12 -6
  29. data/lib/wx/doc/menu.rb +6 -3
  30. data/lib/wx/doc/notebook.rb +6 -3
  31. data/lib/wx/doc/pg/pg_property.rb +23 -9
  32. data/lib/wx/doc/pg/property_grid_interface.rb +4 -4
  33. data/lib/wx/doc/region_iterator.rb +1 -1
  34. data/lib/wx/doc/rtc/rich_text_composite_object.rb +6 -3
  35. data/lib/wx/doc/rtc/rich_text_ctrl.rb +6 -3
  36. data/lib/wx/doc/rtc/rich_text_paragraph.rb +6 -3
  37. data/lib/wx/doc/sizer.rb +6 -3
  38. data/lib/wx/doc/stc/styled_text_ctrl.rb +6 -3
  39. data/lib/wx/doc/textctrl.rb +6 -3
  40. data/lib/wx/doc/tree_ctrl.rb +7 -3
  41. data/lib/wx/doc/v_list_box.rb +6 -3
  42. data/lib/wx/doc/variant.rb +31 -1
  43. data/lib/wx/doc/vboxsizer.rb +41 -5
  44. data/lib/wx/doc/window.rb +6 -3
  45. data/lib/wx/helpers.rb +28 -0
  46. data/lib/wx/keyword_ctors.rb +2 -2
  47. data/lib/wx/keyword_defs.rb +11 -2
  48. data/lib/wx/pg/pg_property.rb +60 -53
  49. data/lib/wx/pg/property_grid_interface.rb +10 -0
  50. data/lib/wx/version.rb +1 -1
  51. data/rakelib/gem.rake +83 -66
  52. data/rakelib/gem.rb +4 -20
  53. data/rakelib/lib/config/mingw.rb +1 -1
  54. data/rakelib/lib/config.rb +9 -3
  55. data/rakelib/lib/core/spec.rb +1 -1
  56. data/rakelib/lib/director/affine_matrix.rb +33 -0
  57. data/rakelib/lib/director/animation_ctrl.rb +1 -1
  58. data/rakelib/lib/director/app.rb +1 -1
  59. data/rakelib/lib/director/aui_manager.rb +2 -2
  60. data/rakelib/lib/director/aui_notebook.rb +1 -1
  61. data/rakelib/lib/director/aui_tab_art.rb +4 -4
  62. data/rakelib/lib/director/bitmap_combobox.rb +4 -2
  63. data/rakelib/lib/director/ctrl_with_items.rb +1 -1
  64. data/rakelib/lib/director/cursor.rb +11 -1
  65. data/rakelib/lib/director/dc.rb +2 -2
  66. data/rakelib/lib/director/defs.rb +1 -1
  67. data/rakelib/lib/director/derived_dc.rb +14 -14
  68. data/rakelib/lib/director/dialog.rb +3 -3
  69. data/rakelib/lib/director/gdicommon.rb +2 -2
  70. data/rakelib/lib/director/geometry.rb +55 -3
  71. data/rakelib/lib/director/graphics_context.rb +8 -3
  72. data/rakelib/lib/director/graphics_object.rb +29 -2
  73. data/rakelib/lib/director/html_listbox.rb +19 -5
  74. data/rakelib/lib/director/hvscrolled.rb +253 -0
  75. data/rakelib/lib/director/hyperlink_ctrl.rb +38 -1
  76. data/rakelib/lib/director/menu_item.rb +1 -1
  77. data/rakelib/lib/director/persistent_window.rb +18 -2
  78. data/rakelib/lib/director/pgeditor.rb +1 -1
  79. data/rakelib/lib/director/pgproperties.rb +4 -4
  80. data/rakelib/lib/director/pgproperty.rb +4 -3
  81. data/rakelib/lib/director/pgvalidation_info.rb +1 -1
  82. data/rakelib/lib/director/print_data.rb +1 -1
  83. data/rakelib/lib/director/property_grid_event.rb +1 -1
  84. data/rakelib/lib/director/property_grid_page.rb +1 -1
  85. data/rakelib/lib/director/property_grid_page_state.rb +1 -1
  86. data/rakelib/lib/director/ribbon_tool_bar.rb +1 -1
  87. data/rakelib/lib/director/richtext_buffer.rb +1 -1
  88. data/rakelib/lib/director/richtext_formatting_dialog.rb +1 -1
  89. data/rakelib/lib/director/richtext_paragraph_layout_box.rb +1 -1
  90. data/rakelib/lib/director/richtext_style_listbox.rb +8 -1
  91. data/rakelib/lib/director/scrolled_t.rb +22 -0
  92. data/rakelib/lib/director/sizer.rb +21 -0
  93. data/rakelib/lib/director/styled_text_event.rb +1 -1
  94. data/rakelib/lib/director/textctrl.rb +2 -2
  95. data/rakelib/lib/director/top_level_window.rb +0 -1
  96. data/rakelib/lib/director/tree_ctrl.rb +1 -1
  97. data/rakelib/lib/director/utils.rb +4 -2
  98. data/rakelib/lib/director/variant.rb +29 -1
  99. data/rakelib/lib/director/vlistbox.rb +9 -3
  100. data/rakelib/lib/director/window.rb +16 -4
  101. data/rakelib/lib/extractor/function.rb +46 -15
  102. data/rakelib/lib/generate/doc/hyperlink_ctrl.yaml +22 -0
  103. data/rakelib/lib/generate/doc/scrolled_canvas.yaml +38 -0
  104. data/rakelib/lib/generate/doc/scrolled_control.yaml +38 -0
  105. data/rakelib/lib/generate/doc/scrolled_window.yaml +38 -0
  106. data/rakelib/lib/specs/interfaces.rb +4 -2
  107. data/rakelib/lib/swig_runner.rb +2 -2
  108. data/rakelib/lib/typemap/print_page_range.rb +1 -1
  109. data/samples/scrolling/tn_varscroll.png +0 -0
  110. data/samples/scrolling/varscroll.rb +416 -0
  111. data/samples/widgets/hyperlink.rb +85 -60
  112. data/tests/test_propgrid.rb +857 -0
  113. metadata +14 -7
  114. data/rakelib/lib/director/vscrolled_window.rb +0 -62
  115. /data/samples/{controls → scrolling}/htlbox.rb +0 -0
  116. /data/samples/{etc → scrolling}/scrollwin.rb +0 -0
  117. /data/samples/{controls → scrolling}/tn_htlbox.png +0 -0
  118. /data/samples/{etc → scrolling}/tn_scrollwin.png +0 -0
@@ -18,7 +18,7 @@ module WXRuby3
18
18
  spec.gc_as_untracked spec.module_name
19
19
  case spec.module_name
20
20
  when 'wxScreenDC'
21
- spec.override_inheritance_chain('wxScreenDC', ['wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version >= '3.3.0'
21
+ spec.override_inheritance_chain('wxScreenDC', ['wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version_check('3.3.0') >= 0
22
22
  spec.make_abstract 'wxScreenDC'
23
23
  # as a ScreenDC should always be a temporary stack object
24
24
  # we do not allow creation in Ruby but rather provide a class
@@ -44,7 +44,7 @@ module WXRuby3
44
44
  'wxScreenDC::EndDrawingOnTop',
45
45
  'wxScreenDC::wxScreenDC'
46
46
  when 'wxClientDC'
47
- spec.override_inheritance_chain('wxClientDC', ['wxWindowDC', 'wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version >= '3.3.0'
47
+ spec.override_inheritance_chain('wxClientDC', ['wxWindowDC', 'wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version_check('3.3.0') >= 0
48
48
  spec.make_abstract 'wxClientDC'
49
49
  spec.ignore 'wxClientDC::wxClientDC'
50
50
  # as a ClientDC should best always be a temporary stack object
@@ -67,7 +67,7 @@ module WXRuby3
67
67
  }
68
68
  __HEREDOC
69
69
  when 'wxPaintDC'
70
- spec.override_inheritance_chain('wxPaintDC', ['wxClientDC', 'wxWindowDC', 'wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version >= '3.3.0'
70
+ spec.override_inheritance_chain('wxPaintDC', ['wxClientDC', 'wxWindowDC', 'wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version_check('3.3.0') >= 0
71
71
  spec.make_abstract 'wxPaintDC'
72
72
  spec.ignore 'wxPaintDC::wxPaintDC'
73
73
  spec.add_header_code <<~__HEREDOC
@@ -92,10 +92,10 @@ module WXRuby3
92
92
  __HEREDOC
93
93
  when 'wxMemoryDC'
94
94
  spec.items << 'wxBufferedDC' << 'wxBufferedPaintDC'
95
- spec.override_inheritance_chain('wxMemoryDC', ['wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version >= '3.3.0'
95
+ spec.override_inheritance_chain('wxMemoryDC', ['wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version_check('3.3.0') >= 0
96
96
  spec.gc_as_untracked %w[wxBufferedDC wxBufferedPaintDC]
97
- spec.override_inheritance_chain('wxBufferedDC', ['wxMemoryDC', 'wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version >= '3.3.0'
98
- spec.override_inheritance_chain('wxBufferedPaintDC', ['wxBufferedDC', 'wxMemoryDC', 'wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version >= '3.3.0'
97
+ spec.override_inheritance_chain('wxBufferedDC', ['wxMemoryDC', 'wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version_check('3.3.0') >= 0
98
+ spec.override_inheritance_chain('wxBufferedPaintDC', ['wxBufferedDC', 'wxMemoryDC', 'wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version_check('3.3.0') >= 0
99
99
  spec.make_abstract 'wxMemoryDC'
100
100
  spec.make_abstract 'wxBufferedDC'
101
101
  spec.make_abstract 'wxBufferedPaintDC'
@@ -224,7 +224,7 @@ module WXRuby3
224
224
  }
225
225
  __HEREDOC
226
226
  when 'wxMirrorDC'
227
- spec.override_inheritance_chain('wxMirrorDC', ['wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version >= '3.3.0'
227
+ spec.override_inheritance_chain('wxMirrorDC', ['wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version_check('3.3.0') >= 0
228
228
  spec.make_abstract 'wxMirrorDC'
229
229
  spec.ignore 'wxMirrorDC::wxMirrorDC'
230
230
  # as a MirrorDC should best always be a temporary stack object
@@ -247,7 +247,7 @@ module WXRuby3
247
247
  }
248
248
  __HEREDOC
249
249
  when 'wxSVGFileDC'
250
- spec.override_inheritance_chain('wxSVGFileDC', ['wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version >= '3.3.0'
250
+ spec.override_inheritance_chain('wxSVGFileDC', ['wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version_check('3.3.0') >= 0
251
251
  spec.items.concat %w[wxSVGBitmapHandler wxSVGBitmapFileHandler wxSVGBitmapEmbedHandler]
252
252
  spec.make_abstract 'wxSVGFileDC'
253
253
  spec.ignore 'wxSVGFileDC::wxSVGFileDC'
@@ -285,7 +285,7 @@ module WXRuby3
285
285
  'wxSVGFileDC::StartPage',
286
286
  'wxSVGFileDC::EndPage'
287
287
  when 'wxGCDC'
288
- spec.override_inheritance_chain('wxGCDC', ['wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version >= '3.3.0'
288
+ spec.override_inheritance_chain('wxGCDC', ['wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version_check('3.3.0') >= 0
289
289
  spec.make_abstract 'wxGCDC'
290
290
  spec.ignore 'wxGCDC::wxGCDC'
291
291
  # like all DC this should best always be a temporary stack object
@@ -391,7 +391,7 @@ module WXRuby3
391
391
  spec.ignore 'wxGCDC::wxGCDC(const wxEnhMetaFileDC &)'
392
392
  when 'wxScaledDC'
393
393
  spec.items.clear # wxRuby extension; no XML docs
394
- if Config.instance.wx_version >= '3.3.0'
394
+ if Config.instance.wx_version_check('3.3.0') >= 0
395
395
  spec.override_inheritance_chain('wxScaledDC', ['wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject'])
396
396
  else
397
397
  spec.override_inheritance_chain('wxScaledDC', %w[wxDC wxObject])
@@ -435,7 +435,7 @@ module WXRuby3
435
435
  };
436
436
  __HEREDOC
437
437
  when 'wxPrinterDC'
438
- spec.override_inheritance_chain('wxPrinterDC', ['wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version >= '3.3.0'
438
+ spec.override_inheritance_chain('wxPrinterDC', ['wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version_check('3.3.0') >= 0
439
439
  spec.make_abstract 'wxPrinterDC'
440
440
  spec.ignore 'wxPrinterDC::wxPrinterDC'
441
441
  # as a PrinterDC should best always be a temporary stack object
@@ -458,7 +458,7 @@ module WXRuby3
458
458
  }
459
459
  __HEREDOC
460
460
  when 'wxPostScriptDC'
461
- spec.override_inheritance_chain('wxPostScriptDC', ['wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version >= '3.3.0'
461
+ spec.override_inheritance_chain('wxPostScriptDC', ['wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version_check('3.3.0') >= 0
462
462
  spec.make_abstract 'wxPostScriptDC'
463
463
  spec.ignore 'wxPostScriptDC::wxPostScriptDC'
464
464
  # as a PostScriptDC should best always be a temporary stack object
@@ -514,7 +514,7 @@ module WXRuby3
514
514
  return rc;
515
515
  }
516
516
  __HEREDOC
517
- if Config.instance.wx_version >= '3.3.0'
517
+ if Config.instance.wx_version_check('3.3.0') >= 0
518
518
  spec.items << 'wxOverlayDC'
519
519
  spec.override_inheritance_chain('wxOverlayDC', ['wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject'])
520
520
  spec.make_abstract 'wxOverlayDC'
@@ -551,7 +551,7 @@ module WXRuby3
551
551
  __HEREDOC
552
552
  end
553
553
  else
554
- spec.override_inheritance_chain(spec.module_name, ['wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version >= '3.3.0'
554
+ spec.override_inheritance_chain(spec.module_name, ['wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version_check('3.3.0') >= 0
555
555
  # ctors of all other derived DC require a running App
556
556
  spec.require_app spec.module_name
557
557
  end
@@ -84,7 +84,7 @@ module WXRuby3
84
84
  end
85
85
  when 'wxFontDialog'
86
86
  # ignore the non-const version
87
- if Config.platform == :macosx && Config.instance.wx_version < '3.3'
87
+ if Config.platform == :macosx && Config.instance.wx_version_check('3.3') < 0
88
88
  # MacOSX implementation is incorrect so we need to use
89
89
  # the non-const definition here
90
90
  spec.ignore 'wxFontDialog::GetFontData() const'
@@ -103,7 +103,7 @@ module WXRuby3
103
103
  __CODE
104
104
  end
105
105
  spec.ignore 'wxFileDialog::SetExtraControlCreator'
106
- if Config.instance.wx_version >= '3.2.1'
106
+ if Config.instance.wx_version_check('3.2.1') >= 0
107
107
  # doc does not seem to match actual header code so just ignore for now
108
108
  spec.ignore('wxFileDialog::AddShortcut')
109
109
  end
@@ -252,7 +252,7 @@ module WXRuby3
252
252
  spec.regard 'wxGenericAboutDialog::DoAddCustomControls',
253
253
  'wxGenericAboutDialog::AddControl',
254
254
  'wxGenericAboutDialog::AddText'
255
- if Config.instance.wx_version >= '3.3.0'
255
+ if Config.instance.wx_version_check('3.3.0') >= 0
256
256
  spec.regard 'wxGenericAboutDialog::GetCustomControlParent'
257
257
  end
258
258
  if Config.instance.features_set?('USE_COLLPANE')
@@ -22,7 +22,7 @@ module WXRuby3
22
22
  spec.ignore %w{
23
23
  wxTheColourDatabase
24
24
  }
25
- if Config.instance.wx_version >= '3.3.0'
25
+ if Config.instance.wx_version_check('3.3.0') >= 0
26
26
  spec.ignore 'wxColourDatabase::GetAllNames', ignore_doc: false
27
27
  spec.add_extend_code 'wxColourDatabase', <<~__HEREDOC
28
28
  VALUE get_all_names() const
@@ -49,7 +49,7 @@ module WXRuby3
49
49
  'wxRect::Intersect(const wxRect &)',
50
50
  'wxRect::Union(const wxRect &)'
51
51
  ]
52
- if Config.instance.wx_version >= '3.3.0'
52
+ if Config.instance.wx_version_check('3.3.0') >= 0
53
53
  # ignore these as they are supposed to specify unary minus but confuse
54
54
  # SWIG
55
55
  spec.ignore 'wxPoint::operator-(const wxPoint&)'
@@ -13,11 +13,15 @@ module WXRuby3
13
13
  class Geometry < Director
14
14
 
15
15
  def setup
16
- spec.items.replace %w{wxPoint2DInt wxPoint2DDouble}
16
+ spec.items.replace %w{wxPoint2DInt wxPoint2DDouble wxRect2DDouble}
17
17
 
18
18
  spec.ignore 'wxPoint2DInt::m_x', 'wxPoint2DInt::m_y',
19
- 'wxPoint2DDouble::m_x', 'wxPoint2DDouble::m_y'
19
+ 'wxPoint2DDouble::m_x', 'wxPoint2DDouble::m_y',
20
+ 'wxRect2DDouble::m_x', 'wxRect2DDouble::m_y',
21
+ 'wxRect2DDouble::m_width', 'wxRect2DDouble::m_height'
20
22
 
23
+ spec.ignore 'wxPoint2DInt::GetFloor(wxInt32 *, wxInt32 *)',
24
+ 'wxPoint2DInt::GetRounded(wxInt32 *, wxInt32 *)'
21
25
  spec.add_extend_code 'wxPoint2DInt', <<~__HEREDOC
22
26
  wxInt32 get_x()
23
27
  {
@@ -73,6 +77,8 @@ module WXRuby3
73
77
  }
74
78
  __HEREDOC
75
79
 
80
+ spec.ignore 'wxPoint2DDouble::GetFloor(wxInt32 *, wxInt32 *)',
81
+ 'wxPoint2DDouble::GetRounded(wxInt32 *, wxInt32 *)'
76
82
  spec.add_extend_code 'wxPoint2DDouble', <<~__HEREDOC
77
83
  wxDouble get_x()
78
84
  {
@@ -128,7 +134,53 @@ module WXRuby3
128
134
  }
129
135
  __HEREDOC
130
136
 
131
- spec.map_apply 'int * OUTPUT' => 'wxInt32 *'
137
+
138
+ spec.add_extend_code 'wxRect2DDouble', <<~__HEREDOC
139
+ wxDouble get_x()
140
+ {
141
+ return $self->m_x;
142
+ }
143
+ wxDouble set_x(wxDouble v)
144
+ {
145
+ return ($self->m_x = v);
146
+ }
147
+ wxDouble get_y()
148
+ {
149
+ return $self->m_y;
150
+ }
151
+ wxDouble set_y(wxDouble v)
152
+ {
153
+ return ($self->m_y = v);
154
+ }
155
+ wxDouble get_width()
156
+ {
157
+ return $self->m_width;
158
+ }
159
+ wxDouble set_width(wxDouble v)
160
+ {
161
+ return ($self->m_width = v);
162
+ }
163
+ wxDouble get_height()
164
+ {
165
+ return $self->m_height;
166
+ }
167
+ wxDouble set_height(wxDouble v)
168
+ {
169
+ return ($self->m_height = v);
170
+ }
171
+ void assign(const wxRect2DDouble& rect)
172
+ {
173
+ (*$self) = rect;
174
+ }
175
+ __HEREDOC
176
+ # implement in pure Ruby
177
+ spec.ignore 'wxRect2DDouble::Intersect(const wxRect2DDouble &, const wxRect2DDouble &, wxRect2DDouble *)',
178
+ 'wxRect2DDouble::Union(const wxRect2DDouble &, const wxRect2DDouble &, wxRect2DDouble *)',
179
+ ignore_doc: false
180
+ spec.map 'wxRect2DDouble *dest' => 'Wx::Rect2DDouble', swig: false do
181
+ map_in ignore: true, code: ''
182
+ map_argout code: ''
183
+ end
132
184
 
133
185
  # ignore all friend operators
134
186
  spec.do_not_generate :functions
@@ -98,12 +98,17 @@ module WXRuby3
98
98
  delete old_dashes;
99
99
  }
100
100
  __HEREDOC
101
+ if Config.instance.wx_version_check('3.3.0') >= 0
102
+ spec.ignore 'wxGraphicsContext::GetClipBox(wxDouble *, wxDouble *, wxDouble *, wxDouble *)'
103
+ else
104
+ # Typemap to fix GraphicsContext#get_clip_box
105
+ spec.map_apply 'double *OUTPUT' => ['wxDouble *x', 'wxDouble *y', 'wxDouble *w', 'wxDouble *h']
106
+ end
101
107
  # type mappings
102
- # Typemap to fix GraphicsContext#get_text_extent and get_dpi and get_clip_box
108
+ # Typemap to fix GraphicsContext#get_text_extent and get_dpi
103
109
  spec.map_apply 'double *OUTPUT' => [ 'wxDouble* width', 'wxDouble* height',
104
110
  'wxDouble* descent', 'wxDouble* externalLeading',
105
- 'wxDouble *dpiX', 'wxDouble *dpiY',
106
- 'wxDouble *x', 'wxDouble *y', 'wxDouble *w', 'wxDouble *h']
111
+ 'wxDouble *dpiX', 'wxDouble *dpiY']
107
112
  spec.map 'wxDouble* width, wxDouble* height, wxDouble* descent, wxDouble* externalLeading' do
108
113
  map_directorargout code: <<~__CODE
109
114
  if ( (TYPE(result) == T_ARRAY) && (RARRAY_LEN(result) >= 2) )
@@ -39,9 +39,36 @@ module WXRuby3
39
39
  spec.map_apply 'double *OUTPUT' => [ 'wxDouble *a', 'wxDouble *b',
40
40
  'wxDouble *c', 'wxDouble *d',
41
41
  'wxDouble *tx' , 'wxDouble *ty' ]
42
- spec.ignore 'wxGraphicsPath::GetBox() const',
42
+ # Deal with GraphicsMatrix#transform_point and #transform_distance methods
43
+ spec.ignore 'wxGraphicsMatrix::TransformPoint', 'wxGraphicsMatrix::TransformDistance'
44
+ spec.map_apply 'double *INOUT' => [ 'wxDouble *x' , 'wxDouble *y',
45
+ 'wxDouble *dx', 'wxDouble *dy']
46
+ spec.add_extend_code 'wxGraphicsMatrix', <<~__CODE
47
+ wxPoint2DDouble transform_point(wxDouble x, wxDouble y)
48
+ {
49
+ $self->TransformPoint(&x, &y);
50
+ return wxPoint2DDouble(x, y);
51
+ }
52
+ wxPoint2DDouble transform_point(const wxPoint2DDouble& pt)
53
+ {
54
+ wxDouble x = pt.m_x, y = pt.m_y;
55
+ $self->TransformPoint(&x, &y);
56
+ return wxPoint2DDouble(x, y);
57
+ }
58
+ wxPoint2DDouble transform_distance(wxDouble dx, wxDouble dy)
59
+ {
60
+ $self->TransformDistance(&dx, &dy);
61
+ return wxPoint2DDouble(dx, dy);
62
+ }
63
+ wxPoint2DDouble transform_distance(const wxPoint2DDouble& p)
64
+ {
65
+ wxDouble dx = p.m_x, dy = p.m_y;
66
+ $self->TransformDistance(&dx, &dy);
67
+ return wxPoint2DDouble(dx, dy);
68
+ }
69
+ __CODE
70
+ spec.ignore 'wxGraphicsPath::GetBox(wxDouble *, wxDouble *, wxDouble *, wxDouble *) const',
43
71
  'wxGraphicsPath::GetCurrentPoint(wxDouble*,wxDouble*) const'
44
- spec.map_apply 'double * OUTPUT' => 'wxDouble *'
45
72
  # wxGraphicsRenderer::GetVersion
46
73
  spec.map_apply 'int * OUTPUT' => ['int *major', 'int *minor', 'int *micro']
47
74
  if Config.platform == :mingw
@@ -19,7 +19,11 @@ module WXRuby3
19
19
  def setup
20
20
  spec.items << 'wxSimpleHtmlListBox' << 'wxItemContainer'
21
21
  super
22
- spec.override_inheritance_chain('wxHtmlListBox', %w[wxVListBox wxVScrolledWindow wxPanel wxWindow wxEvtHandler wxObject])
22
+ if Config.instance.wx_version_check('3.3.0') > 0
23
+ spec.override_inheritance_chain('wxHtmlListBox', ['wxVListBox', 'wxVScrolledWindow', 'wxPanel', 'wxWindow', 'wxEvtHandler', 'wxObject'])
24
+ else
25
+ spec.override_inheritance_chain('wxHtmlListBox', ['wxVListBox', { 'wxVScrolledWindow' => 'wxHScrolledWindow' }, 'wxPanel', 'wxWindow', 'wxEvtHandler', 'wxObject'])
26
+ end
23
27
  spec.make_abstract 'wxHtmlListBox'
24
28
  # provide base implementation for OnGetItem
25
29
  spec.add_header_code <<~__HEREDOC
@@ -34,7 +38,7 @@ module WXRuby3
34
38
  protected:
35
39
  virtual wxString OnGetItem (size_t n) const
36
40
  {
37
- rb_raise(rb_eNoMethodError, "Not implemented");
41
+ return {};
38
42
  }
39
43
  };
40
44
  __HEREDOC
@@ -48,7 +52,7 @@ module WXRuby3
48
52
  {
49
53
  $self->GetFileSystem().ChangePathTo(location, is_dir);
50
54
  }
51
- __HEREDOC
55
+ __HEREDOC
52
56
  # make sure protected methods are included
53
57
  spec.regard 'wxHtmlListBox::OnGetItem',
54
58
  'wxHtmlListBox::OnGetItemMarkup',
@@ -62,9 +66,16 @@ module WXRuby3
62
66
  'virtual void OnDrawBackground(wxDC &dc, const wxRect &rect, size_t n) const',
63
67
  'virtual void OnDrawSeparator(wxDC& dc, wxRect& rect, size_t n) const',
64
68
  visibility: 'protected'
69
+ # optimize; no need for these virtuals here
70
+ spec.no_proxy 'wxHtmlListBox::OnGetRowHeight',
71
+ 'wxHtmlListBox::OnGetRowsHeightHint'
65
72
 
66
73
  # override inheritance chain
67
- spec.override_inheritance_chain('wxSimpleHtmlListBox', %w[wxHtmlListBox wxVListBox wxVScrolledWindow wxPanel wxWindow wxEvtHandler wxObject])
74
+ if Config.instance.wx_version_check('3.3.0') > 0
75
+ spec.override_inheritance_chain('wxSimpleHtmlListBox', ['wxHtmlListBox', 'wxVListBox', 'wxVScrolledWindow', 'wxPanel', 'wxWindow', 'wxEvtHandler', 'wxObject'])
76
+ else
77
+ spec.override_inheritance_chain('wxSimpleHtmlListBox', ['wxHtmlListBox', 'wxVListBox', { 'wxVScrolledWindow' => 'wxHScrolledWindow' }, 'wxPanel', 'wxWindow', 'wxEvtHandler', 'wxObject'])
78
+ end
68
79
  spec.fold_bases('wxSimpleHtmlListBox' => %w[wxItemContainer])
69
80
  # override SWIG's confusion
70
81
  spec.make_concrete 'wxSimpleHtmlListBox'
@@ -99,6 +110,9 @@ module WXRuby3
99
110
  'wxItemContainer::Append(const wxArrayString &, wxClientData **)',
100
111
  'wxItemContainer::Insert(const wxArrayString &, unsigned int, wxClientData **)',
101
112
  'wxItemContainer::Set(const wxArrayString &, wxClientData **)'], ignore_doc: false)
113
+ # optimize; no need for these virtuals here
114
+ spec.no_proxy 'wxSimpleHtmlListBox::OnGetRowHeight',
115
+ 'wxSimpleHtmlListBox::OnGetRowsHeightHint'
102
116
  # for doc only
103
117
  spec.map 'void** clientData' => 'Array', swig: false do
104
118
  map_in code: ''
@@ -187,7 +201,7 @@ module WXRuby3
187
201
  }
188
202
  return rc;
189
203
  }
190
- __HEREDOC
204
+ __HEREDOC
191
205
  end
192
206
  end # class HtmlListBox
193
207
 
@@ -0,0 +1,253 @@
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
+ require_relative './window'
10
+
11
+ module WXRuby3
12
+
13
+ class Director
14
+
15
+ class HVScrolled < Window
16
+
17
+ def setup
18
+ super
19
+ case spec.module_name
20
+ when 'wxHScrolledWindow'
21
+ spec.items.replace %w[wxVarScrollHelperBase wxVarVScrollHelper wxVarHVScrollHelper wxVarHScrollHelper wxHScrolledWindow wxHVScrolledWindow wxPosition]
22
+ spec.override_inheritance_chain('wxHScrolledWindow', %w[wxPanel wxWindow wxEvtHandler wxObject])
23
+ spec.fold_bases('wxHScrolledWindow' => %w[wxVarHScrollHelper wxVarScrollHelperBase])
24
+ spec.make_abstract 'wxHScrolledWindow'
25
+ spec.force_proxy 'wxHScrolledWindow'
26
+ spec.override_inheritance_chain('wxHVScrolledWindow', %w[wxPanel wxWindow wxEvtHandler wxObject])
27
+ spec.fold_bases('wxHVScrolledWindow' => %w[wxVarHVScrollHelper wxVarHScrollHelper wxVarVScrollHelper wxVarScrollHelperBase])
28
+ spec.make_abstract 'wxHVScrolledWindow'
29
+ spec.force_proxy 'wxHVScrolledWindow'
30
+ # provide base implementations for pure virtuals
31
+ spec.add_header_code <<~__HEREDOC
32
+ // Custom subclass implementation.
33
+ class wxRubyHScrolledWindow : public wxHScrolledWindow
34
+ {
35
+ public:
36
+ wxRubyHScrolledWindow()
37
+ : wxHScrolledWindow () {}
38
+ wxRubyHScrolledWindow(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0, const wxString &name=wxPanelNameStr)
39
+ : wxHScrolledWindow(parent, id, pos, size, style, name) {}
40
+ protected:
41
+ virtual wxCoord OnGetColumnWidth(size_t) const
42
+ {
43
+ return {};
44
+ }
45
+ };
46
+
47
+ // Custom subclass implementation.
48
+ class wxRubyHVScrolledWindow : public wxHVScrolledWindow
49
+ {
50
+ public:
51
+ wxRubyHVScrolledWindow()
52
+ : wxHVScrolledWindow () {}
53
+ wxRubyHVScrolledWindow(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0, const wxString &name=wxPanelNameStr)
54
+ : wxHVScrolledWindow(parent, id, pos, size, style, name) {}
55
+ protected:
56
+ virtual wxCoord OnGetRowHeight(size_t) const
57
+ {
58
+ return {};
59
+ }
60
+ virtual wxCoord OnGetColumnWidth(size_t) const
61
+ {
62
+ return {};
63
+ }
64
+ };
65
+ __HEREDOC
66
+ # make Ruby director and wrappers use custom implementation
67
+ spec.use_class_implementation('wxHScrolledWindow', 'wxRubyHScrolledWindow')
68
+ spec.use_class_implementation('wxHVScrolledWindow', 'wxRubyHVScrolledWindow')
69
+ # regard protected methods
70
+ spec.regard 'wxVarVScrollHelper::OnGetRowHeight',
71
+ 'wxVarVScrollHelper::OnGetRowsHeightHint'
72
+ spec.regard 'wxVarHScrollHelper::OnGetColumnWidth',
73
+ 'wxVarHScrollHelper::OnGetColumnsWidthHint'
74
+ # ignore internal implementation methods
75
+ spec.ignore 'wxVarScrollHelperBase::GetNonOrientationTargetSize',
76
+ 'wxVarScrollHelperBase::GetOrientation',
77
+ 'wxVarScrollHelperBase::GetOrientationTargetSize',
78
+ 'wxVarScrollHelperBase::OnGetUnitSize',
79
+ 'wxVarScrollHelperBase::CalcScrolledPosition',
80
+ 'wxVarScrollHelperBase::CalcUnscrolledPosition',
81
+ 'wxVarScrollHelperBase::GetTargetWindow',
82
+ 'wxVarScrollHelperBase::SetTargetWindow',
83
+ 'wxVarScrollHelperBase::UpdateScrollbar',
84
+ 'wxVarScrollHelperBase::RefreshAll'
85
+ spec.map 'const wxPosition&' => 'Array(Integer, Integer), Wx::Position' do
86
+ add_header_code '#include <memory>'
87
+ map_in temp: 'std::unique_ptr<$1_basetype> tmp', code: <<~__CODE
88
+ if ( TYPE($input) == T_DATA )
89
+ {
90
+ void* argp$argnum;
91
+ SWIG_ConvertPtr($input, &argp$argnum, $1_descriptor, 0);
92
+ $1 = reinterpret_cast< $1_basetype * >(argp$argnum);
93
+ }
94
+ else if ( TYPE($input) == T_ARRAY )
95
+ {
96
+ $1 = new $1_basetype( NUM2INT( rb_ary_entry($input, 0) ),
97
+ NUM2INT( rb_ary_entry($input, 1) ) );
98
+ tmp.reset($1); // auto destruct when method scope ends
99
+ }
100
+ else
101
+ {
102
+ rb_raise(rb_eTypeError, "Wrong type for $1_basetype parameter");
103
+ }
104
+ __CODE
105
+ map_typecheck precedence: 'POINTER', code: <<~__CODE
106
+ void *vptr = 0;
107
+ $1 = 0;
108
+ if (TYPE($input) == T_ARRAY && RARRAY_LEN($input) == 2)
109
+ $1 = 1;
110
+ else if (TYPE($input) == T_DATA && SWIG_CheckState (SWIG_ConvertPtr ($input, &vptr, $1_descriptor, 0)))
111
+ $1 = 1;
112
+ __CODE
113
+ end
114
+ if Config.instance.wx_version_check('3.3.0') <= 0
115
+ spec.items << 'wxVScrolledWindow'
116
+ spec.override_inheritance_chain('wxVScrolledWindow', %w[wxPanel wxWindow wxEvtHandler wxObject])
117
+ spec.fold_bases('wxVScrolledWindow' => %w[wxVarVScrollHelper wxVarScrollHelperBase])
118
+ spec.make_abstract 'wxVScrolledWindow'
119
+ spec.force_proxy 'wxVScrolledWindow'
120
+ # provide base implementations for pure virtuals
121
+ spec.add_header_code <<~__HEREDOC
122
+ // Custom subclass implementation.
123
+ class wxRubyVScrolledWindow : public wxVScrolledWindow
124
+ {
125
+ public:
126
+ wxRubyVScrolledWindow()
127
+ : wxVScrolledWindow () {}
128
+ wxRubyVScrolledWindow(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0, const wxString &name=wxPanelNameStr)
129
+ : wxVScrolledWindow(parent, id, pos, size, style, name) {}
130
+ protected:
131
+ virtual wxCoord OnGetRowHeight(size_t) const
132
+ {
133
+ return {};
134
+ }
135
+ };
136
+ __HEREDOC
137
+ # make Ruby director and wrappers use custom implementation
138
+ spec.use_class_implementation('wxVScrolledWindow', 'wxRubyVScrolledWindow')
139
+ end
140
+ spec.do_not_generate(:typedefs)
141
+ when 'wxVScrolledWindow'
142
+ if Config.instance.wx_version_check('3.3.0') > 0
143
+ spec.items.replace %w[wxVScrolled wxVarScrollHelperBase wxVarVScrollHelper]
144
+ spec.gc_as_window
145
+ spec.use_template_as_class('wxVScrolled', 'wxVScrolledWindow')
146
+ spec.override_inheritance_chain('wxVScrolled', %w[wxPanel wxWindow wxEvtHandler wxObject])
147
+ spec.fold_bases('wxVScrolled' => %w[wxVarVScrollHelper wxVarScrollHelperBase])
148
+ spec.make_abstract 'wxVScrolled'
149
+ spec.force_proxy 'wxVScrolled'
150
+ spec.swig_import %w[
151
+ swig/classes/include/wxObject.h
152
+ swig/classes/include/wxEvtHandler.h
153
+ swig/classes/include/wxWindow.h
154
+ swig/classes/include/wxPanel.h
155
+ swig/classes/include/wxHScrolledWindow.h
156
+ ]
157
+ # provide base implementations for pure virtuals
158
+ spec.add_header_code <<~__HEREDOC
159
+ // Custom subclass implementation.
160
+ class wxRubyVScrolledWindow : public wxVScrolledWindow
161
+ {
162
+ public:
163
+ wxRubyVScrolledWindow()
164
+ : wxVScrolledWindow () {}
165
+ wxRubyVScrolledWindow(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0, const wxString &name=wxPanelNameStr)
166
+ : wxVScrolledWindow(parent, id, pos, size, style, name) {}
167
+ protected:
168
+ virtual wxCoord OnGetRowHeight(size_t) const
169
+ {
170
+ return {};
171
+ }
172
+ };
173
+ __HEREDOC
174
+ # make Ruby director and wrappers use custom implementation
175
+ spec.use_class_implementation('wxVScrolled', 'wxRubyVScrolledWindow')
176
+ # regard protected methods
177
+ spec.regard 'wxVarVScrollHelper::OnGetRowHeight',
178
+ 'wxVarVScrollHelper::OnGetRowsHeightHint'
179
+ # ignore internal implementation methods
180
+ spec.ignore 'wxVarScrollHelperBase::GetNonOrientationTargetSize',
181
+ 'wxVarScrollHelperBase::GetOrientation',
182
+ 'wxVarScrollHelperBase::GetOrientationTargetSize',
183
+ 'wxVarScrollHelperBase::OnGetUnitSize',
184
+ 'wxVarScrollHelperBase::CalcScrolledPosition',
185
+ 'wxVarScrollHelperBase::CalcUnscrolledPosition',
186
+ 'wxVarScrollHelperBase::GetTargetWindow',
187
+ 'wxVarScrollHelperBase::SetTargetWindow',
188
+ 'wxVarScrollHelperBase::UpdateScrollbar',
189
+ 'wxVarScrollHelperBase::RefreshAll'
190
+ spec.do_not_generate(:typedefs, :functions, :defines, :variables)
191
+ else
192
+ spec.items.clear
193
+ end
194
+ when 'wxVScrolledCanvas'
195
+ if Config.instance.wx_version_check('3.3.0') > 0
196
+ spec.items.replace %w[wxVScrolled wxVarScrollHelperBase wxVarVScrollHelper]
197
+ spec.gc_as_window
198
+ spec.use_template_as_class('wxVScrolled', 'wxVScrolledCanvas')
199
+ spec.override_inheritance_chain('wxVScrolled', %w[wxPanel wxWindow wxEvtHandler wxObject])
200
+ spec.fold_bases('wxVScrolled' => %w[wxVarVScrollHelper wxVarScrollHelperBase])
201
+ spec.make_abstract 'wxVScrolled'
202
+ spec.force_proxy 'wxVScrolled'
203
+ spec.swig_import %w[
204
+ swig/classes/include/wxObject.h
205
+ swig/classes/include/wxEvtHandler.h
206
+ swig/classes/include/wxWindow.h
207
+ swig/classes/include/wxPanel.h
208
+ swig/classes/include/wxHScrolledWindow.h
209
+ ]
210
+ # provide base implementations for pure virtuals
211
+ spec.add_header_code <<~__HEREDOC
212
+ // Custom subclass implementation.
213
+ class wxRubyVScrolledCanvas : public wxVScrolledCanvas
214
+ {
215
+ public:
216
+ wxRubyVScrolledCanvas()
217
+ : wxVScrolledCanvas () {}
218
+ wxRubyVScrolledCanvas(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0, const wxString &name=wxPanelNameStr)
219
+ : wxVScrolledCanvas(parent, id, pos, size, style, name) {}
220
+ protected:
221
+ virtual wxCoord OnGetRowHeight(size_t) const
222
+ {
223
+ return {};
224
+ }
225
+ };
226
+ __HEREDOC
227
+ # make Ruby director and wrappers use custom implementation
228
+ spec.use_class_implementation('wxVScrolled', 'wxRubyVScrolledCanvas')
229
+ # regard protected methods
230
+ spec.regard 'wxVarVScrollHelper::OnGetRowHeight',
231
+ 'wxVarVScrollHelper::OnGetRowsHeightHint'
232
+ # ignore internal implementation methods
233
+ spec.ignore 'wxVarScrollHelperBase::GetNonOrientationTargetSize',
234
+ 'wxVarScrollHelperBase::GetOrientation',
235
+ 'wxVarScrollHelperBase::GetOrientationTargetSize',
236
+ 'wxVarScrollHelperBase::OnGetUnitSize',
237
+ 'wxVarScrollHelperBase::CalcScrolledPosition',
238
+ 'wxVarScrollHelperBase::CalcUnscrolledPosition',
239
+ 'wxVarScrollHelperBase::GetTargetWindow',
240
+ 'wxVarScrollHelperBase::SetTargetWindow',
241
+ 'wxVarScrollHelperBase::UpdateScrollbar',
242
+ 'wxVarScrollHelperBase::RefreshAll'
243
+ spec.do_not_generate(:typedefs, :functions, :defines, :variables)
244
+ else
245
+ spec.items.clear
246
+ end
247
+ end
248
+ end
249
+ end # class HVScrolledWindow
250
+
251
+ end # class Director
252
+
253
+ end # module WXRuby3