wxruby3 1.4.2 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: db9a443c40a2d1cd6ea3d993fe894ad61d1ce737c2a871877ef88ca06d39a629
4
- data.tar.gz: 43cd46e0283fb6c6706362caa9c6c098bc2cff55216e1d98509c04912afdcf6b
3
+ metadata.gz: c66a3ae46adfde4f69fe289722d28b319f88a13d368babf85d8486d70ec89b81
4
+ data.tar.gz: 9ada796fe609d8fadb1f4b6436d787c2e3570863eacfd65772156cf2ba4baab3
5
5
  SHA512:
6
- metadata.gz: 67d5f62560609aa87f68563a8a51304e87242ca9a084d74ce7f4b2bb65e8765a0d349530c04716d5e34a22e0d62a61e1a2f127fc4a6ebc05f0b4b1591357fd66
7
- data.tar.gz: bafef4ef1d2f06912ccb0c0dad7d86ed236b6c81862c0309e05fad54de634448d18d78f78bef43d70d1952abaeb38fafb86c7624f015597e6ed5aa46e3dbc602
6
+ metadata.gz: 0f22f743031fe5e16981b8c01b09b9e0d505839f330b48ef25715dc73044d85cbe5a211a107d93a41203b8cc0214fad0a9f5b152f6d82f4828e08c0cef136965
7
+ data.tar.gz: f04a7c5176ac19c6a7702bb61f24c9c88c643e65d345618c8a96733bd60dcbb3a0933245fc1bb4b0354881f0b4d875d2379d2982e5e7d50f3fbe1d713d01f46a
@@ -298,6 +298,14 @@ module Wx
298
298
  evt_mousewheel(*args, &block)
299
299
  end
300
300
 
301
+ # Convenience evt_handler to listen to all joystick events.
302
+ def evt_joystick_events(*args, &block)
303
+ evt_joy_button_down(*args, &block)
304
+ evt_joy_button_up(*args, &block)
305
+ evt_joy_move(*args, &block)
306
+ evt_joy_zmove(*args, &block)
307
+ end
308
+
301
309
  # Convenience evt handler to listen to all scrollwin events.
302
310
  def evt_scrollwin(meth = nil, &block)
303
311
  evt_scrollwin_top(meth, &block)
@@ -99,29 +99,6 @@ module Wx
99
99
  # @yieldparam [Wx::CommandEvent] event event to handle
100
100
  def evt_command_range(id1, id2, evt_id, meth = nil, &block) end
101
101
 
102
- # Convenience evt_handler to listen to all mouse events.
103
- # @yieldparam [Wx::MouseEvent] event event to handle
104
- def evt_mouse_events(*args, &block) end
105
-
106
- # Convenience evt handler to listen to all scrollwin events
107
- # (from Wx::ScrolledWindow).
108
- # @param [String,Symbol,Method,Proc] meth (name of) method or event handling proc
109
- # @yieldparam [Wx::ScrollWinEvent] event event to handle
110
- def evt_scrollwin(meth = nil, &block) end
111
-
112
- # Convenience evt handler to listen to all scroll events
113
- # (from Wx::Slider and Wx::ScrollBar).
114
- # @param [String,Symbol,Method,Proc] meth (name of) method or event handling proc
115
- # @yieldparam [Wx::ScrollWinEvent] event event to handle
116
- def evt_scroll(meth = nil, &block) end
117
-
118
- # Convenience evt handler to listen to all scroll events
119
- # (from Wx::Slider and Wx::ScrollBar) with an id.
120
- # @param [Integer] id window identifier
121
- # @param [String,Symbol,Method,Proc] meth (name of) method or event handling proc
122
- # @yieldparam [Wx::ScrollWinEvent] event event to handle
123
- def evt_scroll_command(id, meth = nil, &block) end
124
-
125
102
  # Processes Wx::WindowDestroyEvent events.
126
103
  # In wxRuby Wx::Event#skipped will be forced to true after the provided
127
104
  # handler has finished to make sure the event is propagated as it is
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.4.2'
6
+ WXRUBY_VERSION = '1.5.1'
7
7
  end
