wxruby3 0.9.1 → 0.9.2

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 (153) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -0
  3. data/ext/wxruby3/include/wxRubyApp.h +338 -0
  4. data/ext/wxruby3/include/wxruby-Config.h +6 -6
  5. data/ext/wxruby3/swig/common.i +1 -1
  6. data/lib/wx/aui/aui_tab_ctrl.rb +18 -0
  7. data/lib/wx/aui/auinotebook.rb +6 -2
  8. data/lib/wx/aui/require.rb +1 -0
  9. data/lib/wx/core/app.rb +2 -2
  10. data/lib/wx/core/collapsible_pane.rb +1 -1
  11. data/lib/wx/core/controlwithitems.rb +8 -6
  12. data/lib/wx/core/menu.rb +10 -0
  13. data/lib/wx/core/notebook.rb +6 -2
  14. data/lib/wx/core/sizer.rb +11 -0
  15. data/lib/wx/core/task_bar_button.rb +19 -0
  16. data/lib/wx/core/textctrl.rb +11 -1
  17. data/lib/wx/core/{treectrl.rb → tree_ctrl.rb} +31 -12
  18. data/lib/wx/core/window.rb +10 -0
  19. data/lib/wx/doc/app.rb +48 -38
  20. data/lib/wx/doc/art_locator.rb +47 -43
  21. data/lib/wx/doc/aui/auimanager.rb +16 -8
  22. data/lib/wx/doc/aui/auinotebook.rb +20 -5
  23. data/lib/wx/doc/clipboard.rb +11 -7
  24. data/lib/wx/doc/colour_dialog.rb +14 -10
  25. data/lib/wx/doc/controlwithitems.rb +17 -7
  26. data/lib/wx/doc/data_object.rb +2 -2
  27. data/lib/wx/doc/evthandler.rb +113 -108
  28. data/lib/wx/doc/font.rb +1 -0
  29. data/lib/wx/doc/gc_dc.rb +6 -1
  30. data/lib/wx/doc/graphics_context.rb +1 -0
  31. data/lib/wx/doc/grid/grid.rb +22 -1
  32. data/lib/wx/doc/help_controller.rb +11 -7
  33. data/lib/wx/doc/html/html_help_controller.rb +12 -4
  34. data/lib/wx/doc/list_ctrl.rb +33 -29
  35. data/lib/wx/doc/menu.rb +20 -0
  36. data/lib/wx/doc/notebook.rb +21 -0
  37. data/lib/wx/doc/pg/events.rb +13 -9
  38. data/lib/wx/doc/pg/pg_property.rb +18 -0
  39. data/lib/wx/doc/progress_dialog.rb +36 -32
  40. data/lib/wx/doc/prt/page_setup_dialog.rb +20 -12
  41. data/lib/wx/doc/prt/print_data.rb +13 -5
  42. data/lib/wx/doc/prt/print_dialog.rb +31 -23
  43. data/lib/wx/doc/prt/printer.rb +20 -12
  44. data/lib/wx/doc/radio_box.rb +19 -15
  45. data/lib/wx/doc/rbn/ribbon_bar.rb +13 -5
  46. data/lib/wx/doc/rbn/ribbon_button_bar.rb +13 -5
  47. data/lib/wx/doc/rbn/ribbon_gallery.rb +13 -5
  48. data/lib/wx/doc/rbn/ribbon_tool_bar.rb +13 -5
  49. data/lib/wx/doc/region_iterator.rb +32 -28
  50. data/lib/wx/doc/rtc/rich_text_composite_object.rb +24 -0
  51. data/lib/wx/doc/rtc/rich_text_ctrl.rb +24 -0
  52. data/lib/wx/doc/rtc/rich_text_paragraph.rb +24 -0
  53. data/lib/wx/doc/rtc/richtext_buffer.rb +27 -19
  54. data/lib/wx/doc/rtc/richtext_printing.rb +17 -9
  55. data/lib/wx/doc/rtc/richtext_style_sheet.rb +17 -9
  56. data/lib/wx/doc/sizer.rb +20 -0
  57. data/lib/wx/doc/stc/styled_text_ctrl.rb +24 -0
  58. data/lib/wx/doc/stream.rb +39 -35
  59. data/lib/wx/doc/system_settings.rb +30 -26
  60. data/lib/wx/doc/text_validator.rb +12 -8
  61. data/lib/wx/doc/textctrl.rb +16 -0
  62. data/lib/wx/doc/tree_ctrl.rb +95 -0
  63. data/lib/wx/doc/treebook.rb +9 -5
  64. data/lib/wx/doc/v_list_box.rb +9 -5
  65. data/lib/wx/doc/variant.rb +164 -160
  66. data/lib/wx/doc/window.rb +57 -47
  67. data/lib/wx/doc/window_disabler.rb +10 -6
  68. data/lib/wx/grid/grid.rb +27 -4
  69. data/lib/wx/pg/pg_property.rb +22 -0
  70. data/lib/wx/rtc/require.rb +3 -0
  71. data/lib/wx/rtc/rich_text_composite_object.rb +25 -0
  72. data/lib/wx/rtc/rich_text_ctrl.rb +25 -0
  73. data/lib/wx/rtc/rich_text_paragraph.rb +25 -0
  74. data/lib/wx/stc/require.rb +1 -0
  75. data/lib/wx/stc/styled_text_ctrl.rb +25 -0
  76. data/lib/wx/version.rb +1 -1
  77. data/rakelib/lib/config/linux.rb +0 -3
  78. data/rakelib/lib/config/macosx.rb +2 -2
  79. data/rakelib/lib/config/mingw.rb +1 -1
  80. data/rakelib/lib/config/unixish.rb +1 -1
  81. data/rakelib/lib/config.rb +14 -4
  82. data/rakelib/lib/core/package.rb +14 -7
  83. data/rakelib/lib/core/spec.rb +6 -1
  84. data/rakelib/lib/director/accelerator.rb +2 -3
  85. data/rakelib/lib/director/accessible.rb +47 -0
  86. data/rakelib/lib/director/app.rb +12 -319
  87. data/rakelib/lib/director/app_traits.rb +10 -12
  88. data/rakelib/lib/director/ctrl_with_items.rb +17 -5
  89. data/rakelib/lib/director/data_format.rb +1 -1
  90. data/rakelib/lib/director/derived_dc.rb +1 -1
  91. data/rakelib/lib/director/dialog.rb +1 -0
  92. data/rakelib/lib/director/drag_image.rb +2 -3
  93. data/rakelib/lib/director/event.rb +2 -2
  94. data/rakelib/lib/director/frame.rb +1 -3
  95. data/rakelib/lib/director/gdicommon.rb +8 -10
  96. data/rakelib/lib/director/graphics_context.rb +2 -4
  97. data/rakelib/lib/director/grid_ctrl.rb +34 -3
  98. data/rakelib/lib/director/icon.rb +5 -2
  99. data/rakelib/lib/director/list_ctrl.rb +5 -6
  100. data/rakelib/lib/director/locale.rb +1 -3
  101. data/rakelib/lib/director/log.rb +1 -4
  102. data/rakelib/lib/director/media_ctrl.rb +54 -0
  103. data/rakelib/lib/director/menu.rb +16 -1
  104. data/rakelib/lib/director/menu_item.rb +2 -2
  105. data/rakelib/lib/director/pgproperties.rb +1 -1
  106. data/rakelib/lib/director/pgproperty.rb +24 -1
  107. data/rakelib/lib/director/property_grid_interface.rb +5 -10
  108. data/rakelib/lib/director/richtext_composite_object.rb +25 -0
  109. data/rakelib/lib/director/richtext_ctrl.rb +14 -4
  110. data/rakelib/lib/director/richtext_formatting_dialog.rb +7 -5
  111. data/rakelib/lib/director/richtext_paragraph_layout_box.rb +9 -7
  112. data/rakelib/lib/director/sizer.rb +15 -0
  113. data/rakelib/lib/director/static_box.rb +4 -5
  114. data/rakelib/lib/director/styled_text_ctrl.rb +12 -0
  115. data/rakelib/lib/director/task_bar_button.rb +30 -0
  116. data/rakelib/lib/director/task_bar_icon.rb +5 -13
  117. data/rakelib/lib/director/textctrl.rb +12 -1
  118. data/rakelib/lib/director/tool_tip.rb +1 -1
  119. data/rakelib/lib/director/top_level_window.rb +4 -5
  120. data/rakelib/lib/director/tree_ctrl.rb +5 -6
  121. data/rakelib/lib/director/variant.rb +1 -1
  122. data/rakelib/lib/director/window.rb +24 -5
  123. data/rakelib/lib/director.rb +4 -4
  124. data/rakelib/lib/extractor/function.rb +6 -6
  125. data/rakelib/lib/extractor.rb +34 -5
  126. data/rakelib/lib/generate/analyzer.rb +8 -3
  127. data/rakelib/lib/generate/doc/busy_info.yaml +0 -2
  128. data/rakelib/lib/generate/doc/clipboard.yaml +0 -2
  129. data/rakelib/lib/generate/doc/cursor.yaml +0 -2
  130. data/rakelib/lib/generate/doc/panel.yaml +7 -0
  131. data/rakelib/lib/generate/doc.rb +76 -14
  132. data/rakelib/lib/specs/interfaces.rb +161 -160
  133. data/rakelib/lib/typemap/common.rb +30 -1
  134. data/rakelib/yard/templates/default/fulldoc/html/css/wxruby3.css +74 -2
  135. data/rakelib/yard/templates/default/fulldoc/html/full_list.erb +38 -0
  136. data/rakelib/yard/templates/default/fulldoc/html/setup.rb +39 -0
  137. data/rakelib/yard/templates/default/tags/html/wxrb_require.erb +10 -0
  138. data/rakelib/yard/templates/default/tags/setup.rb +16 -0
  139. data/rakelib/yard/yard-custom-templates.rb +3 -0
  140. data/samples/treectrl/treectrl.rb +1 -1
  141. data/tests/media/beep_lo.wav +0 -0
  142. data/tests/test_list_ctrl.rb +1 -1
  143. data/tests/test_media_ctrl.rb +38 -0
  144. data/tests/test_menu.rb +69 -0
  145. data/tests/test_pg.rb +27 -0
  146. data/tests/test_richtext.rb +45 -0
  147. data/tests/test_sizer.rb +16 -0
  148. data/tests/test_std_controls.rb +42 -1
  149. data/tests/test_styled_text_ctrl.rb +46 -0
  150. data/tests/test_tree_ctrl.rb +138 -0
  151. data/tests/test_window.rb +12 -0
  152. data/tests/testapp_noframe.rb +1 -1
  153. metadata +31 -3
