wxruby3 0.9.8 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (154) hide show
  1. checksums.yaml +4 -4
  2. data/INSTALL.md +23 -1
  3. data/README.md +12 -26
  4. data/ext/mkrf_conf_ext.rb +11 -7
  5. data/lib/wx/core/app.rb +16 -0
  6. data/lib/wx/core/colour.rb +36 -28
  7. data/lib/wx/core/const.rb +19 -0
  8. data/lib/wx/core/enum.rb +17 -1
  9. data/lib/wx/core/geometry.rb +121 -0
  10. data/lib/wx/core/graphics_pen_info.rb +18 -0
  11. data/lib/wx/core/image.rb +49 -0
  12. data/lib/wx/core/menu_bar.rb +11 -0
  13. data/lib/wx/core/paintdc.rb +9 -3
  14. data/lib/wx/doc/app.rb +97 -41
  15. data/lib/wx/doc/bitmap.rb +4 -0
  16. data/lib/wx/doc/client_dc.rb +2 -2
  17. data/lib/wx/doc/clipboard.rb +1 -1
  18. data/lib/wx/doc/colour.rb +12 -0
  19. data/lib/wx/doc/const.rb +16 -0
  20. data/lib/wx/doc/cursor.rb +4 -0
  21. data/lib/wx/doc/dc_overlay.rb +34 -0
  22. data/lib/wx/doc/enum.rb +7 -1
  23. data/lib/wx/doc/event_blocker.rb +1 -1
  24. data/lib/wx/doc/evthandler.rb +25 -3
  25. data/lib/wx/doc/functions.rb +3 -6
  26. data/lib/wx/doc/gc_dc.rb +13 -4
  27. data/lib/wx/doc/geometry.rb +136 -0
  28. data/lib/wx/doc/graphics_context.rb +25 -7
  29. data/lib/wx/doc/icon.rb +4 -0
  30. data/lib/wx/doc/image.rb +56 -0
  31. data/lib/wx/doc/list_ctrl.rb +6 -6
  32. data/lib/wx/doc/memory_dc.rb +2 -11
  33. data/lib/wx/doc/mirror_dc.rb +1 -1
  34. data/lib/wx/doc/pen.rb +26 -0
  35. data/lib/wx/doc/persistence_manager.rb +1 -1
  36. data/lib/wx/doc/persistent_object.rb +1 -1
  37. data/lib/wx/doc/pg/property_grid_interface.rb +3 -3
  38. data/lib/wx/doc/prt/printer_dc.rb +2 -2
  39. data/lib/wx/doc/region_iterator.rb +1 -1
  40. data/lib/wx/doc/scaled_dc.rb +1 -1
  41. data/lib/wx/doc/screen_dc.rb +1 -1
  42. data/lib/wx/doc/svg_file_dc.rb +1 -1
  43. data/lib/wx/doc/textctrl.rb +1 -1
  44. data/lib/wx/doc/tree_ctrl.rb +2 -2
  45. data/lib/wx/doc/validator.rb +6 -6
  46. data/lib/wx/doc/variant.rb +2 -2
  47. data/lib/wx/doc/window.rb +5 -4
  48. data/lib/wx/grid/keyword_defs.rb +1 -1
  49. data/lib/wx/html/keyword_defs.rb +3 -3
  50. data/lib/wx/keyword_defs.rb +76 -71
  51. data/lib/wx/pg/keyword_defs.rb +2 -2
  52. data/lib/wx/pg/pg_property.rb +12 -0
  53. data/lib/wx/rbn/keyword_defs.rb +1 -1
  54. data/lib/wx/rtc/keyword_defs.rb +1 -1
  55. data/lib/wx/stc/keyword_defs.rb +1 -1
  56. data/lib/wx/version.rb +1 -1
  57. data/lib/wx/wxruby/cmd/setup.rb +3 -0
  58. data/rakelib/configure.rb +7 -0
  59. data/rakelib/gem.rake +2 -1
  60. data/rakelib/gem.rb +3 -2
  61. data/rakelib/lib/config/linux.rb +1 -1
  62. data/rakelib/lib/config/unixish.rb +6 -7
  63. data/rakelib/lib/config.rb +25 -4
  64. data/rakelib/lib/core/include/enum.inc +31 -1
  65. data/rakelib/lib/director/affine_matrix.rb +51 -0
  66. data/rakelib/lib/director/app.rb +29 -13
  67. data/rakelib/lib/director/art_provider.rb +4 -0
  68. data/rakelib/lib/director/cursor.rb +6 -2
  69. data/rakelib/lib/director/dc.rb +1 -6
  70. data/rakelib/lib/director/derived_dc.rb +88 -31
  71. data/rakelib/lib/director/dialog.rb +0 -8
  72. data/rakelib/lib/director/geometry.rb +142 -0
  73. data/rakelib/lib/director/graphics_context.rb +3 -2
  74. data/rakelib/lib/director/graphics_object.rb +18 -25
  75. data/rakelib/lib/director/image.rb +59 -0
  76. data/rakelib/lib/director/menu.rb +2 -3
  77. data/rakelib/lib/director/menu_bar.rb +0 -3
  78. data/rakelib/lib/director/pen.rb +1 -1
  79. data/rakelib/lib/director/richtext_ctrl.rb +1 -1
  80. data/rakelib/lib/director/system_settings.rb +1 -1
  81. data/rakelib/lib/director/window.rb +4 -3
  82. data/rakelib/lib/extractor/function.rb +1 -1
  83. data/rakelib/lib/generate/doc/animation_ctrl.yaml +10 -0
  84. data/rakelib/lib/generate/doc/banner_window.yaml +35 -0
  85. data/rakelib/lib/generate/doc/graphics_context.yaml +12 -0
  86. data/rakelib/lib/generate/doc/graphics_object.yaml +12 -0
  87. data/rakelib/lib/generate/doc/grid_ctrl.yaml +25 -0
  88. data/rakelib/lib/generate/doc/header_ctrl.yaml +91 -0
  89. data/rakelib/lib/generate/doc/icon.yaml +10 -0
  90. data/rakelib/lib/generate/doc/info_bar.yaml +27 -0
  91. data/rakelib/lib/generate/doc/log.yaml +1 -1
  92. data/rakelib/lib/generate/doc/media_ctrl.yaml +27 -0
  93. data/rakelib/lib/generate/doc/persistent_window.yaml +22 -0
  94. data/rakelib/lib/generate/doc/pg_editor.yaml +1 -1
  95. data/rakelib/lib/generate/doc/pg_property.yaml +4 -4
  96. data/rakelib/lib/generate/doc/rearrange_list.yaml +14 -0
  97. data/rakelib/lib/generate/doc/ribbon_panel.yaml +15 -0
  98. data/rakelib/lib/generate/doc/rich_text_formatting_dialog.yaml +26 -0
  99. data/rakelib/lib/generate/doc/text_ctrl.yaml +1 -1
  100. data/rakelib/lib/generate/doc/wizard.yaml +27 -0
  101. data/rakelib/lib/generate/doc.rb +4 -4
  102. data/rakelib/lib/generate/interface.rb +1 -1
  103. data/rakelib/lib/specs/interfaces.rb +3 -0
  104. data/rakelib/lib/swig_runner.rb +24 -3
  105. data/rakelib/lib/typemap/points_list.rb +8 -2
  106. data/rakelib/lib/typemap/richtext.rb +17 -0
  107. data/rakelib/yard/templates/default/fulldoc/html/setup.rb +3 -3
  108. data/samples/dialogs/wizard.rb +20 -19
  109. data/samples/drawing/art/drawing/image.bmp +0 -0
  110. data/samples/drawing/art/drawing/mask.bmp +0 -0
  111. data/samples/drawing/art/drawing/pat35.bmp +0 -0
  112. data/samples/drawing/art/drawing/pat36.bmp +0 -0
  113. data/samples/drawing/art/drawing/pat4.bmp +0 -0
  114. data/samples/drawing/art/drawing/smile.xpm +42 -0
  115. data/samples/drawing/drawing.rb +2276 -0
  116. data/samples/drawing/tn_drawing.png +0 -0
  117. data/samples/html/html.rb +1 -1
  118. data/samples/propgrid/propgrid.rb +1 -1
  119. data/samples/propgrid/propgrid_minimal.rb +1 -1
  120. data/samples/propgrid/sample_props.rb +1 -1
  121. data/samples/sampler/editor.rb +13 -11
  122. data/samples/sampler.rb +14 -10
  123. data/samples/text/richtext.rb +53 -0
  124. data/samples/text/scintilla.rb +1 -1
  125. data/samples/text/unicode.rb +4 -4
  126. data/tests/test_ext_controls.rb +12 -5
  127. data/tests/test_std_controls.rb +12 -12
  128. metadata +30 -30
  129. data/lib/wx/doc/extra/00_starting.md +0 -154
  130. data/lib/wx/doc/extra/01_packages.md +0 -180
  131. data/lib/wx/doc/extra/02_lifecycles.md +0 -166
  132. data/lib/wx/doc/extra/03_dialogs.md +0 -57
  133. data/lib/wx/doc/extra/04_enums.md +0 -143
  134. data/lib/wx/doc/extra/05_event-handling.md +0 -191
  135. data/lib/wx/doc/extra/06_geometry.md +0 -62
  136. data/lib/wx/doc/extra/07_colour_and_font.md +0 -52
  137. data/lib/wx/doc/extra/08_extensions.md +0 -144
  138. data/lib/wx/doc/extra/09_exceptions.md +0 -54
  139. data/lib/wx/doc/extra/10_art.md +0 -111
  140. data/lib/wx/doc/extra/11_drawing_and_dc.md +0 -62
  141. data/lib/wx/doc/extra/12_client_data.md +0 -89
  142. data/lib/wx/doc/extra/13_validators.md +0 -139
  143. data/lib/wx/doc/extra/14_config.md +0 -101
  144. data/lib/wx/doc/extra/15_persistence.md +0 -148
  145. data/samples/sampler/back.xpm +0 -21
  146. data/samples/sampler/copy.xpm +0 -44
  147. data/samples/sampler/cut.xpm +0 -46
  148. data/samples/sampler/filesave.xpm +0 -42
  149. data/samples/sampler/find.xpm +0 -62
  150. data/samples/sampler/findrepl.xpm +0 -63
  151. data/samples/sampler/forward.xpm +0 -21
  152. data/samples/sampler/paste.xpm +0 -46
  153. data/samples/sampler/redo.xpm +0 -58
  154. data/samples/sampler/undo.xpm +0 -58