@@ -158,10 +158,37 @@ module WXRuby3
158
158
  private
159
159
 
160
160
  def wx_configure
161
- bash("./configure --with-macosx-version-min=#{WXRuby3.config.sysinfo.os.release}.0 " +
162
- "--disable-optimise --disable-sys-libs --without-liblzma --without-regex " +
163
- "--prefix=`pwd`/install --disable-tests --without-subdirs --disable-debug_info " +
164
- "CFLAGS=\"-Wno-unused-but-set-variable\"")
161
+ wxw_ver = nil
162
+ if WXRuby3.config.sysinfo.os.release >= '15'
163
+ # try to detect wxWidgets version
164
+ verfile = File.join(ext_path, 'wxWidgets', 'include', 'wx', 'version.h')
165
+ if File.exist?(verfile)
166
+ v_major = v_minor = v_release = nil
167
+ File.foreach(verfile) do |line|
168
+ case line
169
+ when /\#define\s+wxMAJOR_VERSION\s+(\d+)/
170
+ v_major = $1.to_i
171
+ when /\#define\s+wxMINOR_VERSION\s+(\d+)/
172
+ v_minor = $1.to_i
173
+ when /\#define\s+wxRELEASE_NUMBER\s+(\d+)/
174
+ v_release = $1.to_i
175
+ end
176
+ end
177
+ wxw_ver = "#{v_major}.#{v_minor}.#{v_release}"
178
+ end
179
+ end
180
+ if WXRuby3.config.sysinfo.os.release >= '15' && (wxw_ver.nil? || wxw_ver <= '3.2.6')
181
+ # circumvent compilation problems on MacOS 15 or higher with older wxWidgets releases
182
+ bash("./configure " +
183
+ "--disable-optimise --disable-sys-libs --without-liblzma --without-regex " +
184
+ "--prefix=`pwd`/install --disable-tests --without-subdirs --disable-debug_info " +
185
+ "CFLAGS=\"-Wno-unused-but-set-variable\"")
186
+ else
187
+ bash("./configure --with-macosx-version-min=#{WXRuby3.config.sysinfo.os.release}.0 " +
188
+ "--disable-optimise --disable-sys-libs --without-liblzma --without-regex " +
189
+ "--prefix=`pwd`/install --disable-tests --without-subdirs --disable-debug_info " +
190
+ "CFLAGS=\"-Wno-unused-but-set-variable\"")
191
+ end
165
192
  end
166
193
 
167
194
  def wx_make
@@ -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
@@ -30,6 +30,13 @@ module WXRuby3
30
30
  self
31
31
  end
32
32
 
33
+ def alias(distro, release, alias_distro, alias_release)
34
+ if @dependencies.has_key?(distro) && @dependencies[distro].has_key?(release)
35
+ @dependencies[alias_distro][alias_release] = @dependencies[distro][release]
36
+ end
37
+ self
38
+ end
39
+
33
40
  def get(distro, release: nil)
34
41
  @dependencies[distro][release]
35
42
  end
@@ -37,7 +44,8 @@ module WXRuby3
37
44
 
38
45
  PLATFORM_DEPS = {
39
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])
40
- .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'),
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').alias('ubuntu', '24.04', 'linuxmint', '22.1'),
41
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]),
42
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]),
43
51
  arch: PlatformDependencies.new(%w[pkg-config gtk3 webkit2gtk gspell libunwind gstreamer curl libsecret libnotify libpng12])
@@ -526,28 +526,6 @@ module WXRuby3
526
526
  end
527
527
  end
528
528
 
