wxruby3 0.9.0.pre.beta.11 → 0.9.0.pre.beta.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. checksums.yaml +4 -4
  2. data/INSTALL.md +85 -0
  3. data/README.md +2 -0
  4. data/assets/logo.png +0 -0
  5. data/assets/logo.svg +170 -0
  6. data/assets/logo.xcf +0 -0
  7. data/ext/wxruby3/swig/wx.i +1 -1
  8. data/lib/wx/core/array_ext.rb +26 -0
  9. data/lib/wx/core/art_locator.rb +92 -0
  10. data/lib/wx/core/artprovider.rb +1 -1
  11. data/lib/wx/core/bitmap.rb +90 -53
  12. data/lib/wx/core/cursor.rb +12 -0
  13. data/lib/wx/core/dataformat.rb +3 -1
  14. data/lib/wx/core/dc.rb +76 -52
  15. data/lib/wx/core/enum.rb +4 -0
  16. data/lib/wx/core/event.rb +38 -5
  17. data/lib/wx/core/evthandler.rb +64 -23
  18. data/lib/wx/core/icon.rb +50 -35
  19. data/lib/wx/core/id_helper.rb +32 -0
  20. data/lib/wx/core/image.rb +63 -53
  21. data/lib/wx/core/point.rb +14 -0
  22. data/lib/wx/core/real_point.rb +15 -1
  23. data/lib/wx/core/rect.rb +42 -7
  24. data/lib/wx/core/region_iterator.rb +37 -0
  25. data/lib/wx/core/size.rb +20 -0
  26. data/lib/wx/core/window.rb +8 -31
  27. data/lib/wx/doc/array_ext.rb +27 -0
  28. data/lib/wx/doc/art_locator.rb +57 -0
  29. data/lib/wx/doc/bitmap.rb +27 -0
  30. data/lib/wx/doc/clipboard.rb +12 -0
  31. data/lib/wx/doc/const.rb +77 -0
  32. data/lib/wx/doc/cursor.rb +16 -0
  33. data/lib/wx/doc/data_object.rb +1 -2
  34. data/lib/wx/doc/dc.rb +63 -46
  35. data/lib/wx/doc/event.rb +24 -0
  36. data/lib/wx/doc/events.rb +14 -0
  37. data/lib/wx/doc/evthandler.rb +24 -3
  38. data/lib/wx/doc/extra/00_starting.md +1 -1
  39. data/lib/wx/doc/extra/06_geometry.md +10 -4
  40. data/lib/wx/doc/extra/10_art.md +105 -0
  41. data/lib/wx/doc/gc_dc.rb +21 -0
  42. data/lib/wx/doc/gdi_common.rb +122 -1
  43. data/lib/wx/doc/graphics_context.rb +42 -0
  44. data/lib/wx/doc/icon.rb +18 -0
  45. data/lib/wx/doc/id_helper.rb +25 -0
  46. data/lib/wx/doc/image.rb +33 -0
  47. data/lib/wx/doc/region_iterator.rb +31 -0
  48. data/lib/wx/doc/scaled_dc.rb +1 -0
  49. data/lib/wx/doc/window.rb +18 -0
  50. data/lib/wx/version.rb +1 -1
  51. data/lib/wx/wxruby/cmd/sampler.rb +3 -21
  52. data/rakelib/lib/config.rb +4 -4
  53. data/rakelib/lib/core/package.rb +3 -3
  54. data/rakelib/lib/director/art_provider.rb +2 -2
  55. data/rakelib/lib/director/busy_info.rb +9 -7
  56. data/rakelib/lib/director/clipboard.rb +1 -1
  57. data/rakelib/lib/director/colour_picker_ctrl.rb +1 -0
  58. data/rakelib/lib/director/data_object.rb +72 -4
  59. data/rakelib/lib/director/derived_dc.rb +100 -6
  60. data/rakelib/lib/director/dir_picker_ctrl.rb +1 -0
  61. data/rakelib/lib/director/event.rb +73 -8
  62. data/rakelib/lib/director/events.rb +19 -1
  63. data/rakelib/lib/director/file_picker_ctrl.rb +1 -0
  64. data/rakelib/lib/director/font_picker_ctrl.rb +1 -0
  65. data/rakelib/lib/director/gdicommon.rb +1 -3
  66. data/rakelib/lib/director/graphics_context.rb +89 -0
  67. data/rakelib/lib/director/help_controller.rb +2 -2
  68. data/rakelib/lib/director/html_data_object.rb +37 -0
  69. data/rakelib/lib/director/image.rb +55 -0
  70. data/rakelib/lib/director/region_iterator.rb +48 -0
  71. data/rakelib/lib/director/richtext_buffer.rb +1 -1
  72. data/rakelib/lib/director/richtext_buffer_data_object.rb +45 -0
  73. data/rakelib/lib/director/scroll_bar.rb +39 -0
  74. data/rakelib/lib/director/slider.rb +39 -0
  75. data/rakelib/lib/director/window.rb +36 -5
  76. data/rakelib/lib/director/window_disabler.rb +0 -7
  77. data/rakelib/lib/extractor/class.rb +1 -1
  78. data/rakelib/lib/extractor/function.rb +1 -1
  79. data/rakelib/lib/generate/doc.rb +26 -6
  80. data/rakelib/lib/specs/interfaces.rb +6 -1
  81. data/rakelib/lib/typemap/common.rb +1 -1
  82. data/rakelib/lib/util/string.rb +29 -8
  83. data/samples/art/wxruby-128x128.png +0 -0
  84. data/samples/art/wxruby-256x256.png +0 -0
  85. data/samples/art/wxruby-64x64.png +0 -0
  86. data/samples/art/wxruby.ico +0 -0
  87. data/samples/art/wxruby.png +0 -0
  88. data/samples/drawing/graphics_drawing.rb +1 -2
  89. data/samples/propgrid/propgrid.rb +65 -65
  90. data/samples/sample.xpm +246 -470
  91. data/samples/treectrl/treectrl.rb +1 -1
  92. data/tests/art/my_art/sample.xpm +251 -0
  93. data/tests/art/sample3.xpm +251 -0
  94. data/tests/art/test_art/bitmap/sample.xpm +251 -0
  95. data/tests/art/test_art/bitmap/wxruby.bmp +0 -0
  96. data/tests/art/test_art/bitmap/wxruby.png +0 -0
  97. data/tests/art/test_art/bitmap/wxruby.xpm +251 -0
  98. data/tests/art/test_art/cursor/wxruby.bmp +0 -0
  99. data/tests/art/test_art/icon/sample.xpm +251 -0
  100. data/tests/art/test_art/icon/wxruby.ico +0 -0
  101. data/tests/art/test_art/icon/wxruby.png +0 -0
  102. data/tests/art/test_art/image/sample.xpm +251 -0
  103. data/tests/art/test_art/image/wxruby.jpg +0 -0
  104. data/tests/art/test_art/image/wxruby.png +0 -0
  105. data/tests/art/test_art/sample2.xpm +251 -0
  106. data/tests/test_art.rb +91 -0
  107. data/tests/test_clipboard.rb +35 -0
  108. data/tests/test_dc.rb +70 -0
  109. data/tests/test_events.rb +12 -0
  110. data/tests/test_geometry.rb +13 -0
  111. metadata +51 -5
