wxruby3 1.0.1 → 1.1.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: d56d06b3a74584ca43ec7314bc816c34175dbb7c68d722dfb88f2d1702dc295b
4
- data.tar.gz: 60d6432e98d834f8eaea4e0e13c8a2bed3fd8a9419cc6331d74c945f9695d223
3
+ metadata.gz: '079f38ae02dfcba5a96738f73c678e0d9a5396920739cb370c47d79b6bb81adf'
4
+ data.tar.gz: 510b7637e541b981deb048d4b0aa3898ea8152900b570ead984dcb9c6daee534
5
5
  SHA512:
6
- metadata.gz: ef773e93094cfad19757c3d7ecfed29135d920a9f4e810521eadd6b226b8e13a10a735763853c1061d0256ce5fc84a2d5b0c28810874c99443c2a3e2548b753d
7
- data.tar.gz: 92df4dfe100a6ec2c4353451d237a1a1819ac2777ac1fdbc9a4a8e6cb4996e8fc3254454582a5465e97c7613eaebca4a29e26935c87286798c24c5d235ef2d36
6
+ metadata.gz: 4b3c4ad6e1c31636d658cd9f0d986c57caf6bc6f72af19af449b7d371c3b9af45b229533f1ae3593b7c23b2b29bf74dfaac8e88740fcca0699dc093f40b29d8f
7
+ data.tar.gz: 827044bb4256d7afc741e77209096cd527f2c77688c0b619fd72cf1ad0bf03992de4e3c60ec93e17795835345b15932ae2773381de85177d941d8b205ab120f7
@@ -42,6 +42,14 @@
42
42
  * wxWidgets we define our own.
43
43
  */
44
44
 
45
+ #if defined(__GNUC__)
46
+ # if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
47
+ # ifndef GCC_HASCLASSVISIBILITY
48
+ # define GCC_HASCLASSVISIBILITY
49
+ # endif
50
+ # endif
51
+ #endif
52
+
45
53
  #ifndef WXRB_EXPORT_FLAG
46
54
  # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
47
55
  # if defined(WXRUBY_STATIC_BUILD)
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.0.1'
6
+ WXRUBY_VERSION = '1.1.1'
7
7
  end
data/rakelib/build.rb CHANGED
@@ -55,8 +55,18 @@ if WXRuby3.is_bootstrapped?
55
55
  pkg.generate_initializer
56
56
  end
57
57
 
58
- # Target to run the linker to create a final .so/.dll wxruby3 package library
59
- file pkg.lib_target => [*pkg.all_obj_files, *pkg.dep_libs] do | t |
58
+ # only for MacOSX
59
+ file pkg.initializer_loader_src => pkg.initializer_src do
60
+ pkg.generate_initializer_loader
61
+ end
62
+
63
+ # Target to run the linker to create a final wxruby package shared library (MacOSX only)
64
+ file pkg.shlib_target => [*pkg.all_obj_files, *pkg.dep_libs] do |t|
65
+ WXRuby3.config.do_shlib_link(pkg)
66
+ end
67
+
68
+ # Target to run the linker to create a final .so/.dll/.bundle wxruby3 package library
69
+ file pkg.lib_target => pkg.lib_target_deps do | t |
60
70
  WXRuby3.config.do_link(pkg)
61
71
  end
62
72
 
data/rakelib/install.rb CHANGED
@@ -152,7 +152,10 @@ module WXRuby3
152
152
  [File.join(WXRuby3.config.get_cfg_string('siterubyver'), 'wx'), ['lib/wx'], 0644],
153
153
  ]
154
154
  # add wxRuby shared libraries