data/rakelib/gem.rb CHANGED
@@ -93,12 +93,13 @@ module WXRuby3
93
93
  end
94
94
 
95
95
  def make_bin_name
96
+ basename = "wxruby3#{WXRuby3.config.with_wxhead? ? '-head' : ''}"
96
97
  os = WXRuby3.config.sysinfo.os
97
98
  case os.id
98
99
  when :windows
99
- "wxruby3_#{os.distro}_ruby#{WXRuby3::Config.rb_ver_major}#{WXRuby3::Config.rb_ver_minor}"
100
+ "#{basename}_#{os.distro}_ruby#{WXRuby3::Config.rb_ver_major}#{WXRuby3::Config.rb_ver_minor}"
100
101
  else
101
- "wxruby3_#{os.distro}_#{os.release || '0'}_ruby#{WXRuby3::Config.rb_ver_major}#{WXRuby3::Config.rb_ver_minor}"
102
+ "#{basename}_#{os.distro}_#{os.release || '0'}_ruby#{WXRuby3::Config.rb_ver_major}#{WXRuby3::Config.rb_ver_minor}"
102
103
  end
103
104
  end
104
105
  private :make_bin_name
@@ -81,7 +81,7 @@ module WXRuby3
81
81
  @dll_pfx = 'lib'