@@ -0,0 +1,48 @@
1
+ ###
2
+ # wxRuby3 wxWidgets interface director
3
+ # Copyright (c) M.J.N. Corino, The Netherlands
4
+ ###
5
+
6
+ module WXRuby3
7
+
8
+ class Director
9
+
10
+ class RegionIterator < Director
11
+
12
+ def setup
13
+ super
14
+ spec.gc_never
15
+ spec.disable_proxies
16
+ spec.make_abstract 'wxRegionIterator'
17
+ # not useful in wxRuby
18
+ spec.ignore 'wxRegionIterator::Reset(const wxRegion &)',
19
+ 'wxRegionIterator::operator bool'
20
+ # add iteration control methods
21
+ spec.add_extend_code 'wxRegionIterator', <<~__HEREDOC
22
+ void next_rect()
23
+ {
24
+ $self->operator ++();
25
+ }
26
+ __HEREDOC
27
+ # add custom factory method
28
+ spec.add_extend_code 'wxRegionIterator', <<~__HEREDOC
29
+ static void for_region(const wxRegion& region)
30
+ {
31
+ wxRegionIterator region_it(region);
32
+ if (rb_block_given_p())
33
+ {
34
+ wxRegionIterator *p_region_it = &region_it;
35
+ VALUE rb_region_it = SWIG_NewPointerObj(SWIG_as_voidptr(p_region_it), SWIGTYPE_p_wxRegionIterator, 0);
36
+ rb_yield(rb_region_it);
37
+ SWIG_RubyRemoveTracking((void *)p_region_it);
38
+ DATA_PTR(rb_region_it) = NULL;
39
+ }
40
+ }
41
+ __HEREDOC
42
+ spec.do_not_generate :functions, :variables, :defines, :enums
43
+ end
44
+ end # class RegionIterator
45
+
46
+ end # class Director
47
+
48
+ end # module WXRuby3
@@ -22,7 +22,7 @@ module WXRuby3
22
22
  wxRichTextBuffer