529
- def generate_event_types(fout, item, evts_handled)
530
- fout.puts " # from #{item.name}"
531
- item.event_types.each do |evt_hnd, evt_type, evt_arity, evt_klass, _|
532
- evh_name = evt_hnd.downcase
533
- unless evts_handled.include?(evh_name)
534
- evt_klass ||= if item.event
535
- item.name
536
- else
537
- raise "Don't know Event class for #{evh_name} event type (from #{item.name})"
538
- end
539
- fout.puts ' '+<<~__HEREDOC.split("\n").join("\n ")
540
- self.register_event_type EventType[
541
- '#{evh_name}', #{evt_arity},
542
- #{fullname}::#{evt_type},
543
- #{fullname}::#{evt_klass.sub(/\Awx/i, '')}
544
- ] if #{fullname}.const_defined?(:#{evt_type})
545
- __HEREDOC
546
- evts_handled << evh_name
547
- end
548
- end
549
- end
550
-
551
529
  class << self
552
530
  # need to share these over all packages since events may be defined in multiple
553
531
  def generated_events
@@ -561,6 +539,46 @@ module WXRuby3
561
539
  end
562
540
  @event_list_packages
563
541
  end
542
+
543
+ # some event handler (catch-all) macros need custom coding so we need to skip
544
+ # them when generating
545
+ def ignored_event_handlers
546
+ @ignored_event_handlers ||= Set.new
547
+ end
548
+
549
+ def full_docs?
550
+ if @full_docs.nil?
551
+ @full_docs = !!ENV['WXRUBY_FULLDOCS']
552
+ end
553
+ @full_docs
554
+ end
555
+ end
556
+
557
+ def generate_event_types(fout, item, evts_handled)
558
+ fout.puts " # from #{item.name}"
559
+ item.event_types.each do |evt_hnd, evt_type, evt_arity, evt_klass, _|
560
+ unless Package.ignored_event_handlers.include?(evt_hnd)
561
+ evh_name = evt_hnd.downcase
562
+ unless evts_handled.include?(evh_name)
563
+ evt_klass ||= item.name if item.event
564
+ # skip if we do not have an actually existing event class
565
+ if (item.event && item.name == evt_klass) ||
566
+ (evt_klass && included_directors.any? { |dir| dir.defmod.find_item(evt_klass) })
567
+
568
+ evt_klass ||= item.name
569
+ fout.puts ' '+<<~__HEREDOC.split("\n").join("\n ")
570
+ self.register_event_type EventType[
571
+ '#{evh_name}', #{evt_arity},
572
+ #{fullname}::#{evt_type},
573
+ #{fullname}::#{evt_klass.sub(/\Awx/i, '')}
574
+ ]
575
+ __HEREDOC
576
+ evts_handled << evh_name
577
+
578
+ end
579
+ end
580
+ end
581
+ end
564
582
  end
565
583
 
566
584
  def generate_event_list
@@ -635,31 +653,36 @@ module WXRuby3
635
653
  item.event_types.each do |evt_hnd, evt_type, evt_arity, evt_klass, evt_nodoc|
636
654
  evh_name = evt_hnd.downcase
637
655
  unless evts_handled.include?(evh_name)