@@ -38,8 +38,8 @@ module WXRuby3
38
38
  wxAppTraits::IsUsingUniversalWidgets
39
39
  wxAppTraits::ShowAssertDialog
40
40
  wxAppTraits::SafeMessageBox
41
- wxAppTraits::GetAssertStackTrace
42
41
  ], ignore_doc: false
42
+ spec.ignore('wxAppTraits::GetAssertStackTrace', ignore_doc: 'USE_STACKWALKER')
43
43
  # redefine
44
44
  spec.extend_interface 'wxAppTraits',
45
45
  'wxString GetDesktopEnvironment() const',
@@ -48,21 +48,19 @@ module WXRuby3
48
48
  'bool IsUsingUniversalWidgets() const',
49
49
  'bool ShowAssertDialog(const wxString& msg)',
50
50
  'bool SafeMessageBox(const wxString &text, const wxString &title)'
51
- if Config.instance.features_set?('wxUSE_STACKWALKER')
51
+ if Config.instance.features_set?('USE_STACKWALKER')
52
52
  spec.extend_interface 'wxAppTraits', 'wxString GetAssertStackTrace()'
53
53
  end
54
54
  spec.map_apply 'int * OUTPUT' => ['int *major', 'int *minor', 'int *micro']
55
55
 
56
- unless Config.platform == :mingw
57
- spec.ignore 'wxStandardPaths::DontIgnoreAppSubDir',
58
- 'wxStandardPaths::IgnoreAppSubDir',
59
- 'wxStandardPaths::IgnoreAppBuildSubDirs',
60
- 'wxStandardPaths::MSWGetShellDir'
61
- end
62
- unless Config.platform == :linux
63
- spec.ignore 'wxStandardPaths::SetInstallPrefix',
64
- 'wxStandardPaths::GetInstallPrefix'
65
- end
56
+ spec.ignore_unless('WXMSW',
57
+ 'wxStandardPaths::DontIgnoreAppSubDir',
58
+ 'wxStandardPaths::IgnoreAppSubDir',
59
+ 'wxStandardPaths::IgnoreAppBuildSubDirs',
60
+ 'wxStandardPaths::MSWGetShellDir')
61
+ spec.ignore_unless('WXGTK',
62
+ 'wxStandardPaths::SetInstallPrefix',
63
+ 'wxStandardPaths::GetInstallPrefix')
66
64
  end