23
23
  ]
24
24
  spec.gc_as_object 'wxRichTextAttr'
25
- spec.gc_never 'wxRichTextBuffer'
25
+ spec.gc_as_object 'wxRichTextBuffer'
26
26
  spec.override_inheritance_chain('wxRichTextBuffer', %w[wxObject])
27
27
  spec.ignore %w[
28
28
  wxRichTextBuffer::GetBatchedCommand
@@ -0,0 +1,45 @@
1
+ ###
2
+ # wxRuby3 wxWidgets interface director
3
+ # Copyright (c) M.J.N. Corino, The Netherlands
4
+ ###
5
+
6
+ module WXRuby3
7
+
8
+ class Director
9
+
10
+ class RichTextBufferDataObject < Director
11
+
12
+ include Typemap::DataFormat
13
+ include Typemap::DataObjectData
14
+
15
+ def setup
16
+ super
17
+ spec.gc_as_object
18
+ # make sure the build scripts know that DataObjectSimple is part of the DataObject module
19
+ spec.override_inheritance_chain('wxRichTextBufferDataObject', {'wxDataObjectSimple' => 'wxDataObject'}, 'wxDataObject')
20
+ # we only allow Ruby derivatives from wxDataObject but not of any of the C++ implemented
21
+ # specializations
22
+ spec.no_proxy 'wxRichTextBufferDataObject'
23
+ spec.add_swig_code <<~__HEREDOC
24
+ // SWIG gets confused and doesn't realise that various virtual methods
25
+ // from wxDataObject are implemented fully in this subclass, and so,
26
+ // believing it to be abstract doesn't provide an allocator for this
27
+ // class. This undocumented feature overrides this.
28
+ %feature("notabstract") wxRichTextBufferDataObject;
29
+ __HEREDOC
30
+
31
+ # ignore overrrides (will be available through base class)
32
+ spec.ignore 'wxRichTextBufferDataObject::GetPreferredFormat'
33
+ spec.ignore 'wxRichTextBufferDataObject::GetDataSize'
34
+ spec.ignore 'wxRichTextBufferDataObject::GetDataHere'
35
+ spec.ignore 'wxRichTextBufferDataObject::SetData'
36
+
37
+ spec.new_object 'wxRichTextBufferDataObject::GetRichTextBuffer'
38
+ spec.do_not_generate :variables, :defines, :functions, :enums
39
+ end
40
+
41
+ end
42
+
43
+ end
44
+
45
+ end
@@ -0,0 +1,39 @@
1
+ ###
2
+ # wxRuby3 wxWidgets interface director
3
+ # Copyright (c) M.J.N. Corino, The Netherlands
4
+ ###
5
+
6
+ require_relative './window'
7
+
8
+ module WXRuby3
9
+
10
+ class Director
11
+
12
+ class ScrollBar < Window
13
+
14
+ def setup
15
+ super
16
+ end
17
+
18
+ def process(gendoc: false)
19
+ defmod = super
20
+ # fix documentation errors for scroll events
21
+ def_item = defmod.find_item('wxScrollBar')
22
+ if def_item
23
+ def_item.event_types.each do |evt_spec|
24
+ case evt_spec.first
25
+ when 'EVT_COMMAND_SCROLL_THUMBRELEASE', 'EVT_COMMAND_SCROLL_CHANGED'
26
+ if evt_spec[2] == 0
27
+ evt_spec[2] = 1 # incorrectly documented without 'id' argument
28
+ evt_spec[4] = true # ignore extracted docs
29
+ end
30
+ end
31
+ end
32
+ end
33
+ defmod
34
+ end
35
+ end # class ScrollBar
36
+
37
+ end # class Director
38
+
39
+ end # module WXRuby3
@@ -0,0 +1,39 @@
1
+ ###
2
+ # wxRuby3 wxWidgets interface director
3
+ # Copyright (c) M.J.N. Corino, The Netherlands
4
+ ###
5
+
6
+ require_relative './window'
7
+
8
+ module WXRuby3
9
+
10
+ class Director
11
+
12
+ class Slider < Window
13
+
14
+ def setup
15
+ super
16
+ end
17
+
18
+ def process(gendoc: false)
19
+ defmod = super
20
+ # fix documentation errors for scroll events
21
+ def_item = defmod.find_item('wxSlider')
22
+ if def_item
23
+ def_item.event_types.each do |evt_spec|
24
+ case evt_spec.first
25
+ when 'EVT_COMMAND_SCROLL_THUMBRELEASE', 'EVT_COMMAND_SCROLL_CHANGED'
26
+ if evt_spec[2] == 0
27
+ evt_spec[2] = 1 # incorrectly documented without 'id' argument
28
+ evt_spec[4] = true # ignore extracted docs
29
+ end
30
+ end
31
+ end
32
+ end
33
+ defmod
34
+ end
35
+ end # class Slider
36
+
37
+ end # class Director
38
+
39
+ end # module WXRuby3
@@ -156,7 +156,29 @@ module WXRuby3
156
156
  extern VALUE wxRuby_GetWindowClass() {
157
157
  return SwigClassWxWindow.klass;
158
158
  }
159
+ // we need this static method here because we do not want SWIG to parse the preprocessor
160
+ // statements (#if/#else/#endif) which it does in %extend blocks
161
+ static VALUE do_paint_buffered(wxWindow* ptr)
162
+ {
163
+ VALUE rc = Qnil;
164
+ wxAutoBufferedPaintDC dc(ptr);
165
+ #if wxALWAYS_NATIVE_DOUBLE_BUFFER
166
+ wxPaintDC* ptr_dc = &dc;
167
+ VALUE r_class = rb_const_get(mWxCore, rb_intern("PaintDC"));
168
+ #else
169
+ wxMemoryDC* ptr_dc = &dc;
170
+ VALUE r_class = rb_const_get(mWxCore, rb_intern("MemoryDC"));
171
+ #endif
172
+ swig_type_info* swig_type = wxRuby_GetSwigTypeForClass(r_class);
173
+ VALUE rb_dc = SWIG_NewPointerObj(SWIG_as_voidptr(ptr_dc), swig_type, 0);
174
+ rc = rb_yield(rb_dc);
175
+ SWIG_RubyRemoveTracking((void *)ptr_dc);
176
+ DATA_PTR(rb_dc) = NULL;
177
+
178
+ return rc;
179
+ }
159
180
  __HEREDOC
181
+ spec.add_header_code 'static VALUE do_paint_buffered(wxWindow* ptr);'
160
182
  spec.add_extend_code 'wxWindow', <<~__HEREDOC
161
183
  // passes a DC for drawing on Window into a passed ruby block, and
162
184
  // ensure that the DC is correctly deleted when drawing is
@@ -167,9 +189,9 @@ module WXRuby3
167
189
  {
168
190
  static WxRuby_ID painting_id("@__painting__");
169
191
 
170
- if ( ! rb_block_given_p() )
171
- rb_raise(rb_eArgError, "No block given for Window#paint");
192
+ if (!rb_block_given_p()) rb_raise(rb_eArgError, "No block given for Window#paint");
172
193
 
194
+ VALUE rc = Qnil;
173
195
  wxWindow *ptr = self;
174
196
  VALUE rb_win = SWIG_RubyInstanceFor(ptr);
175
197
  // see if within an evt_paint block - see classes/window.rb
@@ -178,7 +200,7 @@ module WXRuby3
178
200
  {
179
201
  wxPaintDC dc(ptr);
180
202
  VALUE dcVal = SWIG_NewPointerObj((void *) &dc,SWIGTYPE_p_wxPaintDC, 0);
181
- rb_yield(dcVal);
203
+ rc = rb_yield(dcVal);
182
204
  SWIG_RubyRemoveTracking((void *) &dc);
183
205
  DATA_PTR(dcVal) = NULL;
184
206
  }
@@ -186,12 +208,21 @@ module WXRuby3
186
208
  {
187
209
  wxClientDC dc(ptr);
188
210
  VALUE dcVal = SWIG_NewPointerObj((void *) &dc,SWIGTYPE_p_wxClientDC, 0);
189
- rb_yield(dcVal);
211
+ rc = rb_yield(dcVal);
190
212
  SWIG_RubyRemoveTracking((void *) &dc);
191
213
  DATA_PTR(dcVal) = NULL;
192
214
  }
193
215
 
194
- return Qnil;
216
+ return rc;
217
+ }
218
+
219
+ // similar to the paint() method but now for buffered painting
220
+ // we do not check __painting__ here, instead we do that in pure Ruby
221
+ VALUE paint_buffered()
222
+ {
223
+ if (!rb_block_given_p()) rb_raise(rb_eArgError, "No block given for Window#paint_buffered");
224
+
225
+ return do_paint_buffered(self);
195
226
  }
196
227
 
197
228
  // Return a window handle as a platform-specific ruby integer
@@ -28,13 +28,6 @@ module WXRuby3
28
28
  return ;
29
29
  }