638
- evt_klass ||= item.name
639
- evh_args, evh_docstr = evt_nodoc ? nil : find_event_doc(evh_name)
640
- fdoc.doc.puts evh_docstr if evh_docstr
641
- fdoc.doc.puts "Processes a {#{fullname}::#{evt_type}} event." unless /Process.*\s(event|command)/ =~ evh_docstr
642
- case evt_arity
643
- when 0
644
- evh_args = 'meth = nil, &block' unless evh_args
645
- when 1
646
- evh_args = 'id, meth = nil, &block' unless evh_args
647
- argnms = evh_args.split(',')
648
- fdoc.doc.puts "@param [Integer,Wx::Enum,Wx::Window,Wx::MenuItem,Wx::ToolBarTool,Wx::Timer] #{argnms.shift.strip} window/control id"
649
- when 2
650
- evh_args = 'first_id, last_id, meth = nil, &block' unless evh_args
651
- argnms = evh_args.split(',')
652
- fdoc.doc.puts "@param [Integer,Wx::Enum,Wx::Window,Wx::MenuItem,Wx::ToolBarTool,Wx::Timer] #{argnms.shift.strip} first window/control id of range"
653
- fdoc.doc.puts "@param [Integer,Wx::Enum,Wx::Window,Wx::MenuItem,Wx::ToolBarTool,Wx::Timer] #{argnms.shift.strip} last window/control id of range"
654
- end
655
- fdoc.doc.puts "@param [String,Symbol,Method,Proc] meth (name of) method or handler proc"
656
- #fdoc.doc.puts "@param [Proc] block handler block"
657
- fdoc.doc.puts "@yieldparam [#{fullname}::#{evt_klass.sub(/\Awx/i, '')}] event the event to handle"
656
+ evt_klass ||= item.name if item.event
657
+ # skip if we do not have an actually existing event class (for this platform)
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
+
661
+ evh_args, evh_docstr = evt_nodoc ? nil : find_event_doc(evh_name)
662
+ fdoc.doc.puts evh_docstr if evh_docstr
663
+ fdoc.doc.puts "Processes a {#{fullname}::#{evt_type}} event." unless /Process.*\s(event|command)/ =~ evh_docstr
664
+ case evt_arity
665
+ when 0
666
+ evh_args = 'meth = nil, &block' unless evh_args
667
+ when 1
668
+ evh_args = 'id, meth = nil, &block' unless evh_args
669
+ argnms = evh_args.split(',')
670
+ fdoc.doc.puts "@param [Integer,Wx::Enum,Wx::Window,Wx::MenuItem,Wx::ToolBarTool,Wx::Timer] #{argnms.shift.strip} window/control id"
671
+ when 2
672
+ evh_args = 'first_id, last_id, meth = nil, &block' unless evh_args
673
+ argnms = evh_args.split(',')
674
+ fdoc.doc.puts "@param [Integer,Wx::Enum,Wx::Window,Wx::MenuItem,Wx::ToolBarTool,Wx::Timer] #{argnms.shift.strip} first window/control id of range"
675
+ fdoc.doc.puts "@param [Integer,Wx::Enum,Wx::Window,Wx::MenuItem,Wx::ToolBarTool,Wx::Timer] #{argnms.shift.strip} last window/control id of range"
676
+ end
677
+ fdoc.doc.puts "@param [String,Symbol,Method,Proc] meth (name of) method or handler proc"
678
+ #fdoc.doc.puts "@param [Proc] block handler block"
679
+ fdoc.doc.puts "@yieldparam [#{fullname}::#{evt_klass.sub(/\Awx/i, '')}] event the event to handle"
658
680
 
659
- fdoc.puts "def #{evh_name}(#{evh_args}) end"
660
- fdoc.puts
681
+ fdoc.puts "def #{evh_name}(#{evh_args}) end"
682
+ fdoc.puts
661
683
 
662
- evts_handled << evh_name
684
+ evts_handled << evh_name
685
+ end
663
686
  end
664
687
  end
665
688
  end
@@ -788,10 +811,6 @@ module WXRuby3
788
811
  end
789
812
  private :generate_core_doc
790
813
 
791
- def self.full_docs?
792
- !!ENV['WXRUBY_FULLDOCS']
793
- end
794
-
795
814
  def generate_docs
796
815
  # make sure all modules have been extracted from xml
797
816
  included_directors.each {|dir| dir.extract_interface(false, gendoc: true) }
@@ -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',
@@ -61,8 +66,8 @@ module WXRuby3
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);
@@ -88,8 +93,8 @@ module WXRuby3
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);
@@ -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)
@@ -23,10 +23,12 @@ module WXRuby3
23
23
  wxSizeEvent wxMoveEvent wxPaintEvent wxEraseEvent wxFocusEvent wxActivateEvent
24
24
  wxInitDialogEvent wxMenuEvent wxCloseEvent wxShowEvent wxIconizeEvent wxMaximizeEvent
25
25
  wxFullScreenEvent wxJoystickEvent wxDropFilesEvent wxUpdateUIEvent wxSysColourChangedEvent
