wxruby3 1.5.4 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. checksums.yaml +4 -4
  2. data/ext/wxruby3/swig/RubyStockObjects.i +1 -0
  3. data/lib/wx/aui/auifloatframe.rb +1 -1
  4. data/lib/wx/aui/auimanager.rb +1 -1
  5. data/lib/wx/aui/auinotebook.rb +2 -2
  6. data/lib/wx/core/animation.rb +1 -1
  7. data/lib/wx/core/cursor.rb +10 -0
  8. data/lib/wx/core/dataformat.rb +1 -1
  9. data/lib/wx/core/file_dialog.rb +1 -1
  10. data/lib/wx/core/geometry.rb +34 -0
  11. data/lib/wx/core/hboxsizer.rb +22 -0
  12. data/lib/wx/core/hyperlink_ctrl.rb +18 -0
  13. data/lib/wx/core/position.rb +58 -0
  14. data/lib/wx/core/vboxsizer.rb +22 -0
  15. data/lib/wx/doc/aui/auimanager.rb +6 -3
  16. data/lib/wx/doc/aui/auinotebook.rb +6 -3
  17. data/lib/wx/doc/config.rb +14 -8
  18. data/lib/wx/doc/controlwithitems.rb +7 -3
  19. data/lib/wx/doc/core.rb +21 -0
  20. data/lib/wx/doc/geometry.rb +47 -7
  21. data/lib/wx/doc/graphics_object.rb +24 -0
  22. data/lib/wx/doc/grid/grid.rb +18 -9
  23. data/lib/wx/doc/hboxsizer.rb +41 -5
  24. data/lib/wx/doc/list_ctrl.rb +12 -6
  25. data/lib/wx/doc/menu.rb +6 -3
  26. data/lib/wx/doc/notebook.rb +6 -3
  27. data/lib/wx/doc/pg/pg_property.rb +18 -9
  28. data/lib/wx/doc/pg/property_grid_interface.rb +4 -4
  29. data/lib/wx/doc/region_iterator.rb +1 -1
  30. data/lib/wx/doc/rtc/rich_text_composite_object.rb +6 -3
  31. data/lib/wx/doc/rtc/rich_text_ctrl.rb +6 -3
  32. data/lib/wx/doc/rtc/rich_text_paragraph.rb +6 -3
  33. data/lib/wx/doc/sizer.rb +6 -3
  34. data/lib/wx/doc/stc/styled_text_ctrl.rb +6 -3
  35. data/lib/wx/doc/textctrl.rb +6 -3
  36. data/lib/wx/doc/tree_ctrl.rb +7 -3
  37. data/lib/wx/doc/v_list_box.rb +6 -3
  38. data/lib/wx/doc/variant.rb +1 -1
  39. data/lib/wx/doc/vboxsizer.rb +41 -5
  40. data/lib/wx/doc/window.rb +6 -3
  41. data/lib/wx/helpers.rb +28 -0
  42. data/lib/wx/keyword_ctors.rb +2 -2
  43. data/lib/wx/keyword_defs.rb +11 -2
  44. data/lib/wx/pg/pg_property.rb +1 -1
  45. data/lib/wx/version.rb +1 -1
  46. data/rakelib/lib/config/mingw.rb +1 -1
  47. data/rakelib/lib/config.rb +6 -0
  48. data/rakelib/lib/director/affine_matrix.rb +33 -0
  49. data/rakelib/lib/director/animation_ctrl.rb +1 -1
  50. data/rakelib/lib/director/app.rb +1 -1
  51. data/rakelib/lib/director/aui_manager.rb +2 -2
  52. data/rakelib/lib/director/aui_notebook.rb +1 -1
  53. data/rakelib/lib/director/aui_tab_art.rb +4 -4
  54. data/rakelib/lib/director/ctrl_with_items.rb +1 -1
  55. data/rakelib/lib/director/cursor.rb +11 -1
  56. data/rakelib/lib/director/dc.rb +2 -2
  57. data/rakelib/lib/director/defs.rb +1 -1
  58. data/rakelib/lib/director/derived_dc.rb +14 -14
  59. data/rakelib/lib/director/dialog.rb +3 -3
  60. data/rakelib/lib/director/gdicommon.rb +2 -2
  61. data/rakelib/lib/director/geometry.rb +55 -3
  62. data/rakelib/lib/director/graphics_context.rb +8 -3
  63. data/rakelib/lib/director/graphics_object.rb +29 -2
  64. data/rakelib/lib/director/html_listbox.rb +6 -5
  65. data/rakelib/lib/director/hvscrolled_window.rb +140 -0
  66. data/rakelib/lib/director/hyperlink_ctrl.rb +38 -1
  67. data/rakelib/lib/director/menu_item.rb +1 -1
  68. data/rakelib/lib/director/persistent_window.rb +2 -2
  69. data/rakelib/lib/director/pgeditor.rb +1 -1
  70. data/rakelib/lib/director/pgproperties.rb +4 -4
  71. data/rakelib/lib/director/pgproperty.rb +1 -1
  72. data/rakelib/lib/director/pgvalidation_info.rb +1 -1
  73. data/rakelib/lib/director/print_data.rb +1 -1
  74. data/rakelib/lib/director/property_grid_event.rb +1 -1
  75. data/rakelib/lib/director/property_grid_page.rb +1 -1
  76. data/rakelib/lib/director/property_grid_page_state.rb +1 -1
  77. data/rakelib/lib/director/ribbon_tool_bar.rb +1 -1
  78. data/rakelib/lib/director/richtext_buffer.rb +1 -1
  79. data/rakelib/lib/director/richtext_formatting_dialog.rb +1 -1
  80. data/rakelib/lib/director/richtext_paragraph_layout_box.rb +1 -1
  81. data/rakelib/lib/director/richtext_style_listbox.rb +2 -1
  82. data/rakelib/lib/director/scrolled_t.rb +22 -0
  83. data/rakelib/lib/director/sizer.rb +21 -0
  84. data/rakelib/lib/director/styled_text_event.rb +1 -1
  85. data/rakelib/lib/director/textctrl.rb +2 -2
  86. data/rakelib/lib/director/tree_ctrl.rb +1 -1
  87. data/rakelib/lib/director/utils.rb +1 -1
  88. data/rakelib/lib/director/variant.rb +1 -1
  89. data/rakelib/lib/director/vlistbox.rb +5 -3
  90. data/rakelib/lib/director/window.rb +14 -3
  91. data/rakelib/lib/extractor/function.rb +46 -15
  92. data/rakelib/lib/generate/doc/hyperlink_ctrl.yaml +22 -0
  93. data/rakelib/lib/generate/doc/scrolled_canvas.yaml +38 -0
  94. data/rakelib/lib/generate/doc/scrolled_control.yaml +38 -0
  95. data/rakelib/lib/generate/doc/scrolled_window.yaml +38 -0
  96. data/rakelib/lib/specs/interfaces.rb +2 -2
  97. data/rakelib/lib/typemap/print_page_range.rb +1 -1
  98. data/samples/scrolling/tn_varscroll.png +0 -0
  99. data/samples/scrolling/varscroll.rb +416 -0
  100. data/samples/widgets/hyperlink.rb +85 -60
  101. metadata +12 -6
  102. data/rakelib/lib/director/vscrolled_window.rb +0 -62
  103. /data/samples/{controls → scrolling}/htlbox.rb +0 -0
  104. /data/samples/{etc → scrolling}/scrollwin.rb +0 -0
  105. /data/samples/{controls → scrolling}/tn_htlbox.png +0 -0
  106. /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,7 @@ 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
