wxruby3 1.5.0 → 1.5.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ba2a7c48f9f24e515c6891a059c0b1801f91bd11fe0dcc4d2d82c76fb810da0b
4
- data.tar.gz: 9bb9ada532a116f6826dc394a0f418f278115c65b7c80702f15c80274bc44628
3
+ metadata.gz: d4076c5fcd81a2bd38c5e53367b337a7a0f2590f047bcf12def1bd3d3df9d301
4
+ data.tar.gz: ade42868f8a79fcc293af4b9070eab971f80a0871a1a0fe7384d55a144a77332
5
5
  SHA512:
6
- metadata.gz: ed03bde1136e78acd711d2b1ffc696306840ca3f5032d8cd90b64f4eba005772c8de0a475035c0441537302f33a28b981f391f992715ef72207ed451b3e4bf74
7
- data.tar.gz: a4e78a5adafd2cc15e05b113a2146de556bf86312d3cc2f7709b13103ecc7248c150127ff710547e63deb8055e4cf220df7ec963265a3e5b07582bbf6b5802be
6
+ metadata.gz: 6e9d0f837e87dc24ddbcc17a4eff510ba6af44bc3f108c76301b0fb36d86a496dab422127c7fc0b917470f5b282709696448a6d0f8a1256d18c9a2a46c972a63
7
+ data.tar.gz: 9065c12716485ebcefdd5a01bbb3ef7f4a3bf56c3b8aba3e12b6b4c189766e8a1279591a55553fc9e898838488f78993f95d31cd12a0c3b5e9525398d7fd4c8c
data/lib/wx/version.rb CHANGED
@@ -3,5 +3,5 @@
3
3
  # This software is released under the MIT license.
4
4
 
5
5
  module Wx
6
- WXRUBY_VERSION = '1.5.0'
6
+ WXRUBY_VERSION = '1.5.2'
7
7
  end
@@ -109,7 +109,15 @@ module WXRuby3
109
109
  doxygen = get_cfg_string("doxygen")
110
110
  doxygen = nix_path(doxygen) unless doxygen == 'doxygen'
111
111
  chdir(File.join(ext_path, 'wxWidgets', 'docs', 'doxygen')) do
112
- unless bash({ 'DOXYGEN' => doxygen, 'WX_SKIP_DOXYGEN_VERSION_CHECK' => '1' }, './regen.sh', 'xml')
112
+ exec_env = { 'DOXYGEN' => doxygen, 'WX_SKIP_DOXYGEN_VERSION_CHECK' => '1' }
113
+ # check if we're using an MSYS version or a native Windows version
114
+ if WXRuby3.config.sysinfo.os.pkgman && WXRuby3.config.sysinfo.os.pkgman.installed?('doxygen')
115
+ # The latest MSYS version doxygen generated *nix paths instead of Windows paths in the XML files
116
+ # to be sure the paths are shortened to relative paths we need to set WXWIDGETS to the *nix
117
+ # root path for wxWidgets as well and not the Windows root path as the regen.sh script still does.
118
+ exec_env['WXWIDGETS'] = nix_path(File.join(ext_path, 'wxWidgets'))
119
+ end
120
+ unless bash(exec_env, './regen.sh', 'xml')
113
121
  $stderr.puts 'ERROR: Failed to generate wxWidgets XML API specifications for parsing by wxRuby3.'
114
122
  exit(1)
115
123
  end
@@ -21,7 +21,7 @@ module WXRuby3
21
21
  end
22
22
 
23
23
  def add(distro, *deps, release: nil)
24
- @dependencies[distro] ||= ::Hash.new
24
+ @dependencies[distro] = ::Hash.new(@dependencies.default.default) unless @dependencies.has_key?(distro)
25
25
  if release
26
26
  @dependencies[distro][release] = deps.flatten
27
27
  else