82
82
 
83
83
  if @wx_version
84
- @extra_cflags.concat %w[-Wno-unused-function -Wno-conversion-null -Wno-maybe-uninitialized]
84
+ @extra_cflags.concat %w[-Wno-unused-function -Wno-conversion-null -Wno-maybe-uninitialized -Wno-deprecated-copy]
85
85
  @extra_cflags << ' -Wno-deprecated-declarations' unless @no_deprecated
86
86
 
87
87
  @ruby_ldflags << '-s' if @release_build # strip debug symbols for release build
@@ -92,11 +92,10 @@ module WXRuby3
92
92
  chdir(ext_path) do
93
93
  if (rc = sh("#{get_cfg_string('git')} clone https://github.com/wxWidgets/wxWidgets.git"))
94
94
  chdir('wxWidgets') do
95
- tag = if @wx_version
96
- "v#{@wx_version}"
97
- else
98
- expand("#{get_cfg_string('git')} tag").split("\n").select { |t| (/\Av3\.(\d+)/ =~ t) && $1.to_i >= 2 }.max
99
- end
95
+ tag = wx_gitref ||
96
+ expand("#{get_cfg_string('git')} tag").split("\n").select do |t|
97
+ (/\Av(\d+)\.(\d+)\.\d+\Z/ =~ t) && (($1.to_i == 3 && $2.to_i >= 2) || $1.to_i > 3)
98
+ end.max
100
99
  # checkout the version we are building against
101
100
  rc = sh("#{get_cfg_string('git')} checkout #{tag}")
102
101
  end
@@ -220,8 +219,8 @@ module WXRuby3
220
219
  # add ruby defined shared ruby lib(s); not any other flags
221
220
  @ruby_libs.concat RB_CONFIG['LIBRUBYARG_SHARED'].split(' ').select { |s| s.start_with?('-l')}
222
221
 
223
- # maintain minimum compatibility with ABI 3.0.0
224
- @wx_abi_version = [ @wx_version, "3.0.0" ].min
222
+ # maintain minimum compatibility with ABI 3.0.1
223
+ @wx_abi_version = [ @wx_version, "3.0.1" ].min
225
224
  @wx_cppflags << "-DwxABI_VERSION=%s" % @wx_abi_version.tr(".", "0")
226
225
  end
227
226
  end
@@ -313,7 +313,7 @@ module WXRuby3
313
313
  private :make_ruby_cmd
314
314
 
315
315
  def execute(*cmd)
316
- do_run(*cmd.flatten)
316
+ sh(exec_env.merge({'RUBYLIB'=>rb_lib_path}), cmd.flatten.join(' '), fail_on_error: true)
317
317
  end
318
318
 
319
319
  def run(*cmd, capture: nil, verbose: true)
@@ -720,6 +720,10 @@ module WXRuby3
720
720
  get_config('with-wxwin')
721
721
  end
722
722
 
723
+ def with_wxhead?
724
+ get_config('with-wxhead')
725
+ end
726
+
723
727
  def wx_version
724
728
  @wx_version || ''
725
729
  end
@@ -760,6 +764,17 @@ module WXRuby3
760
764
  [ rake_deps_path, src_path, src_gen_path, obj_path, classes_path, common_path, interface_path ]
761
765
  end
762
766
 
767
+ def wx_gitref
768
+ if @wx_version
769
+ "v#{@wx_version}"
770
+ elsif get_config('with-wxhead')
771
+ 'master'
772
+ else
773
+ nil
774
+ end
775
+ end
776
+ private :wx_gitref
777
+
763
778
  def do_bootstrap
764
779
  install_prerequisites
765
780
  # do we have a local wxWidgets tree already?
@@ -832,9 +847,15 @@ module WXRuby3
832
847
  features = {}
833
848
 
834
849
  if is_configured? && wxwidgets_setup_h