+ spec.override_inheritance_chain('wxHtmlListBox', ['wxVListBox', { 'wxVScrolledWindow' => 'wxHVScrolledWindow' }, 'wxPanel', 'wxWindow', 'wxEvtHandler', 'wxObject'])
23
23
  spec.make_abstract 'wxHtmlListBox'
24
24
  # provide base implementation for OnGetItem
25
25
  spec.add_header_code <<~__HEREDOC
@@ -34,7 +34,7 @@ module WXRuby3
34
34
  protected:
35
35
  virtual wxString OnGetItem (size_t n) const
36
36
  {
37
- rb_raise(rb_eNoMethodError, "Not implemented");
37
+ return {};
38
38
  }
39
39
  };
40
40
  __HEREDOC
@@ -48,7 +48,7 @@ module WXRuby3
48
48
  {
49
49
  $self->GetFileSystem().ChangePathTo(location, is_dir);
50
50
  }
51
- __HEREDOC
51
+ __HEREDOC
52
52
  # make sure protected methods are included
53
53
  spec.regard 'wxHtmlListBox::OnGetItem',
54
54
  'wxHtmlListBox::OnGetItemMarkup',
@@ -62,9 +62,10 @@ module WXRuby3
62
62
  'virtual void OnDrawBackground(wxDC &dc, const wxRect &rect, size_t n) const',