26
- wxMouseCaptureChangedEvent wxMouseCaptureLostEvent wxDisplayChangedEvent wxDPIChangedEvent
27
- wxPaletteChangedEvent wxQueryNewPaletteEvent wxNavigationKeyEvent wxWindowCreateEvent
28
- wxWindowDestroyEvent wxHelpEvent wxClipboardTextEvent wxContextMenuEvent wxChildFocusEvent
26
+ wxDPIChangedEvent wxPaletteChangedEvent wxQueryNewPaletteEvent wxNavigationKeyEvent
27
+ wxWindowCreateEvent wxWindowDestroyEvent wxHelpEvent wxClipboardTextEvent wxContextMenuEvent wxChildFocusEvent
29
28
  ])
29
+ if Config.instance.features_set?('WXMSW')
30
+ spec.items.concat %w[wxMouseCaptureChangedEvent wxMouseCaptureLostEvent wxDisplayChangedEvent]
31
+ end
30
32
  spec.fold_bases('wxMouseEvent' => %w[wxMouseState wxKeyboardState], 'wxKeyEvent' => 'wxKeyboardState')
31
33
  spec.ignore 'wxShowEvent::GetShow', 'wxIconizeEvent::Iconized'
32
34
  spec.ignore 'wxKeyEvent::GetPosition(wxCoord *,wxCoord *) const'
@@ -554,9 +554,33 @@ module WXRuby3
554
554
  '%constant char* wxGRID_VALUE_DATE = "date";',
555
555
  '%constant char* wxGRID_VALUE_TEXT = "string";',
556
556
  '%constant char* wxGRID_VALUE_LONG = "long";'
557
+ # fix naming mismatch with #evt_grid_cmd_col_size
558
+ spec.add_swig_code '%constant int EVT_GRID_CMD_COL_SIZE = wxEVT_GRID_COL_SIZE;',
559
+ '%constant int EVT_GRID_CMD_ROW_SIZE = wxEVT_GRID_ROW_SIZE;',
560
+ '%constant int EVT_GRID_CMD_EDITOR_CREATED = wxEVT_GRID_EDITOR_CREATED;',
561
+ '%constant int EVT_GRID_CMD_RANGE_SELECTING = wxEVT_GRID_RANGE_SELECTING;',
562
+ '%constant int EVT_GRID_CMD_RANGE_SELECTED = wxEVT_GRID_RANGE_SELECTED;'
563
+ end
564
+
565
+ def doc_generator
566
+ GridCtrlDocGenerator.new(self)
557
567
  end
558
568
  end # class GridCtrl
559
569
 
560
570
  end # class Director
561
571
 
572
+ class GridCtrlDocGenerator < DocGenerator
573
+
574
+ protected def gen_constants_doc(fdoc)
575
+ super
576
+ xref_table = package.all_modules.reduce(DocGenerator.constants_db) { |db, mod| db[mod] }
577
+ gen_constant_doc(fdoc, 'EVT_GRID_CMD_COL_SIZE', xref_table['EVT_GRID_COL_SIZE'], 'wxRuby specific alias for Wx::EVT_GRID_COL_SIZE')
578
+ gen_constant_doc(fdoc, 'EVT_GRID_CMD_ROW_SIZE', xref_table['EVT_GRID_ROW_SIZE'], 'wxRuby specific alias for Wx::EVT_GRID_ROW_SIZE')
579
+ gen_constant_doc(fdoc, 'EVT_GRID_CMD_EDITOR_CREATED', xref_table['EVT_GRID_EDITOR_CREATED'], 'wxRuby specific alias for Wx::EVT_GRID_EDITOR_CREATED')
580
+ gen_constant_doc(fdoc, 'EVT_GRID_CMD_RANGE_SELECTING', xref_table['EVT_GRID_RANGE_SELECTING'], 'wxRuby specific alias for Wx::wxEVT_GRID_RANGE_SELECTING')
581
+ gen_constant_doc(fdoc, 'EVT_GRID_CMD_RANGE_SELECTED', xref_table['EVT_GRID_RANGE_SELECTED'], 'wxRuby specific alias for Wx::wxEVT_GRID_RANGE_SELECTED')
582
+ end
583
+
584
+ end
585
+
562
586
  end # module WXRuby3