835
- File.read(wxwidgets_setup_h).scan(/^\s*#define\s+(wx\w+|__\w+__)\s+([01])/) do | define |
836
- feat_val = $2.to_i.zero? ? false : true
837
- feat_id = $1.sub(/\Awx/i, '').gsub(/\A__|__\Z/, '')
850
+ File.read(wxwidgets_setup_h).scan(/^\s*#define\s+(wx\w+|__\w+__)\s+([01]|wx\w+)/) do | define |
851
+ val_str = $2
852
+ feat_str = $1
853
+ if val_str.start_with?('wx')
854
+ feat_val = !!features[val_str.sub(/\Awx/i, '')]
855
+ else
856
+ feat_val = val_str.to_i.zero? ? false : true
857
+ end
858
+ feat_id = feat_str.sub(/\Awx/i, '').gsub(/\A__|__\Z/, '')
838
859
  features[feat_id] = feat_val
839
860
  end
840
861
  # make sure correct platform defines are included as well which will not be the case always
@@ -177,6 +177,7 @@ static VALUE wx_Enum_sc_create_enum_class(int argc, VALUE *argv, VALUE self)
177
177
  ID id_to_i = rb_intern("to_i");
178
178
  ID id_const_set = rb_intern("const_set");
179
179
  VALUE enum_klass = rb_funcall(rb_cClass, id_new, 1, cWxEnum, 0);
180
+ VALUE enum_singleton_klass = rb_funcall(enum_klass, rb_intern("singleton_class"), 0, 0);
180
181
  VALUE enum_values = rb_funcall(argv[1], rb_intern("keys"), 0, 0);
181
182
  for (int i=0; i<RARRAY_LEN(enum_values) ;++i)
182
183
  {
@@ -184,6 +185,8 @@ static VALUE wx_Enum_sc_create_enum_class(int argc, VALUE *argv, VALUE self)
184
185
  VALUE enum_value_num = rb_funcall(rb_hash_aref(argv[1], enum_value_name), id_to_i, 0, 0);
185
186
  VALUE enum_value = rb_funcall(enum_klass, id_new, 1, enum_value_num, 0);
186
187
  rb_funcall(enum_klass, id_const_set, 2, enum_value_name, enum_value, 0);
188
+ rb_hash_aset(rb_iv_get(enum_singleton_klass, __iv_enum_klass_values), enum_value_num, enum_value);
189
+ rb_hash_aset(rb_iv_get(enum_singleton_klass, __iv_enum_klass_values_by_name), rb_to_symbol(enum_value_name), enum_value);
187
190
  }
188
191
  rb_hash_aset(rb_iv_get(cEnum_Singleton, __iv_Enum_sc_enums), enum_name, enum_klass);
189
192
  return enum_klass;
@@ -230,10 +233,31 @@ static VALUE wx_Enum_sc_get_enum_value(int argc, VALUE *argv, VALUE self)
230
233
  return rb_hash_aref(rb_iv_get(enum_singleton_klass, __iv_enum_klass_values_by_name), rb_to_symbol(argv[0]));
231
234
  }
232
235
 
236
+ static VALUE wx_Enum_sc_get_enum_values(VALUE self)
237
+ {
238
+ VALUE enum_singleton_klass = rb_funcall(self, rb_intern("singleton_class"), 0, 0);
239
+ return rb_iv_get(enum_singleton_klass, __iv_enum_klass_values);
240
+ }
241
+
242
+ static VALUE wx_Enum_sc_get_enum_values_by_name(VALUE self)
243
+ {
244
+ VALUE enum_singleton_klass = rb_funcall(self, rb_intern("singleton_class"), 0, 0);
245
+ return rb_iv_get(enum_singleton_klass, __iv_enum_klass_values_by_name);
246
+ }
247
+
248
+ static VALUE wx_Enum_sc_get_enum_names_by_value(VALUE self)
249
+ {
250
+ VALUE enum_singleton_klass = rb_funcall(self, rb_intern("singleton_class"), 0, 0);
251
+ return rb_funcall(rb_iv_get(enum_singleton_klass, __iv_enum_klass_values_by_name), rb_intern("invert"), 0);
252
+ }
253
+
233
254
  WXRB_EXPORT_FLAG VALUE wxRuby_CreateEnumClass(const char* enum_class_name_cstr)
234
255
  {
235
256
  VALUE enum_klass = rb_funcall(rb_cClass, rb_intern("new"), 1, cWxEnum, 0);
236
257
  rb_define_singleton_method(enum_klass, "[]", VALUEFUNC(wx_Enum_sc_get_enum_value), -1);
258
+ rb_define_singleton_method(enum_klass, "values", VALUEFUNC(wx_Enum_sc_get_enum_values), 0);
259
+ rb_define_singleton_method(enum_klass, "values_by_name", VALUEFUNC(wx_Enum_sc_get_enum_values_by_name), 0);
260
+ rb_define_singleton_method(enum_klass, "names_by_value", VALUEFUNC(wx_Enum_sc_get_enum_names_by_value), 0);
237
261
  VALUE enum_singleton_klass = rb_funcall(enum_klass, rb_intern("singleton_class"), 0, 0);
238
262
  rb_iv_set(enum_singleton_klass, __iv_enum_klass_values, rb_hash_new());
239
263
  rb_iv_set(enum_singleton_klass, __iv_enum_klass_values_by_name, rb_hash_new());
@@ -266,7 +290,13 @@ WXRB_EXPORT_FLAG VALUE wxRuby_GetEnumValueObject(const char* enum_wx_class_name_
266
290
  VALUE enum_klass = rb_hash_aref(enum_hash, ID2SYM(rb_intern(enum_class_name)));
267
291
  VALUE enum_singleton_klass = rb_funcall(enum_klass, rb_intern("singleton_class"), 0, 0);
268
292
  VALUE enum_values_hash = rb_iv_get(enum_singleton_klass, __iv_enum_klass_values);
269
- return rb_hash_aref(enum_values_hash, INT2NUM(enum_val));
293
+ VALUE rc = rb_hash_aref(enum_values_hash, INT2NUM(enum_val));
294
+ if (NIL_P(rc))
295
+ {
296
+ VALUE args[1] = { INT2NUM(enum_val) };
297
+ rc = rb_class_new_instance(1, args, enum_klass);
298
+ }
299
+ return rc;
270
300
  }
271
301
  return Qnil;
272
302
  }
@@ -0,0 +1,51 @@
1
+ # Copyright (c) 2023 M.J.N. Corino, The Netherlands
2
+ #
3
+ # This software is released under the MIT license.
4
+
5
+ ###
6
+ # wxRuby3 wxWidgets interface director
7
+ ###
8
+
9
+ module WXRuby3
10
+
11
+ class Director
12
+
13
+ class AffineMatrix2D < Director
14
+
15
+ def setup
16
+ spec.items.unshift('wxAffineMatrix2DBase') << 'wxMatrix2D'
17
+
18
+ spec.make_abstract 'wxAffineMatrix2DBase'
19
+ spec.disable_proxies
20
+
21
+ spec.map_apply 'int * OUTPUT' => ['wxDouble *']
22
+ spec.map 'wxPoint2DDouble *' => 'Wx::Point2DDouble' do
23
+ map_in ignore: true, temp: 'wxPoint2DDouble tmp', code: '$1 = &tmp;'
24
+
25
+ map_argout code: <<~__CODE
26
+ $result = SWIG_Ruby_AppendOutput($result, SWIG_NewPointerObj(new wxPoint2DDouble(tmp$argnum), SWIGTYPE_p_wxPoint2DDouble, SWIG_POINTER_OWN));
27
+ __CODE
28
+ end
29
+ spec.map 'wxMatrix2D *' => 'Wx::Matrix2D' do
30
+ map_in ignore: true, temp: 'wxMatrix2D tmp', code: '$1 = &tmp;'
31
+
32
+ map_argout code: <<~__CODE
33
+ $result = SWIG_Ruby_AppendOutput($result, SWIG_NewPointerObj(new wxMatrix2D(tmp$argnum), SWIGTYPE_p_wxPoint2DDouble, SWIG_POINTER_OWN));
34
+ __CODE
35
+ end
36
+
37
+ spec.ignore 'wxAffineMatrix2D::Mirror',
38
+ 'wxAffineMatrix2D::TransformPoint',
39
+ 'wxAffineMatrix2D::TransformDistance',
40
+ 'wxAffineMatrix2D::IsEqual'
41
+
42
+ spec.regard 'wxMatrix2D::m_11', 'wxMatrix2D::m_12',
43
+ 'wxMatrix2D::m_21', 'wxMatrix2D::m_22'
44
+
45
+ end
46
+
47
+ end
48
+
49
+ end
50
+
51
+ end
@@ -87,31 +87,47 @@ module WXRuby3
87
87
  }