63
63
  'virtual void OnDrawSeparator(wxDC& dc, wxRect& rect, size_t n) const',
64
64
  visibility: 'protected'
65
+ spec.no_proxy 'wxVListBox::OnGetRowHeight'
65
66
 
66
67
  # override inheritance chain
67
- spec.override_inheritance_chain('wxSimpleHtmlListBox', %w[wxHtmlListBox wxVListBox wxVScrolledWindow wxPanel wxWindow wxEvtHandler wxObject])
68
+ spec.override_inheritance_chain('wxSimpleHtmlListBox', ['wxHtmlListBox', 'wxVListBox', { 'wxVScrolledWindow' => 'wxHVScrolledWindow' }, 'wxPanel', 'wxWindow', 'wxEvtHandler', 'wxObject'])
68
69
  spec.fold_bases('wxSimpleHtmlListBox' => %w[wxItemContainer])
69
70
  # override SWIG's confusion
70
71
  spec.make_concrete 'wxSimpleHtmlListBox'
@@ -187,7 +188,7 @@ module WXRuby3
187
188
  }
188
189
  return rc;
189
190
  }
190
- __HEREDOC
191
+ __HEREDOC
191
192
  end
192
193
  end # class HtmlListBox
193
194
 
@@ -0,0 +1,140 @@
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 HVScrolledWindow < Window
16
+
17
+ def setup
18
+ super
19
+ spec.items << 'wxVarScrollHelperBase' << 'wxVarHVScrollHelper' <<
20
+ 'wxVarVScrollHelper' << 'wxVScrolledWindow' <<
21
+ 'wxVarHScrollHelper' << 'wxHScrolledWindow' <<
22
+ 'wxPosition'
23
+ spec.override_inheritance_chain('wxVScrolledWindow', %w[wxPanel wxWindow wxEvtHandler wxObject])
24
+ spec.fold_bases('wxVScrolledWindow' => %w[wxVarVScrollHelper wxVarScrollHelperBase])
25
+ spec.make_abstract 'wxVScrolledWindow'
26
+ spec.force_proxy 'wxVScrolledWindow'
27
+ spec.override_inheritance_chain('wxHScrolledWindow', %w[wxPanel wxWindow wxEvtHandler wxObject])
28
+ spec.fold_bases('wxHScrolledWindow' => %w[wxVarHScrollHelper wxVarScrollHelperBase])
29
+ spec.make_abstract 'wxHScrolledWindow'
30
+ spec.force_proxy 'wxHScrolledWindow'
31
+ spec.override_inheritance_chain('wxHVScrolledWindow', %w[wxPanel wxWindow wxEvtHandler wxObject])
32
+ spec.fold_bases('wxHVScrolledWindow' => %w[wxVarHVScrollHelper wxVarHScrollHelper wxVarVScrollHelper wxVarScrollHelperBase])
33
+ spec.make_abstract 'wxHVScrolledWindow'
34
+ spec.force_proxy 'wxHVScrolledWindow'
35
+ # provide base implementations for pure virtuals
36
+ spec.add_header_code <<~__HEREDOC
37
+ // Custom subclass implementation.
38
+ class wxRubyVScrolledWindow : public wxVScrolledWindow
39
+ {
40
+ public:
41
+ wxRubyVScrolledWindow()
42
+ : wxVScrolledWindow () {}
43
+ wxRubyVScrolledWindow(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0, const wxString &name=wxPanelNameStr)
44
+ : wxVScrolledWindow(parent, id, pos, size, style, name) {}
45
+ protected:
46
+ virtual wxCoord OnGetRowHeight(size_t) const
47
+ {
48
+ return {};
49
+ }
50
+ };
51
+
52
+ // Custom subclass implementation.
53
+ class wxRubyHScrolledWindow : public wxHScrolledWindow
54
+ {
55
+ public:
56
+ wxRubyHScrolledWindow()
57
+ : wxHScrolledWindow () {}
58
+ wxRubyHScrolledWindow(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0, const wxString &name=wxPanelNameStr)
59
+ : wxHScrolledWindow(parent, id, pos, size, style, name) {}
60
+ protected:
61
+ virtual wxCoord OnGetColumnWidth(size_t) const
62
+ {
63
+ return {};
64
+ }
65
+ };
66
+
67
+ // Custom subclass implementation.
68
+ class wxRubyHVScrolledWindow : public wxHVScrolledWindow
69
+ {
70
+ public:
71
+ wxRubyHVScrolledWindow()
72
+ : wxHVScrolledWindow () {}
73
+ wxRubyHVScrolledWindow(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0, const wxString &name=wxPanelNameStr)
74
+ : wxHVScrolledWindow(parent, id, pos, size, style, name) {}
75
+ protected:
76
+ virtual wxCoord OnGetRowHeight(size_t) const
77
+ {
78
+ return {};
79
+ }
80
+ virtual wxCoord OnGetColumnWidth(size_t) const
81
+ {
82
+ return {};
83
+ }
84
+ };
85
+ __HEREDOC
86
+ # make Ruby director and wrappers use custom implementation
87
+ spec.use_class_implementation('wxVScrolledWindow', 'wxRubyVScrolledWindow')
88
+ spec.use_class_implementation('wxHScrolledWindow', 'wxRubyHScrolledWindow')
89
+ spec.use_class_implementation('wxHVScrolledWindow', 'wxRubyHVScrolledWindow')
90
+ # regard protected methods
91
+ spec.regard 'wxVarVScrollHelper::OnGetRowHeight',
92
+ 'wxVarVScrollHelper::OnGetRowsHeightHint'
93
+ spec.regard 'wxVarHScrollHelper::OnGetColumnWidth',
94
+ 'wxVarHScrollHelper::OnGetColumnsWidthHint'
95
+ # ignore internal implementation methods
96
+ spec.ignore 'wxVarScrollHelperBase::GetNonOrientationTargetSize',
97
+ 'wxVarScrollHelperBase::GetOrientation',
98
+ 'wxVarScrollHelperBase::GetOrientationTargetSize',
99
+ 'wxVarScrollHelperBase::OnGetUnitSize',
100
+ 'wxVarScrollHelperBase::CalcScrolledPosition',
101
+ 'wxVarScrollHelperBase::CalcUnscrolledPosition',
102
+ 'wxVarScrollHelperBase::GetTargetWindow',
103
+ 'wxVarScrollHelperBase::SetTargetWindow',
104
+ 'wxVarScrollHelperBase::UpdateScrollbar',
105
+ 'wxVarScrollHelperBase::RefreshAll'
106
+ spec.map 'const wxPosition&' => 'Array(Integer, Integer), Wx::Position' do
107
+ add_header_code '#include <memory>'
108
+ map_in temp: 'std::unique_ptr<$1_basetype> tmp', code: <<~__CODE
109
+ if ( TYPE($input) == T_DATA )
110
+ {
111
+ void* argp$argnum;
112
+ SWIG_ConvertPtr($input, &argp$argnum, $1_descriptor, 0);
113
+ $1 = reinterpret_cast< $1_basetype * >(argp$argnum);
114
+ }
115
+ else if ( TYPE($input) == T_ARRAY )
116
+ {
117
+ $1 = new $1_basetype( NUM2INT( rb_ary_entry($input, 0) ),
118
+ NUM2INT( rb_ary_entry($input, 1) ) );
119
+ tmp.reset($1); // auto destruct when method scope ends
120
+ }
121
+ else
122
+ {
123
+ rb_raise(rb_eTypeError, "Wrong type for $1_basetype parameter");
124
+ }
125
+ __CODE
126
+ map_typecheck precedence: 'POINTER', code: <<~__CODE
127
+ void *vptr = 0;
128
+ $1 = 0;
129
+ if (TYPE($input) == T_ARRAY && RARRAY_LEN($input) == 2)
130
+ $1 = 1;
131
+ else if (TYPE($input) == T_DATA && SWIG_CheckState (SWIG_ConvertPtr ($input, &vptr, $1_descriptor, 0)))
132
+ $1 = 1;
133
+ __CODE
134
+ end
135
+ end
136
+ end # class HVScrolledWindow
137
+
138
+ end # class Director
139
+
140
+ end # module WXRuby3
@@ -16,7 +16,7 @@ module WXRuby3
16
16
 
