wxruby3 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/ext/wxruby3/include/wxruby-runtime.h +3 -0
  3. data/ext/wxruby3/swig/common.i +22 -0
  4. data/ext/wxruby3/swig/custom/director.swg +296 -0
  5. data/ext/wxruby3/swig/custom/rubyapi.swg +19 -0
  6. data/ext/wxruby3/swig/custom/rubyerrors.swg +45 -0
  7. data/ext/wxruby3/swig/custom/rubyhead.swg +192 -0
  8. data/ext/wxruby3/swig/custom/rubyrun.swg +187 -0
  9. data/ext/wxruby3/swig/custom/swigrun.swg +363 -0
  10. data/ext/wxruby3/swig/custom/typemaps/swigtypemaps.swg +173 -0
  11. data/ext/wxruby3/swig/wx.i +50 -30
  12. data/lib/wx/core/const.rb +83 -0
  13. data/lib/wx/doc/const.rb +66 -66
  14. data/lib/wx/doc/event.rb +0 -6
  15. data/lib/wx/doc/functions.rb +9 -9
  16. data/lib/wx/doc/window.rb +5 -0
  17. data/lib/wx/keyword_defs.rb +43 -6
  18. data/lib/wx/version.rb +1 -1
  19. data/rakelib/lib/config/macosx.rb +1 -1
  20. data/rakelib/lib/core/include/funcall.inc +33 -14
  21. data/rakelib/lib/core/include/swigdirector.inc +384 -0
  22. data/rakelib/lib/core/include/swigrubyerrors.inc +161 -0
  23. data/{ext/wxruby3/swig/custom/swig4/rubyrun.swg → rakelib/lib/core/include/swigrubyrun.inc} +245 -120
  24. data/rakelib/lib/core/include/swigrun.inc +700 -0
  25. data/rakelib/lib/core/package.rb +5 -2
  26. data/rakelib/lib/core/parameter.rb +3 -0
  27. data/rakelib/lib/director/accelerator.rb +1 -1
  28. data/rakelib/lib/director/animation.rb +1 -1
  29. data/rakelib/lib/director/animation_ctrl.rb +20 -0
  30. data/rakelib/lib/director/app.rb +23 -5
  31. data/rakelib/lib/director/art_provider.rb +1 -1
  32. data/rakelib/lib/director/data_object_simple_base.rb +1 -2
  33. data/rakelib/lib/director/dialog.rb +5 -0
  34. data/rakelib/lib/director/dialup_event.rb +44 -0
  35. data/rakelib/lib/director/dialup_manager.rb +45 -0
  36. data/rakelib/lib/director/event.rb +20 -2
  37. data/rakelib/lib/director/file_ctrl.rb +35 -0
  38. data/rakelib/lib/director/file_ctrl_event.rb +26 -0
  39. data/rakelib/lib/director/gdicommon.rb +19 -1
  40. data/rakelib/lib/director/grid_cell_editor.rb +6 -6
  41. data/rakelib/lib/director/help_controller.rb +1 -1
  42. data/rakelib/lib/director/pgarray_editor_dialog.rb +0 -6
  43. data/rakelib/lib/director/pgeditor.rb +2 -2
  44. data/rakelib/lib/director/pgproperties.rb +2 -2
  45. data/rakelib/lib/director/richtext_buffer.rb +1 -1
  46. data/rakelib/lib/director/richtext_ctrl.rb +1 -1
  47. data/rakelib/lib/director/sash_event.rb +42 -0
  48. data/rakelib/lib/director/sizer.rb +64 -1
  49. data/rakelib/lib/director/sizer_item.rb +22 -0
  50. data/rakelib/lib/director/task_bar_icon.rb +1 -1
  51. data/rakelib/lib/director/tree_ctrl.rb +19 -44
  52. data/rakelib/lib/generate/doc/animation_ctrl.yaml +15 -0
  53. data/rakelib/lib/generate/doc/events.yaml +10 -4
  54. data/rakelib/lib/generate/doc/static_box.yaml +8 -0
  55. data/rakelib/lib/generate/doc/xml_resource.yaml +3 -0
  56. data/rakelib/lib/generate/doc.rb +14 -3
  57. data/rakelib/lib/generate/interface.rb +4 -3
  58. data/rakelib/lib/specs/interfaces.rb +5 -1
  59. data/rakelib/lib/swig_runner.rb +4 -50
  60. data/rakelib/lib/typemap/common.rb +24 -9
  61. data/rakelib/lib/typemap/data_format.rb +1 -1
  62. data/rakelib/lib/typemap/data_object_data.rb +2 -2
  63. data/rakelib/lib/typemap/pgprop_arg.rb +7 -2
  64. data/rakelib/lib/typemap/points_list.rb +5 -7
  65. data/rakelib/lib/util/string.rb +10 -8
  66. data/samples/text/richtext.rb +0 -30
  67. data/tests/test_app_exit_exception.rb +36 -0
  68. data/tests/test_app_init_exception.rb +20 -0
  69. data/tests/test_book_controls.rb +29 -0
  70. data/tests/test_exceptions.rb +41 -0
  71. data/tests/test_sizer.rb +43 -0
  72. data/tests/test_std_controls.rb +36 -0
  73. metadata +25 -4
  74. data/ext/wxruby3/swig/custom/swig3/rubyrun.swg +0 -456