67
65
  end
68
66
 
@@ -51,9 +51,11 @@ module WXRuby3
51
51
  'wxItemContainer::Append(const wxArrayString &, void **)',
52
52
  'wxItemContainer::Insert(const wxArrayString &, unsigned int, void **)',
53
53
  'wxItemContainer::Set(const wxArrayString &, void **)'], ignore_doc: false)
54
- # add undocumented method
55
- spec.extend_interface 'wxControlWithItems',
56
- 'bool IsSorted() const'
54
+ if Config.instance.wx_version < '3.3.0'
55
+ # add undocumented method
56
+ spec.extend_interface 'wxControlWithItems',
57
+ 'bool IsSorted() const'
58
+ end
57
59
  # for doc only
58
60
  spec.map 'void** clientData' => 'Array', swig: false do
59
61
  map_in code: ''
@@ -62,13 +64,23 @@ module WXRuby3
62
64
  # Replace the old Wx definition of this method (which segfaults)
63
65
  # Only need the setter as we cache data in Ruby and the getter
64
66
  # therefor can be pure Ruby
65
- spec.add_extend_code('wxControlWithItems', <<~__HEREDOC
67
+ spec.add_extend_code 'wxControlWithItems', <<~__HEREDOC
66
68
  VALUE set_client_data(int n, VALUE item_data) {
67
69
  self->SetClientData(n, (void *)item_data);
68
70
  return item_data;
69
71
  }
72
+
73
+ VALUE each_string()
74
+ {
75
+ VALUE rc = Qnil;
76
+ for (unsigned int i=0; i<$self->GetCount() ;++i)
77
+ {
78
+ VALUE rb_s = WXSTR_TO_RSTR($self->GetString(i));
79
+ rc = rb_yield(rb_s);
80
+ }
81
+ return rc;
82
+ }
70
83
  __HEREDOC
71
- )
72
84
  end
73
85
  end
74
86
 
@@ -20,7 +20,7 @@ module WXRuby3
20
20
  # The formal signature for these is NativeFormat; this is required on
21
21
  # MSVC as otherwise an impermissible implicit cast is tried, and so
22
22
  # doesn't compile
23
- spec.ignore 'wxDataFormat::GetType'
23
+ spec.ignore 'wxDataFormat::GetType', ignore_doc: false
24
24
  spec.extend_interface 'wxDataFormat',
25
25
  'typedef unsigned short NativeFormat',
26
26
  'wxDataFormat::NativeFormat GetType() const'
@@ -278,7 +278,7 @@ module WXRuby3
278
278
  # like all DC this should best always be a temporary stack object
279
279
  # we do not allow creation in Ruby but rather provide class
280
280
  # methods for block execution on a temp dc
281
- unless Config.platform == :linux
281
+ if Config.instance.features_set?('USE_PRINTING_ARCHITECTURE', Director.AnyOf(*%w[WXMSW WXOSX USE_GTKPRINT]))
282
282
  spec.add_extend_code 'wxGCDC', <<~__HEREDOC
283
283
  static VALUE draw_on(const wxPrinterDC& dc)