@@ -45,7 +45,7 @@ module WXRuby3
45
45
  PLATFORM_DEPS = {
46
46
  debian: PlatformDependencies.new(%w[libgtk-3-dev libwebkit2gtk-4.0-dev libgspell-1-dev libunwind-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libcurl4-openssl-dev libsecret-1-dev libnotify-dev])
47
47
  .add('ubuntu', %w[libgtk-3-dev libwebkit2gtk-4.1-dev libgspell-1-dev libunwind-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libcurl4-openssl-dev libsecret-1-dev libnotify-dev], release: '24.04')
48
- .alias('ubuntu', '24.04', 'linuxmint', '22'),
48
+ .alias('ubuntu', '24.04', 'linuxmint', '22').alias('ubuntu', '24.04', 'linuxmint', '22.1'),
49
49
  rhel: PlatformDependencies.new(%w[expat-devel findutils gspell-devel gstreamer1-plugins-base-devel gtk3-devel libcurl-devel libjpeg-devel libnotify-devel libpng-devel libSM-devel libsecret-devel libtiff-devel SDL-devel webkit2gtk4.1-devel zlib-devel]),
50
50
  suse: PlatformDependencies.new(%w[gtk3-devel webkit2gtk3-devel gspell-devel gstreamer-devel gstreamer-plugins-base-devel libcurl-devel libsecret-devel libnotify-devel libSDL-devel zlib-devel libjpeg-devel libpng-devel]),
51
51
  arch: PlatformDependencies.new(%w[pkg-config gtk3 webkit2gtk gspell libunwind gstreamer curl libsecret libnotify libpng12])
@@ -655,8 +655,8 @@ module WXRuby3
655
655
  unless evts_handled.include?(evh_name)
656
656
  evt_klass ||= item.name if item.event
657
657
  # skip if we do not have an actually existing event class (for this platform)
658
- if Package.full_docs? || (item.event && item.name == evt_klass) ||
659
- (evt_klass && included_directors.any? { |dir| dir.defmod.find_item(evt_klass) })
658
+ if (item.event && item.name == evt_klass) ||
659
+ (evt_klass && (Package.full_docs? || included_directors.any? { |dir| dir.defmod.find_item(evt_klass) }))
660
660
 
661
661
  evh_args, evh_docstr = evt_nodoc ? nil : find_event_doc(evh_name)
662
662
  fdoc.doc.puts evh_docstr if evh_docstr
@@ -18,8 +18,13 @@ module WXRuby3
18
18
  super
19
19
  spec.gc_as_object 'wxAuiManager'
20
20
  if Config.instance.wx_version >= '3.3.0'
21
- spec.items << 'wxAuiSerializer' << 'wxAuiDockLayoutInfo' << 'wxAuiPaneLayoutInfo' << 'wxAuiTabLayoutInfo' << 'wxAuiDeserializer'
22
- spec.gc_as_untracked 'wxAuiSerializer', 'wxAuiDeserializer', 'wxAuiDockLayoutInfo', 'wxAuiPaneLayoutInfo', 'wxAuiTabLayoutInfo'
21
+ spec.items << 'wxAuiBookSerializer' << 'wxAuiSerializer' <<
22
+ 'wxAuiDockLayoutInfo' << 'wxAuiPaneLayoutInfo' << 'wxAuiTabLayoutInfo' <<
23
+ 'wxAuiBookDeserializer' << 'wxAuiDeserializer'
24
+ spec.gc_as_untracked 'wxAuiBookSerializer', 'wxAuiSerializer', 'wxAuiBookDeserializer', 'wxAuiDeserializer',
25
+ 'wxAuiDockLayoutInfo', 'wxAuiPaneLayoutInfo', 'wxAuiTabLayoutInfo'
26
+ spec.make_abstract 'wxAuiBookSerializer'
27
+ spec.make_abstract 'wxAuiBookDeserializer'
23
28
  spec.regard 'wxAuiDockLayoutInfo::dock_direction',
24
29
  'wxAuiDockLayoutInfo::dock_layer',
25
30
  'wxAuiDockLayoutInfo::dock_row',
@@ -57,17 +62,17 @@ module WXRuby3
57
62
  rb_raise(rb_eTypeError, "Expected Array of Integer for 1");
58
63
  }
59
64
  }
60
- __HEREDOC
65
+ __HEREDOC
61
66
  spec.map 'std::vector<wxAuiPaneLayoutInfo>' => 'Array<Wx::AuiPaneLayoutInfo>' do
62
67
  map_out code: <<~__CODE
63
68
  $result = rb_ary_new();
64
- std::vector<wxAuiPaneLayoutInfo>& panes = (std::vector<wxAuiPaneLayoutInfo>&)$1;
65
- for (const wxAuiPaneLayoutInfo& pane : panes)
69
+ std::vector<wxAuiPaneLayoutInfo>* panes = (std::vector<wxAuiPaneLayoutInfo>*)&$1;
70
+ for (const wxAuiPaneLayoutInfo& pane : *panes)
66
71
  {
67
72
  VALUE r_pane = SWIG_NewPointerObj(new wxAuiPaneLayoutInfo(pane), SWIGTYPE_p_wxAuiPaneLayoutInfo, SWIG_POINTER_OWN);
68
73
  rb_ary_push($result, r_pane);
69
74
  }
70
- __CODE
75
+ __CODE
71
76
  map_directorout code: <<~__CODE