@@ -16,6 +16,9 @@ module WXRuby3
16
16
  CONST_RE = /(\A|\W)const(\W|\Z)/
17
17
  MULTI_WORD_TYPES = %w[char short int long]
18
18
  def initialize(param)
19
+ # prevent unwanted splitting on whitespaces in template type decls
20
+ param = param.gsub(/\<\s+/, '<')
21
+ param.gsub!(/\s+\>/, '>')
19
22
  @array = false
20
23
  if ::Array === param
21
24
  @ctype, @name, arr = param
@@ -69,7 +69,7 @@ module WXRuby3
69
69
  for (int i = 0; i < RARRAY_LEN($input); i++)
70
70
  {
71
71
  SWIG_ConvertPtr(rb_ary_entry($input,i), (void **) &wx_acc_ent,
72
- SWIGTYPE_p_wxAcceleratorEntry, 1);
72
+ SWIGTYPE_p_wxAcceleratorEntry, 0);
73
73
  if (wx_acc_ent == NULL)
74
74
  rb_raise(rb_eTypeError, "Reference to null wxAcceleratorEntry");
75
75
  arr[i] = *wx_acc_ent;
@@ -60,7 +60,7 @@ module WXRuby3
60
60
  void* ptr = 0;
61
61
  int res$argnum = SWIG_ConvertPtr($result, &ptr, SWIGTYPE_p_wxImage, 0 );
62
62
  if (!SWIG_IsOK(res$argnum)) {
63
- Swig::DirectorTypeMismatchException::raise(rb_eTypeError, "Expected Wx::Image result");
63
+ Swig::DirectorTypeMismatchException::raise(swig_get_self(), "$symname", rb_eTypeError, "Expected Wx::Image result");
64
64
  }
65
65
  *$1 = *reinterpret_cast<wxImage*> (ptr);
66
66
  __CODE
@@ -18,6 +18,26 @@ module WXRuby3
18
18
 
19
19
  def setup
20
20
  super
21
+ if Config.instance.wx_version >= '3.3.0'
22
+ spec.items << 'wxAnimationBundle'
23
+ spec.ignore 'wxAnimationBundle::GetAll', ignore_doc: false
24
+ spec.add_extend_code 'wxAnimationBundle', <<~__HEREDOC
25
+ VALUE get_all() const
26
+ {
27
+ const std::vector<wxAnimation>& ani_list = $self->GetAll();
28
+ VALUE rb_ani_list = rb_ary_new();
29
+ for (const wxAnimation& ani : ani_list)
30
+ {
31
+ VALUE rb_ani = SWIG_NewPointerObj(new wxAnimation(ani), SWIGTYPE_p_wxAnimation, SWIG_POINTER_OWN);
32
+ rb_ary_push(rb_ani_list, rb_ani);
33
+ }
34
+ return rb_ani_list;
35
+ }
36
+ __HEREDOC
37
+ spec.map 'const std::vector<wxAnimation>&' => 'Array<Wx::Animation>', swig: false do
38
+ map_out code: ''
39
+ end
40
+ end
21
41
  spec.do_not_generate :variables, :enums, :defines, :functions
22
42
  end
23
43
  end # class AnimationCtrl
@@ -341,7 +341,17 @@ module WXRuby3
341
341
  // Get the ruby representation of the App object, and call the
342
342
  // ruby on_init method to set up the initial window state