284
284
  {
@@ -24,6 +24,7 @@ module WXRuby3
24
24
  when 'wxDialog'
25
25
  spec.items << 'wxDialogLayoutAdapter'
26
26
  spec.gc_as_object 'wxDialogLayoutAdapter'
27
+ spec.suppress_warning(514, 'wxDialogLayoutAdapter')
27
28
  spec.disown 'wxDialogLayoutAdapter* adapter'
28
29
  spec.new_object 'wxDialog::SetLayoutAdapter'
29
30
  spec.ignore('wxDialog::GetContentWindow',
@@ -15,9 +15,8 @@ module WXRuby3
15
15
  include Typemap::TreeItemId
16
16
 
17
17
  def setup
18
- unless Config.instance.features_set?('__WXUNIVERSAL__')
19
- spec.ignore('wxDragImage::DoDrawImage', 'wxDragImage::GetImageRect', 'wxDragImage::UpdateBackingFromWindow')
20
- end
18
+ # If wxRuby ever supports WXUNIVERSAL this should change to #ignore_unless
19
+ spec.ignore('wxDragImage::DoDrawImage', 'wxDragImage::GetImageRect', 'wxDragImage::UpdateBackingFromWindow')
21
20
  super
22
21
  end
23
22
  end # class DragImage
@@ -195,8 +195,8 @@ module WXRuby3
195
195
  }
196
196
  __HEREDOC
197
197
  spec.ignore 'wxQueueEvent'
198
- spec.ignore('wxEVT_HOTKEY') unless Config.instance.features_set?('wxUSE_HOTKEY')
199
- spec.ignore('wxEVT_MOUSE_CAPTURE_CHANGED', 'wxEVT_MOUSE_CAPTURE_LOST', 'wxEVT_DISPLAY_CHANGED') unless Config.instance.features_set?('__WXMSW__')
198
+ spec.ignore_unless('USE_HOTKEY', 'wxEVT_HOTKEY')
199
+ spec.ignore_unless('WXMSW', 'wxEVT_MOUSE_CAPTURE_CHANGED', 'wxEVT_MOUSE_CAPTURE_LOST', 'wxEVT_DISPLAY_CHANGED')
200
200
  # make sure this event constant definition exists
201
201
  spec.add_swig_code %Q{%constant wxEventType wxEVT_MENU_HIGHLIGHT_ALL = wxEVT_MENU_HIGHLIGHT;}
202
202
  # add event type constant missing from interface defs
@@ -21,9 +21,7 @@ module WXRuby3
21
21
  when 'wxFrame'
22
22
  spec.ignore %w[
23
23
  wxFrame::OnCreateStatusBar wxFrame::OnCreateToolBar]
24
- unless Config.instance.features_set?(*%w[__WXMSW__ wxUSE_TASKBARBUTTON])
25
- spec.ignore('wxFrame::MSWGetTaskBarButton')
26
- end
24
+ spec.ignore_unless(%w[WXMSW USE_TASKBARBUTTON], 'wxFrame::MSWGetTaskBarButton')
27
25
  # this reimplemented window base method need to be properly wrapped but
28
26
  # is missing from the XML docs
29
27
  spec.extend_interface('wxFrame', 'virtual void OnInternalIdle()')
@@ -78,16 +78,14 @@ module WXRuby3
78
78
  wxPoint::x wxPoint::y
79
79
  wxRealPoint::x wxRealPoint::y
80
80
  ]
81
- spec.ignore('wxStockCursor.wxCURSOR_DEFAULT') unless Config.instance.features_set?('__WXGTK__')
82
- unless Config.instance.features_set?('__X__')
83
- spec.ignore %w{
84
- wxStockCursor.wxCURSOR_CROSS_REVERSE
85
- wxStockCursor.wxCURSOR_DOUBLE_ARROW
86
- wxStockCursor.wxCURSOR_BASED_ARROW_UP
87
- wxStockCursor.wxCURSOR_BASED_ARROW_DOWN
88
- }
89
- end
90
- spec.ignore('wxStockCursor.wxCURSOR_COPY_ARROW') unless Config.instance.features_set?('__WXOSX__')
81
+ spec.ignore_unless('WXGTK', 'wxStockCursor.wxCURSOR_DEFAULT')
82
+ spec.ignore_unless 'WXX11', %w{
83
+ wxStockCursor.wxCURSOR_CROSS_REVERSE
84
+ wxStockCursor.wxCURSOR_DOUBLE_ARROW
85
+ wxStockCursor.wxCURSOR_BASED_ARROW_UP
86
+ wxStockCursor.wxCURSOR_BASED_ARROW_DOWN
87
+ }
88
+ spec.ignore_unless('WXOSX', 'wxStockCursor.wxCURSOR_COPY_ARROW')
91
89
  spec.add_extend_code 'wxRect', <<~__HEREDOC