72
77
  if (TYPE($input) == T_ARRAY)
73
78
  {
@@ -83,18 +88,18 @@ module WXRuby3
83
88
  $result.push_back(*pane);
84
89
  }
85
90
  }
86
- __CODE
91
+ __CODE
87
92
  end
88
93
  spec.map 'std::vector<wxAuiTabLayoutInfo>' => 'Array<Wx::AuiTabLayoutInfo>' do
89
94
  map_out code: <<~__CODE
90
95
  $result = rb_ary_new();
91
- std::vector<wxAuiTabLayoutInfo>& tabs = (std::vector<wxAuiTabLayoutInfo>&)$1;
92
- for (const wxAuiTabLayoutInfo& tab : tabs)
96
+ std::vector<wxAuiTabLayoutInfo>* tabs = (std::vector<wxAuiTabLayoutInfo>*)&$1;
97
+ for (const wxAuiTabLayoutInfo& tab : *tabs)
93
98
  {
94
99
  VALUE r_tab = SWIG_NewPointerObj(new wxAuiTabLayoutInfo(tab), SWIGTYPE_p_wxAuiTabLayoutInfo, SWIG_POINTER_OWN);
95
100
  rb_ary_push($result, r_tab);
96
101
  }
97
- __CODE
102
+ __CODE
98
103
  map_directorout code: <<~__CODE
99
104
  if (TYPE($input) == T_ARRAY)
100
105
  {
@@ -110,8 +115,86 @@ module WXRuby3
110
115
  $result.push_back(*tab);
111
116
  }
112
117
  }
118
+ __CODE
119
+ end
120
+ # For wxAuiDeserialize::HandleOrphanedPage: the ruby method is passed the AuiNotebook
121
+ # and the page and should return either true if the orphaned page should just be appended
122
+ # to the main tab, a tuple with an AuiTabCtrl and a tab index to place the orphaned page in
123
+ # or false if the orphaned page should be removed.
124
+ spec.map 'int page, wxAuiTabCtrl **tabCtrl, int * tabIndex' do
125
+
126
+ add_header_code <<~__CODE
127
+ static WxRuby_ID s_AuiTabCtrl_id("AuiTabCtrl");
128
+ __CODE
129
+
130
+ map_in from: {type: 'Integer', index: 0}, temp: 'wxAuiTabCtrl *tab_ctrl, int tab_ix', code: <<~__CODE
131
+ $1 = NUM2INT($input);
132
+ tab_ctrl = nullptr; tab_ix = 0;
133
+ $2 = &tab_ctrl;
134
+ $3 = &tab_ix;
135
+ __CODE
136
+
137
+ # ignore C defined return value entirely (also affects directorout)
138
+ map_out ignore: 'bool'
139
+
140
+ map_argout as: {type: 'Boolean,Array(Wx::AUI::AuiTabCtrl, Integer)', index: 1}, code: <<~__CODE
141
+ if (result)
142
+ {
143
+ if (tab_ctrl$argnum)
144
+ {
145
+ VALUE rb_klass = rb_const_get(mWxAuiManager, s_AuiTabCtrl_id());
146
+ swig_type_info* swig_type = wxRuby_GetSwigTypeForClass(rb_klass);
147
+ $result = rb_ary_new();
148
+ rb_ary_push($result, SWIG_NewPointerObj(SWIG_as_voidptr(tab_ctrl$argnum), swig_type, 0));
149
+ rb_ary_push($result, INT2NUM(tab_ix$argnum));
150
+ }
151
+ else
152
+ $result = Qtrue;
153
+ }
154
+ else
155
+ $result = Qfalse;
113
156
  __CODE
157
+
158
+ # convert page and ignore rest for now
159
+ map_directorin code: '$input = INT2NUM(page);'
160
+
161
+ map_directorargout code: <<~__CODE
162
+ if (result != Qfalse)
163
+ {
164
+ if (result == Qtrue)
165
+ {
166
+ c_result = true;
167
+ *tabCtrl = nullptr;
168
+ *tabIndex = 0;
169
+ }
170
+ else if (TYPE(result) == T_ARRAY && RARRAY_LEN(result) == 2)
171
+ {
172
+ VALUE rb_klass = rb_const_get(mWxAuiManager, s_AuiTabCtrl_id());
173
+ swig_type_info* swig_type = wxRuby_GetSwigTypeForClass(rb_klass);
174
+ void *tab_ctrl;
175
+ int res = SWIG_ConvertPtr(rb_ary_entry(result, 0), &tab_ctrl, swig_type, 0);
176
+ if (!SWIG_IsOK(res))
177
+ {
178
+ Swig::DirectorTypeMismatchException::raise(swig_get_self(), "$symname", rb_eTypeError,
179
+ "HandleOrphanedPage should return false, true or Array(Wx::AUI::AuiTabCtrl, Integer)");
180
+ }
181
+ *tabCtrl = reinterpret_cast<wxAuiTabCtrl*>(tab_ctrl);
182
+ *tabIndex = NUM2INT(rb_ary_entry(result, 1));
183
+ c_result = true;
184
+ }
185
+ else
186
+ {
187
+ Swig::DirectorTypeMismatchException::raise(swig_get_self(), "$symname", rb_eTypeError,
188
+ "HandleOrphanedPage should return false, true or Array(Wx::AUI::AuiTabCtrl, Integer)");
189
+ }
190
+ }
191
+ else
192
+ c_result = false;
193
+ __CODE
194
+
114
195
  end