155
- WXRuby3::Director.each_package { |pkg| specs << [WXRuby3.config.get_cfg_string('siterubyverarch'), [pkg.lib_target], 0555] }
155
+ WXRuby3::Director.each_package do |pkg|
156
+ specs << [WXRuby3.config.get_cfg_string('siterubyverarch'), [pkg.lib_target], 0555]
157
+ specs << [WXRuby3.config.get_cfg_string('siterubyverarch'), [pkg.lib_target.sub(/\.#{WXRuby3.config.dll_ext}\Z/, '.dylib')], 0555] if WXRuby3.config.macosx?
158
+ end
156
159
  if WXRuby3.config.get_config('with-wxwin')
157
160
  specs << [WXRuby3.config.get_cfg_string('siterubyverarch'), Install.wxwin_shlibs, 0555]
158
161
  end
@@ -46,6 +46,19 @@ module WXRuby3
46
46
  end
47
47
  protected :patch_rpath
48
48
 
49
+ # add deployment lookup paths for wxruby shared libraries
50
+ # and make loadpath for initializer dylibs relative
51
+ def update_shlib_loadpaths(shlib)
52
+ # in case of a .bundle library
53
+ if /\.bundle\Z/ =~ shlib
54
+ # change the full path of the complementary initializer .dylib to a path relative to any rpath-s
55
+ dylib = "lib#{File.basename(shlib, '.bundle')}.dylib"
56
+ dylib_path = File.expand_path(File.join(Config.instance.dest_dir, dylib))
57
+ sh("install_name_tool -change #{dylib_path} '@rpath/#{dylib}' #{shlib}")
58
+ end
59
+ super
60
+ end
61
+
49
62
  # add Ruby library path for wxruby shared libraries
50
63
  def update_shlib_ruby_libpath(shlib)
51
64
  # fix lookup for the Ruby shared library
@@ -123,10 +136,23 @@ module WXRuby3
123
136
  wx_libset.collect { |s| s.dup }
124
137
  end
125
138
 
126
- def do_link(pkg)
139
+ def do_shlib_link(pkg)
127
140
  objs = pkg.all_obj_files.collect { |o| File.join('..', o) }.join(' ') + ' '
128
- sh "cd lib && #{WXRuby3.config.ld} #{WXRuby3.config.ldflags(pkg.lib_target)} #{objs} " +
129
- "#{WXRuby3.config.libs} #{WXRuby3.config.link_output_flag}#{pkg.lib_target}"
141
+ depsh = pkg.dep_libs.join(' ')
142
+ ldsh = WXRuby3.config.ld.sub(/-bundle/, '')
143
+ ldsh.sub!(/-dynamic/, '-dynamiclib')
144
+ sh "cd lib && " +
145
+ "#{ldsh} #{WXRuby3.config.ldflags(pkg.lib_target)} #{objs} #{depsh} " +
146
+ "#{WXRuby3.config.libs} #{WXRuby3.config.link_output_flag}#{pkg.shlib_target}",
147
+ fail_on_error: true
148
+ end
149
+
150
+ def do_link(pkg)
151
+ sh "cd lib && " +
152
+ "#{WXRuby3.config.ld} #{WXRuby3.config.ldflags(pkg.lib_target)} #{File.join('..', pkg.init_obj_file)} " +
153
+ "-L. -l#{pkg.libname} " +
154
+ "#{WXRuby3.config.libs} #{WXRuby3.config.link_output_flag}#{pkg.lib_target}",
155
+ fail_on_error: true
130
156
  end
131
157
 
132
158
  private
@@ -151,15 +177,14 @@ module WXRuby3
151
177
 
152
178
  if @wx_version
153
179
  @cpp.sub!(/-std=gnu\+\+11/, '-std=gnu++14')
154
- @ld.sub!(/-o\s*\Z/, '')
180
+ # on Mac OSX this differs from the wxWidgets linking setup
181
+ @ld = RB_CONFIG['LDSHAREDXX'] || 'g++ -std=gnu++14 -dynamic -bundle'
182
+ @ld.sub!(/-std=gnu\+\+11/, '-std=gnu++14')
155
183
 
156
184
  @extra_cflags.concat %w[-Wno-unused-function -Wno-conversion-null -Wno-sometimes-uninitialized
157
185
  -Wno-overloaded-virtual -Wno-deprecated-copy]
158
186
  @extra_cflags << ' -Wno-deprecated-declarations' unless @no_deprecated
159
187
 
160
- # create a .dylib binary
161
- @extra_ldflags << '-dynamic -bundle'
162
-
163
188
  unless @wx_path.empty?
164
189
  libdirs = @wx_libs.select {|s| s.start_with?('-L')}.collect {|s| s.sub(/^-L/,'')}
165
190
  @exec_env['DYLD_LIBRARY_PATH'] = "#{ENV['DYLD_LIBRARY_PATH']}:#{dest_dir}:#{libdirs.join(':')}"
@@ -69,6 +69,10 @@ module WXRuby3
69
69
  File.join(Config.instance.dest_dir, "#{libname}.#{Config.instance.dll_ext}")
70
70
  end
71
71
 
72
+ def shlib_target
73
+ Config.instance.macosx? ? File.join(Config.instance.dest_dir, "lib#{libname}.dylib") : nil
74
+ end
75
+
72
76
  def package(pkgname)
73
77
  subpackages[pkgname] ||= Package.new(pkgname, self)
74
78
  end
@@ -156,9 +160,30 @@ module WXRuby3
156
160
  @all_obj_files
157
161
  end
158
162
 
163
+ # only used for MacOSX
164
+ def init_obj_file
165
+ if Config.instance.macosx?
166
+ File.join(Config.instance.obj_dir, "#{libname}_init_loader.#{Config.instance.obj_ext}")
167
+ else
168
+ File.join(Config.instance.obj_dir, "#{libname}_init.#{Config.instance.obj_ext}")
169
+ end
170
+ end
171
+
172
+ def lib_target_deps
173
+ if Config.instance.macosx?
174
+ [init_obj_file, shlib_target, *dep_libs]
175
+ else
176
+ [*all_obj_files, *dep_libs]
177
+ end
178
+ end
179
+
159
180
  def dep_libs
160
181
  if parent
161
- parent.dep_libs + [File.join(Config.instance.dest_dir, "#{parent.libname}.#{Config.instance.dll_ext}")]
182
+ parent.dep_libs + if Config.instance.macosx?
183
+ [parent.shlib_target]
184
+ else
185
+ [parent.lib_target]
186
+ end
162
187
  else
163
188
  []
164
189
  end
@@ -176,6 +201,11 @@ module WXRuby3
176
201
  File.join(Config.instance.src_dir, "#{libname}_init.cpp")
177
202
  end
178
203
 
204
+ # only for MacOSX
205
+ def initializer_loader_src
206
+ File.join(Config.instance.src_dir, "#{libname}_init_loader.cpp")
207
+ end
208
+
179
209
  def is_dir_with_fulfilled_deps?(dir, cls_set)
180
210
  if (modreg = Spec.module_registry[dir.spec.module_name]) && !modreg.empty?
181
211
  # check if all base classes are defined previously or part of the same director or outside the current package
@@ -286,6 +316,14 @@ module WXRuby3
286
316
  fsrc.puts '#include <ruby.h>'
287
317
  fsrc.puts '#include <ruby/version.h>'
288
318
  fsrc.puts <<~__HEREDOC
319
+ #if defined(__GNUC__)
320
+ # if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
321
+ # ifndef GCC_HASCLASSVISIBILITY
322
+ # define GCC_HASCLASSVISIBILITY
323
+ # endif
324
+ # endif
325
+ #endif
326
+
289
327
  #ifndef WXRB_EXPORT_FLAG
290
328
  # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
291
329
  # if defined(WXRUBY_STATIC_BUILD)
@@ -338,7 +376,11 @@ module WXRuby3
338
376
  fsrc.puts '#ifdef __cplusplus'
339
377
  fsrc.puts 'extern "C"'
340
378
  fsrc.puts '#endif'
341
- fsrc.puts "WXRB_EXPORT_FLAG void Init_#{libname}()"
379
+ if Config.instance.macosx?
380
+ fsrc.puts "WXRB_EXPORT_FLAG void wxruby_init_#{libname}()"
381
+ else
382
+ fsrc.puts "WXRB_EXPORT_FLAG void Init_#{libname}()"
383
+ end
342
384
  fsrc.puts '{'
343
385
  fsrc.indent do
344
386
  fsrc.puts 'static bool initialized;'
@@ -357,7 +399,7 @@ module WXRuby3
357
399
  fsrc << <<~__HERDOC
358
400
  // define Enum class
359
401
  wx_define_Enum_class();
360
- __HERDOC
402
+ __HERDOC
361
403
  fsrc.puts
362
404
  # generate constant definitions for feature defines from setup.h
363
405
  fsrc.puts %Q{VALUE mWxSetup = rb_define_module_under(#{module_variable}, "Setup");}
@@ -391,6 +433,72 @@ module WXRuby3
391
433
  generate_event_list if included_directors.any? {|dir| dir.has_events? }
392
434
  end
393
435
 
436
+ # only for MacOSX
437
+ def generate_initializer_loader
438
+ STDERR.puts "* generating package #{name} initializer : #{initializer_src}" if Director.verbose?
439
+
440
+ Stream.transaction do
441
+ fsrc = CodeStream.new(initializer_loader_src)
442
+ fsrc.puts '#include <ruby.h>'
443
+ fsrc.puts '#include <ruby/version.h>'
444
+ fsrc.puts <<~__HEREDOC
445
+ #if defined(__GNUC__)
446
+ # if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
447
+ # ifndef GCC_HASCLASSVISIBILITY
448
+ # define GCC_HASCLASSVISIBILITY
449
+ # endif
450
+ # endif
451
+ #endif
452
+
453
+ #ifndef WXRB_EXPORT_FLAG
454
+ # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
455
+ # if defined(WXRUBY_STATIC_BUILD)
456
+ # define WXRB_EXPORT_FLAG
457
+ # else
458
+ # define WXRB_EXPORT_FLAG __declspec(dllexport)
459
+ # endif
460
+ # else
461
+ # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
462
+ # define WXRB_EXPORT_FLAG __attribute__ ((visibility("default")))
463
+ # else
464
+ # define WXRB_EXPORT_FLAG
465
+ # endif
466
+ # endif
467
+ #endif
468
+
469
+ #ifndef WXRB_IMPORT_FLAG
470
+ # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
471
+ # if defined(WXRUBY_STATIC_BUILD)
472
+ # define WXRB_IMPORT_FLAG
473
+ # else
474
+ # define WXRB_IMPORT_FLAG __declspec(dllimport)
475
+ # endif
476
+ # else
477
+ # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
478
+ # define WXRB_IMPORT_FLAG __attribute__ ((visibility("default")))
479
+ # else
480
+ # define WXRB_IMPORT_FLAG
481
+ # endif
482
+ # endif
483
+ #endif
484
+ __HEREDOC
485
+ fsrc.puts '#ifdef __cplusplus'
486
+ fsrc.puts 'extern "C"'
487
+ fsrc.puts '#endif'
488
+ fsrc.puts "WXRB_IMPORT_FLAG void wxruby_init_#{libname}();"
489
+ fsrc.puts
490
+ fsrc.puts '#ifdef __cplusplus'
491
+ fsrc.puts 'extern "C"'
492
+ fsrc.puts '#endif'
493
+ fsrc.puts "WXRB_EXPORT_FLAG void Init_#{libname}()"
494
+ fsrc.puts '{'
495
+ fsrc.indent do
496
+ fsrc.puts "wxruby_init_#{libname}();"
497
+ end
498
+ fsrc.puts '}'
499
+ end
500
+ end
501
+
394
502
  def extract(*mods, genint: true)
395
503
  included_directors.each do |dir|
396
504
  dir.extract_interface(genint) if (mods.empty? || mods.include?(dir.spec.name))
@@ -420,11 +528,11 @@ module WXRuby3
420
528
  raise "Don't know Event class for #{evh_name} event type (from #{item.name})"
421
529
  end
422
530
  fout.puts ' '+<<~__HEREDOC.split("\n").join("\n ")
423
- self.register_event_type EventType[
424
- '#{evh_name}', #{evt_arity},
425
- #{fullname}::#{evt_type},
426
- #{fullname}::#{evt_klass.sub(/\Awx/i, '')}
427
- ] if #{fullname}.const_defined?(:#{evt_type})
531
+ self.register_event_type EventType[
532
+ '#{evh_name}', #{evt_arity},
533
+ #{fullname}::#{evt_type},
534
+ #{fullname}::#{evt_klass.sub(/\Awx/i, '')}
535
+ ] if #{fullname}.const_defined?(:#{evt_type})
428
536
  __HEREDOC
429
537
  evts_handled << evh_name
430
538
  end
@@ -562,7 +670,7 @@ module WXRuby3
562
670
 
563
671
  class EvtHandler
564
672
 
565
- __HEREDOC
673
+ __HEREDOC
566
674
  fdoc.indent(2) do
567
675
  fdoc.doc.puts "@!group #{name} Event handler methods"
568
676
  fdoc.puts
@@ -651,7 +759,7 @@ module WXRuby3
651
759
 
652
760
  end
653
761
  __HEREDOC
654
- __SCRIPT
762
+ __SCRIPT
655
763
  begin
656
764
  tmpfile = Tempfile.new('script')
657
765
  ftmp_name = tmpfile.path.dup
@@ -16,6 +16,7 @@ module WXRuby3
16
16
  super
17
17
  spec.items << 'wxAuiDefaultTabArt' << 'wxAuiSimpleTabArt'
18
18
  spec.gc_as_object
19
+ spec.disable_proxies
19
20
  # missing from interface documentation
20
21
  spec.extend_interface('wxAuiTabArt',
21
22
  'virtual ~wxAuiTabArt ()',
@@ -16,7 +16,8 @@ module WXRuby3
16
16
  super
17
17
  spec.items << 'wxAuiDefaultToolBarArt'
18
18
  spec.gc_as_object
19
- spec.extend_interface('wxAuiToolBarArt', 'virtual ~wxAuiToolBarArt ()')
19
+ spec.make_abstract 'wxAuiToolBarArt'
20
+ spec.disable_proxies
20
21
  spec.suppress_warning(473, 'wxAuiToolBarArt::Clone', 'wxAuiDefaultToolBarArt::Clone')
21
22
  spec.map 'const wxAuiToolBarItemArray&' => 'Array<Wx::AUI::AuiToolBarItem>,nil' do
22
23
  map_in temp: 'wxAuiToolBarItemArray tmp', code: <<~__CODE
@@ -16,6 +16,13 @@ module WXRuby3
16
16
 
17
17
  def setup
18
18
  super
19
+ _readDC = if Config.instance.wx_version >= '3.3.0'
20
+ spec.items.unshift 'wxReadOnlyDC' # prepend before wxDC
21
+ spec.items << 'wxInfoDC'
22
+ 'wxReadOnlyDC'
23
+ else
24
+ 'wxDC'
25
+ end
19
26
  spec.items << 'wxFontMetrics'
20
27
  # it's not safe to track DC objects as these are often created on the stack in C++
21
28
  # before being passed to Ruby methods
@@ -29,22 +36,24 @@ module WXRuby3
29
36
  'wxFontMetrics::externalLeading',
30
37
  'wxFontMetrics::averageWidth'
31
38
  spec.ignore [
32
- 'wxDC::GetPartialTextExtents',
33
- 'wxDC::DrawLines(const wxPointList *,wxCoord,wxCoord)',
34
- 'wxDC::DrawPolygon(const wxPointList *,wxCoord,wxCoord,wxPolygonFillMode)',
35
- 'wxDC::DrawSpline(const wxPointList *)',
36
- 'wxDC::GetLogicalOrigin(wxCoord *,wxCoord *) const',
37
- 'wxDC::GetHandle'
39
+ 'wxDC::DrawLines(const wxPointList *,wxCoord,wxCoord)',
40
+ 'wxDC::DrawPolygon(const wxPointList *,wxCoord,wxCoord,wxPolygonFillMode)',
41
+ 'wxDC::DrawSpline(const wxPointList *)',
42
+ 'wxDC::GetHandle'
43
+ ]
44
+ spec.ignore [
45
+ "#{_readDC}::GetPartialTextExtents",
46
+ "#{_readDC}::GetLogicalOrigin(wxCoord *,wxCoord *) const",
38
47
  ]
48
+ spec.rename_for_ruby({
49
+ 'GetDimensions' => "#{_readDC}::GetSize(wxCoord *, wxCoord *) const",
50
+ 'GetDimensionsMM' => "#{_readDC}::GetSizeMM(wxCoord *, wxCoord *) const",
51
+ 'GetTextSize' => "#{_readDC}::GetTextExtent(const wxString &) const",
52
+ 'GetMultiLineTextSize' => "#{_readDC}::GetMultiLineTextExtent(const wxString &) const"
53
+ })
39
54
  spec.disable_proxies
40
55
  spec.disown 'wxGraphicsContext *ctx'
41
- spec.rename_for_ruby({
42
- 'GetDimensions' => 'wxDC::GetSize(wxCoord *, wxCoord *) const',
43
- 'GetDimensionsMM' => 'wxDC::GetSizeMM(wxCoord *, wxCoord *) const',
44
- 'GetTextSize' => 'wxDC::GetTextExtent(const wxString &) const',
45
- 'GetMultiLineTextSize' => 'wxDC::GetMultiLineTextExtent(const wxString &) const'
46
- })
47
- spec.add_extend_code 'wxDC', <<~__HEREDOC
56
+ spec.add_extend_code _readDC, <<~__HEREDOC
48
57
  // Needs to return input parameter with list of lengths
49
58
  VALUE get_partial_text_extents(VALUE text) {
50
59
  wxString str = wxString(StringValuePtr(text), wxConvUTF8);
@@ -57,10 +66,31 @@ module WXRuby3
57
66
  }
58
67
  return rb_result;
59
68
  }
60
- __HEREDOC
69
+ __HEREDOC
61
70
  # for GetUserScale and GetLogicalScale
62
71
  spec.map_apply 'double * OUTPUT' => 'double *'
63
72
  spec.swig_import 'swig/classes/include/wxGDICommon.h'
73
+ if Config.instance.wx_version >= '3.3.0'
74
+ # add similar block-style creator as #draw_on methods
75
+ spec.add_extend_code 'wxInfoDC', <<~__HEREDOC
76
+ static VALUE inform_on(wxWindow* win)
77
+ {
78
+ if (!wxRuby_IsAppRunning())
79
+ rb_raise(rb_eRuntimeError, "A running Wx::App is required.");
80
+ if (!win)
81
+ rb_raise(rb_eRuntimeError, "A running valid Wx::Window is required for argument.");
82
+ VALUE rc = Qnil;
83
+ if (rb_block_given_p ())
84
+ {
85
+ wxInfoDC info_dc(win);
86
+ wxReadOnlyDC* dc_ptr = &info_dc; // wxInfoDC::operator&() returns wxReadOnlyDC*
87
+ VALUE rb_dc = SWIG_NewPointerObj(SWIG_as_voidptr(dc_ptr), SWIGTYPE_p_wxInfoDC, 0);
88
+ rc = rb_yield(rb_dc);
89
+ }
90
+ return rc;
91
+ }
92
+ __HEREDOC
93
+ end
64
94
  end
65
95
  end # class DC
66
96
 
@@ -18,6 +18,7 @@ module WXRuby3
18
18
  spec.gc_as_untracked spec.module_name
19
19
  case spec.module_name
20
20
  when 'wxScreenDC'
21
+ spec.override_inheritance_chain('wxScreenDC', ['wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version >= '3.3.0'
21
22
  spec.make_abstract 'wxScreenDC'
22
23
  # as a ScreenDC should always be a temporary stack object
23
24
  # we do not allow creation in Ruby but rather provide a class
@@ -43,6 +44,7 @@ module WXRuby3
43
44
  'wxScreenDC::EndDrawingOnTop',
44
45
  'wxScreenDC::wxScreenDC'
45
46
  when 'wxClientDC'
47
+ spec.override_inheritance_chain('wxClientDC', ['wxWindowDC', 'wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version >= '3.3.0'
46
48
  spec.make_abstract 'wxClientDC'
47
49
  spec.ignore 'wxClientDC::wxClientDC'
48
50
  # as a ClientDC should best always be a temporary stack object
@@ -65,6 +67,7 @@ module WXRuby3
65
67
  }
66
68
  __HEREDOC
67
69
  when 'wxPaintDC'
70
+ spec.override_inheritance_chain('wxPaintDC', ['wxClientDC', 'wxWindowDC', 'wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version >= '3.3.0'
68
71
  spec.make_abstract 'wxPaintDC'
69
72
  spec.ignore 'wxPaintDC::wxPaintDC'
70
73
  spec.add_header_code <<~__HEREDOC
@@ -89,7 +92,10 @@ module WXRuby3
89
92
  __HEREDOC
90
93
  when 'wxMemoryDC'
91
94
  spec.items << 'wxBufferedDC' << 'wxBufferedPaintDC'
95
+ spec.override_inheritance_chain('wxMemoryDC', ['wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version >= '3.3.0'
92
96
  spec.gc_as_untracked %w[wxBufferedDC wxBufferedPaintDC]
97
+ spec.override_inheritance_chain('wxBufferedDC', ['wxMemoryDC', 'wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version >= '3.3.0'
98
+ spec.override_inheritance_chain('wxBufferedPaintDC', ['wxBufferedDC', 'wxMemoryDC', 'wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version >= '3.3.0'
93
99
  spec.make_abstract 'wxMemoryDC'
94
100
  spec.make_abstract 'wxBufferedDC'
95
101
  spec.make_abstract 'wxBufferedPaintDC'
@@ -218,6 +224,7 @@ module WXRuby3
218
224
  }
219
225
  __HEREDOC
220
226
  when 'wxMirrorDC'
227
+ spec.override_inheritance_chain('wxMirrorDC', ['wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version >= '3.3.0'
221
228
  spec.make_abstract 'wxMirrorDC'
222
229
  spec.ignore 'wxMirrorDC::wxMirrorDC'
223
230
  # as a MirrorDC should best always be a temporary stack object
@@ -240,6 +247,7 @@ module WXRuby3
240
247
  }
241
248
  __HEREDOC
242
249
  when 'wxSVGFileDC'
250
+ spec.override_inheritance_chain('wxSVGFileDC', ['wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version >= '3.3.0'
243
251
  spec.items.concat %w[wxSVGBitmapHandler wxSVGBitmapFileHandler wxSVGBitmapEmbedHandler]
244
252
  spec.make_abstract 'wxSVGFileDC'
245
253
  spec.ignore 'wxSVGFileDC::wxSVGFileDC'
@@ -277,6 +285,7 @@ module WXRuby3
277
285
  'wxSVGFileDC::StartPage',
278
286
  'wxSVGFileDC::EndPage'
279
287
  when 'wxGCDC'
288
+ spec.override_inheritance_chain('wxGCDC', ['wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version >= '3.3.0'
280
289
  spec.make_abstract 'wxGCDC'
281
290
  spec.ignore 'wxGCDC::wxGCDC'
282
291
  # like all DC this should best always be a temporary stack object
@@ -382,7 +391,11 @@ module WXRuby3
382
391
  spec.ignore 'wxGCDC::wxGCDC(const wxEnhMetaFileDC &)'
383
392
  when 'wxScaledDC'
384
393
  spec.items.clear # wxRuby extension; no XML docs
385
- spec.override_inheritance_chain('wxScaledDC', %w[wxDC wxObject])
394
+ if Config.instance.wx_version >= '3.3.0'
395
+ spec.override_inheritance_chain('wxScaledDC', ['wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject'])
396
+ else
397
+ spec.override_inheritance_chain('wxScaledDC', %w[wxDC wxObject])
398
+ end
386
399
  # as there are no dependencies parsed from XML make sure we're initialized after Wx::DC
387
400
  spec.initialize_at_end = true
388
401
  spec.no_proxy 'wxScaledDC'
@@ -422,6 +435,7 @@ module WXRuby3
422
435
  };
423
436
  __HEREDOC
424
437
  when 'wxPrinterDC'
438
+ spec.override_inheritance_chain('wxPrinterDC', ['wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version >= '3.3.0'
425
439
  spec.make_abstract 'wxPrinterDC'
426
440
  spec.ignore 'wxPrinterDC::wxPrinterDC'
427
441
  # as a PrinterDC should best always be a temporary stack object
@@ -444,6 +458,7 @@ module WXRuby3
444
458
  }
445
459
  __HEREDOC
446
460
  when 'wxPostScriptDC'
461
+ spec.override_inheritance_chain('wxPostScriptDC', ['wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version >= '3.3.0'
447
462
  spec.make_abstract 'wxPostScriptDC'
448
463
  spec.ignore 'wxPostScriptDC::wxPostScriptDC'
449
464
  # as a PostScriptDC should best always be a temporary stack object
@@ -499,7 +514,44 @@ module WXRuby3
499
514
  return rc;
500
515
  }
501
516
  __HEREDOC
517
+ if Config.instance.wx_version >= '3.3.0'
518
+ spec.items << 'wxOverlayDC'
519
+ spec.override_inheritance_chain('wxOverlayDC', ['wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject'])
520
+ spec.make_abstract 'wxOverlayDC'
521
+ spec.ignore 'wxOverlayDC::wxOverlayDC'
522
+ spec.add_extend_code 'wxOverlayDC', <<~__HEREDOC
523
+ static VALUE draw_on(wxOverlay &overlay, wxWindow *win)
524
+ {
525
+ if (!wxRuby_IsAppRunning())
526
+ rb_raise(rb_eRuntimeError, "A running Wx::App is required.");
527
+ VALUE rc = Qnil;
528
+ if (rb_block_given_p ())
529
+ {
530
+ wxOverlayDC ovl_dc(overlay, win);
531
+ wxOverlayDC* ovl_dc_ptr = &ovl_dc;
532
+ VALUE rb_dc = SWIG_NewPointerObj(SWIG_as_voidptr(ovl_dc_ptr), SWIGTYPE_p_wxOverlayDC, 0);
533
+ rc = rb_yield(rb_dc);
534
+ }
535
+ return rc;
536
+ }
537
+ static VALUE draw_on(wxOverlay &overlay, wxWindow *win, const wxRect &rect)
538
+ {
539
+ if (!wxRuby_IsAppRunning())
540
+ rb_raise(rb_eRuntimeError, "A running Wx::App is required.");
541
+ VALUE rc = Qnil;
542
+ if (rb_block_given_p ())
543
+ {
544
+ wxOverlayDC ovl_dc(overlay, win, rect);
545
+ wxOverlayDC* ovl_dc_ptr = &ovl_dc;
546
+ VALUE rb_dc = SWIG_NewPointerObj(SWIG_as_voidptr(ovl_dc_ptr), SWIGTYPE_p_wxOverlayDC, 0);
547
+ rc = rb_yield(rb_dc);
548
+ }
549
+ return rc;
550
+ }
551
+ __HEREDOC
552
+ end
502
553
  else
554
+ spec.override_inheritance_chain(spec.module_name, ['wxDC', { 'wxReadOnlyDC' => 'wxDC' }, 'wxObject']) if Config.instance.wx_version >= '3.3.0'
503
555
  # ctors of all other derived DC require a running App
504
556
  spec.require_app spec.module_name
505
557
  end
@@ -16,7 +16,9 @@ module WXRuby3
16
16
  spec.items << 'wxRibbonPageTabInfo' << 'wxRibbonMSWArtProvider' << 'wxRibbonAUIArtProvider'
17
17
  super
18
18
  spec.gc_as_object 'wxRibbonArtProvider'
19
+ spec.make_abstract 'wxRibbonArtProvider'
19
20
  spec.gc_as_untracked 'wxRibbonPageTabInfo'
21
+ spec.disable_proxies
20
22
  spec.suppress_warning(473,
21
23
  'wxRibbonArtProvider::Clone',
22
24
  'wxRibbonMSWArtProvider::Clone',
@@ -20,6 +20,22 @@ module WXRuby3
20
20
  super
21
21
  spec.items << 'wxRichTextFontTable' << 'wxRichTextFieldType' << 'wxRichTextFieldTypeStandard' << 'wxRichTextDrawingHandler'
22
22
  spec.make_abstract 'wxRichTextFieldType'
23
+ if Config.instance.wx_version >= '3.3.0'
24
+ # make Ruby director and wrappers use custom implementation
25
+ spec.use_class_implementation('wxRichTextFieldType', 'wxRubyRichTextFieldType')
26
+ spec.add_header_code <<~__HEREDOC
27
+ class wxRubyRichTextFieldType : public wxRichTextFieldType
28
+ {
29
+ public:
30
+ virtual ~wxRubyRichTextFieldType() {}
31
+ wxRubyRichTextFieldType(const wxString &name=wxEmptyString) : wxRichTextFieldType(name) {}
32
+ wxRubyRichTextFieldType(const wxRichTextFieldType &fieldType) : wxRichTextFieldType(fieldType) {}
33
+ virtual bool Draw(wxRichTextField *, wxDC &, wxRichTextDrawingContext &, const wxRichTextRange &, const wxRichTextSelection &, const wxRect &, int , int ) { return false; }
34
+ virtual bool Layout(wxRichTextField *, wxReadOnlyDC &, wxRichTextDrawingContext &, const wxRect &, const wxRect &, int) { return false; }
35
+ virtual bool GetRangeSize(wxRichTextField *, const wxRichTextRange &, wxSize &, int &, wxReadOnlyDC &, wxRichTextDrawingContext &, int, const wxPoint &, const wxSize &, wxArrayInt *) const { return false; }
36
+ };
37
+ __HEREDOC
38
+ end
23
39
  spec.no_proxy 'wxRichTextFontTable'
24
40
  spec.include 'wx/richtext/richtextstyles.h'
25
41
  spec.ignore %w[
@@ -120,6 +120,7 @@ module WXRuby3
120
120
  end
121
121
  if Config.instance.wx_version >= '3.3.0'
122
122
  spec.ignore_unless('WXMSW', 'wxWindow::MSWDisableComposited')
123
+ spec.ignore('wxWindow::GTKGetWin32Handle')
123
124
  end
124
125
  if Config.instance.features_set?('USE_ACCESSIBILITY')
125
126
  spec.disown 'wxAccessible *accessible'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wxruby3
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Corino
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-02 00:00:00.000000000 Z
11
+ date: 2024-08-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -1191,7 +1191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1191
1191
  - !ruby/object:Gem::Version
1192
1192
  version: '0'
1193
1193
  requirements: []
1194
- rubygems_version: 3.5.9
1194
+ rubygems_version: 3.5.11
1195
1195
  signing_key:
1196
1196
  specification_version: 4
1197
1197
  summary: wxWidgets extension for Ruby