92
90
  wxRect add(const wxRect &rect) const {
93
91
  return (*(const wxRect*)$self) + rect;
@@ -34,9 +34,7 @@ module WXRuby3
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
- if Config.platform == :linux
38
- spec.ignore 'wxGraphicsContext::Create(const wxPrinterDC &)'
39
- end
37
+ spec.ignore_unless(Config::AnyOf.new('WXMSW', 'WXOSX', 'USE_GTKPRINT'), 'wxGraphicsContext::Create(const wxPrinterDC &)')
40
38
  spec.add_header_code <<~__HEREDOC
41
39
  // special free funcs are needed to clean up Dashes array if it has been
42
40
  // set; wxWidgets does not do this automatically so will leak if not
@@ -229,7 +227,7 @@ module WXRuby3
229
227
  __CODE
230
228
  end
231
229
  # add convenience method providing efficient gc memory management
232
- unless Config.platform == :linux
230
+ if Config.instance.features_set?('USE_PRINTING_ARCHITECTURE', Director.AnyOf(*%w[WXMSW WXOSX USE_GTKPRINT]))
233
231
  spec.add_extend_code 'wxGraphicsContext', <<~__HEREDOC
234
232
  static VALUE draw_on(const wxPrinterDC& dc)
235
233
  {
@@ -87,10 +87,13 @@ module WXRuby3
87
87
  __CODE
88
88
  end
89
89
 
90
- spec.ignore 'wxGrid::GetSelectedBlocks' # ignore
90
+ spec.ignore 'wxGrid::GetSelectedBlocks', ignore_doc: false # ignore
91
+ spec.map 'wxGridBlocks' => 'Array<Wx::GRID::GridBlockCoords>', swig: false do
92
+ map_out code: ''
93
+ end
91
94
  # add rubified API (finish in pure Ruby)
92
95
  spec.add_extend_code 'wxGrid', <<~__HEREDOC
93
- VALUE selected_blocks()
96
+ VALUE each_selected_block()
94
97
  {
95
98
  VALUE rc = Qnil;
96
99
  if (rb_block_given_p())
@@ -103,6 +106,34 @@ module WXRuby3
103
106
  }
104
107
  return rc;
105
108
  }
109
+
110
+ VALUE each_selected_row_block()
111
+ {
112
+ VALUE rc = Qnil;
113
+ if (rb_block_given_p())
114
+ {
115
+ wxGridBlockCoordsVector sel = $self->GetSelectedRowBlocks();
116
+ for (const wxGridBlockCoords& gbc : sel)
117
+ {
118
+ rc = rb_yield (SWIG_NewPointerObj(new wxGridBlockCoords(gbc), SWIGTYPE_p_wxGridBlockCoords, SWIG_POINTER_OWN));
119
+ }
120
+ }
121
+ return rc;
122
+ }
123
+
124
+ VALUE each_selected_col_block()
125
+ {
126
+ VALUE rc = Qnil;
127
+ if (rb_block_given_p())
128
+ {
129
+ wxGridBlockCoordsVector sel = $self->GetSelectedColBlocks();
130
+ for (const wxGridBlockCoords& gbc : sel)
131
+ {
132
+ rc = rb_yield (SWIG_NewPointerObj(new wxGridBlockCoords(gbc), SWIGTYPE_p_wxGridBlockCoords, SWIG_POINTER_OWN));
133
+ }
134
+ }
135
+ return rc;
136
+ }
106
137
  __HEREDOC
107
138
 
108
139
  spec.ignore 'wxGrid::GetGridWindowOffset(const wxGridWindow *, int &, int &) const'
@@ -113,7 +144,7 @@ module WXRuby3
113
144
  typedef wxGrid::TabBehaviour TabBehaviour;
114
145
  __HEREDOC
115
146
 
116
- spec.map 'wxGridBlockCoordsVector' => 'Array<Wx::GRID::GridBlockCoords' do
147
+ spec.map 'wxGridBlockCoordsVector' => 'Array<Wx::GRID::GridBlockCoords>' do
117
148
  map_out code: <<~__CODE
118
149
  $result = rb_ary_new();
119
150
  for (const wxGridBlockCoords& gbc: $1)
@@ -25,9 +25,12 @@ module WXRuby3
25
25
  spec.ignore('wxIcon::wxIcon(const char *const *)', 'wxIcon::wxIcon(const char[],int,int)')
26
26
  # xml specs incorrectly list this method for MWS while it does not exist anymore
27
27
  spec.ignore('wxIcon::ConvertToDisabled')
28
- unless Config.platform == :mingw
28
+ if Config.platform == :mingw
29
+ spec.ignore 'wxIconBundle::wxIconBundle(const wxString &, WXHINSTANCE)',
30
+ 'wxIconBundle::AddIcon(const wxString&,WXHINSTANCE)',
31
+ 'wxIcon::CreateFromHICON'
32
+ else
29
33
  spec.override_inheritance_chain('wxIcon', %w[wxBitmap wxGDIObject wxObject])
30
- spec.ignore 'wxIconBundle::wxIconBundle(const wxString &, WXHINSTANCE)'
31
34
  end
32
35
  super
33
36
  end
@@ -55,12 +55,11 @@ module WXRuby3
55
55
  (void)self->EditLabel(item);
56
56
  }
57
57
  __HEREDOC
58
- unless Config.instance.features_set?('wxHAS_LISTCTRL_COLUMN_ORDER')
59
- spec.ignore %w[wxListCtrl::GetColumnIndexFromOrder
60
- wxListCtrl::GetColumnOrder
61
- wxListCtrl::GetColumnsOrder
62
- wxListCtrl::SetColumnsOrder]
63
- end
58
+ spec.ignore_unless 'HAS_LISTCTRL_COLUMN_ORDER',
59
+ %w[wxListCtrl::GetColumnIndexFromOrder
60
+ wxListCtrl::GetColumnOrder
61
+ wxListCtrl::GetColumnsOrder
62
+ wxListCtrl::SetColumnsOrder]
64
63
  # these are protected so ignored by default but we want them here
65
64
  spec.regard %w[
66
65
  wxListCtrl::OnGetItemAttr
@@ -28,9 +28,7 @@ module WXRuby3
28
28
  wxLanguageInfo::DescriptionNative
29
29
  wxLanguageInfo::LayoutDirection
30
30
  ]
31
- if Config.instance.features_set?('__WXMSW__')
32
- spec.regard('wxLanguageInfo::WinLang', 'wxLanguageInfo::WinSublang')
33
- end
31
+ spec.ignore_unless('WXMSW', 'wxLanguageInfo::WinLang', 'wxLanguageInfo::WinSublang')
34
32
  end
35
33
  end # class Locale
36
34
 
@@ -14,16 +14,13 @@ module WXRuby3
14
14
 
15
15
  def setup
16
16
  spec.gc_as_object %w[wxLog wxLogChain wxLogInterposer wxLogWindow]