196
+ spec.suppress_warning(473, 'wxAuiDeserializer::CreatePaneWindow')
197
+
115
198
  end
116
199
  # need a custom implementation to handle (event handler proc) cleanup
117
200
  spec.add_header_code <<~__HEREDOC
@@ -23,14 +23,25 @@ module WXRuby3
23
23
  wxAuiNotebookPage::caption
24
24
  wxAuiNotebookPage::tooltip
25
25
  wxAuiNotebookPage::bitmap
26
- wxAuiNotebookPage::rect
27
26
  wxAuiNotebookPage::active]
28
27
  if Config.instance.wx_version >= '3.3.0'
29
28
  spec.items << 'wxAuiNotebookPosition'
30
- spec.regard 'wxAuiNotebookPosition::tabctrl',
31
- 'wxAuiNotebookPosition::page'
32
- spec.make_readonly 'wxAuiNotebookPosition::tabctrl',
33
- 'wxAuiNotebookPosition::page'
29
+ spec.regard 'wxAuiNotebookPosition::tabCtrl',
30
+ 'wxAuiNotebookPosition::tabIdx'
31
+ spec.make_readonly 'wxAuiNotebookPosition::tabCtrl',
32
+ 'wxAuiNotebookPosition::tabIdx'
33
+
34
+ spec.map 'std::vector<wxAuiTabCtrl*>' => 'Array<Wx::AuiTabCtrl>' do
35
+ map_out code: <<~__CODE
36
+ $result = rb_ary_new();
37
+ std::vector<wxAuiTabCtrl*>* tabctrls = (std::vector<wxAuiTabCtrl*>*)&$1;
38
+ for (wxAuiTabCtrl* tabctrl : *tabctrls)
39
+ {
40
+ VALUE r_tabctrl = SWIG_NewPointerObj(SWIG_as_voidptr(tabctrl), SWIGTYPE_p_wxAuiTabCtrl, 0);
41
+ rb_ary_push($result, r_tabctrl);
42
+ }
43
+ __CODE
44
+ end
34
45
  end
35
46
  # reset type mapping done in BookCtrls as the non-const arg is used for query-ing here (FindTab)
36
47
  # (wxWidgets should have made this a const arg)
@@ -32,7 +32,7 @@ module WXRuby3
32
32
  wxDELETEA
33
33
  wxSwap
34
34
  }
35
- if Config.instance.wx_version >= '3.3.0'
35
+ if Config.instance.wx_version >= '3.2.7'
36
36
  spec.ignore %w[wxWARN_UNUSED]
37
37
  end
38
38
  spec.ignore 'wxOVERRIDE'
@@ -19,6 +19,9 @@ module WXRuby3
19
19
  spec.make_abstract 'wxPGCellData' # there is never any need to create an instance in Ruby
20
20
  spec.no_proxy 'wxPGCellData'
21
21
  spec.gc_never 'wxPGCellData'
22
+ # wxPGChoiceEntry are always passed by value and never transfer ownership
23
+ # so we do not need tracking or special free function
24
+ spec.gc_as_untracked 'wxPGChoiceEntry'
22
25
  spec.do_not_generate :variables, :enums, :defines, :functions # with PGProperty
23
26
  # add method for correctly wrapping PGCell output references
24
27
  spec.add_header_code <<~__CODE
@@ -49,6 +49,13 @@ module WXRuby3
49
49
  'wxPGChoices::wxPGChoices(size_t, const wxString *, const long *)',
50
50
  'wxPGChoices::wxPGChoices(const wxChar **, const long *)',
51
51
  'wxPGChoices::GetId'
