wxruby3 1.5.2 → 1.5.3

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: d4076c5fcd81a2bd38c5e53367b337a7a0f2590f047bcf12def1bd3d3df9d301
4
- data.tar.gz: ade42868f8a79fcc293af4b9070eab971f80a0871a1a0fe7384d55a144a77332
3
+ metadata.gz: 3ea544cb7fe32dce3bbef74d16dc56ebe6fe8cb0ff381cbeee3a5ee9a37471d5
4
+ data.tar.gz: 2afddf4097dffcf4ee6bb4ed649d86165dd5e1decea9f330c27792e95eb2447d
5
5
  SHA512:
6
- metadata.gz: 6e9d0f837e87dc24ddbcc17a4eff510ba6af44bc3f108c76301b0fb36d86a496dab422127c7fc0b917470f5b282709696448a6d0f8a1256d18c9a2a46c972a63
7
- data.tar.gz: 9065c12716485ebcefdd5a01bbb3ef7f4a3bf56c3b8aba3e12b6b4c189766e8a1279591a55553fc9e898838488f78993f95d31cd12a0c3b5e9525398d7fd4c8c
6
+ metadata.gz: 03f848a8b259e10f1a7dfe74505361825e2819cbc8fd2f20d5ca1f1990afa9d9fea4abecaa5bbdda4129864c4f24aa22fb7b1508fc2632839f0d7ffa89919cba
7
+ data.tar.gz: e187a4d0fd6c3f4985afae321228e6956e56df349001e2f6478ea458bafaf4bd5e8210d94de963270820eaedc7ff8de9f3b60684cc493415ce5ad67d4741a228
@@ -4,27 +4,36 @@
4
4
 
5
5
  # Advanced User Interface Notebook - draggable panes etc
6
6
 
7
- class Wx::AUI::AuiNotebook
7
+ module Wx
8
+ module AUI
8
9
 
9
- # Before wxWidgets 3.3 the AUI manager of this control would prevent
10
- # WindowDestroyEvent propagation so we 'patch' in a std event handler
11
- # that designates the event skipped.
12
- if Wx::WXWIDGETS_VERSION < '3.3'
13
- wx_initialize = instance_method :initialize
14
- wx_redefine_method :initialize do |*args|
15
- wx_initialize.bind(self).call(*args)
16
- evt_window_destroy { |evt| evt.skip }
10
+ if Wx::WXWIDGETS_VERSION >= '3.3'
11
+ AuiDefaultTabArt = AuiFlatTabArt
17
12
  end
18
- end
19
13
 
20
- # Convenience method for iterating pages
21
- def each_page
22
- if block_given?
23
- 0.upto(get_page_count - 1) do | i |
24
- yield get_page(i)
14
+ class AuiNotebook
15
+
16
+ # Before wxWidgets 3.3 the AUI manager of this control would prevent
17
+ # WindowDestroyEvent propagation so we 'patch' in a std event handler
18
+ # that designates the event skipped.
19
+ if Wx::WXWIDGETS_VERSION < '3.3'
20
+ wx_initialize = instance_method :initialize
21
+ wx_redefine_method :initialize do |*args|
22
+ wx_initialize.bind(self).call(*args)
23
+ evt_window_destroy { |evt| evt.skip }
24
+ end
25
+ end
26
+
27
+ # Convenience method for iterating pages
28
+ def each_page
29
+ if block_given?
30
+ 0.upto(get_page_count - 1) do | i |
31
+ yield get_page(i)
32
+ end
33
+ else
34
+ ::Enumerator.new { |y| each_page { |pg| y << pg } }
35
+ end
25
36
  end
26
- else
27
- ::Enumerator.new { |y| each_page { |pg| y << pg } }
28
37
  end
29
38
  end
30
39
  end
@@ -21,6 +21,34 @@ class Wx::Dialog
21
21
 
22
22
  end
23
23
 
24
+ def create_button_sizer(flags)
25
+ if Wx.has_feature?(:USE_BUTTON)
26
+ create_std_dialog_button_sizer(flags)
27
+ else
28
+ nil
29
+ end
30
+ end
31
+
32
+ def create_separated_sizer(sizer)
33
+ # Mac Human Interface Guidelines recommend not to use static lines as
34
+ # grouping elements
35
+ if Wx.has_feature?(:USE_STATLINE) && Wx::PLATFORM != 'WXOSX'
36
+ topsizer = Wx::VBoxSizer.new
37
+ topsizer.add(Wx::StaticLine.new(self),
38
+ Wx::SizerFlags.new.expand.double_border(Wx::BOTTOM))
39
+ topsizer.add(sizer, Wx::SizerFlags.new.expand)
40
+ sizer = topsizer
41
+ end
42
+
43
+ sizer
44
+ end
45
+
46
+ def create_separated_button_sizer(flags)
47
+ sizer = create_button_sizer(flags)
48
+ return create_separated_sizer(sizer) if sizer
49
+ nil
50
+ end
51
+
24
52
  module Functor