343
343
  VALUE the_app = rb_const_get(#{spec.package.module_variable}, rb_intern("THE_APP"));
344
- VALUE result = wxRuby_Funcall(the_app, rb_intern("on_ruby_init"), 0, 0);
344
+ bool ex_caught = false;
345
+ VALUE result = wxRuby_Funcall(ex_caught, the_app, rb_intern("on_ruby_init"), 0, 0);
346
+
347
+ if (ex_caught)
348
+ {
349
+ #ifdef __WXRB_DEBUG__
350
+ wxRuby_PrintException(result);
351
+ #endif
352
+ rb_iv_set(the_app, "@exception", result);
353
+ result = Qfalse; // exit app
354
+ }
345
355
 
346
356
  // If on_init return any (ruby) true value, signal to wxWidgets to
347
357
  // enter the main event loop by returning true, else return false
@@ -371,7 +381,15 @@ module WXRuby3
371
381
  ID on_exit_id = rb_intern("on_exit");
372
382
  if (rb_funcall(the_app, rb_intern("respond_to?"), 1, ID2SYM(on_exit_id)) == Qtrue)
373
383
  {
374
- wxRuby_Funcall(the_app, on_exit_id, 0, 0);
384
+ bool ex_caught = false;
385
+ VALUE rc = wxRuby_Funcall(ex_caught, the_app, on_exit_id, 0, 0);
386
+ if (ex_caught)
387
+ {
388
+ #ifdef __WXRB_DEBUG__
389
+ wxRuby_PrintException(rc);
390
+ #endif
391
+ rb_iv_set(the_app, "@exception", rc);
392
+ }
375
393
  }
376
394
 
377
395
  // perform wxRuby cleanup
@@ -470,10 +488,10 @@ module WXRuby3
470
488
  VALUE msg = rb_funcall(err, message_id(), 0);
471
489
  VALUE err_name = rb_funcall(rb_funcall(err, class_id(), 0), name_id(), 0);
472
490
  VALUE bt = rb_funcall(err, backtrace_id(), 0);
473
- bt = rb_funcall(bt, join_id(), 1, rb_str_new2("\\n"));
491
+ bt = rb_funcall(bt, join_id(), 1, rb_str_new2("\\n\\tfrom "));
474
492
  std::cerr << std::endl
475
- << ' ' << StringValuePtr(err_name) << ": " << StringValuePtr(msg) << std::endl
476
- << StringValuePtr(bt) << std::endl;
493
+ << ' ' << StringValuePtr(msg) << '(' << StringValuePtr(err_name) << ')' << std::endl
494
+ << "\\tfrom " << StringValuePtr(bt) << std::endl << std::endl;
477
495
  }
478
496
  __HEREDOC
479
497
  super
@@ -53,7 +53,7 @@ module WXRuby3
53
53
  if ( TYPE(v_ret) == T_DATA )
54
54
  {
55
55
  void* ptr;
56
- SWIG_ConvertPtr(v_ret, &ptr, SWIGTYPE_p_wxSize, 1);
56
+ SWIG_ConvertPtr(v_ret, &ptr, SWIGTYPE_p_wxSize, 0);
57
57
  return *reinterpret_cast< wxSize * >(ptr);
58
58
  }
59
59
  else if ( TYPE(v_ret) == T_ARRAY )
@@ -105,8 +105,7 @@ module WXRuby3
105
105
  }
106
106
  else
107
107
  {
108
- Swig::DirectorTypeMismatchException::raise(rb_eTypeError,
109
- "get_data_here should return a string, or nil on failure");
108
+ Swig::DirectorTypeMismatchException::raise(swig_get_self(), "$symname", rb_eTypeError, "get_data_here should return a string, or nil on failure");
110
109
  }
111
110
  }
112
111
  else
@@ -87,6 +87,11 @@ module WXRuby3
87
87
  end
88
88
  spec.do_not_generate :functions
89
89
  when 'wxPropertySheetDialog'
90
+ # need to adjust sizer arg name to apply disown specs
91
+ spec.ignore 'wxPropertySheetDialog::SetInnerSizer(wxSizer *)', ignore_doc: false
92
+ spec.extend_interface 'wxPropertySheetDialog',
93
+ 'void SetInnerSizer(wxSizer *sizer_disown)'
94
+ spec.disown 'wxSizer *sizer_disown'
90
95
  spec.ignore 'wxPropertySheetDialog::GetContentWindow'
91
96
  # In Ruby a derived class with customized '#initialize' is far easier
92
97
  spec.ignore 'wxPropertySheetDialog::CreateBookCtrl'