17
17
  def setup
18
18
  super
19
- if Config.instance.wx_version <= '3.3.0'
19
+ if Config.instance.wx_version_check('3.3.0') <= 0
20
20
  # XML docs (< 3.3) incorrectly declare these pure virtual
21
21
  spec.ignore 'wxHyperlinkCtrl::GetVisited', 'wxHyperlinkCtrl::SetVisited', ignore_doc: false
22
22
  # replace by correct declarations
@@ -24,6 +24,43 @@ module WXRuby3
24
24
  'virtual bool wxHyperlinkCtrl::GetVisited() const',
25
25
  'virtual void wxHyperlinkCtrl::SetVisited(bool visited = true)'
26
26
  end
27
+
28
+ def process(gendoc: false)
29
+ defmod = super
30
+ # For WXOSX wxGenericHyperlinkCtrl is functionally identical to wxHyperlinkCtrl
31
+ # so we will declare a constant for that in pure Ruby.
32
+ # In case we are generating documentation create the class def anyway so we get full docs for MacOS as well.
33
+ unless Config.instance.features_set?('WXOSX') && !gendoc
34
+ spec.include 'wx/generic/hyperlink.h'
35
+ def_hlink = defmod.find_item('wxHyperlinkCtrl')
36
+ # create a definition for 'wxGenericHyperlinkCtrl' which is not documented
37
+ def_genhlink = def_hlink.dup
38
+ def_genhlink.name = 'wxGenericHyperlinkCtrl'
39
+ def_genhlink.items = def_genhlink.items.collect { |itm| itm.dup }
40
+ def_genhlink.items.each do |itm|
41
+ if itm.is_a?(Extractor::MethodDef)
42
+ itm.overloads = itm.overloads.collect { |ovl| ovl.dup }
43
+ itm.all.each do |ovl|
44
+ ovl.name = 'wxGenericHyperlinkCtrl' if ovl.is_ctor
45
+ ovl.class_name = 'wxGenericHyperlinkCtrl'
46
+ ovl.update_attributes(klass: def_genhlink)
47
+ end
48
+ end
49
+ end
50
+ defmod.items << def_genhlink
51
+ if Config.instance.wx_version_check('3.3.0') <= 0
52
+ # the interface extensions to fix the incorrectly pure virtual declared methods are missing
53
+ spec.extend_interface 'wxGenericHyperlinkCtrl',
54
+ 'virtual bool wxGenericHyperlinkCtrl::GetVisited() const',
55
+ 'virtual void wxGenericHyperlinkCtrl::SetVisited(bool visited = true)'
56
+ end
57
+ # as we already called super before adding wxGenericHyperlinkCtrl the no_proxy settings from the
58
+ # base Window director are missing; just copy all those set for wxStaticBitmap
59
+ list = spec.no_proxies.select { |name| name.start_with?('wxHyperlinkCtrl::') }
60
+ spec.no_proxy(*list.collect { |name| name.sub(/\AwxHyperlinkCtrl::/, 'wxGenericHyperlinkCtrl::')})
61
+ end
62
+ defmod
63
+ end
27
64
  end