@@ -12,6 +12,8 @@ module WXRuby3
12
12
 
13
13
  class HtmlPrintout < Director
14
14
 
15
+ include Typemap::PrintPageRange
16
+
15
17
  def setup
16
18
  super
17
19
  spec.override_inheritance_chain('wxHtmlPrintout', {'wxPrintout' => 'wxPrinter'}, 'wxObject')
@@ -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
@@ -12,6 +12,8 @@ module WXRuby3
12
12
 
13
13
  class PrintData < Director
14
14
 
15
+ include Typemap::PrintPageRange
16
+
15
17
  def setup
16
18
  super
17
19
  spec.gc_as_untracked
@@ -21,6 +23,11 @@ module WXRuby3
21
23
  # only keep the const version
22
24
  spec.ignore 'wxPageSetupDialogData::GetPrintData'
23
25
  spec.regard 'wxPageSetupDialogData::GetPrintData() const'
26
+ if Config.instance.wx_version >= '3.3.0'
27
+ # new since 3.3.0
28
+ spec.items << 'wxPrintPageRange'
29
+ spec.regard 'wxPrintPageRange::fromPage', 'wxPrintPageRange::toPage' # include public attributes
30
+ end
24
31
  # for GetPrintData methods
25
32
  spec.map 'wxPrintData&' => 'Wx::PrintData' do
26
33
  map_out code: '$result = SWIG_NewPointerObj(SWIG_as_voidptr(new wxPrintData(*$1)), SWIGTYPE_p_wxPrintData, SWIG_POINTER_OWN);'
@@ -12,6 +12,8 @@ module WXRuby3
12
12
 
13
13
  class Printer < Director
14
14
 
15
+ include Typemap::PrintPageRange
16
+
15
17
  def setup
16
18
  super
17
19
  spec.items << 'wxPrintout' << 'wxPrintPreview'
@@ -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))
@@ -12,6 +12,8 @@ module WXRuby3
12
12
 
13
13
  class RichTextPrinting < Director
14
14
 
15
+ include Typemap::PrintPageRange
16
+
15
17
  def setup
16
18
  spec.items << 'wxRichTextPrintout'
17
19
  super
@@ -20,9 +20,26 @@ module WXRuby3
20
20
  # is missing from the XML docs
21
21
  spec.extend_interface('wxSplitterWindow', 'virtual void OnInternalIdle()')
22
22
  super
23
+ # fix naming mismatch with #evt_splitter_dclick
24
+ spec.add_swig_code '%constant int EVT_SPLITTER_DCLICK = wxEVT_SPLITTER_DOUBLECLICKED;'
23
25
  end
26
+
27
+ def doc_generator
28
+ SplitterWindowDocGenerator.new(self)
29
+ end
30
+
24
31
  end # class SplitterWindow
25
32
 
26
33
  end # class Director
27
34
 
35
+ class SplitterWindowDocGenerator < DocGenerator
36
+
37
+ protected def gen_constants_doc(fdoc)
38
+ super
39
+ xref_table = package.all_modules.reduce(DocGenerator.constants_db) { |db, mod| db[mod] }
40
+ gen_constant_doc(fdoc, 'EVT_SPLITTER_DCLICK', xref_table['EVT_SPLITTER_DOUBLECLICKED'], 'wxRuby specific alias for Wx::EVT_SPLITTER_DOUBLECLICKED')
41
+ end
42
+
43
+ end
44
+
28
45
  end # module WXRuby3
@@ -24,11 +24,28 @@ module WXRuby3
24
24
  spec.ignore 'wxTextCtrl::GTKGetTextBuffer',
25
25
  'wxTextCtrl::GTKGetEditable'
26
26
  end
27
- if Config.instance.wx_version >= '3.3.0' && Config.instance.wx_port == :wxmsw
27
+ if Config.instance.wx_version >= '3.3.0'
28
28
  spec.items << 'wxTextSearch' << 'wxTextSearchResult'