@@ -0,0 +1,44 @@
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
+ require_relative './event'
10
+
11
+ module WXRuby3
12
+
13
+ class Director
14
+
15
+ class DialUpEvent < Event
16
+
17
+ def setup
18
+ super
19
+ spec.disable_proxies
20
+ # missing from interface docs
21
+ spec.add_swig_code '%constant int EVT_DIALUP_CONNECTED = wxEVT_DIALUP_CONNECTED;'
22
+ spec.add_swig_code '%constant int EVT_DIALUP_DISCONNECTED = wxEVT_DIALUP_DISCONNECTED;'
23
+ end
24
+
25
+ def doc_generator
26
+ DialUpEventDocGenerator.new(self)
27
+ end
28
+
29
+ end # class DialupEvent
30
+
31
+ end # class Director
32
+
33
+ class DialUpEventDocGenerator < DocGenerator
34
+
35
+ protected def gen_constants_doc(fdoc)
36
+ super
37
+ xref_table = package.all_modules.reduce(DocGenerator.constants_db) { |db, mod| db[mod] }
38
+ gen_constant_doc(fdoc, 'EVT_DIALUP_CONNECTED', xref_table['EVT_DIALUP_CONNECTED'], 'connected event')
39
+ gen_constant_doc(fdoc, 'EVT_DIALUP_DISCONNECTED', xref_table['EVT_DIALUP_DISCONNECTED'], 'disconnected event')
40
+ end
41
+
42
+ end
43
+
44
+ end # module WXRuby3
@@ -0,0 +1,45 @@
1
+ # Copyright (c) 2023 M.J.N. Corino, The Netherlands
2
+ #
3
+ # This software is released under the MIT license.
4
+
5
+ ###
6
+ # wxRuby3 Defs director
7
+ ###
8
+
9
+ module WXRuby3
10
+
11
+ class Director
12
+
13
+ class DialUpManager < Director
14
+
15
+ def setup
16
+ super
17
+ spec.gc_as_untracked
18
+ spec.make_abstract 'wxDialUpManager'
19
+ spec.disable_proxies
20
+ spec.ignore 'wxDialUpManager::GetISPNames', ignore_doc: false
21
+ spec.add_extend_code 'wxDialUpManager', <<~__HEREDOC
22
+ VALUE get_isp_names() const
23
+ {
24
+ VALUE rb_isps = rb_ary_new();
25
+ wxArrayString isps;
26
+ size_t n_isps = $self->GetISPNames(isps);
27
+ for (size_t i=0; i<n_isps ;++i)
28
+ {
29
+ rb_ary_push(rb_isps, WXSTR_TO_RSTR(isps.Item(i)));
30
+ }
31
+ return rb_isps;
32
+ }
33
+ __HEREDOC
34
+ spec.map 'wxArrayString& names', swig: false do
35
+ map_in ignore: true, code: ''
36
+ map_out ignore: 'size_t'
37
+ map_argout as: 'Array<String>'
38
+ end
39
+ end
40
+
41
+ end
42
+
43
+ end
44
+
45
+ end
@@ -201,8 +201,6 @@ module WXRuby3
201
201
  spec.add_swig_code %Q{%constant wxEventType wxEVT_MENU_HIGHLIGHT_ALL = wxEVT_MENU_HIGHLIGHT;}
202
202
  # add event type constant missing from interface defs
203
203
  spec.add_swig_code %Q{%constant wxEventType wxEVT_NC_PAINT = wxEVT_NC_PAINT;}
204
- # add undocumented global function
205
- spec.add_swig_code 'wxWindow* wxFindFocusDescendant(wxWindow* ancestor);'
206
204
  end
207
205
  super
208
206
  end
@@ -237,8 +235,28 @@ module WXRuby3
237
235
  end
238
236
  defmod
239
237
  end
238
+
239
+ def doc_generator
240
+ if spec.module_name == 'wxEvent'
241
+ EventDocGenerator.new(self)
242
+ else
243
+ super
244
+ end
245
+ end
246
+
240
247
  end # class Event
241
248
 
242
249
  end # class Director
243
250
 
251
+ class EventDocGenerator < DocGenerator
252
+
253
+ protected def gen_constants_doc(fdoc)
254
+ super
255
+ xref_table = package.all_modules.reduce(DocGenerator.constants_db) { |db, mod| db[mod] }
256
+ gen_constant_doc(fdoc, 'EVT_MENU_HIGHLIGHT_ALL', xref_table['EVT_MENU_HIGHLIGHT'], '')
257
+ gen_constant_doc(fdoc, 'EVT_NC_PAINT', xref_table['EVT_NC_PAINT'], '')
258
+ end
259
+
260
+ end
261
+
244
262
  end # module WXRuby3
@@ -0,0 +1,35 @@
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
+ require_relative './window'
10
+
11
+ module WXRuby3
12
+
13
+ class Director
14
+
15
+ class FileCtrl < Window
16
+
17
+ def setup
18
+ super
19
+ # for GetFileNames and GetPaths
20
+ spec.map 'wxArrayString &filenames', 'wxArrayString &paths', as: 'Array<String>' do
21
+ map_in ignore: true, temp: 'wxArrayString tmp', code: '$1 = &tmp;'
22
+ map_argout code: <<~__HEREDOC
23
+ $result = rb_ary_new();
24
+ for (size_t i=0; i<tmp$argnum.Count() ;++i)
25
+ {
26
+ rb_ary_push($result, WXSTR_TO_RSTR(tmp$argnum.Item(i)));
27
+ }
28
+ __HEREDOC
29
+ end
30
+ end
31
+ end # class FileCtrl
32
+
33
+ end # class Director
34
+
35
+ end # module WXRuby3
@@ -0,0 +1,26 @@
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
+ require_relative './event'
10
+
11
+ module WXRuby3
12
+
13
+ class Director
14
+
15
+ class FileCtrlEvent < Event
16
+
17
+ def setup
18
+ super
19
+ spec.disable_proxies
20
+ spec.do_not_generate(:variables, :defines, :enums, :functions) # with FileCtrl
21
+ end
22
+ end # class FileCtrlEvent
23
+
24
+ end # class Director
25
+
26
+ end # module WXRuby3
@@ -22,6 +22,24 @@ module WXRuby3
22
22
  spec.ignore %w{
23
23
  wxTheColourDatabase
24
24
  }