30
30
  __HEREDOC
31
- spec.ignore %w[
32
- wxFindWindowByLabel
33
- wxFindWindowByName
34
- wxNewId
35
- wxUsleep
36
- ]
37
- spec.ignore 'wxPostDelete' unless Config.instance.wx_version >= '3.3.0'
38
31
  spec.do_not_generate(:variables, :enums, :defines, :functions)
39
32
  end
40
33
  end # class WindowDisabler
@@ -227,7 +227,7 @@ module WXRuby3
227
227
  end
228
228
  # record event handler (macro) name, event type handled and the number of event id arguments
229
229
  evt_arity = args.inject(0) {|c, a| c += 1 if a.start_with?('id'); c }
230
- @event_types << [evt_handler, evt_type, evt_arity, evt_klass]
230
+ @event_types << [evt_handler, evt_type, evt_arity, evt_klass, false]
231
231
  end
232
232
  end
233
233
  end
@@ -111,7 +111,7 @@ module WXRuby3
111
111
  end
112
112
  params << { name: pnm, type: arg.type }
113
113
  if paramdef.default
114
- defexp = rb_constant_expression(paramdef.default)
114
+ defexp = rb_constant_expression(paramdef.default, xml_trans.constants_xref_db)
115
115
  # in case the default expression dereferences a pointer or passes an address clean it up