17
- spec.items.concat(%w[wxLogBuffer wxLogChain wxLogGui wxLogStderr wxLogStream wxLogTextCtrl wxLogInterposer wxLogWindow wxLogNull wxLogRecordInfo])
17
+ spec.items.concat(%w[wxLogBuffer wxLogChain wxLogGui wxLogStderr wxLogTextCtrl wxLogInterposer wxLogWindow wxLogNull wxLogRecordInfo])
18
18
  spec.no_proxy(%w[wxLogBuffer wxLogGui wxLogStderr wxLogTextCtrl wxLogWindow])
19
19
  spec.force_proxy(%w[wxLogInterposer])
20
20
  spec.ignore 'wxLog::SetFormatter'
21
21
  spec.regard %w[wxLog::DoLogRecord wxLog::DoLogTextAtLevel wxLog::DoLogText]
22
22
  spec.ignore 'wxLogBuffer::Flush'
23
23
  spec.ignore 'wxLogGui::Flush'
24
- if Config.instance.features_set?('wxUSE_STD_IOSTREAM')
25
- spec.ignore 'wxLogStream'
26
- end
27
24
  # wxLogStderr
28
25
  spec.ignore 'wxLogStderr::wxLogStderr'
29
26
  spec.add_extend_code 'wxLogStderr', <<~__HEREDOC
@@ -16,6 +16,60 @@ module WXRuby3
16
16
 
17
17
  def setup
18
18
  super
19
+ spec.map 'const wxURI&' => 'URI' do
20
+ add_header <<~__CODE
21
+ static VALUE wxRuby_GetRubyURIClass()
22
+ {
23
+ static VALUE rb_cURI = Qnil;
24
+ if (NIL_P(rb_cURI))
25
+ {
26
+ rb_require("uri");
27
+ rb_cURI = rb_const_get(rb_cObject, rb_intern("URI"));
28
+ }
29
+ return rb_cURI;
30
+ }
31
+ static WxRuby_ID to_s_id("to_s");
32
+ __CODE
33
+ map_in temp: 'wxURI tmp', code: <<~__CODE
34
+ if (rb_obj_is_kind_of($input, wxRuby_GetRubyURIClass()))
35
+ {
36
+ VALUE s = rb_funcall($input, to_s_id(), 0);
37
+ tmp = wxURI(RSTR_TO_WXSTR(s));
38
+ $1 = &tmp;
39
+ }
40
+ else
41
+ {
42
+ rb_raise(rb_eArgError, "expected URI for %d", $argnum-1);
43
+ }
44
+ __CODE
45
+ map_typecheck precedence: 'POINTER', code: '$1 = rb_obj_is_kind_of($input, wxRuby_GetRubyURIClass());'
46
+ end
47
+ spec.map 'wxFileOffset' => 'Integer' do
48
+ # we need these inline methods here as we do not want SWIG to preprocess the code
49
+ # as it will do in the type mapping code sections
50
+ add_header_code <<~__CODE
51
+ inline wxFileOffset __ruby2wxFileOffset(VALUE num)
52
+ {
53
+ #ifdef wxHAS_HUGE_FILES
54
+ return static_cast<wxFileOffset> (NUM2LL(num));
55
+ #else
56
+ return static_cast<wxFileOffset> (NUM2LONG(num));
57
+ #endif
58
+ }
59
+ inline VALUE __wxFileOffset2ruby(wxFileOffset offs)
60
+ {
61
+ #ifdef wxHAS_HUGE_FILES
62
+ return LL2NUM(offs);
63
+ #else
64
+ return LONG2NUM(offs);
65
+ #endif
66
+ }
67
+ __CODE
68
+
69
+ map_in code: '$1 = __ruby2wxFileOffset($input);'
70
+ map_out code: '$result = __wxFileOffset2ruby($1);'
71
+ map_typecheck code: '$1 = TYPE($input) == T_FIXNUM;'
72
+ end
19
73
  spec.do_not_generate :variables, :enums, :defines, :functions
20
74
  end
21
75
  end # class MediaCtrl
@@ -85,6 +85,8 @@ module WXRuby3
85
85
  spec.add_swig_code <<~__HEREDOC
86
86
  %markfunc wxMenu "mark_wxMenu";
87
87
  __HEREDOC
88
+ # ignore MSW specific method
89
+ spec.ignore 'wxMenu::MSWCommand'
88
90
  # fix SWIG's problems with const& return value
89
91
  spec.ignore('wxMenu::GetTitle', ignore_doc: false) # keep doc
90
92
  spec.add_extend_code 'wxMenu', <<~__HEREDOC
@@ -92,7 +94,20 @@ module WXRuby3
92
94
  wxString const& title = $self->GetTitle();
93
95
  return &const_cast<wxString&> (title);
94
96
  }
95
- __HEREDOC
97
+
98
+ VALUE each_item()
99
+ {
100
+ VALUE rc = Qnil;
101
+ for (size_t i=0; i<$self->GetMenuItemCount(); ++i)
102
+ {
103
+ wxMenuItem *wx_menu_item = $self->FindItemByPosition(i);
104
+ VALUE rb_menu_item = SWIG_NewPointerObj(SWIG_as_voidptr(wx_menu_item),
105
+ SWIGTYPE_p_wxMenuItem, 0);
106
+ rc = rb_yield(rb_menu_item);
107
+ }
108
+ return rc;
109
+ }
110
+ __HEREDOC
96
111
  super
97
112
  end
98
113
  end # class Menu
@@ -21,11 +21,11 @@ module WXRuby3
21
21
  spec.ignore(%w[wxMenuItem::GetLabel wxMenuItem::GetName wxMenuItem::GetText wxMenuItem::SetText wxMenuItem::GetLabelFromText])