88
88
  __HEREDOC
89
89
  if Config.platform == :macosx
90
- # add accessor methods for the standard OSX menu items
90
+ # add static accessor methods for the standard OSX menu items
91
91
  spec.add_extend_code 'wxApp', <<~__HEREDOC
92
- void set_mac_about_menu_itemid(long menu_itemid)
92
+ static void set_mac_about_menu_itemid(long menu_itemid)
93
93
  {
94
- $self->s_macAboutMenuItemId = menu_itemid;
94
+ wxApp::s_macAboutMenuItemId = menu_itemid;
95
95
  }
96
- long get_mac_about_menu_itemid(long menu_itemid)
96
+ static long get_mac_about_menu_itemid(long menu_itemid)
97
97
  {
98
- return $self->s_macAboutMenuItemId;
98
+ return wxApp::s_macAboutMenuItemId;
99
99
  }
100
- void set_mac_preferences_menu_itemid(long menu_itemid)
100
+ static void set_mac_preferences_menu_itemid(long menu_itemid)
101
101
  {
102
- $self->s_macPreferencesMenuItemId = menu_itemid;
102
+ wxApp::s_macPreferencesMenuItemId = menu_itemid;
103
103
  }
104
- long get_mac_preferences_menu_itemid(long menu_itemid)
104
+ static long get_mac_preferences_menu_itemid(long menu_itemid)
105
105
  {
106
- return $self->s_macPreferencesMenuItemId;
106
+ return wxApp::s_macPreferencesMenuItemId;
107
107
  }
108
- void set_mac_exit_menu_itemid(long menu_itemid)
108
+ static void set_mac_exit_menu_itemid(long menu_itemid)
109
109
  {
110
- $self->s_macExitMenuItemId = menu_itemid;
110
+ wxApp::s_macExitMenuItemId = menu_itemid;
111
111
  }