25
53
  def self.included(klass)
26
54
  scope = klass.name.split('::')
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.2'
6
+ WXRUBY_VERSION = '1.5.3'
7
7
  end
@@ -14,7 +14,12 @@ module WXRuby3
14
14
 
15
15
  def setup
16
16
  super
17
- spec.items << 'wxAuiDefaultTabArt' << 'wxAuiSimpleTabArt'
17
+ if Config.instance.wx_version >= '3.3.0'
18
+ spec.items << 'wxAuiFlatTabArt' << 'wxAuiSimpleTabArt'
19
+ spec.ignore 'wxAuiDefaultTabArt', 'wxAuiNativeTabArt'
20
+ else
21
+ spec.items << 'wxAuiDefaultTabArt' << 'wxAuiSimpleTabArt'
22
+ end
18
23
  spec.gc_as_object
19
24
  spec.disable_proxies
20
25
  # missing from interface documentation
@@ -92,8 +97,54 @@ module WXRuby3
92
97
  'wxAuiSimpleTabArt::Clone')
93
98
  spec.do_not_generate(:variables, :defines, :enums, :functions)
94
99
  end
100
+
101
+
102
+ def generator
103
+ WXRuby3::AuiTabArtGenerator.new(self)
104
+ end
105
+ protected :generator
106
+
107
+ def doc_generator
108
+ WXRuby3::AuiTabArtDocGenerator.new(self)
109
+ end
110
+ protected :doc_generator
111
+
95
112
  end # class AuiTabArt
96
113
 
97
114
  end # class Director
98
115
 
116
+ class AuiTabArtGenerator < InterfaceGenerator
117
+
118
+ def gen_interface_classes(fout)
119
+ super
120
+ if Config.instance.wx_version >= '3.3.0'
121
+ fout.puts
122
+ fout.puts 'class wxAuiNativeTabArt : public wxAuiTabArt'
123
+ fout.puts '{'
124
+ fout.puts '};'
125
+ end
126
+ end
127
+
128
+ end
129
+
130
+ class AuiTabArtDocGenerator < DocGenerator
131
+ def gen_class_doc(fdoc)
132
+ super
133
+ if Config.instance.wx_version >= '3.3.0'
134
+ fdoc.doc.puts 'Wx::AUI::AuiNativeTabArt is either an art provider providing native-like appearance (WXMSW and WXGTK) or a generic Tab Art provider if not available.'
135
+ fdoc.puts 'class AuiNativeTabArt < AuiTabArt; end'
136
+ fdoc.puts
137
+ end
138
+ end
139
+ def gen_constants_doc(fdoc)
140
+ super
141
+ if Config.instance.wx_version >= '3.3.0'
142
+ fdoc.doc.puts 'Wx::AUI::AuiDefaultTabArt is an alias for the tab art provider used by {Wx::AUI::AuiNotebook} by default.'
143
+ fdoc.doc.puts 'Since wxWidgets 3.3.0, this is {Wx::AUI::AuiFlatTabArt} under all platforms. In the previous versions, this was wxAuiNativeTabArt.'
144
+ fdoc.puts 'AuiDefaultTabArt = Wx::AUI::AuiFlatTabArt'
145
+ fdoc.puts
146
+ end
147
+ end
148
+ end
149
+
99
150
  end # module WXRuby3
@@ -34,7 +34,28 @@ module WXRuby3
34
34
  extern VALUE wxRuby_GetDialogClass() {
35
35
  return SwigClassWxDialog.klass;
36
36
  }