52
+ # type mapping for wxPGChoiceEntry output references to make sure to always return managed copies
53
+ # (uses reference counted data internally)
54
+ spec.map "wxPGChoiceEntry&", as: "Wx::PGChoiceEntry" do
55
+ map_out code: <<~__CODE
56
+ $result = SWIG_NewPointerObj((new wxPGChoiceEntry(*static_cast< const wxPGChoiceEntry* >($1))), SWIGTYPE_p_wxPGChoiceEntry, SWIG_POINTER_OWN);
57
+ __CODE
58
+ end
52
59
  # replace by extension
53
60
  spec.ignore 'wxPGChoices::operator[]', ignore_doc: false
54
61
  spec.add_extend_code 'wxPGChoices', <<~__HEREDOC
@@ -190,7 +190,7 @@ module WXRuby3
190
190
  # methods).
191
191
  spec.ignore 'wxPropertyGridInterface::RefreshGrid', ignore_doc: false
192
192
  spec.add_extend_code 'wxPropertyGridInterface', <<~__HEREDOC
193
- void RefreshGrid(VALUE rb_state)
193
+ void RefreshGrid(VALUE rb_state = Qnil)
194
194
  {
195
195
  wxPropertyGridPageState *state = 0;
196
196
  if (!NIL_P(rb_state))
@@ -19,3 +19,10 @@
19
19
  ```ruby
20
20
  @mgr.get_pane(@text1).float
21
21
  ```
22
+ :wxAuiBookDeserializer.HandleOrphanedPage:
23
+ :detail:
24
+ :pre:
25
+ :para:
26
+ - :pattern: !ruby/regexp /The overridden version may return true but modify.*appending them./
27
+ :replace: |
28
+ The overridden version may return a 2-element array with an AuiTabCtrl and tab index instead to change where the page should be inserted, e.g. by returning a tab index of 0 to insert the new pages at the beginning instead of appending them.
@@ -475,6 +475,26 @@ module WXRuby3
475
475
  map_typecheck precedence: 'INT32_ARRAY', code: '$1 = (TYPE($input) == T_ARRAY);'
476
476
  end
477
477
 
478
+ map 'std::vector<size_t>' => 'Array<Integer>' do
479
+ map_out code: <<~__CODE
480
+ $result = rb_ary_new();
481
+ std::vector<size_t>* vec = (std::vector<size_t>*)&$1;
482
+ for (size_t i : *vec)
483
+ {
484
+ rb_ary_push($result, INT2NUM(i));
485
+ }
486
+ __CODE
487
+ map_directorout code: <<~__CODE
488
+ if (TYPE($input) == T_ARRAY)
489
+ {
490
+ for (int i = 0; i < RARRAY_LEN($input); i++)
491
+ {
492
+ $result.push_back(NUM2INT(rb_ary_entry($input,i)));
493
+ }
494
+ }
495
+ __CODE
496
+ end
497
+
478
498
  # various enumerator type mappings
479
499
 
480
500
  map *%w[wxEdge wxRelationship wxKeyCode], as: 'Integer' do
@@ -17,6 +17,7 @@ class FileDialogTests < Test::Unit::TestCase
17
17
  end
18
18
  end
19
19
 
20
+ # temporary as wxw >= 3.3.0 introduced a bug
20
21
  def test_file_dialog
21
22
  dlg = Wx::FileDialog.new(nil, 'Select file')
22
23
  assert_kind_of(Wx::FileDialog, dlg)
data/tests/test_pg.rb CHANGED
@@ -9,18 +9,26 @@ class PGChoicesTests < WxRuby::Test::GUITests
9
9
  def test_enum_labels
10
10
  texts = %w[Red Blue Green Yellow Black White]
11
11
  choices = Wx::PG::PGChoices.new(texts)
12
- choices.each_label { |lbl| assert_equal(texts.shift, lbl) }
12
+ GC.start
13
+ choices.each_label do |lbl|
14
+ assert_equal(texts.shift, lbl)
15
+ GC.start
16
+ end
13
17
  end
14
18
 
15
19
  def test_enum_entries
16
20
  texts = %w[Flag1 Flag2 Flag3 Flag4]
17
21
  choices = Wx::PG::PGChoices.new
22
+ GC.start
18
23
  texts.each_with_index do |s, i|
19
24
  choices.add(s, 1 << i)
20
25
  end
21
26
  choices.each_entry.each_with_index do |entry, ix|
27
+ GC.start
22
28
  assert_equal(1 << ix, entry.value)
29
+ GC.start
23
30
  assert_equal(texts[ix], entry.get_text)
31
+ GC.start
24
32
  end
25
33
  end
26
34
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wxruby3
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Corino
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-01-30 00:00:00.000000000 Z
10
+ date: 2025-03-22 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: nokogiri