wxruby3 0.9.0.pre.beta.14 → 0.9.0.pre.rc.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (164) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -0
  3. data/README.md +47 -4
  4. data/assets/hello_button.png +0 -0
  5. data/assets/hello_button_clicked.png +0 -0
  6. data/assets/hello_world.png +0 -0
  7. data/assets/repo-social-preview.png +0 -0
  8. data/ext/wxruby3/include/wxruby-runtime.h +1 -0
  9. data/ext/wxruby3/swig/memory_management.i +6 -10
  10. data/ext/wxruby3/swig/wx.i +17 -6
  11. data/lib/wx/core/art_locator.rb +2 -2
  12. data/lib/wx/core/artprovider.rb +2 -2
  13. data/lib/wx/core/bitmap.rb +6 -5
  14. data/lib/wx/core/bitmap_combobox.rb +34 -0
  15. data/lib/wx/core/controlwithitems.rb +52 -14
  16. data/lib/wx/core/cursor.rb +1 -1
  17. data/lib/wx/core/dc.rb +0 -20
  18. data/lib/wx/core/event_blocker.rb +14 -0
  19. data/lib/wx/core/evthandler.rb +36 -0
  20. data/lib/wx/core/find_replace_dialog.rb +24 -0
  21. data/lib/wx/core/icon.rb +1 -1
  22. data/lib/wx/core/image.rb +1 -1
  23. data/lib/wx/core/paintdc.rb +8 -0
  24. data/lib/wx/core/text_entry.rb +15 -0
  25. data/lib/wx/core/v_list_box.rb +13 -0
  26. data/lib/wx/core/window.rb +1 -1
  27. data/lib/wx/doc/busy_info.rb +21 -0
  28. data/lib/wx/doc/client_dc.rb +28 -0
  29. data/lib/wx/doc/controlwithitems.rb +11 -0
  30. data/lib/wx/doc/dc.rb +0 -14
  31. data/lib/wx/doc/event_blocker.rb +27 -0
  32. data/lib/wx/doc/evthandler.rb +4 -0
  33. data/lib/wx/doc/extra/02_lifecycles.md +49 -0
  34. data/lib/wx/doc/extra/10_art.md +1 -1
  35. data/lib/wx/doc/extra/11_drawing_and_dc.md +62 -0
  36. data/lib/wx/doc/memory_dc.rb +75 -0
  37. data/lib/wx/doc/mirror_dc.rb +16 -0
  38. data/lib/wx/doc/prt/printer_dc.rb +26 -0
  39. data/lib/wx/doc/screen_dc.rb +10 -6
  40. data/lib/wx/doc/svg_file_dc.rb +20 -0
  41. data/lib/wx/doc/v_list_box.rb +9 -0
  42. data/lib/wx/doc/window_disabler.rb +10 -0
  43. data/lib/wx/html/keyword_defs.rb +6 -7
  44. data/lib/wx/html/require.rb +1 -0
  45. data/lib/wx/html/simple_html_listbox.rb +105 -0
  46. data/lib/wx/keyword_defs.rb +7 -0
  47. data/lib/wx/version.rb +1 -1
  48. data/lib/wx/wxruby/cmd/test.rb +1 -1
  49. data/rakelib/install.rb +3 -1
  50. data/rakelib/lib/core/mapping.rb +5 -5
  51. data/rakelib/lib/core/spec.rb +7 -3
  52. data/rakelib/lib/core/spec_helper.rb +9 -1
  53. data/rakelib/lib/director/accelerator.rb +1 -1
  54. data/rakelib/lib/director/app.rb +25 -3
  55. data/rakelib/lib/director/art_provider.rb +5 -1
  56. data/rakelib/lib/director/aui_pane_info.rb +1 -1
  57. data/rakelib/lib/director/aui_tab_ctrl.rb +1 -1
  58. data/rakelib/lib/director/bitmap.rb +2 -1
  59. data/rakelib/lib/director/bitmap_combobox.rb +32 -0
  60. data/rakelib/lib/director/brush.rb +1 -0
  61. data/rakelib/lib/director/busy_info.rb +1 -1
  62. data/rakelib/lib/director/choice.rb +1 -0
  63. data/rakelib/lib/director/clipboard.rb +1 -1
  64. data/rakelib/lib/director/colour.rb +1 -0
  65. data/rakelib/lib/director/colour_picker_ctrl.rb +1 -1
  66. data/rakelib/lib/director/combobox.rb +1 -2
  67. data/rakelib/lib/director/ctrl_with_items.rb +3 -0
  68. data/rakelib/lib/director/cursor.rb +1 -0
  69. data/rakelib/lib/director/data_object.rb +5 -7
  70. data/rakelib/lib/director/dc.rb +5 -1
  71. data/rakelib/lib/director/defs.rb +3 -0
  72. data/rakelib/lib/director/derived_dc.rb +278 -27
  73. data/rakelib/lib/director/dialog.rb +4 -1
  74. data/rakelib/lib/director/dir_picker_ctrl.rb +1 -1
  75. data/rakelib/lib/director/event.rb +3 -3
  76. data/rakelib/lib/director/event_blocker.rb +41 -0
  77. data/rakelib/lib/director/event_filter.rb +20 -0
  78. data/rakelib/lib/director/event_handler.rb +29 -2
  79. data/rakelib/lib/director/file_picker_ctrl.rb +1 -1
  80. data/rakelib/lib/director/find_replace_data.rb +1 -0
  81. data/rakelib/lib/director/font.rb +2 -1
  82. data/rakelib/lib/director/font_data.rb +1 -0
  83. data/rakelib/lib/director/font_picker_ctrl.rb +1 -1
  84. data/rakelib/lib/director/gdi_object.rb +1 -0
  85. data/rakelib/lib/director/graphics_context.rb +6 -6
  86. data/rakelib/lib/director/grid_table_message.rb +1 -1
  87. data/rakelib/lib/director/html_cell.rb +1 -1
  88. data/rakelib/lib/director/html_data_object.rb +5 -7
  89. data/rakelib/lib/director/html_listbox.rb +65 -1
  90. data/rakelib/lib/director/icon.rb +2 -0
  91. data/rakelib/lib/director/listbox.rb +1 -0
  92. data/rakelib/lib/director/locale.rb +2 -1
  93. data/rakelib/lib/director/palette.rb +1 -0
  94. data/rakelib/lib/director/pen.rb +2 -1
  95. data/rakelib/lib/director/pgproperties.rb +1 -1
  96. data/rakelib/lib/director/pgproperty.rb +1 -1
  97. data/rakelib/lib/director/pgvalidation_info.rb +1 -1
  98. data/rakelib/lib/director/platform_info.rb +1 -1
  99. data/rakelib/lib/director/print_data.rb +1 -1
  100. data/rakelib/lib/director/property_grid_interface.rb +1 -1
  101. data/rakelib/lib/director/property_grid_page_state.rb +1 -1
  102. data/rakelib/lib/director/region.rb +1 -0
  103. data/rakelib/lib/director/ribbon_art_provider.rb +1 -1
  104. data/rakelib/lib/director/richtext_buffer_data_object.rb +5 -7
  105. data/rakelib/lib/director/richtext_header_footer_data.rb +1 -1
  106. data/rakelib/lib/director/searchctrl.rb +24 -0
  107. data/rakelib/lib/director/sizer.rb +2 -2
  108. data/rakelib/lib/director/styled_text_ctrl.rb +2 -0
  109. data/rakelib/lib/director/text_entry.rb +2 -2
  110. data/rakelib/lib/director/tree_ctrl.rb +6 -3
  111. data/rakelib/lib/director/uiaction_simulator.rb +20 -0
  112. data/rakelib/lib/director/variant.rb +1 -1
  113. data/rakelib/lib/director/vlistbox.rb +25 -0
  114. data/rakelib/lib/director/window.rb +0 -6
  115. data/rakelib/lib/director/with_images.rb +1 -1
  116. data/rakelib/lib/director/xml_node.rb +1 -1
  117. data/rakelib/lib/extractor/function.rb +5 -3
  118. data/rakelib/lib/generate/doc/about_dialog_info.yaml +46 -0
  119. data/rakelib/lib/generate/doc/accelerator.yaml +21 -0
  120. data/rakelib/lib/generate/doc/art_provider.yaml +35 -0
  121. data/rakelib/lib/generate/doc/bitmap.yaml +37 -0
  122. data/rakelib/lib/generate/doc/box_sizer.yaml +15 -0
  123. data/rakelib/lib/generate/doc/busy_info.yaml +74 -0
  124. data/rakelib/lib/generate/doc/client_dc.yaml +19 -0
  125. data/rakelib/lib/generate/doc/clipboard.yaml +43 -0
  126. data/rakelib/lib/generate/doc/collapsible_pane.yaml +21 -0
  127. data/rakelib/lib/generate/doc/colour_dialog.yaml +32 -0
  128. data/rakelib/lib/generate/doc/control.yaml +46 -0
  129. data/rakelib/lib/generate/doc/cursor.yaml +40 -0
  130. data/rakelib/lib/generate/doc/data_object.yaml +55 -0
  131. data/rakelib/lib/generate/doc/dc.yaml +14 -0
  132. data/rakelib/lib/generate/doc/dialog.yaml +36 -0
  133. data/rakelib/lib/generate/doc/dir_dialog.yaml +25 -0
  134. data/rakelib/lib/generate/doc/events.yaml +152 -0
  135. data/rakelib/lib/generate/doc/evt_handler.yaml +63 -0
  136. data/rakelib/lib/generate/doc.rb +76 -13
  137. data/rakelib/lib/generate/interface.rb +11 -0
  138. data/rakelib/lib/specs/interfaces.rb +5 -4
  139. data/rakelib/lib/swig_runner.rb +3 -3
  140. data/rakelib/lib/typemap/common.rb +15 -3
  141. data/rakelib/lib/util/string.rb +1 -0
  142. data/rakelib/yard/yard/relative_markdown_links.rb +5 -1
  143. data/samples/bigdemo/wxArtProvider.rbw +5 -4
  144. data/samples/controls/controls.rb +2 -2
  145. data/samples/controls/htlbox.rb +411 -0
  146. data/samples/controls/tn_htlbox.png +0 -0
  147. data/samples/drawing/graphics_drawing.rb +1 -2
  148. data/samples/drawing/{svgtest.rb → image_prt.rb} +49 -18
  149. data/samples/drawing/tn_image_prt.png +0 -0
  150. data/samples/propgrid/propgrid.rb +23 -21
  151. data/samples/ribbon/ribbon.rb +47 -46
  152. data/tests/lib/wxapp_runner.rb +3 -3
  153. data/tests/lib/wxframe_runner.rb +59 -0
  154. data/tests/test_app_event_filter.rb +74 -0
  155. data/tests/test_art_provider.rb +52 -0
  156. data/tests/test_clipboard.rb +2 -1
  157. data/tests/test_event_handling.rb +199 -16
  158. data/tests/test_events.rb +4 -11
  159. data/tests/test_gdi_object.rb +161 -0
  160. data/tests/test_intl.rb +11 -14
  161. data/tests/test_item_data.rb +33 -1
  162. data/tests/test_std_controls.rb +147 -0
  163. metadata +56 -4
  164. data/samples/drawing/tn_svgtest.png +0 -0