37
- __HEREDOC
37
+ __HEREDOC
38
+ spec.ignore 'wxDialog::CreateButtonSizer', # pure Ruby impl
39
+ 'wxDialog::CreateSeparatedButtonSizer', # pure Ruby impl
40
+ 'wxDialog::CreateSeparatedSizer', # pure Ruby impl
41
+ 'wxDialog::CreateTextSizer', # custom impl
42
+ ignore_doc: false
43
+ spec.new_object 'wxDialog::CreateStdDialogButtonSizer' if Config.instance.features_set?('USE_BUTTON')
44
+ spec.add_extend_code 'wxDialog', <<~__HEREDOC
45
+ VALUE CreateTextSizer(const wxString& message, int widthMax)
46
+ {
47
+ wxSizer* txt_szr = $self->CreateTextSizer(message, widthMax);
48
+ if (txt_szr)
49
+ {
50
+ // Get the wx class
51
+ wxString class_name( txt_szr->GetClassInfo()->GetClassName() );
52
+ swig_type_info* swig_type = wxRuby_GetSwigTypeForClassName(class_name);
53
+ if (swig_type)
54
+ return SWIG_NewPointerObj(SWIG_as_voidptr(txt_szr), swig_type, SWIG_POINTER_OWN | 0 );
55
+ }
56
+ return Qnil;
57
+ }
58
+ __HEREDOC
38
59
  when 'wxMessageDialog'
39
60
  spec.ignore 'wxMessageDialog::ButtonLabel'
40
61
  spec.map 'const ButtonLabel&' => 'String,Integer' do
data/tests/test_dialog.rb CHANGED
@@ -16,5 +16,66 @@ class DialogTests < Test::Unit::TestCase
16
16
  dlg = TestDialog.new
17
17
  assert_kind_of(Wx::Dialog, dlg)
18
18
  assert_kind_of(Wx::Window, dlg)
19
+ dlg.destroy
20
+ end
21
+
22
+ class TestDialog2 < Wx::Dialog
23
+ def initialize
24
+ super(nil, -1, 'Test Dialog')
25
+
26
+ sizer_top = Wx::VBoxSizer.new
27
+ sizer_top.add(Wx::StaticText.new(self, label: 'Some text ...'))
28
+
29
+ sizer_btn = Wx::HBoxSizer.new
30
+ btn_focused = Wx::Button.new(self, -1, "Default button")
31
+ btn_other = Wx::Button.new(self, -1, "&Another button")
32
+ btn_close = Wx::Button.new(self, Wx::ID_CANCEL, "&Close")
33
+ sizer_btn.add(btn_focused, 0, Wx::ALIGN_CENTER | Wx::ALL, 5)
34
+ sizer_btn.add(btn_other, 0, Wx::ALIGN_CENTER | Wx::ALL, 5)
35
+ sizer_btn.add(btn_close, 0, Wx::ALIGN_CENTER | Wx::ALL, 5)
36
+
37
+ sizer_top.add(create_separated_sizer(sizer_btn))
38
+
39
+ set_auto_layout(true)
40
+ set_sizer(sizer_top)
41
+
42
+ sizer_top.set_size_hints(self)
43
+ sizer_top.fit(self)
44
+
45
+ btn_focused.set_focus
46
+ btn_focused.set_default
47
+ end
48
+ end
49
+
50
+ def test_dialog_with_separated_sizer
51
+ dlg = TestDialog2.new
52
+ dlg.show(true)
53
+ 200.times { Wx.get_app.yield }
54
+ sleep(2) unless is_ci_build?
55
+ dlg.destroy
56
+ end
57
+
58
+ class TestDialog3 < Wx::Dialog
59
+ def initialize
60
+ super(nil, -1, 'Test Dialog')
61
+
62
+ sizer_top = Wx::VBoxSizer.new
63
+ sizer_top.add(Wx::StaticText.new(self, label: 'Some text ...'))
64
+ sizer_top.add(create_separated_button_sizer(Wx::YES_NO|Wx::CANCEL))
65
+
66
+ set_auto_layout(true)
67
+ set_sizer(sizer_top)
68
+
69
+ sizer_top.set_size_hints(self)
70
+ sizer_top.fit(self)
71
+ end
72
+ end
73
+
74
+ def test_dialog_with_button_sizer
75
+ dlg = TestDialog3.new
76
+ dlg.show(true)
77
+ 200.times { Wx.get_app.yield }
78
+ sleep(2) unless is_ci_build?
79
+ dlg.destroy
19
80
  end
20
81
  end
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.2
4
+ version: 1.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Corino
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-03-22 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: nokogiri
@@ -1210,7 +1210,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1210
1210
  - !ruby/object:Gem::Version
1211
1211
  version: '0'
1212
1212
  requirements: []
1213
- rubygems_version: 3.6.2
1213
+ rubygems_version: 3.6.7
1214
1214
  specification_version: 4
1215
1215
  summary: wxWidgets extension for Ruby
1216
1216
  test_files: []