116
116
  defexp.sub!(/\A\s*[\*\&]/, '')
117
117
  # in case the default expression contains anything else but simple numbers or identifiers, wrap in ()
@@ -46,12 +46,17 @@ module WXRuby3
46
46
  tmpfile << script
47
47
  tmpfile.close(false)
48
48
  result = if Director.trace?
49
- Config.instance.run(ftmp_name, capture: :out)
49
+ Config.instance.run(ftmp_name, capture: :out, verbose: false)
50
50
  else
51
- Config.instance.run(ftmp_name, capture: :no_err)
51
+ Config.instance.run(ftmp_name, capture: :no_err, verbose: false)
52
52
  end
53
53
  STDERR.puts "* got constants collection output:\n#{result}" if Director.trace?
54
- db = JSON.load(result)
54
+ begin
55
+ db = JSON.load(result)
56
+ rescue Exception
57
+ File.open('constants_raw.json', "w") { |f| f << result } if Director.verbose?
58
+ ::Kernel.raise RuntimeError, "Exception loading constants collection result: #{$!.message.slice(0, 512)}", cause: nil
59
+ end
55
60
  File.open('constants.json', "w") { |f| f << JSON.pretty_generate(db) } if Director.verbose?
56
61
  return db
57
62
  ensure
@@ -293,6 +298,8 @@ module WXRuby3
293
298
  ["#{DocGenerator.constants_xref_db[constnm]['mod']}::#{constnm}", true]
294
299
  elsif DocGenerator.constants_xref_db.has_key?(rb_constant_name(nm_str))
295
300
  ["Wx::#{rb_constant_name(nm_str)}", true]
301
+ elsif DocGenerator.constants_xref_db.has_key?(rb_constant_name(nm_str, false))
302
+ ["Wx::#{rb_constant_name(nm_str, false)}", true]
296
303
  elsif !_is_method?(nm_str, ref_scope)
297
304
  ["Wx::#{constnm}", true]
298
305
  else
@@ -324,6 +331,9 @@ module WXRuby3
324
331
  elsif DocGenerator.constants_xref_db.has_key?(rb_constant_name(nm_str))
325
332
  cnm = rb_constant_name(nm_str)
326
333
  constnm = "#{DocGenerator.constants_xref_db[cnm]['mod']}::#{cnm}"
334
+ elsif DocGenerator.constants_xref_db.has_key?(rb_constant_name(nm_str, false))
335
+ cnm = rb_constant_name(nm_str, false)
336
+ constnm = "#{DocGenerator.constants_xref_db[cnm]['mod']}::#{cnm}"
327
337
  elsif nm_str.start_with?('wx')
328
338
  known = false
329
339
  constnm = "Wx::#{constnm}"
@@ -411,10 +421,12 @@ module WXRuby3
411
421
  para = node_to_doc(node)
412
422
  # loose specific notes paragraphs
413
423
  case para