@@ -12,8 +12,8 @@ module WXRuby3
12
12
  class App < EvtHandler
13
13
 
14
14
  def setup
15
- spec.items << 'wxAppConsole'
16
- spec.fold_bases('wxApp' => 'wxAppConsole')
15
+ spec.items << 'wxAppConsole' << 'wxEventFilter'
16
+ spec.fold_bases('wxApp' => 'wxAppConsole', 'wxAppConsole' => 'wxEventFilter')
17
17
  spec.override_inheritance_chain('wxApp', %w[wxEvtHandler wxObject])
18
18
  spec.ignore %w{
19
19
  wxApp.ProcessMessage
@@ -78,6 +78,7 @@ module WXRuby3
78
78
  spec.no_proxy %w{
79
79
  wxApp::GetDisplayMode
80
80
  wxApp::GetTopWindow
81
+ wxApp::OnAssertFailure
81
82
  }
82
83
  spec.include %w{
83
84
  wx/init.h
@@ -340,7 +341,28 @@ module WXRuby3
340
341
  // actually implemented in ruby in classes/app.rb
341
342
  virtual void OnAssertFailure(const wxChar *file, int line, const wxChar *func, const wxChar *cond, const wxChar *msg)
342
343
  {
343
- std::wcout << "ASSERT fired" << std::endl;
344
+ VALUE rb_app = SWIG_RubyInstanceFor(this);
345
+ if (rb_during_gc() || NIL_P(rb_app))
346
+ {
347
+ std::wcout << file << "(" << line << "): ASSERT " << cond
348
+ << (NIL_P(rb_app) ? " fired without THE_APP in " : " fired during GC phase in ")
349
+ << func << "() with message [" << msg << "]" << std::endl;
350
+ }
351
+ else
352
+ {
353
+ VALUE obj0 = Qnil ;
354
+ VALUE obj1 = Qnil ;
355
+ VALUE obj2 = Qnil ;
356
+ VALUE obj3 = Qnil ;
357
+ VALUE obj4 = Qnil ;
358
+
359
+ obj0 = rb_str_new2((const char *)wxString(file).utf8_str());
360
+ obj1 = INT2NUM(line);
361
+ obj2 = rb_str_new2((const char *)wxString(func).utf8_str());
362
+ obj3 = rb_str_new2((const char *)wxString(cond).utf8_str());
363
+ obj4 = rb_str_new2((const char *)wxString(msg).utf8_str());
364
+ (void)wxRuby_Funcall(rb_app, rb_intern("on_assert_failure"), 5,obj0,obj1,obj2,obj3,obj4);
365
+ }
344
366
  }
345
367
 
346
368
  void _wxRuby_Cleanup()
@@ -15,7 +15,11 @@ module WXRuby3
15
15
  spec.use_class_implementation('wxArtProvider', 'wxRubyArtProvider')
16
16
  spec.ignore('wxArtProvider::Insert') # deprecated and problematic
17
17
  spec.ignore('wxArtProvider::Remove') # problematic as adding disowns the art provider, use Delete
18
- spec.no_proxy('wxArtProvider')
18
+ # regard protected methods
19
+ spec.regard 'wxArtProvider::DoGetSizeHint',
20
+ 'wxArtProvider::CreateBitmap',
21
+ 'wxArtProvider::CreateBitmapBundle',
22
+ 'wxArtProvider::CreateIconBundle'
19
23
  spec.include('wx/artprov.h')
20
24
  spec.add_swig_code <<~__HEREDOC
21
25
  // ArtId and ArtClient are basically just strings ...
@@ -11,7 +11,7 @@ module WXRuby3
11
11
 
12
12
  def setup
13
13
  spec.disable_proxies
14
- spec.gc_as_temporary
14
+ spec.gc_as_untracked
15
15
  spec.regard %w[
16
16
  wxAuiPaneInfo::name
17
17
  wxAuiPaneInfo::caption
@@ -16,7 +16,7 @@ module WXRuby3
16
16
  super
17
17
  # now replace items because wxAuiTabCtrl is actually not documented (!!!)
18
18
  spec.items.replace %w[wxAuiTabContainerButton]
19
- spec.gc_as_temporary 'wxAuiTabContainerButton'
19
+ spec.gc_as_untracked 'wxAuiTabContainerButton'
20
20
  spec.no_proxy %w[wxAuiTabCtrl wxAuiTabContainerButton]
21
21
  spec.swig_import %w[swig/classes/include/wxObject.h swig/classes/include/wxEvtHandler.h swig/classes/include/wxWindow.h swig/classes/include/wxControl.h]
22
22
  # cannot use #add_extend_code because we do not have an actual parsed XML item
@@ -11,7 +11,8 @@ module WXRuby3
11
11
 
12
12
  def setup
13
13
  spec.items << 'wxBitmapBundle' << 'wxMask'
14
- spec.gc_as_object 'wxBitmapBundle'
14
+ spec.gc_as_untracked 'wxBitmap'
15
+ spec.gc_as_untracked 'wxBitmapBundle'
15
16
  spec.require_app 'wxBitmap',
16
17
  'wxBitmapBundle',
17
18
  'wxMask'
@@ -0,0 +1,32 @@
1
+ ###
2
+ # wxRuby3 wxWidgets interface director
3
+ # Copyright (c) M.J.N. Corino, The Netherlands
4
+ ###
5
+
6
+ require_relative './ctrl_with_items'
7
+
8
+ module WXRuby3
9
+
10
+ class Director
11
+
12
+ class BitmapComboBox < ControlWithItems
13
+
14
+ def setup
15
+ super
16
+ setup_ctrl_with_items('wxBitmapComboBox')
17
+ spec.override_inheritance_chain('wxBitmapComboBox',
18
+ %w[wxComboBox
19
+ wxControlWithItems
20
+ wxControl
21
+ wxWindow
22
+ wxEvtHandler
23
+ wxObject])
24
+ spec.ignore 'wxBitmapComboBox::Insert(const wxString &, const wxBitmap &, unsigned int, wxClientData *)',
25
+ 'wxBitmapComboBox::Append(const wxString &, const wxBitmap &, wxClientData *)'
26
+ end
27
+
28
+ end # class BitmapComboBox
29
+
30
+ end # class Director
31
+
32
+ end # module WXRuby3
@@ -12,6 +12,7 @@ module WXRuby3
12
12
  def setup
13
13
  super
14
14
  spec.disable_proxies
15
+ spec.gc_as_untracked 'wxBrush'
15
16
  # all but the default ctor require a running App
16
17
  spec.require_app 'wxBrush::wxBrush(const wxColour &colour, wxBrushStyle style)',
17
18
  'wxBrush::wxBrush(const wxBitmap &stippleBitmap)',
@@ -13,7 +13,7 @@ module WXRuby3
13
13
  super
14
14
  spec.items << 'wxBusyInfoFlags'
15
15
  spec.disable_proxies
16
- spec.gc_as_temporary 'wxBusyInfo', 'wxBusyInfoFlags'
16
+ spec.gc_as_untracked 'wxBusyInfo', 'wxBusyInfoFlags'
17
17
  # again C++ type guards do not work with Ruby
18
18
  # need to Rubify this
19
19
  spec.make_abstract 'wxBusyInfo'
@@ -23,6 +23,7 @@ module WXRuby3
23
23
  # redundant with good typemaps
24
24
  spec.ignore('wxChoice::wxChoice(wxWindow *,wxWindowID,const wxPoint &,const wxSize &,int,const wxString[],long,const wxValidator &,const wxString &)')
25
25
  spec.ignore('wxChoice::Create(wxWindow *,wxWindowID,const wxPoint &,const wxSize &,int,const wxString[],long,const wxValidator &,const wxString &)')
26
+ spec.ignore('wxChoice::IsSorted') # provided by ControlWithItems
26
27
  end
27
28
 
28
29
  end # class Choice
@@ -13,7 +13,7 @@ module WXRuby3
13
13
 
14
14
  def setup
15
15
  super
16
- spec.gc_as_temporary # don't even track Clipboard objects
16
+ spec.gc_as_untracked # don't even track Clipboard objects
17
17
  # there is no need or support for clipboard derivatives
18
18
  # not least because wxRuby only ever allows a single global clipboard
19
19
  spec.disable_proxies
@@ -10,6 +10,7 @@ module WXRuby3
10
10
  class Colour < Director
11
11
 
12
12
  def setup
13
+ spec.gc_as_untracked('wxColour')
13
14
  spec.require_app 'wxColour::wxColour(const wxColour&)'
14
15
  spec.ignore(%w[
15
16
  wxColour::GetPixel wxTransparentColour wxColour::operator!=
@@ -13,7 +13,7 @@ module WXRuby3
13
13
 
14
14
  def setup
15
15
  super
16
- spec.add_swig_code '%feature("notabstract") wxColourPickerCtrl;'
16
+ spec.make_concrete 'wxColourPickerCtrl'
17
17
  spec.do_not_generate(:variables, :defines, :enums, :functions) # with ColourPickerEvent
18
18
  end
19
19
  end # class ColourPickerCtrl
@@ -22,8 +22,7 @@ module WXRuby3
22
22
  wxWindow
23
23
  wxEvtHandler
24
24
  wxObject])
25
- spec.ignore(%w[
26
- wxComboBox::IsEmpty])
25
+ spec.ignore('wxComboBox::IsEmpty') # ambiguous ControlWithItems<>TextEntry
27
26
  spec.rename_for_ruby(
28
27
  'SetTextSelectionRange' => 'wxComboBox::SetSelection(long, long)',
29
28
  'GetTextSelectionRange' => 'wxComboBox::GetSelection(long *, long *) const')
@@ -47,6 +47,9 @@ module WXRuby3
47
47
  'wxItemContainer::Append(const wxArrayString &, void **)',
48
48
  'wxItemContainer::Insert(const wxArrayString &, unsigned int, void **)',
49
49
  'wxItemContainer::Set(const wxArrayString &, void **)'], ignore_doc: false)
50
+ # add undocumented method
51
+ spec.extend_interface 'wxControlWithItems',
52
+ 'bool IsSorted() const'
50
53
  # for doc only
51
54
  spec.map 'void** clientData' => 'Array', swig: false do
52
55
  map_in code: ''
@@ -10,6 +10,7 @@ module WXRuby3
10
10
  class Cursor < Director
11
11
 
12
12
  def setup
13
+ spec.gc_as_untracked 'wxCursor'
13
14
  # all but the default ctor require a running App
14
15
  spec.require_app 'wxCursor::wxCursor(const wxString &, wxBitmapType, int, int)',
15
16
  'wxCursor::wxCursor(wxStockCursor)',
@@ -44,13 +44,11 @@ module WXRuby3
44
44
  spec.ignore 'wxTextDataObject::GetAllFormats'
45
45
 
46
46
  %w[wxDataObjectComposite wxBitmapDataObject wxFileDataObject wxTextDataObject wxImageDataObject wxURLDataObject].each do |kls|
47
- spec.add_swig_code <<~__HEREDOC
48
- // SWIG gets confused and doesn't realise that various virtual methods
49
- // from wxDataObject are implemented fully in this subclass, and so,
50
- // believing it to be abstract doesn't provide an allocator for this
51
- // class. This undocumented feature overrides this.
52
- %feature("notabstract") #{kls};
53
- __HEREDOC
47
+ # SWIG gets confused and doesn't realise that various virtual methods
48
+ # from wxDataObject are implemented fully in these subclasses, and so,
49
+ # believing it to be abstract doesn't provide an allocator for this
50
+ # class. This overrides this.
51
+ spec.make_concrete kls
54
52
  end
55
53
 
56
54
  # Once a DataObject has been added, it belongs to the wxDataObjectComposite object,
@@ -13,8 +13,12 @@ module WXRuby3
13
13
 
14
14
  def setup
15
15
  super
16
+ # it's not safe to track DC objects as these are often created on the stack in C++
17
+ # before being passed to Ruby methods
18
+ # as we cannot capture their deletion in anyway this would leave the tracked items
19
+ # registered and reused when future stack allocated DC's happen to have the same address
20
+ spec.gc_as_untracked
16
21
  spec.ignore [
17
- 'wxDC::StartPage',
18
22
  'wxDC::GetPartialTextExtents',
19
23
  'wxDC::DrawLines(const wxPointList *,wxCoord,wxCoord)',
20
24
  'wxDC::DrawPolygon(const wxPointList *,wxCoord,wxCoord,wxPolygonFillMode)',
@@ -25,6 +25,9 @@ module WXRuby3
25
25
  wxINT64_MAX
26
26
  wxUINT64_MAX
27
27
  wxVaCopy
28
+ wxDELETE
29
+ wxDELETEA
30
+ wxSwap
28
31
  }
29
32
  if Config.instance.wx_version >= '3.3.0'
30
33
  spec.ignore 'wxOVERRIDE'