112
- long get_mac_exit_menu_itemid(long menu_itemid)
112
+ static long get_mac_exit_menu_itemid(long menu_itemid)
113
113
  {
114
- return $self->s_macExitMenuItemId;
114
+ return wxApp::s_macExitMenuItemId;
115
+ }
116
+ static void set_mac_help_menu_title(const wxString& title)
117
+ {
118
+ wxApp::s_macHelpMenuTitleName = title;
119
+ }
120
+ static const wxString& get_mac_help_menu_title()
121
+ {
122
+ return wxApp::s_macHelpMenuTitleName;
123
+ }
124
+ static void set_mac_window_menu_title(const wxString& title)
125
+ {
126
+ wxApp::s_macWindowMenuTitleName = title;
127
+ }
128
+ static const wxString& get_mac_window_menu_title()
129
+ {
130
+ return wxApp::s_macWindowMenuTitleName;
115
131
  }
116
132
  __HEREDOC
117
133
  end
@@ -28,6 +28,10 @@ module WXRuby3
28
28
  // ArtId and ArtClient are basically just strings ...
29
29
  typedef wxString wxArtID;
30
30
  typedef wxString wxArtClient;
31
+
32
+ // Missing from docs
33
+ %constant const char* wxART_STOP = wxART_STOP;
34
+ %constant const char* wxART_REFRESH = wxART_REFRESH;
31
35
  __HEREDOC
32
36
  spec.map *%w[wxArtID wxArtClient], as: 'String', swig: false do
33
37
  map_in
@@ -20,8 +20,12 @@ module WXRuby3
20
20
  'wxCursor::wxCursor(const wxImage &)',
21
21
  'wxCursor::wxCursor(const char *const *)',
22
22
  'wxCursor::wxCursor(const wxCursor &)'
23
- spec.ignore 'wxCursor::wxCursor(const char[],int,int,int,int,const char[])',
24
- 'wxCursor::wxCursor(const char *const *)'
23
+ spec.ignore 'wxCursor::wxCursor(const char *const *)'
24
+ if Config.instance.wx_version >= '3.3.0'
25
+ spec.ignore 'wxCursor::wxCursor(const char[],int,int,int,int,const char[], const wxColour*, const wxColour*)'
26
+ else
27
+ spec.ignore 'wxCursor::wxCursor(const char[],int,int,int,int,const char[])'
28
+ end
25
29
  # ignore stock object (see RubyStockObjects.i)
26
30
  spec.ignore %w[wxSTANDARD_CURSOR wxHOURGLASS_CURSOR wxCROSS_CURSOR]
27
31
  super
@@ -36,13 +36,8 @@ module WXRuby3
36
36
  'wxDC::GetLogicalOrigin(wxCoord *,wxCoord *) const',
37
37
  'wxDC::GetHandle'
38
38
  ]
39
- # ignore Matrix Transformation methods until someone asks for them
40
- # TODO : possibly wrap at a later time
41
- spec.ignore 'wxDC::SetTransformMatrix',
42
- 'wxDC::GetTransformMatrix',
43
- 'wxDC::ResetTransformMatrix',
44
- 'wxDC::CanUseTransformMatrix'
45
39
  spec.disable_proxies