28
65
  end # class HyperlinkCtrl
29
66
 
@@ -24,7 +24,7 @@ module WXRuby3
24
24
  spec.ignore_unless('USE_ACCEL', 'wxMenuItem::GetAccel')
25
25
  spec.no_proxy 'wxMenuItem::GetAccel'
26
26
  spec.ignore 'wxMenuItem::GetBitmap(bool)' # not portable
27
- if Config.instance.wx_version > '3.2.4'
27
+ if Config.instance.wx_version_check('3.2.4') > 0
28
28
  spec.ignore_unless('WXMSW', 'wxMenuItem::SetBackgroundColour','wxMenuItem::SetFont','wxMenuItem::SetTextColour')
29
29
  end
30
30
  super
@@ -14,7 +14,7 @@ module WXRuby3
14
14
 
15
15
  def setup
16
16
  spec.items << 'wxPersistentTLW' << 'wxPersistentBookCtrl' << 'wxPersistentTreeBookCtrl'
17
- if Config.instance.wx_version > '3.2.4'
17
+ if Config.instance.wx_version_check('3.2.4') > 0
18
18
  # only after 3.2.4 properly available
19
19
  spec.items << 'wxPersistentComboBox'
20
20
  end
@@ -57,7 +57,7 @@ module WXRuby3
57
57
  spec.extend_interface 'wxPersistentTreeBookCtrl',