29
- spec.regard 'wxTextSearchResult::m_start', 'wxTextSearchResult::m_end'
30
- spec.make_readonly 'wxTextSearchResult::m_start', 'wxTextSearchResult::m_end'
31
- spec.rename_for_ruby 'start' => 'wxTextSearchResult::m_start',
29
+ spec.regard 'wxTextSearch::m_searchValue',
30
+ 'wxTextSearch::m_startingPosition',
31
+ 'wxTextSearch::m_matchCase',
32
+ 'wxTextSearch::m_wholeWord',
33
+ 'wxTextSearch::m_direction',
34
+ 'wxTextSearchResult::m_start',
35
+ 'wxTextSearchResult::m_end'
36
+ spec.make_readonly 'wxTextSearch::m_searchValue',
37
+ 'wxTextSearch::m_startingPosition',
38
+ 'wxTextSearch::m_matchCase',
39
+ 'wxTextSearch::m_wholeWord',
40
+ 'wxTextSearch::m_direction',
41
+ 'wxTextSearchResult::m_start',
42
+ 'wxTextSearchResult::m_end'
43
+ spec.rename_for_ruby 'get_search_value' => 'wxTextSearch::m_searchValue',
44
+ 'get_starting_position' => 'wxTextSearch::m_startingPosition',
45
+ 'match_case?' => 'wxTextSearch::m_matchCase',
46
+ 'whole_word?' => 'wxTextSearch::m_wholeWord',
47
+ 'get_direction' => 'wxTextSearch::m_direction',
48
+ 'start' => 'wxTextSearchResult::m_start',
32
49
  'end' => 'wxTextSearchResult::m_end'
33
50
  end
34
51
  if Config.instance.wx_port == :wxqt
@@ -8,6 +8,14 @@
8
8
 
9
9
  module WXRuby3
10
10
 