40
+ spec.disown 'wxGraphicsContext *ctx'
46
41
  spec.rename_for_ruby({
47
42
  'GetDimensions' => 'wxDC::GetSize(wxCoord *, wxCoord *) const',
48
43
  'GetDimensionsMM' => 'wxDC::GetSizeMM(wxCoord *, wxCoord *) const',
@@ -16,7 +16,8 @@ module WXRuby3
16
16
  super
17
17
  spec.disable_proxies
18
18
  spec.gc_as_untracked spec.module_name
19
- if spec.module_name == 'wxScreenDC'
19
+ case spec.module_name
20
+ when 'wxScreenDC'
20
21
  spec.make_abstract 'wxScreenDC'
21
22
  # as a ScreenDC should always be a temporary stack object
22
23
  # we do not allow creation in Ruby but rather provide a class
@@ -41,7 +42,7 @@ module WXRuby3
41
42
  spec.ignore 'wxScreenDC::StartDrawingOnTop',
42
43
  'wxScreenDC::EndDrawingOnTop',
43
44
  'wxScreenDC::wxScreenDC'
44
- elsif spec.module_name == 'wxClientDC'
45
+ when 'wxClientDC'
45
46
  spec.make_abstract 'wxClientDC'
46
47
  spec.ignore 'wxClientDC::wxClientDC'
47
48
  # as a ClientDC should best always be a temporary stack object
@@ -63,19 +64,38 @@ module WXRuby3
63
64
  return rc;
64
65
  }
65
66
  __HEREDOC
66
- elsif spec.module_name == 'wxPaintDC'
67
+ when 'wxPaintDC'
67
68
  spec.make_abstract 'wxPaintDC'
68
69
  spec.ignore 'wxPaintDC::wxPaintDC'
69
- elsif spec.module_name == 'wxMemoryDC'
70
- spec.items << 'wxBufferedDC' << 'wxBufferedPaintDC' << 'wxAutoBufferedPaintDC'
70
+ spec.add_header_code <<~__HEREDOC
71
+ // we need this static method here because we do not want SWIG to parse the preprocessor
72
+ // statements (#if/#else/#endif) which it does in %extend blocks
73
+ #include "wx/dcbuffer.h"
74
+ static VALUE do_check_native_double_buffer()
75
+ {
76
+ #if wxALWAYS_NATIVE_DOUBLE_BUFFER
77
+ return Qtrue;
78
+ #else
79
+ return Qfalse;
80
+ #endif
81
+ }
82
+ __HEREDOC
83
+ spec.add_extend_code 'wxPaintDC', <<~__HEREDOC
84
+ #include "wx/dcbuffer.h"
85
+ static VALUE has_native_double_buffer()
86
+ {
87
+ return do_check_native_double_buffer();
88
+ }
89
+ __HEREDOC
90
+ when 'wxMemoryDC'
91
+ spec.items << 'wxBufferedDC' << 'wxBufferedPaintDC'
92
+ spec.gc_as_untracked %w[wxBufferedDC wxBufferedPaintDC]
71
93
  spec.make_abstract 'wxMemoryDC'
72
94
  spec.make_abstract 'wxBufferedDC'
73
95
  spec.make_abstract 'wxBufferedPaintDC'
74
- spec.make_abstract 'wxAutoBufferedPaintDC'
75
96
  spec.ignore 'wxMemoryDC::wxMemoryDC',
76
97
  'wxBufferedDC::wxBufferedDC',
77
- 'wxBufferedPaintDC::wxBufferedPaintDC',
78
- 'wxAutoBufferedPaintDC::wxAutoBufferedPaintDC'
98
+ 'wxBufferedPaintDC::wxBufferedPaintDC'
79
99
  # like all DC's these should best always be a temporary stack objects
80
100
  # we do not allow creation in Ruby but rather provide a class
81
101
  # method for block execution on a temp dc
@@ -197,23 +217,7 @@ module WXRuby3
197
217
  return rc;
198
218
  }
199
219
  __HEREDOC
200
- spec.add_extend_code 'wxAutoBufferedPaintDC', <<~__HEREDOC
201
- static VALUE draw_on(wxWindow* tgt)
202
- {
203
- if (!wxRuby_IsAppRunning())
204
- rb_raise(rb_eRuntimeError, "A running Wx::App is required.");
205
- VALUE rc = Qnil;
206
- if (rb_block_given_p ())
207
- {
208
- wxAutoBufferedPaintDC dc(tgt);
209
- wxAutoBufferedPaintDC* dc_ptr = &dc;
210
- VALUE rb_dc = SWIG_NewPointerObj(SWIG_as_voidptr(dc_ptr), SWIGTYPE_p_wxAutoBufferedPaintDC, 0);
211
- rc = rb_yield(rb_dc);
212
- }
213
- return rc;
214
- }
215
- __HEREDOC
216
- elsif spec.module_name == 'wxMirrorDC'
220
+ when 'wxMirrorDC'
217
221
  spec.make_abstract 'wxMirrorDC'
218
222
  spec.ignore 'wxMirrorDC::wxMirrorDC'
219
223
  # as a MirrorDC should best always be a temporary stack object
@@ -235,7 +239,7 @@ module WXRuby3
235
239
  return rc;
236
240
  }
237
241
  __HEREDOC
238
- elsif spec.module_name == 'wxSVGFileDC'
242
+ when 'wxSVGFileDC'
239
243
  spec.items.concat %w[wxSVGBitmapHandler wxSVGBitmapFileHandler wxSVGBitmapEmbedHandler]
240
244
  spec.make_abstract 'wxSVGFileDC'
241
245
  spec.ignore 'wxSVGFileDC::wxSVGFileDC'
@@ -272,7 +276,7 @@ module WXRuby3
272
276
  'wxSVGFileDC::EndDoc',
273
277
  'wxSVGFileDC::StartPage',
274
278
  'wxSVGFileDC::EndPage'
275
- elsif spec.module_name == 'wxGCDC'
279
+ when 'wxGCDC'
276
280
  spec.make_abstract 'wxGCDC'
277
281
  spec.ignore 'wxGCDC::wxGCDC'
278
282
  # like all DC this should best always be a temporary stack object
@@ -301,6 +305,24 @@ module WXRuby3
301
305
  __HEREDOC
302
306
  end
303
307
  spec.add_extend_code 'wxGCDC', <<~__HEREDOC
308
+ static VALUE draw_on()
309
+ {
310
+ if (!wxRuby_IsAppRunning())
311
+ rb_raise(rb_eRuntimeError, "A running Wx::App is required.");
312
+ VALUE rc = Qnil;
313
+ if (rb_block_given_p ())
314
+ {
315
+ // Somehow there seems to be a problem with the Ruby GCDC value
316
+ // being GC-ed unless we block GC for the duration of the block
317
+ // execution. Unclear why. We have similar code for other objects
318
+ // where this issue does not come up.
319
+ wxGCDC gc_dc;
320
+ wxGCDC* dc_ptr = &gc_dc;
321
+ VALUE rb_dc = SWIG_NewPointerObj(SWIG_as_voidptr(dc_ptr), SWIGTYPE_p_wxGCDC, 0);
322
+ rc = rb_yield(rb_dc);
323
+ }
324
+ return rc;
325
+ }
304
326
  static VALUE draw_on(const wxWindowDC& dc)