58
58
  'virtual wxString GetKind() const override'
59
59
  spec.do_not_generate :functions, :defines, :typedefs, :variables, :enums
60
- if Config.instance.wx_version >= '3.0.0'
60
+ if Config.instance.wx_version_check('3.0.0') >= 0
61
61
  # wxPersistentComboBox
62
62
  spec.override_inheritance_chain('wxPersistentComboBox', [{ 'wxPersistentWindowBase' => 'wxPersistentWindow' }, 'wxPersistentObject'])
63
63
  # add method override missing from docs
@@ -17,7 +17,7 @@ module WXRuby3
17
17
  spec.items.concat %w[wxPGCheckBoxEditor wxPGChoiceEditor wxPGChoiceAndButtonEditor wxPGComboBoxEditor
18
18
  wxPGTextCtrlEditor wxPGSpinCtrlEditor wxPGTextCtrlAndButtonEditor wxPGEditorDialogAdapter]
19
19
  spec.includes << 'wx/propgrid/propgriddefs.h'
20
- if Config.instance.wx_version > '3.2.4'
20
+ if Config.instance.wx_version_check('3.2.4') > 0
21
21
  # make sure SWIG knows this as enum type
22
22
  spec.add_swig_code 'enum wxPGPropertyFlags;'
23
23
  end
@@ -65,7 +65,7 @@ module WXRuby3
65
65
  'wxUIntProperty::m_prefix',
66
66
  'wxDateProperty::m_format',