11
+ Director::Package.ignored_event_handlers.merge(%w[
12
+ EVT_SCROLL
13
+ EVT_COMMAND_SCROLL
14
+ EVT_SCROLLWIN
15
+ EVT_MOUSE_EVENTS
16
+ EVT_JOYSTICK_EVENTS
17
+ ])
18
+
11
19
  Director.Package('Wx') { |pkg|
12
20
  Director.Spec(pkg, 'wxDefs')
13
21
  Director.Spec(pkg, 'wxFunctions')
@@ -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
@@ -0,0 +1,97 @@
1
+ # Copyright (c) 2023 M.J.N. Corino, The Netherlands
2
+ #
3
+ # This software is released under the MIT license.
4
+
5
+ ###
6
+ # wxRuby3 PrintPageRange array typemap definition
7
+ ###
8
+
9
+ require_relative '../core/mapping'
10
+
11
+ module WXRuby3
12
+
13
+ module Typemap
14
+
15
+ # Typemaps for converting returned PGCell references to
16
+ # either the correct wxRuby class
17
+ module PrintPageRange
18
+
19
+ include Typemap::Module
20
+
21
+ define do
22
+
23
+ if Config.instance.wx_version >= '3.3.0'
24
+ map 'const std::vector<wxPrintPageRange> &' => 'Array<Wx::PRT::PrintPageRange>' do
25
+ map_out code: <<~__CODE
26
+ $result = rb_ary_new();
27
+ for (const wxPrintPageRange& range : *$1)
28
+ {
29
+ VALUE r_range = SWIG_NewPointerObj(new wxPrintPageRange(range), SWIGTYPE_p_wxPrintPageRange, SWIG_POINTER_OWN);
30
+ rb_ary_push($result, r_range);
31
+ }
32
+ __CODE
33
+ map_in temp: 'std::vector<wxPrintPageRange> tmp', code: <<~__CODE
34
+ if (TYPE($input) == T_ARRAY)
35
+ {
36
+ $1 = &tmp;
37
+ for (int i = 0; i < RARRAY_LEN($input); i++)
38
+ {
39
+ void *ptr;
40
+ VALUE r_range = rb_ary_entry($input, i);
41
+ int res = SWIG_ConvertPtr(r_range, &ptr, SWIGTYPE_p_wxPrintPageRange, 0);
42
+ if (!SWIG_IsOK(res) || !ptr) {
43
+ rb_raise(rb_eTypeError, "Expected Array of Wx::PRT::PrintPageRange for 1");
44
+ }
45
+ wxPrintPageRange *range = reinterpret_cast< wxPrintPageRange * >(ptr);
46
+ $1->push_back(*range);
47
+ }
48
+ }
49
+ else {
50
+ rb_raise(rb_eArgError, "Expected Array of Wx::PRT::PrintPageRange for 1");
51
+ }
52
+ __CODE
53
+ end
54
+
55
+ map 'std::vector<wxPrintPageRange> &' => 'Array<Wx::PRT::PrintPageRange>' do
56
+
57
+ map_in temp: 'std::vector<wxPrintPageRange> tmp_vector', code: '$1 = &tmp_vector;'
58
+
59
+ map_argout code: <<~__CODE
60
+ for (const wxPrintPageRange& range : *$1)
61
+ {
62
+ VALUE r_range = SWIG_NewPointerObj(new wxPrintPageRange(range), SWIGTYPE_p_wxPrintPageRange, SWIG_POINTER_OWN);
63
+ rb_ary_push($input, r_range);
64
+ }
65
+ __CODE
66
+
67
+ map_directorin code: '$input = rb_ary_new();'
68
+
69
+ map_directorargout code: <<~__CODE
70
+ for (int i = 0; i < RARRAY_LEN($result); i++)
71
+ {
72
+ void *ptr;
73
+ VALUE r_range = rb_ary_entry($result, i);
74
+ int res = SWIG_ConvertPtr(r_range, &ptr, SWIGTYPE_p_wxPrintPageRange, 0);
75
+ if (!SWIG_IsOK(res) || !ptr) {
76
+ Swig::DirectorTypeMismatchException::raise(swig_get_self(), "$symname", rb_eTypeError,
77
+ "expected Array of Wx::PRT::PrintPageRange in argument 1");
78
+ }
79
+ wxPrintPageRange *range = reinterpret_cast< wxPrintPageRange * >(ptr);
80
+ $1.push_back(*range);
81
+ }
82
+ __CODE
83
+
84
+ end
85
+ end
86
+ # Doc only mapping def
87
+ map 'std::vector<wxPrintPageRange> &' => 'Array<Wx::PRT::PrintPageRange>', swig: false do
88
+ map_in
89
+ end
90
+
91
+ end
92
+
93
+ end
94
+
95
+ end
96
+
97
+ end
@@ -17,6 +17,8 @@ class FileDialogTests < Test::Unit::TestCase
17
17
  end
18
18
  end
19
19
 
20
+ # temporary as wxw >= 3.3.0 introduced a bug
21
+ if Wx::WXWIDGETS_VERSION < '3.3.0'
20
22
  def test_file_dialog
21
23
  dlg = Wx::FileDialog.new(nil, 'Select file')
22
24
  assert_kind_of(Wx::FileDialog, dlg)
@@ -24,6 +26,7 @@ class FileDialogTests < Test::Unit::TestCase
24
26
  assert_kind_of(Wx::Window, dlg)
25
27
  assert_equal(Wx::ID_OK, dialog_tester(dlg))
26
28
  end
29
+ end
27
30
 
28
31
  class FileDialogTestCustomization < Wx::FileDialogCustomizeHook
29
32
 
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.4.2
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Corino
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2024-12-29 00:00:00.000000000 Z
10
+ date: 2025-02-25 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: nokogiri
@@ -820,6 +820,7 @@ files:
820
820
  - rakelib/lib/typemap/pgprop_arg.rb
821
821
  - rakelib/lib/typemap/pgproperty.rb
822
822
  - rakelib/lib/typemap/points_list.rb
823
+ - rakelib/lib/typemap/print_page_range.rb
823
824
  - rakelib/lib/typemap/richtext.rb
824
825
  - rakelib/lib/typemap/tree_itemid.rb
825
826
  - rakelib/lib/util/string.rb