22
22
  # ignore this as there is no implementation anymore
23
23
  spec.ignore 'wxMenuItem::GetAccelFromString'
24
- spec.ignore('wxMenuItem::GetAccel') unless Config.instance.features_set?('wxUSE_ACCEL')
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
27
  if Config.instance.wx_version >= '3.3.0'
28
- spec.ignore('wxMenuItem::SetBackgroundColour','wxMenuItem::SetFont','wxMenuItem::SetTextColour') unless Config.instance.features_set?('__WXMSW__')
28
+ spec.ignore_unless('WXMSW', 'wxMenuItem::SetBackgroundColour','wxMenuItem::SetFont','wxMenuItem::SetTextColour')
29
29
  end
30
30
  super
31
31
  end
@@ -141,7 +141,7 @@ module WXRuby3
141
141
  spec.map_apply 'int * OUTPUT' => 'int* pIndex'
142
142
  end
143
143
  # for UIntProperty and IntProperty
144
- if Config.instance.features_set?('wxUSE_LONGLONG')
144
+ if Config.instance.features_set?('USE_LONGLONG')
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
@@ -54,7 +54,30 @@ module WXRuby3
54
54
  {
55
55
  return (*self)[idx];
56
56
  }
57
- __HEREDOC
57
+
58
+ VALUE each_label()
59
+ {
60
+ VALUE rc = Qnil;
61
+ for (unsigned int i=0; i<$self->GetCount() ;++i)
62
+ {
63
+ VALUE rb_lbl = WXSTR_TO_RSTR($self->GetLabel(i));
64
+ rc = rb_yield(rb_lbl);
65
+ }
66
+ return rc;
67
+ }
68
+
69
+ VALUE each_entry()
70
+ {
71
+ VALUE rc = Qnil;
72
+ for (unsigned int i=0; i<$self->GetCount() ;++i)
73
+ {
74
+ wxPGChoiceEntry *entry = &($self->Item(i));
75
+ VALUE rb_entry = SWIG_NewPointerObj(SWIG_as_voidptr(entry), SWIGTYPE_p_wxPGChoiceEntry, 0);
76
+ rc = rb_yield(rb_entry);
77
+ }
78
+ return rc;
79
+ }
80
+ __HEREDOC
58
81
  # for GetIndicesForStrings
59
82
  spec.map 'wxArrayString *unmatched' => 'Array,nil' do
60
83
 
@@ -39,16 +39,11 @@ module WXRuby3
39
39
  spec.extend_interface 'wxPropertyGridInterface',
40
40
  'void SetPropertyValues(const wxVariant &list, const wxPGPropArgCls& defaultCategory = 0)'
41
41
  # optionals
42
- unless Config.instance.features_set?('wxUSE_LONGLONG')
43
- spec.ignore 'wxPropertyGridInterface::GetPropertyValueAsLongLong',
44
- 'wxPropertyGridInterface::GetPropertyValueAsULongLong'
45
- end
46
- unless Config.instance.features_set?('wxUSE_DATETIME')
47
- spec.ignore 'wxPropertyGridInterface::GetPropertyValueAsDateTime'
48
- end
49
- unless Config.instance.features_set?('wxUSE_VALIDATORS')
50
- spec.ignore 'wxPropertyGridInterface::GetPropertyValidator'
51
- end
42
+ spec.ignore_unless 'USE_LONGLONG',
43
+ 'wxPropertyGridInterface::GetPropertyValueAsLongLong',
44
+ 'wxPropertyGridInterface::GetPropertyValueAsULongLong'
45
+ spec.ignore_unless 'USE_DATETIME', 'wxPropertyGridInterface::GetPropertyValueAsDateTime'
46
+ spec.ignore_unless 'USE_VALIDATORS', 'wxPropertyGridInterface::GetPropertyValidator'
52
47
  # fix incorrect XML documentation
53
48
  spec.ignore 'wxPropertyGridInterface::SetPropertyImage', ignore_doc: false # ignore non-const BitmapBundle arg decl
54
49
  # and add correct decl
@@ -45,6 +45,17 @@ module WXRuby3
45
45
  }
46
46
  return rc;
47
47
  }
48
+
49
+ VALUE each_child()
50
+ {
51
+ VALUE rc = Qnil;
52
+ for (size_t i=0; i<$self->GetChildCount() ;++i)
53
+ {
54
+ wxRichTextObject *rto = $self->GetChild(i);
55
+ rc = rb_yield(wxRuby_RichTextObject2Ruby(rto, 0));
56
+ }
57
+ return rc;
58
+ }
48
59
  __HEREDOC
49
60
 
50
61
  spec.new_object 'wxRichTextLine::Clone'
@@ -161,6 +172,20 @@ module WXRuby3
161
172
  }
162
173
  $self->MoveFromList(wx_lst);
163
174
  }
175
+
176
+ VALUE each_line()
177
+ {
178
+ VALUE rc = Qnil;
179
+ const wxRichTextLineVector &lines = $self->GetLines();
180
+ int lnr = 0;
181
+ for (const wxRichTextLine* line : lines)
182
+ {
183
+ VALUE rb_ln = SWIG_NewPointerObj(SWIG_as_voidptr(const_cast<wxRichTextLine*> (line)), SWIGTYPE_p_wxRichTextLine, 0);
184
+ rc = rb_yield(rb_ln);
185
+ ++lnr;
186
+ }
187
+ return rc;
188
+ }
164
189
  __CODE
165
190
 
166
191
  spec.do_not_generate(:typedefs, :variables, :enums, :defines, :functions)
@@ -15,7 +15,7 @@ module WXRuby3
15
15
  class RichTextCtrl < Window