67
67
  'wxDateProperty::m_dpStyle'
68
- if Config.instance.wx_version > '3.2.4'
68
+ if Config.instance.wx_version_check('3.2.4') > 0
69
69
  # currently missing from interface docs
70
70
  spec.extend_interface 'wxEnumProperty',
71
71
  'bool ValueFromString_(wxVariant& value, int* pIndex, const wxString& text,int argFlags) const',
@@ -111,7 +111,7 @@ module WXRuby3
111
111
  end
112
112
  # make sure the derived Enum property classes provide the protected accessors too
113
113
  %w[wxCursorProperty wxEditEnumProperty wxSystemColourProperty wxColourProperty].each do |kls|
114
- if Config.instance.wx_version > '3.2.4'
114
+ if Config.instance.wx_version_check('3.2.4') > 0
115
115
  # currently missing from interface docs
116
116
  spec.extend_interface kls,
117
117
  'int GetIndex() const',
@@ -136,12 +136,12 @@ module WXRuby3
136
136
  'wxLongStringProperty::DisplayEditorDialog',
137
137
  'wxMultiChoiceProperty::DisplayEditorDialog',
138
138
  'wxFontProperty::DisplayEditorDialog'
139
- if Config.instance.wx_version > '3.2.4'
139
+ if Config.instance.wx_version_check('3.2.4') > 0
140
140
  # for wxEnumProperty and derivatives ValueFromString_/ValueFromInt_
141
141
  spec.map_apply 'int * OUTPUT' => 'int* pIndex'
142
142
  end
143
143
  # for UIntProperty and IntProperty
144
- if Config.instance.features_set?('USE_LONGLONG') || Config.instance.wx_version >= '3.3.0'
144
+ if Config.instance.features_set?('USE_LONGLONG') || Config.instance.wx_version_check('3.3.0') >= 0
145
145
  # wxLongLong mapping to be considered before considering 'long' (see typecheck precedence)
146
146
  spec.map 'const wxLongLong&' => 'Integer' do
147
147
  map_in temp: 'wxLongLong tmp', code: <<~__CODE
@@ -120,7 +120,7 @@ module WXRuby3
120
120
  # do not think this useful for wxRuby (Also; caused GC problems)
121
121
  spec.ignore 'wxPGProperty::GetCellRenderer'
122
122
  # obsolete
123
- if Config.instance.wx_version < '3.3.0'
123
+ if Config.instance.wx_version_check('3.3.0') < 0
124
124
  spec.ignore %w[wxPGProperty::AddChild wxPGProperty::GetValueString]
125
125
  else
126
126
  spec.ignore 'wxPGProperty::AddChild'
@@ -16,7 +16,7 @@ module WXRuby3
16
16
  super
17
17
  spec.items << 'propgrid/propgrid.h'
18
18
  spec.gc_as_untracked 'wxPGValidationInfo'
19
- if Config.instance.wx_version < '3.3.0'
19
+ if Config.instance.wx_version_check('3.3.0') < 0
20
20
  spec.ignore 'wxPGVFBFlags' # not a constant but a rather a clumsy typedef
21
21
  spec.map 'wxPGVFBFlags' => 'Integer' do
22
22
  map_in code: '$1 = (unsigned char)NUM2UINT($input);'
@@ -23,7 +23,7 @@ module WXRuby3
23
23
  # only keep the const version
24
24
  spec.ignore 'wxPageSetupDialogData::GetPrintData'
25
25
  spec.regard 'wxPageSetupDialogData::GetPrintData() const'
26
- if Config.instance.wx_version >= '3.3.0'
26
+ if Config.instance.wx_version_check('3.3.0') >= 0
27
27
  # new since 3.3.0
28
28
  spec.items << 'wxPrintPageRange'
29
29
  spec.regard 'wxPrintPageRange::fromPage', 'wxPrintPageRange::toPage' # include public attributes