414
- when /\A\s*wxPerl Note:/, # wxPerl note
415
- /\A\s*Library:/ # Library note
424
+ when /\A(\<b\>)?wxPerl Note:/, # wxPerl note
425
+ /\A\s*Library:/, # Library note
426
+ /\A\s*Include\s+file:/ # Include file note
416
427
  ''
417
428
  else
429
+ para.sub!(/Include\s+file:\s+\#include\s+\<[^>]+\>\s*\Z/, '')
418
430
  if event_section?
419
431
  case para
420
432
  when /The following event handler macros redirect.*(\{.*})/
@@ -509,6 +521,14 @@ module WXRuby3
509
521
  doc
510
522
  end
511
523
 
524
+ def constants_db
525
+ DocGenerator.constants_db
526
+ end
527
+
528
+ def constants_xref_db
529
+ DocGenerator.constants_xref_db
530
+ end
531
+
512
532
  end
513
533
 
514
534
  def run
@@ -611,7 +631,7 @@ module WXRuby3
611
631
  end
612
632
  else
613
633
  item.items.each do |e|
614
- const_name = rb_constant_name(e.name)
634
+ const_name = rb_constant_name(e.name, false)
615
635
  if xref_table.has_key?(const_name)
616
636
  gen_constant_doc(fdoc, const_name, xref_table[const_name], get_constant_doc(e))
617
637
  end
@@ -43,6 +43,7 @@ module WXRuby3
43
43
  Director.Spec(pkg, 'wxPen')
44
44
  Director.Spec(pkg, 'wxPalette')
45
45
  Director.Spec(pkg, 'wxRegion')
46
+ Director.Spec(pkg, 'wxRegionIterator')
46
47
  Director.Spec(pkg, 'wxIconLocation')
47
48
  Director.Spec(pkg, 'wxBitmap')
48
49
  Director.Spec(pkg, 'wxIcon')
@@ -84,7 +85,8 @@ module WXRuby3
84
85
  Director.Spec(pkg, 'wxCollapsiblePaneEvent', requirements: %w[wxUSE_COLLPANE])
85
86
  Director.Spec(pkg, 'wxStaticLine', director: Director::Window)
86
87
  Director.Spec(pkg, 'wxGauge', director: Director::Window)
87
- Director.Spec(pkg, 'wxSlider', director: Director::Window)
88
+ Director.Spec(pkg, 'wxSlider')
89
+ Director.Spec(pkg, 'wxScrollBar')
88
90
  Director.Spec(pkg, 'wxStaticText', director: Director::Window)
89
91
  Director.Spec(pkg, 'wxSpinButton', director: Director::Window, requirements: %w[wxUSE_SPINBTN])
90
92
  Director.Spec(pkg, 'wxSpinEvent', director: Director::Event, requirements: Director.AnyOf(*%w[wxUSE_SPINBTN wxUSE_SPINCTRL]))
@@ -220,6 +222,8 @@ module WXRuby3
220
222
  Director.Spec(pkg, 'wxRichTextHeaderFooterData', requirements: %w[wxUSE_PRINTING_ARCHITECTURE])
221
223
  Director.Spec(pkg, 'wxRichTextPrinting', requirements: %w[wxUSE_PRINTING_ARCHITECTURE])
222
224
  Director.Spec(pkg, 'wxSymbolPickerDialog', director: Director::Dialog)
225
+ # need to look into special needs
226
+ # Director.Spec(pkg, 'wxRichTextBufferDataObject')
223
227
  }
224
228
 
225
229
  Director.Package('Wx::STC', 'wxUSE_STC') { |pkg|
@@ -270,6 +274,7 @@ module WXRuby3
270
274
  Director.Spec(pkg, 'wxHtmlEasyPrinting', requirements: %w[wxUSE_PRINTING_ARCHITECTURE])
271
275
  Director.Spec(pkg, 'wxHtmlPrintout', requirements: %w[wxUSE_PRINTING_ARCHITECTURE])
272
276
  Director.Spec(pkg, 'wxHtmlListBox')
277
+ Director.Spec(pkg, 'wxHTMLDataObject') if Config.instance.wx_version >= '3.3'
273
278
  }
274
279
 