25
+ if Config.instance.wx_version >= '3.3.0'
26
+ spec.ignore 'wxColourDatabase::GetAllNames', ignore_doc: false
27
+ spec.add_extend_code 'wxColourDatabase', <<~__HEREDOC
28
+ VALUE get_all_names() const
29
+ {
30
+ wxVector<wxString> nms = $self->GetAllNames();
31
+ VALUE rb_nms = rb_ary_new();
32
+ for (const wxString& nm : nms)
33
+ {
34
+ rb_ary_push(rb_nms, WXSTR_TO_RSTR(nm));
35
+ }
36
+ return rb_nms;
37
+ }
38
+ __HEREDOC
39
+ spec.map 'wxVector<wxString>' => 'Array<String>', swig: false do
40
+ map_out code: ''
41
+ end
42
+ end
25
43
  spec.ignore [
26
44
  'wxClientDisplayRect(int *,int *,int *,int *)',
27
45
  'wxDisplaySize(int *,int *)',
@@ -38,7 +56,7 @@ module WXRuby3
38
56
  if ( TYPE($input) == T_DATA )
39
57
  {
40
58
  void* argp$argnum;
41
- SWIG_ConvertPtr($input, &argp$argnum, $1_descriptor, 1 );
59
+ SWIG_ConvertPtr($input, &argp$argnum, $1_descriptor, 0);
42
60
  $1 = reinterpret_cast< $1_basetype * >(argp$argnum);
43
61
  }
44
62
  else
@@ -182,12 +182,12 @@ module WXRuby3
182
182
  static WxRuby_ID ga_mouse_id("mouse");
183
183
 
184
184
  inline wxGridActivationResult
185
- array_to_wxGridActivationResult(VALUE rbarr)
185
+ array_to_wxGridActivationResult(VALUE self, const char* method, VALUE rbarr)
186
186
  {
187
187
  if (rbarr == Qnil ||
188
188
  !(TYPE(rbarr) == T_ARRAY || TYPE(rbarr) == T_SYMBOL))
189
189
  {
190
- Swig::DirectorTypeMismatchException::raise(SWIG_ErrorType(SWIG_ArgError(SWIG_ERROR)),
190
+ Swig::DirectorTypeMismatchException::raise(self, method, SWIG_ErrorType(SWIG_ArgError(SWIG_ERROR)),
191
191
  "in output value of type 'wxGridActivationResult'");
192
192
  }
193
193
  if (TYPE(rbarr) == T_SYMBOL)
@@ -197,7 +197,7 @@ module WXRuby3
197
197
  else if (SYM2ID(rbarr) == ga_show_editor_id())
198
198
  return wxGridActivationResult::DoEdit();
199
199
  else
200
- Swig::DirectorTypeMismatchException::raise(SWIG_ErrorType(SWIG_ArgError(SWIG_ERROR)),
200
+ Swig::DirectorTypeMismatchException::raise(self, method, SWIG_ErrorType(SWIG_ArgError(SWIG_ERROR)),
201
201
  "in output value of type 'wxGridActivationResult'");
202
202
  }
203
203
  else
@@ -206,7 +206,7 @@ module WXRuby3
206
206
  VALUE rbStr = rb_ary_shift(rbarr); // could be nil
207
207
  if (rbAction == Qnil || TYPE(rbAction) != T_SYMBOL)
208
208
  {
209
- Swig::DirectorTypeMismatchException::raise(SWIG_ErrorType(SWIG_ArgError(SWIG_ERROR)),
209
+ Swig::DirectorTypeMismatchException::raise(self, method, SWIG_ErrorType(SWIG_ArgError(SWIG_ERROR)),
210
210
  "in output value of type 'wxGridActivationResult'");
211
211
  }
212
212
  else if (SYM2ID(rbAction) == ga_change_id() && rbStr != Qnil)
@@ -220,7 +220,7 @@ module WXRuby3
220
220
  else if (SYM2ID(rbAction) == ga_show_editor_id())
221
221
  return wxGridActivationResult::DoEdit();
222
222
  else
223
- Swig::DirectorTypeMismatchException::raise(SWIG_ErrorType(SWIG_ArgError(SWIG_ERROR)),
223
+ Swig::DirectorTypeMismatchException::raise(self, method, SWIG_ErrorType(SWIG_ArgError(SWIG_ERROR)),
224
224
  "in output value of type 'wxGridActivationResult'");
225
225
  }
226
226
  }
@@ -366,7 +366,7 @@ module WXRuby3
366
366
  obj2 = SWIG_NewPointerObj(SWIG_as_voidptr(grid), SWIGTYPE_p_wxGrid, 0 );
367
367
  obj3 = wxGridActivationSource_to_array(actSource);
368
368
  result = rb_funcall(swig_get_self(), try_activate_id(), 4,obj0,obj1,obj2,obj3);
369
- return array_to_wxGridActivationResult(result);
369
+ return array_to_wxGridActivationResult(swig_get_self(), "try_activate", result);
370
370
  __METHOD__
371
371
  elsif !helpers_added && line["SwigDirector_#{module_name}::SwigDirector_#{module_name}(VALUE self"]
372
372
  # insert helper methods
@@ -16,7 +16,7 @@ module WXRuby3
16
16
 
17
17
  def setup
18
18
  super
19
- spec.items << 'wxHelpControllerBase'
19
+ spec.items << 'wxHelpControllerBase' << 'helpfrm.h'
20
20
  spec.fold_bases(spec.module_name => 'wxHelpControllerBase')
21
21
  spec.rename_for_ruby('Init' => "#{spec.module_name}::Initialize")
22
22
  # ignore these (pure virtual) decls
@@ -53,12 +53,6 @@ module WXRuby3
53
53
  spec.suppress_warning(473, 'wxPGArrayEditorDialog::GetTextCtrlValidator')
54
54
  # make sure SWIG knows this type is an enum
55
55
  spec.add_swig_code 'enum wxPGPropertyFlags;'
56
- if Config.instance.wx_version >= '3.3.0'
57
- # internal use only
58
- spec.ignore 'wxPG_PROP_PASSWORD',
59
- 'wxPG_PROP_USE_CHECKBOX',
60
- 'wxPG_PROP_USE_DCC'
61
- end
62
56
  end
63
57
  end # class PGArrayEditorDialog
64
58
 
@@ -51,7 +51,7 @@ module WXRuby3
51
51
  int res = SWIG_ConvertPtr(rb_ary_entry($input, 0), &ptr, SWIGTYPE_p_wxWindow, 0 | 0);
52
52
  if (!SWIG_IsOK(res))
53
53
  {
54
- Swig::DirectorTypeMismatchException::raise(SWIG_ErrorType(SWIG_ArgError(res)), "in primary output value of type 'wxWindow *'");
54
+ Swig::DirectorTypeMismatchException::raise(swig_get_self(), "$symname", SWIG_ErrorType(SWIG_ArgError(res)), "in primary output value of type 'wxWindow *'");
55
55
  }
56
56
  $result = wxPGWindowList(static_cast<wxWindow*>(ptr));
57
57
  if (RARRAY_LEN($input) > 1)
@@ -59,7 +59,7 @@ module WXRuby3
59
59
  res = SWIG_ConvertPtr(rb_ary_entry($input, 1), &ptr, SWIGTYPE_p_wxWindow, 0 | 0);
60
60
  if (!SWIG_IsOK(res))
61
61
  {
62
- Swig::DirectorTypeMismatchException::raise(SWIG_ErrorType(SWIG_ArgError(res)), "in secundary output value of type 'wxWindow *'");
62
+ Swig::DirectorTypeMismatchException::raise(swig_get_self(), "$symname", SWIG_ErrorType(SWIG_ArgError(res)), "in secundary output value of type 'wxWindow *'");
63
63
  }
64
64
  $result.SetSecondary(static_cast<wxWindow*>(ptr));
65
65
  }
@@ -174,7 +174,7 @@ module WXRuby3
174
174
  void* argp$argnum = NULL;
175
175
  if ( TYPE($input) == T_DATA )
176
176
  {
177
- if (SWIG_IsOK(SWIG_ConvertPtr($input, &argp$argnum, $1_descriptor, $argnum-1)) && argp$argnum)
177
+ if (SWIG_IsOK(SWIG_ConvertPtr($input, &argp$argnum, $1_descriptor, 0)) && argp$argnum)
178
178
  {
179
179
  $1 = reinterpret_cast< $1_basetype * >(argp$argnum);
180
180
  }
@@ -200,7 +200,7 @@ module WXRuby3
200
200
  }
201
201
  else
202
202
  {
203
- Swig::DirectorTypeMismatchException::raise(rb_eTypeError,
203
+ Swig::DirectorTypeMismatchException::raise(swig_get_self(), "$symname", rb_eTypeError,
204
204
  "on_custom_string_edit should return a string, or nil");
205
205
  }
206
206
  }
@@ -224,7 +224,7 @@ module WXRuby3
224
224
  int res = SWIG_ConvertPtr(rb_ary_entry(rb_int_arr, i), &ptr,SWIGTYPE_p_wxRichTextAttr, 0);
225
225
  if (!SWIG_IsOK(res))
226
226
  {
227
- Swig::DirectorTypeMismatchException::raise(SWIG_ErrorType(SWIG_ArgError(res)), "in output value of type '""Wx::RTC::RichTextAttr""'");
227
+ Swig::DirectorTypeMismatchException::raise(swig_get_self(), "$symname", SWIG_ErrorType(SWIG_ArgError(res)), "in output value of type '""Wx::RTC::RichTextAttr""'");
228
228
  }
229
229
  wxRichTextAttr* wx_att = static_cast< wxRichTextAttr* >(ptr);
230
230
  $1.Add(*wx_att);
@@ -153,7 +153,7 @@ module WXRuby3
153
153
  }
154
154
  else
155
155
  {
156
- Swig::DirectorTypeMismatchException::raise(rb_eTypeError,
156
+ Swig::DirectorTypeMismatchException::raise(swig_get_self(), "$symname", rb_eTypeError,
157
157
  "expected an Integer, or nil on failure");
158
158
  }
159
159
  }
@@ -0,0 +1,42 @@
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
+ require_relative './event'
10
+
11
+ module WXRuby3
12
+
13
+ class Director
14
+
15
+ class SashEvent < Event
16
+
17
+ def setup
18
+ super
19
+ spec.disable_proxies
20
+ # missing from interface docs
21
+ spec.add_swig_code '%constant int EVT_SASH_DRAGGED_RANGE = wxEVT_SASH_DRAGGED;'
22
+ end
23
+
24
+ def doc_generator
25
+ SashEventDocGenerator.new(self)
26
+ end
27
+
28
+ end # class SashEvent
29
+
30
+ end # class Director
31
+
32
+ class SashEventDocGenerator < DocGenerator
33
+
34
+ protected def gen_constants_doc(fdoc)
35
+ super
36
+ xref_table = package.all_modules.reduce(DocGenerator.constants_db) { |db, mod| db[mod] }
37
+ gen_constant_doc(fdoc, 'EVT_SASH_DRAGGED_RANGE', xref_table['EVT_SASH_DRAGGED'], '')
38
+ end
39
+
40
+ end
41
+
42
+ end # module WXRuby3
@@ -14,7 +14,6 @@ module WXRuby3
14
14
 
15
15
  def setup
16
16
  # Any nested sizers passed to Add() in are owned by C++, not GC'd by Ruby
17
- spec.disown 'wxSizer* sizer'
18
17
  case spec.module_name
19
18
  when 'wxSizer'
20
19
  spec.items << 'wxSizerFlags'
@@ -26,6 +25,64 @@ module WXRuby3
26
25
  'wxSizer::Insert(size_t, wxSizerItem *)',
27
26
  'wxSizer::Prepend(wxSizerItem *)'
28
27
  spec.ignore 'wxSizer::Remove(wxWindow *)' # long time deprecated
28
+ # need to adjust sizer arg name to apply disown specs
29
+ spec.ignore 'wxSizer::Add(wxSizer *, const wxSizerFlags &)',
30
+ 'wxSizer::Add(wxSizer *, int, int, int, wxObject *)',
31
+ 'wxSizer::Insert(size_t, wxSizer *, const wxSizerFlags &)',
32
+ 'wxSizer::Insert(size_t, wxSizer *, int, int, int, wxObject *)',
33
+ 'wxSizer::Prepend(wxSizer *, const wxSizerFlags &)',
34
+ 'wxSizer::Prepend(wxSizer *, int, int, int, wxObject *)',
35
+ ignore_doc: false
36
+ spec.extend_interface 'wxSizer',
37
+ 'wxSizerItem* Add(wxSizer *sizer_disown, const wxSizerFlags &flags)',
38
+ 'wxSizerItem* Add(wxSizer *sizer_disown, int proportion=0, int flag=0, int border=0, wxObject *userData=NULL)',
39
+ 'wxSizerItem* Insert(size_t index, wxSizer *sizer_disown, const wxSizerFlags &flags)',
40
+ 'wxSizerItem* Insert(size_t index, wxSizer *sizer_disown, int proportion=0, int flag=0, int border=0, wxObject *userData=NULL)',
41
+ 'wxSizerItem* Prepend(wxSizer *sizer_disown, const wxSizerFlags &flags)',
42
+ 'wxSizerItem* Prepend(wxSizer *sizer_disown, int proportion=0, int flag=0, int border=0, wxObject *userData=NULL)'
43
+ spec.disown 'wxSizer* sizer_disown'
44
+ # needs custom impl to transfer ownership of detached items
45
+ spec.ignore 'wxSizer::Detach(wxSizer*)',
46
+ 'wxSizer::Detach(int)', ignore_doc: false
47
+ spec.add_extend_code 'wxSizer', <<~__HEREDOC
48
+ bool detach(wxSizer* szr)
49
+ {
50
+ if ($self->Detach(szr))
51
+ {
52
+ VALUE rb_szr = SWIG_RubyInstanceFor(szr);
53
+ if (rb_szr && !NIL_P(rb_szr))
54
+ {
55
+ // transfer ownership to Ruby
56
+ RDATA(rb_szr)->dfree = GcSizerFreeFunc;
57
+ }
58
+ return true;
59
+ }
60
+ return false;
61
+ }
62
+
63
+ bool detach(int itm_nr)
64
+ {
65
+ wxSizerItem* itm = $self->GetItem(itm_nr);
66
+ if (itm)
67
+ {
68
+ VALUE rb_szr = Qnil;
69
+ if (itm->IsSizer())
70
+ {
71
+ rb_szr = SWIG_RubyInstanceFor(itm->GetSizer());
72
+ }
73
+ if ($self->Detach(itm_nr))
74
+ {
75
+ if (rb_szr && !NIL_P(rb_szr))
76
+ {
77
+ // transfer ownership to Ruby
78
+ RDATA(rb_szr)->dfree = GcSizerFreeFunc;
79
+ }
80
+ return true;
81
+ }
82
+ }
83
+ return false;
84
+ }
85
+ __HEREDOC
29
86
  # Typemap for GetChildren - convert to array of Sizer items
30
87
  spec.map 'wxSizerItemList&' => 'Array<Wx::SizerItem>' do
31
88
  map_out code: <<~__CODE
@@ -50,6 +107,12 @@ module WXRuby3
50
107
  spec.gc_as_untracked 'wxGBSpan', 'wxGBPosition'
51
108
  # cannot use this with wxRuby
52
109
  spec.ignore 'wxGridBagSizer::Add(wxGBSizerItem *)'
110
+ # need to adjust sizer arg name to apply disown specs
111
+ spec.ignore 'wxGridBagSizer::Add(wxSizer *, const wxGBPosition &, const wxGBSpan &, int, int, wxObject *)',
112
+ ignore_doc: false
113
+ spec.extend_interface 'wxGridBagSizer',
114
+ 'wxSizerItem *Add(wxSizer *sizer_disown, const wxGBPosition &pos, const wxGBSpan &span=wxDefaultSpan, int flag=0, int border=0, wxObject *userData=NULL)'
115
+ spec.disown 'wxSizer* sizer_disown'
53
116
  end
54
117
  # no real use for allowing these to be overloaded but a whole lot of grieve
55
118
  # if we do allow it
@@ -22,6 +22,28 @@ module WXRuby3
22
22
  # ignore constructors
23
23
  spec.ignore 'wxSizerItem::wxSizerItem'
24
24
  spec.ignore(%w[wxSizerItem::SetSizer wxSizerItem::SetSpacer wxSizerItem::SetWindow])
25
+ # need to adjust sizer arg name to apply disown specs
26
+ spec.ignore 'wxSizerItem::AssignSizer(wxSizer *)', ignore_doc: false
27
+ spec.extend_interface 'wxSizerItem',
28
+ 'void AssignSizer(wxSizer *sizer_disown)'
29
+ spec.disown 'wxSizer *sizer_disown'
30
+ # needs custom impl to properly transfer ownership to Ruby
31
+ spec.ignore 'wxSizerItem::DetachSizer', ignore_doc: false
32
+ spec.add_extend_code 'wxSizerItem', <<~__HEREDOC
33
+ void detach_sizer()
34
+ {
35
+ if ($self->IsSizer())
36
+ {
37
+ VALUE rb_szr = SWIG_RubyInstanceFor($self->GetSizer());
38
+ if (rb_szr && !NIL_P(rb_szr))
39
+ {
40
+ // transfer ownership to Ruby
41
+ RDATA(rb_szr)->dfree = GcSizerFreeFunc;
42
+ }
43
+ $self->DetachSizer();
44
+ }
45
+ }
46
+ __HEREDOC
25
47
  when 'wxGBSizerItem'
26
48
  spec.make_abstract 'wxGBSizerItem'
27
49
  # ignore constructors