305
327
  {
306
328
  if (!wxRuby_IsAppRunning())
@@ -355,9 +377,10 @@ module WXRuby3
355
377
  }
356
378
  return rc;
357
379
  }
358
- __HEREDOC
380
+ __HEREDOC
381
+ spec.disown 'wxGraphicsContext *gc'
359
382
  spec.ignore 'wxGCDC::wxGCDC(const wxEnhMetaFileDC &)'
360
- elsif spec.module_name == 'wxScaledDC'
383
+ when 'wxScaledDC'
361
384
  spec.items.clear # wxRuby extension; no XML docs
362
385
  spec.override_inheritance_chain('wxScaledDC', %w[wxDC wxObject])
363
386
  # as there are no dependencies parsed from XML make sure we're initialized after Wx::DC
@@ -398,7 +421,7 @@ module WXRuby3
398
421
  wxScaledDC(wxDC& target, double scale);
399
422
  };
400
423
  __HEREDOC
401
- elsif spec.module_name == 'wxPrinterDC'
424
+ when 'wxPrinterDC'
402
425
  spec.make_abstract 'wxPrinterDC'
403
426
  spec.ignore 'wxPrinterDC::wxPrinterDC'
404
427
  # as a PrinterDC should best always be a temporary stack object
@@ -420,7 +443,7 @@ module WXRuby3
420
443
  return rc;
421
444
  }
422
445
  __HEREDOC
423
- elsif spec.module_name == 'wxPostScriptDC'
446
+ when 'wxPostScriptDC'
424
447
  spec.make_abstract 'wxPostScriptDC'
425
448
  spec.ignore 'wxPostScriptDC::wxPostScriptDC'
426
449
  # as a PostScriptDC should best always be a temporary stack object
@@ -442,6 +465,40 @@ module WXRuby3
442
465
  return rc;
443
466
  }
444
467
  __HEREDOC
468
+ when 'wxDCOverlay'
469
+ spec.items << 'wxOverlay'
470
+ spec.make_abstract 'wxDCOverlay'
471
+ spec.ignore 'wxDCOverlay::wxDCOverlay'
472
+ spec.add_extend_code 'wxDCOverlay', <<~__HEREDOC
473
+ static VALUE draw_on(wxOverlay &overlay, wxDC *dc)
474
+ {
475
+ if (!wxRuby_IsAppRunning())
476
+ rb_raise(rb_eRuntimeError, "A running Wx::App is required.");
477
+ VALUE rc = Qnil;
478
+ if (rb_block_given_p ())
479
+ {
480
+ wxDCOverlay ovl_dc(overlay, dc);
481
+ wxDCOverlay* ovl_dc_ptr = &ovl_dc;
482
+ VALUE rb_dc = SWIG_NewPointerObj(SWIG_as_voidptr(ovl_dc_ptr), SWIGTYPE_p_wxDCOverlay, 0);
483
+ rc = rb_yield(rb_dc);
484
+ }
485
+ return rc;
486
+ }
487
+ static VALUE draw_on(wxOverlay &overlay, wxDC *dc, int x, int y, int width, int height)
488
+ {
489
+ if (!wxRuby_IsAppRunning())
490
+ rb_raise(rb_eRuntimeError, "A running Wx::App is required.");
491
+ VALUE rc = Qnil;
492
+ if (rb_block_given_p ())
493
+ {
494
+ wxDCOverlay ovl_dc(overlay, dc, x, y, width, height);
495
+ wxDCOverlay* ovl_dc_ptr = &ovl_dc;
496
+ VALUE rb_dc = SWIG_NewPointerObj(SWIG_as_voidptr(ovl_dc_ptr), SWIGTYPE_p_wxDCOverlay, 0);
497
+ rc = rb_yield(rb_dc);
498
+ }
499
+ return rc;
500
+ }
501
+ __HEREDOC
445
502
  else
446
503
  # ctors of all other derived DC require a running App
447
504
  spec.require_app spec.module_name
@@ -212,14 +212,6 @@ module WXRuby3
212
212
  return Qfalse;
213
213
  }
214
214
  __HEREDOC
215
- when 'wxSymbolPickerDialog'
216
- # redefine these to prevent problematic handling of title/caption defaults
217
- spec.ignore 'wxSymbolPickerDialog::wxSymbolPickerDialog(const wxString &, const wxString &, const wxString &, wxWindow *, wxWindowID, const wxString &, const wxPoint &, const wxSize &, long)',
218
- 'wxSymbolPickerDialog::Create',
219
- ignore_doc: false
220
- spec.extend_interface 'wxSymbolPickerDialog',
221
- 'wxSymbolPickerDialog(const wxString &symbol, const wxString &initialFont, const wxString &normalTextFont, wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &pos, const wxSize &size, long style)',
222
- 'bool Create(const wxString &symbol, const wxString &initialFont, const wxString &normalTextFont, wxWindow *parent, wxWindowID id, const wxString &caption, const wxPoint &pos, const wxSize &size, long style)'
223
215
  when 'wxWizard'
224
216
  # special handling
225
217
  spec.ignore 'wxWizard::GetBitmap'