275
280
  Director.Package('Wx::AUI', 'wxUSE_AUI') { |pkg|
@@ -588,7 +588,7 @@ module WXRuby3
588
588
  end
589
589
 
590
590
  # special case bc SWIG causes trouble in Window.cpp
591
- map 'const wxRegion&', 'const wxRegion*' do
591
+ map 'const wxRegion&', 'const wxRegion*', as: 'Wx::Region' do
592
592
  map_out code: '$result = wxRuby_WrapWxObjectInRuby(new wxRegion(*static_cast<const wxRegion*> ($1)));'
593
593
  end
594
594
 
@@ -62,10 +62,13 @@ module WXRuby3
62
62
  rbnm
63
63
  end
64
64
 
65
- def rb_constant_name(name)
66
- rbnm = underscore(name)
65
+ def rb_constant_name(name, do_transform = true)
66
+ rbnm = do_transform ? underscore(name) : name.dup
67
67
  rbnm.sub!(/\Awx_/, '')
68
- rbnm.upcase!
68
+ unless do_transform
69
+ rbnm.sub!(/\Awx([A-Z])/, '\1')
70
+ end
71
+ rbnm.upcase! if do_transform
69
72
  rbnm
70
73
  end
71
74
 
@@ -85,10 +88,17 @@ module WXRuby3
85
88
 
86
89
  def rb_constant_value(name)
87
90
  val = name.sub(/\Awx/, 'Wx::')
88
- val == 'NULL' ? 'nil' : val
91
+ case val
92
+ when /NULL|nullptr/
93
+ 'nil'
94
+ when /EmptyString/
95
+ %q['']
96
+ else
97
+ val
98
+ end
89
99
  end
90
100
 
91
- def rb_constant_expression(exp)
101
+ def rb_constant_expression(exp, const_xref)
92
102
  exp.gsub(/(\w+(::\w+)*)(\s*\()?/) do |s|
93
103
  idstr = $1
94
104
  is_call = !!$3
@@ -119,15 +129,26 @@ module WXRuby3
119
129
  else
120
130
  if is_scoped
121
131
  # nested identifier
132
+ if const_xref.has_key?(rb_constant_name(idstr))
133
+ "#{scoped_name}::#{rb_constant_name(idstr)}"
134
+ elsif const_xref.has_key?(rb_constant_name(idstr, false))
135
+ "#{scoped_name}::#{rb_constant_name(idstr, false)}"
136
+ end
122
137
  "#{scoped_name}::#{idstr}"
123
138
  else
124
139
  # constant
125
140
  if /[\-\+\.\d]+/ =~ idstr
126
141
  idstr # numeric constant
127
- elsif /\A(true|false|NULL)/ =~ idstr
128
- $1 == 'NULL' ? 'nil' : $1
142
+ elsif /\A(true|false|NULL|nullptr)/ =~ idstr
143
+ ($1 == 'NULL' || $1 == 'nullptr') ? 'nil' : $1
129
144
  else
130
- "Wx::#{rb_constant_name(idstr)}"
145
+ if const_xref.has_key?(rb_constant_name(idstr))
146
+ "#{const_xref[rb_constant_name(idstr)]['mod']}::#{rb_constant_name(idstr)}"
147
+ elsif const_xref.has_key?(rb_constant_name(idstr, false))
148
+ "#{const_xref[rb_constant_name(idstr, false)]['mod']}::#{rb_constant_name(idstr, false)}"
149
+ else
150
+ rb_constant_value(idstr)
151
+ end
131
152
  end
132
153
  end
133
154
  end
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -155,8 +155,7 @@ class GraphicsWindow < Wx::Window
155
155
  def on_paint
156
156
  # We do our drawing now
157
157
  rect = self.get_client_size
158
- paint do |dc|
159
- gdc = Wx::GraphicsContext.create(dc)
158
+ Wx::GraphicsContext.draw_on(self) do |gdc|
160
159
  unless @rtxt
161
160
  create_resources(gdc)
162
161
  end
@@ -286,75 +286,75 @@ class MyColourProperty < Wx::PG::ColourProperty
286
286
  end
287
287
 
288
288
  module ID
289
- %i[
290
- PGID
291
- ABOUT
292
- QUIT
293
- APPENDPROP
294
- APPENDCAT
295
- INSERTPROP
296
- INSERTCAT
297
- ENABLE
298
- SETREADONLY
299
- HIDE
300
- BOOL_CHECKBOX
301
- DELETE
302
- DELETER
303
- DELETEALL
304
- UNSPECIFY
305
- ITERATE1
306
- ITERATE2
307
- ITERATE3
308
- ITERATE4
309
- CLEARMODIF
310
- FREEZE
311
- DUMPLIST
312
- COLOURSCHEME1
313
- COLOURSCHEME2
314
- COLOURSCHEME3
315
- CATCOLOURS
316
- SETBGCOLOUR
317
- SETBGCOLOURRECUR
318
- STATICLAYOUT
319
- POPULATE1
320
- POPULATE2
321
- COLLAPSE
322
- COLLAPSEALL
323
- GETVALUES
324
- SETVALUES
325
- SETVALUES2
326
- RUNTESTFULL
327
- RUNTESTPARTIAL
328
- FITCOLUMNS
329
- CHANGEFLAGSITEMS
330
- TESTINSERTCHOICE
331
- TESTDELETECHOICE
332
- INSERTPAGE
333
- REMOVEPAGE
334
- SETSPINCTRLEDITOR
335
- SETPROPERTYVALUE
336
- TESTREPLACE
337
- SETCOLUMNS
338
- SETVIRTWIDTH
339
- SETPGDISABLED
340
- TESTXRC
341
- ENABLECOMMONVALUES
342
- SELECTSTYLE
343
- SAVESTATE
344
- RESTORESTATE
345
- RUNMINIMAL
346
- ENABLELABELEDITING
347
- VETOCOLDRAG
348
- ONEXTENDEDKEYNAV
349
- SHOWPOPUP
350
- POPUPGRID
351
- ].each_with_index { |sym, ix| self.const_set(sym, ix+1) }
289
+ include Wx::IDHelper
290
+
291
+ PGID = self.next_id
292
+ ABOUT = self.next_id
293
+ QUIT = self.next_id
294
+ APPENDPROP = self.next_id
295
+ APPENDCAT = self.next_id
296
+ INSERTPROP = self.next_id
297
+ INSERTCAT = self.next_id
298
+ ENABLE = self.next_id
299
+ SETREADONLY = self.next_id
300
+ HIDE = self.next_id
301
+ BOOL_CHECKBOX = self.next_id
302
+ DELETE = self.next_id
303
+ DELETER = self.next_id
304
+ DELETEALL = self.next_id
305
+ UNSPECIFY = self.next_id
306
+ ITERATE1 = self.next_id
307
+ ITERATE2 = self.next_id
308
+ ITERATE3 = self.next_id
309
+ ITERATE4 = self.next_id
310
+ CLEARMODIF = self.next_id
311
+ FREEZE = self.next_id
312
+ DUMPLIST = self.next_id
313
+ COLOURSCHEME1 = self.next_id
314
+ COLOURSCHEME2 = self.next_id
315
+ COLOURSCHEME3 = self.next_id
316
+ CATCOLOURS = self.next_id
317
+ SETBGCOLOUR = self.next_id
318
+ SETBGCOLOURRECUR = self.next_id
319
+ STATICLAYOUT = self.next_id
320
+ POPULATE1 = self.next_id
321
+ POPULATE2 = self.next_id
322
+ COLLAPSE = self.next_id
323
+ COLLAPSEALL = self.next_id
324
+ GETVALUES = self.next_id
325
+ SETVALUES = self.next_id
326
+ SETVALUES2 = self.next_id
327
+ RUNTESTFULL = self.next_id
328
+ RUNTESTPARTIAL = self.next_id
329
+ FITCOLUMNS = self.next_id
330
+ CHANGEFLAGSITEMS = self.next_id
331
+ TESTINSERTCHOICE = self.next_id
332
+ TESTDELETECHOICE = self.next_id
333
+ INSERTPAGE = self.next_id
334
+ REMOVEPAGE = self.next_id
335
+ SETSPINCTRLEDITOR = self.next_id
336
+ SETPROPERTYVALUE = self.next_id
337
+ TESTREPLACE = self.next_id
338
+ SETCOLUMNS = self.next_id
339
+ SETVIRTWIDTH = self.next_id
340
+ SETPGDISABLED = self.next_id
341
+ TESTXRC = self.next_id
342
+ ENABLECOMMONVALUES = self.next_id
343
+ SELECTSTYLE = self.next_id
344
+ SAVESTATE = self.next_id
345
+ RESTORESTATE = self.next_id
346
+ RUNMINIMAL = self.next_id
347
+ ENABLELABELEDITING = self.next_id
348
+ VETOCOLDRAG = self.next_id
349
+ ONEXTENDEDKEYNAV = self.next_id
350
+ SHOWPOPUP = self.next_id
351
+ POPUPGRID = self.next_id
352
352
 
353
353
  if Wx.has_feature?(:USE_HEADERCTRL)
354
- SHOWHEADER = POPUPGRID+1
354
+ SHOWHEADER = self.next_id
355
355
  end
356
356
 
357
- COLOURSCHEME4 = 100
357
+ COLOURSCHEME4 = self.next_id
358
358
  end
359
359
 
360
360
  #