16
16
 
17
17
  include Typemap::RichText
18
- if Config.instance.features_set?('wxUSE_DATETIME')
18
+ if Config.instance.features_set?('USE_DATETIME')
19
19
  include Typemap::DateTime
20
20
  end
21
21
 
@@ -117,9 +117,7 @@ module WXRuby3
117
117
  wxRichTextCtrl::ProcessMouseMovement
118
118
  wxRichTextCtrl::ProcessBackKey
119
119
  ]
120
- unless Config.instance.features_set?('wxUSE_DATETIME')
121
- spec.ignore %w[wxRichTextCtrl::GetDragStartTime wxRichTextCtrl::SetDragStartTime]
122
- end
120
+ spec.ignore_unless 'USE_DATETIME', %w[wxRichTextCtrl::GetDragStartTime wxRichTextCtrl::SetDragStartTime]
123
121
  spec.add_header_code 'extern VALUE wxRuby_RichTextObject2Ruby(const wxRichTextObject *wx_rto, int own);'
124
122
  spec.swig_import('swig/classes/include/wxTextAttr.h',
125
123
  'swig/classes/include/wxRichTextObject.h',
@@ -208,6 +206,18 @@ module WXRuby3
208
206
  __CODE
209
207
 
210
208
  end
209
+ spec.add_extend_code 'wxRichTextCtrl', <<~__HEREDOC
210
+ VALUE each_line()
211
+ {
212
+ VALUE rc = Qnil;
213
+ for (int i=0; i<$self->GetNumberOfLines() ;++i)
214
+ {
215
+ VALUE rb_ln = WXSTR_TO_RSTR($self->GetLineText(i));
216
+ rc = rb_yield(rb_ln);
217
+ }
218
+ return rc;
219
+ }
220
+ __HEREDOC
211
221
  end
212
222
  end # class RichTextCtrl
213
223
 
@@ -27,11 +27,13 @@ module WXRuby3
27
27
  wxRichTextFormattingDialog::SetStyle
28
28
  wxRichTextFormattingDialog::SetStyleDefinition
29
29
  ]
30
- # add undocumented methods
31
- spec.extend_interface 'wxRichTextFormattingDialog',
32
- 'wxRichTextObject* GetObject() const',
33
- 'void SetObject(wxRichTextObject* obj)',
34
- 'virtual bool ApplyStyle(wxRichTextCtrl* ctrl, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO)'
30
+ if Config.instance.wx_version < '3.3.0'
31
+ # add undocumented methods
32
+ spec.extend_interface 'wxRichTextFormattingDialog',
33
+ 'wxRichTextObject* GetObject() const',
34
+ 'void SetObject(wxRichTextObject* obj)',
35
+ 'virtual bool ApplyStyle(wxRichTextCtrl* ctrl, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO)'
36
+ end
35
37
  spec.add_header_code 'extern VALUE wxRuby_RichTextObject2Ruby(const wxRichTextObject *wx_rto, int own);'
36
38
  spec.disown 'wxRichTextFormattingDialogFactory *factory'
37
39
  spec.suppress_warning(473, 'wxRichTextFormattingDialogFactory::CreatePage')
@@ -83,13 +83,15 @@ module WXRuby3
83
83
  return rb_rtsd;
84
84
  }
85
85
  __HEREDOC
86
- # add undocumented convenience method
87
- spec.extend_interface 'wxRichTextListStyleDefinition',
88
- 'void SetAttributes(int i, int leftIndent, int leftSubIndent, int bulletStyle, const wxString& bulletSymbol = wxEmptyString)'
89
- # undocumented methods
90
- spec.extend_interface 'wxRichTextStyleSheet',
91
- 'wxRichTextStyleSheet(const wxRichTextStyleSheet& sheet)',
92
- 'void Copy(const wxRichTextStyleSheet& sheet)'
86
+ if Config.instance.wx_version < '3.3.0'
87
+ # add undocumented convenience method
88
+ spec.extend_interface 'wxRichTextListStyleDefinition',
89
+ 'void SetAttributes(int i, int leftIndent, int leftSubIndent, int bulletStyle, const wxString& bulletSymbol = wxEmptyString)'
90
+ # undocumented methods
91
+ spec.extend_interface 'wxRichTextStyleSheet',
92
+ 'wxRichTextStyleSheet(const wxRichTextStyleSheet& sheet)',
93
+ 'void Copy(const wxRichTextStyleSheet& sheet)'
94
+ end
93
95
  # redefine these since we need to be able to selectively specify 'disown'
94
96
  spec.ignore 'wxRichTextStyleSheet::AddCharacterStyle',
95
97
  'wxRichTextStyleSheet::AddListStyle',
@@ -82,6 +82,21 @@ module WXRuby3
82
82
  }
83
83
  return false;
84
84
  }
85
+
86
+ VALUE each_child()
87
+ {
88
+ const wxSizerItemList& child_list = self->GetChildren();
89
+ VALUE rc = Qnil;
90
+ wxSizerItemList::compatibility_iterator node = child_list.GetFirst();
91
+ while (node)
92
+ {
93
+ wxSizerItem *wx_si = node->GetData();
94
+ VALUE rb_si = SWIG_NewPointerObj(wx_si, SWIGTYPE_p_wxSizerItem, 0);
95
+ rc = rb_yield(rb_si);
96
+ node = node->GetNext();
97
+ }
98
+ return rc;
99
+ }
85
100
  __HEREDOC
86
101
  # Typemap for GetChildren - convert to array of Sizer items
87
102
  spec.map 'wxSizerItemList&' => 'Array<Wx::SizerItem>' do