wxruby3 0.9.4 → 0.9.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/INSTALL.md +315 -78
  3. data/README.md +32 -21
  4. data/ext/wxruby3/include/wxruby-ComboPopup.h +777 -0
  5. data/lib/wx/core/combo_ctrl.rb +171 -0
  6. data/lib/wx/core/ext.rb +22 -3
  7. data/lib/wx/doc/comboctrl.rb +128 -3
  8. data/lib/wx/doc/owner_drawn_combobox.rb +5 -1
  9. data/lib/wx/version.rb +1 -1
  10. data/lib/wx/wxruby/base.rb +6 -4
  11. data/lib/wx/wxruby/cmd/sampler.rb +39 -29
  12. data/lib/wx/wxruby/cmd/setup.rb +122 -0
  13. data/lib/wx/wxruby/cmd/test.rb +56 -6
  14. data/rakefile +14 -0
  15. data/rakelib/bin.rake +48 -0
  16. data/rakelib/bin.rb +62 -0
  17. data/rakelib/build.rb +11 -7
  18. data/rakelib/config.rake +3 -1
  19. data/rakelib/configure.rb +28 -8
  20. data/rakelib/doc.rake +3 -1
  21. data/rakelib/gem.rake +169 -0
  22. data/rakelib/gem.rb +82 -0
  23. data/rakelib/install.rb +2 -0
  24. data/rakelib/lib/config/linux.rb +24 -2
  25. data/rakelib/lib/config/macosx.rb +16 -0
  26. data/rakelib/lib/config/mingw.rb +133 -9
  27. data/rakelib/lib/config/pkgman/arch.rb +53 -0
  28. data/rakelib/lib/config/pkgman/base.rb +169 -0
  29. data/rakelib/lib/config/pkgman/debian.rb +66 -0
  30. data/rakelib/lib/config/pkgman/macosx.rb +183 -0
  31. data/rakelib/lib/config/pkgman/rhel.rb +54 -0
  32. data/rakelib/lib/config/pkgman/suse.rb +54 -0
  33. data/rakelib/lib/config/unixish.rb +36 -19
  34. data/rakelib/lib/config.rb +254 -61
  35. data/rakelib/lib/core/include/funcall.inc +2 -1
  36. data/rakelib/lib/core/package.rb +47 -49
  37. data/rakelib/lib/director/comboctrl.rb +104 -3
  38. data/rakelib/lib/director/defs.rb +1 -3
  39. data/rakelib/lib/director/gdicommon.rb +5 -0
  40. data/rakelib/lib/director/menu_item.rb +1 -1
  41. data/rakelib/lib/director/num_validator.rb +5 -7
  42. data/rakelib/lib/director/owner_drawn_combobox.rb +1 -0
  43. data/rakelib/lib/director/persistent_window.rb +2 -2
  44. data/rakelib/lib/director/pgeditor.rb +1 -1
  45. data/rakelib/lib/director/pgproperties.rb +3 -3
  46. data/rakelib/lib/director/pgproperty.rb +5 -1
  47. data/rakelib/lib/director/richtext_style_listbox.rb +5 -0
  48. data/rakelib/lib/director/sizer.rb +1 -1
  49. data/rakelib/lib/director/window.rb +4 -0
  50. data/rakelib/lib/extractor/module.rb +15 -0
  51. data/rakelib/lib/generate/doc/combo_ctrl.yaml +135 -0
  52. data/rakelib/lib/generate/doc/file_dialog_customize_hook.yaml +62 -0
  53. data/rakelib/lib/generate/doc/file_system.yaml +28 -0
  54. data/rakelib/lib/generate/doc.rb +29 -14
  55. data/rakelib/lib/generate/interface.rb +16 -6
  56. data/rakelib/lib/swig_runner.rb +18 -15
  57. data/rakelib/lib/typemap/combo_popup.rb +42 -0
  58. data/rakelib/prepost.rake +9 -4
  59. data/rakelib/yard/templates/default/fulldoc/html/css/wxruby3.css +14 -0
  60. data/rakelib/yard/templates/default/fulldoc/html/setup.rb +5 -5
  61. data/rakelib/yard/yard/relative_markdown_links.rb +7 -1
  62. data/tests/test_combo_ctrl.rb +196 -0
  63. metadata +28 -17
  64. data/ext/mkrf_conf_srcgem.rb +0 -67
  65. data/rakelib/run.rake +0 -52
@@ -604,55 +604,53 @@ module WXRuby3
604
604
  def generate_core_doc
605
605
  script = <<~__SCRIPT
606
606
  require 'wx'
607
- Wx::App.run do
608
- STDOUT.puts \<<~__HEREDOC
609
- # ----------------------------------------------------------------------------
610
- # This file is automatically generated by the WXRuby3 documentation
611
- # generator. Do not alter this file.
612
- # ----------------------------------------------------------------------------
613
-
614
-
615
- module Wx
616
-
617
- # wxRuby version string
618
- Wx::WXRUBY_VERSION = '\#{Wx::WXRUBY_VERSION}'
619
-
620
- # wxRuby version release type (alpha, beta, rc)
621
- Wx::WXRUBY_RELEASE_TYPE = '\#{Wx::WXRUBY_RELEASE_TYPE}'
622
- # wxRuby major version number
623
- Wx::WXRUBY_MAJOR = \#{Wx::WXRUBY_MAJOR}
624
- # wxRuby minor version number
625
- Wx::WXRUBY_MINOR = \#{Wx::WXRUBY_MINOR}
626
- # wxRuby release number
627
- Wx::WXRUBY_RELEASE = \#{Wx::WXRUBY_RELEASE}
628
-
629
- # Convenience string for WxWidgets version info
630
- WXWIDGETS_VERSION = '\#{Wx::WXWIDGETS_VERSION}'
631
-
632
- # Integer constant reflecting the major version of the wxWidgets release used to build wxRuby
633
- WXWIDGETS_MAJOR_VERSION = \#{Wx::WXWIDGETS_MAJOR_VERSION}
634
-
635
- # Integer constant reflecting the minor version of the wxWidgets release used to build wxRuby
636
- WXWIDGETS_MINOR_VERSION = \#{Wx::WXWIDGETS_MINOR_VERSION}
637
-
638
- # Integer constant reflecting the release number of the wxWidgets release used to build wxRuby
639
- WXWIDGETS_RELEASE_NUMBER = \#{Wx::WXWIDGETS_RELEASE_NUMBER}
640
-
641
- # Integer constant reflecting the sub-release number of the wxWidgets release used to build wxRuby
642
- WXWIDGETS_SUBRELEASE_NUMBER = \#{Wx::WXWIDGETS_SUBRELEASE_NUMBER}
643
-
644
- # Integer constant reflecting the wxWidgets wxDEBUG_LEVEL
645
- WXWIDGETS_DEBUG_LEVEL = \#{Wx::WXWIDGETS_DEBUG_LEVEL}
646
-
647
- # Boolean constant indicating if wxRuby was build in debug (true) or release (false) mode
648
- DEBUG = \#{Wx::DEBUG}
649
-
650
- # Platform id of the wxWidgets port used to build wxRuby
651
- PLATFORM = '\#{Wx::PLATFORM}'
652
-
653
- end
654
- __HEREDOC
655
- end
607
+ STDOUT.puts \<<~__HEREDOC
608
+ # ----------------------------------------------------------------------------
609
+ # This file is automatically generated by the WXRuby3 documentation
610
+ # generator. Do not alter this file.
611
+ # ----------------------------------------------------------------------------
612
+
613
+
614
+ module Wx
615
+
616
+ # wxRuby version string
617
+ WXRUBY_VERSION = '\#{Wx::WXRUBY_VERSION}'
618
+
619
+ # wxRuby version release type (alpha, beta, rc)
620
+ WXRUBY_RELEASE_TYPE = '\#{Wx::WXRUBY_RELEASE_TYPE}'
621
+ # wxRuby major version number
622
+ WXRUBY_MAJOR = \#{Wx::WXRUBY_MAJOR}
623
+ # wxRuby minor version number
624
+ WXRUBY_MINOR = \#{Wx::WXRUBY_MINOR}
625
+ # wxRuby release number
626
+ WXRUBY_RELEASE = \#{Wx::WXRUBY_RELEASE}
627
+
628
+ # Convenience string for WxWidgets version info
629
+ WXWIDGETS_VERSION = '\#{Wx::WXWIDGETS_VERSION}'
630
+
631
+ # Integer constant reflecting the major version of the wxWidgets release used to build wxRuby
632
+ WXWIDGETS_MAJOR_VERSION = \#{Wx::WXWIDGETS_MAJOR_VERSION}
633
+
634
+ # Integer constant reflecting the minor version of the wxWidgets release used to build wxRuby
635
+ WXWIDGETS_MINOR_VERSION = \#{Wx::WXWIDGETS_MINOR_VERSION}
636
+
637
+ # Integer constant reflecting the release number of the wxWidgets release used to build wxRuby
638
+ WXWIDGETS_RELEASE_NUMBER = \#{Wx::WXWIDGETS_RELEASE_NUMBER}
639
+
640
+ # Integer constant reflecting the sub-release number of the wxWidgets release used to build wxRuby
641
+ WXWIDGETS_SUBRELEASE_NUMBER = \#{Wx::WXWIDGETS_SUBRELEASE_NUMBER}
642
+
643
+ # Integer constant reflecting the wxWidgets wxDEBUG_LEVEL
644
+ WXWIDGETS_DEBUG_LEVEL = \#{Wx::WXWIDGETS_DEBUG_LEVEL}
645
+
646
+ # Boolean constant indicating if wxRuby was build in debug (true) or release (false) mode
647
+ DEBUG = \#{Wx::DEBUG}
648
+
649
+ # Platform id of the wxWidgets port used to build wxRuby
650
+ PLATFORM = '\#{Wx::PLATFORM}'
651
+
652
+ end
653
+ __HEREDOC
656
654
  __SCRIPT
657
655
  begin
658
656
  tmpfile = Tempfile.new('script')
@@ -14,9 +14,10 @@ module WXRuby3
14
14
 
15
15
  class ComboCtrl < Window
16
16
 
17
+ include Typemap::ComboPopup
18
+
17
19
  def setup
18
20
  super
19
- spec.items << 'wxComboPopup'
20
21
  # mixin TextEntry
21
22
  spec.include_mixin 'wxComboCtrl', { 'Wx::TextEntry' => 'wxTextEntryBase' }
22
23
  spec.override_inheritance_chain('wxComboCtrl',
@@ -29,8 +30,108 @@ module WXRuby3
29
30
  wxComboCtrl::DoSetPopupControl
30
31
  wxComboCtrl::DoShowPopup
31
32
  ]
32
- # turn wxComboPopup into a mixin module
33
- spec.make_mixin 'wxComboPopup'
33
+ spec.add_header_code <<~__HEREDOC
34
+ #include "wxruby-ComboPopup.h"
35
+
36
+ static VALUE g_rb_mWxComboPopup = Qnil;
37
+ static VALUE g_rb_cComboPopupWx = Qnil;
38
+
39
+ WXRUBY_EXPORT wxComboPopup* wxRuby_ComboPopupFromRuby(VALUE popup)
40
+ {
41
+ if (!NIL_P(popup) && !rb_obj_is_kind_of(popup, g_rb_mWxComboPopup))
42
+ {
43
+ rb_raise(rb_eArgError, "Expected a Wx::ComboPopup or nil for 1");
44
+ return nullptr;
45
+ }
46
+
47
+ wxComboPopup* cpp = nullptr;
48
+ if (!NIL_P(popup))
49
+ {
50
+ VALUE rb_cp_proxy = rb_iv_get(popup, "@_wx_combo_popup_proxy");
51
+ if (NIL_P(rb_cp_proxy))
52
+ {
53
+ cpp = new WxRubyComboPopup(popup);
54
+ rb_cp_proxy = Data_Wrap_Struct(rb_cObject, 0, 0, cpp);
55
+ rb_iv_set(popup, "@_wx_combo_popup_proxy", rb_cp_proxy);
56
+ }
57
+ else
58
+ {
59
+ Data_Get_Struct(rb_cp_proxy, wxComboPopup, cpp);
60
+ }
61
+ }
62
+ return cpp;
63
+ }
64
+
65
+ WXRUBY_EXPORT VALUE wxRuby_ComboPopupToRuby(wxComboPopup* cpp)
66
+ {
67
+ VALUE rb_cpp = Qnil;
68
+ if (cpp)
69
+ {
70
+ WxRubyComboPopup *wxrb_cpp = dynamic_cast<WxRubyComboPopup*> (cpp);
71
+ if (wxrb_cpp)
72
+ {
73
+ rb_cpp = wxrb_cpp->GetRubyComboPopup();
74
+ }
75
+ else
76
+ {
77
+ // in this case we're probably working for a wxOwnerDrawnComboBox or wxRichTextListbox
78
+ // with default popup control which is a C++ implemented class without any Ruby linkage.
79
+ // wrap this in the Wx::ComboPopupWx class to provide a Ruby interface
80
+ rb_cpp = Data_Wrap_Struct(g_rb_cComboPopupWx, 0, 0, cpp); // do not own or track
81
+ }
82
+ }
83
+ return rb_cpp;
84
+ }
85
+
86
+ static void wxRuby_markComboPopups()
87
+ {
88
+ WxRubyComboPopup::GC_mark_combo_popups();
89
+ }
90
+ __HEREDOC
91
+ # ignore these
92
+ spec.ignore 'wxComboCtrl::SetPopupControl',
93
+ 'wxComboCtrl::GetPopupControl',
94
+ ignore_doc: false
95
+ # for GetPopupControl docs only
96
+ spec.map 'wxComboPopup*' => 'Wx::ComboPopup', swig: false do
97
+ map_out code: ''
98
+ end
99
+ # and replace
100
+ spec.add_extend_code 'wxComboCtrl', <<~__HEREDOC
101
+ void SetPopupControl(VALUE popup)
102
+ {
103
+ wxComboPopup* cpp = wxRuby_ComboPopupFromRuby(popup);
104
+ $self->SetPopupControl(cpp);
105
+ }
106
+
107
+ VALUE GetPopupControl()
108
+ {
109
+ return wxRuby_ComboPopupToRuby($self->GetPopupControl());
110
+ }
111
+ __HEREDOC
112
+ spec.add_init_code <<~__HEREDOC
113
+ wxRuby_AppendMarker(wxRuby_markComboPopups);
114
+
115
+ g_rb_mWxComboPopup = rb_define_module_under(mWxCore, "ComboPopup");
116
+ rb_define_method(g_rb_mWxComboPopup, "get_combo_ctrl", VALUEFUNC(wx_combo_popup_get_combo_ctrl), -1);
117
+
118
+ g_rb_cComboPopupWx = rb_define_class_under(mWxCore, "ComboPopupWx", rb_cObject);
119
+ rb_undef_alloc_func(g_rb_cComboPopupWx);
120
+ rb_define_method(g_rb_cComboPopupWx, "lazy_create", VALUEFUNC(combo_popup_wx_lazy_create), -1);
121
+ rb_define_method(g_rb_cComboPopupWx, "create", VALUEFUNC(combo_popup_wx_create), -1);
122
+ rb_define_method(g_rb_cComboPopupWx, "get_combo_ctrl", VALUEFUNC(combo_popup_wx_get_combo_ctrl), -1);
123
+ rb_define_method(g_rb_cComboPopupWx, "find_item", VALUEFUNC(combo_popup_wx_find_item), -1);
124
+ rb_define_method(g_rb_cComboPopupWx, "get_adjusted_size", VALUEFUNC(combo_popup_wx_get_adjusted_size), -1);
125
+ rb_define_method(g_rb_cComboPopupWx, "get_control", VALUEFUNC(combo_popup_wx_get_control), -1);
126
+ rb_define_method(g_rb_cComboPopupWx, "set_string_value", VALUEFUNC(combo_popup_wx_set_string_value), -1);
127
+ rb_define_method(g_rb_cComboPopupWx, "get_string_value", VALUEFUNC(combo_popup_wx_get_string_value), -1);
128
+ rb_define_method(g_rb_cComboPopupWx, "on_combo_double_click", VALUEFUNC(combo_popup_wx_on_combo_double_click), -1);
129
+ rb_define_method(g_rb_cComboPopupWx, "on_combo_key_event", VALUEFUNC(combo_popup_wx_on_combo_key_event), -1);
130
+ rb_define_method(g_rb_cComboPopupWx, "on_combo_char_event", VALUEFUNC(combo_popup_wx_on_combo_char_event), -1);
131
+ rb_define_method(g_rb_cComboPopupWx, "on_dismiss", VALUEFUNC(combo_popup_wx_on_dismiss), -1);
132
+ rb_define_method(g_rb_cComboPopupWx, "on_popup", VALUEFUNC(combo_popup_wx_on_popup), -1);
133
+ rb_define_method(g_rb_cComboPopupWx, "paint_combo_control", VALUEFUNC(combo_popup_wx_paint_combo_control), -1);
134
+ __HEREDOC
34
135
  end
35
136
 
36
137
  end # class ComboCtrl
@@ -32,9 +32,7 @@ module WXRuby3
32
32
  wxDELETEA
33
33
  wxSwap
34
34
  }
35
- if Config.instance.wx_version >= '3.3.0'
36
- spec.ignore 'wxOVERRIDE'
37
- end
35
+ spec.ignore 'wxOVERRIDE'
38
36
  super
39
37
  end
40
38
 
@@ -49,6 +49,11 @@ module WXRuby3
49
49
  'wxRect::Intersect(const wxRect &)',
50
50
  'wxRect::Union(const wxRect &)'
51
51
  ]
52
+ if Config.instance.wx_version >= '3.3.0'
53
+ # ignore these as they are supposed to specify unary minus but confuse
54
+ # SWIG
55
+ spec.ignore 'wxPoint::operator-(const wxPoint&)'
56
+ end
52
57
  spec.regard 'wxRect::Offset', regard_doc: false
53
58
  # overrule common wxPoint mapping for wxRect ctor to fix ctor ambiguities here wrt wxSize
54
59
  spec.map 'const wxPoint& topLeft', 'const wxPoint& bottomRight', as: 'Wx::Point' do
@@ -24,7 +24,7 @@ module WXRuby3
24
24
  spec.ignore_unless('USE_ACCEL', 'wxMenuItem::GetAccel')
25
25
  spec.no_proxy 'wxMenuItem::GetAccel'
26
26
  spec.ignore 'wxMenuItem::GetBitmap(bool)' # not portable
27
- if Config.instance.wx_version >= '3.3.0'
27
+ if Config.instance.wx_version > '3.2.4'
28
28
  spec.ignore_unless('WXMSW', 'wxMenuItem::SetBackgroundColour','wxMenuItem::SetFont','wxMenuItem::SetTextColour')
29
29
  end
30
30
  super
@@ -383,13 +383,11 @@ module WXRuby3
383
383
  # hardcoded interface declarations
384
384
  spec.add_interface_code <<~__HEREDOC
385
385
  // Bit masks used for numeric validator styles.
386
- enum wxNumValidatorStyle
387
- {
388
- wxNUM_VAL_DEFAULT = 0x0,
389
- wxNUM_VAL_THOUSANDS_SEPARATOR = 0x1,
390
- wxNUM_VAL_ZERO_AS_BLANK = 0x2,
391
- wxNUM_VAL_NO_TRAILING_ZEROES = 0x4
392
- };
386
+ enum wxNumValidatorStyle;
387
+ %constant int NumValidatorStyle_wxNUM_VAL_DEFAULT = 0x0;
388
+ %constant int NumValidatorStyle_wxNUM_VAL_THOUSANDS_SEPARATOR = 0x1;
389
+ %constant int NumValidatorStyle_wxNUM_VAL_ZERO_AS_BLANK = 0x2;
390
+ %constant int NumValidatorStyle_wxNUM_VAL_NO_TRAILING_ZEROES = 0x4;
393
391
 
394
392
  %alias WXIntegerValidator::GetMin "min";
395
393
  %alias WXIntegerValidator::SetMin "min=";
@@ -15,6 +15,7 @@ module WXRuby3
15
15
  class OwnerDrawnComboBox < Window
16
16
 
17
17
  include Typemap::ClientData
18
+ include Typemap::ComboPopup
18
19
 
19
20
  def setup
20
21
  super
@@ -14,8 +14,8 @@ module WXRuby3
14
14
 
15
15
  def setup
16
16
  spec.items << 'wxPersistentTLW' << 'wxPersistentBookCtrl' << 'wxPersistentTreeBookCtrl'
17
- if Config.instance.wx_version >= '3.3.0'
18
- # before 3.3.0 this was not properly available
17
+ if Config.instance.wx_version > '3.2.4'
18
+ # only after 3.2.4 properly available
19
19
  spec.items << 'wxPersistentComboBox'
20
20
  end
21
21
  super
@@ -17,7 +17,7 @@ module WXRuby3
17
17
  spec.items.concat %w[wxPGCheckBoxEditor wxPGChoiceEditor wxPGChoiceAndButtonEditor wxPGComboBoxEditor
18
18
  wxPGTextCtrlEditor wxPGSpinCtrlEditor wxPGTextCtrlAndButtonEditor wxPGEditorDialogAdapter]
19
19
  spec.includes << 'wx/propgrid/propgriddefs.h'
20
- if Config.instance.wx_version >= '3.3.0'
20
+ if Config.instance.wx_version > '3.2.4'
21
21
  # make sure SWIG knows this as enum type
22
22
  spec.add_swig_code 'enum wxPGPropertyFlags;'
23
23
  end
@@ -65,7 +65,7 @@ module WXRuby3
65
65
  'wxUIntProperty::m_prefix',
66
66
  'wxDateProperty::m_format',
67
67
  'wxDateProperty::m_dpStyle'
68
- if Config.instance.wx_version >= '3.3.0'
68
+ if Config.instance.wx_version > '3.2.4'
69
69
  # currently missing from interface docs
70
70
  spec.extend_interface 'wxEnumProperty',
71
71
  'bool ValueFromString_(wxVariant& value, int* pIndex, const wxString& text,int argFlags) const',
@@ -111,7 +111,7 @@ module WXRuby3
111
111
  end
112
112
  # make sure the derived Enum property classes provide the protected accessors too
113
113
  %w[wxCursorProperty wxEditEnumProperty wxSystemColourProperty wxColourProperty].each do |kls|
114
- if Config.instance.wx_version >= '3.3.0'
114
+ if Config.instance.wx_version > '3.2.4'
115
115
  # currently missing from interface docs
116
116
  spec.extend_interface kls,
117
117
  'int GetIndex() const',
@@ -136,7 +136,7 @@ module WXRuby3
136
136
  'wxLongStringProperty::DisplayEditorDialog',
137
137
  'wxMultiChoiceProperty::DisplayEditorDialog',
138
138
  'wxFontProperty::DisplayEditorDialog'
139
- if Config.instance.wx_version >= '3.3.0'
139
+ if Config.instance.wx_version > '3.2.4'
140
140
  # for wxEnumProperty and derivatives ValueFromString_/ValueFromInt_
141
141
  spec.map_apply 'int * OUTPUT' => 'int* pIndex'
142
142
  end
@@ -113,7 +113,11 @@ module WXRuby3
113
113
  # do not think this useful for wxRuby (Also; caused GC problems)
114
114
  spec.ignore 'wxPGProperty::GetCellRenderer'
115
115
  # obsolete
116
- spec.ignore %w[wxPGProperty::AddChild wxPGProperty::GetValueString]
116
+ if Config.instance.wx_version < '3.3.0'
117
+ spec.ignore %w[wxPGProperty::AddChild wxPGProperty::GetValueString]
118
+ else
119
+ spec.ignore 'wxPGProperty::AddChild'
120
+ end
117
121
  # not of use in Ruby
118
122
  spec.ignore(%w[wxPGProperty::GetClientData wxPGProperty::SetClientData])
119
123
  # only keep the const version
@@ -15,6 +15,7 @@ module WXRuby3
15
15
  class RichTextStyleListBox < Window
16
16
 
17
17
  include Typemap::RichText
18
+ include Typemap::ComboPopup
18
19
 
19
20
  def setup
20
21
  super
@@ -28,6 +29,10 @@ module WXRuby3
28
29
  wxWindow
29
30
  wxEvtHandler
30
31
  wxObject])
32
+ # missing from docs; required so proxy calls correct override
33
+ spec.extend_interface 'wxRichTextStyleComboCtrl',
34
+ 'virtual void DoSetPopupControl(wxComboPopup* popup)',
35
+ visibility: 'protected'
31
36
  end
32
37
 
33
38
  end
@@ -20,7 +20,7 @@ module WXRuby3
20
20
  when 'wxSizer'
21
21
  spec.items << 'wxSizerFlags'
22
22
  spec.gc_as_untracked('wxSizerFlags')
23
- if Config.instance.wx_version < '3.3.0'
23
+ unless Config.instance.wx_version > '3.2.4'
24
24
  # missing from docs
25
25
  spec.extend_interface 'wxSizerFlags',
26
26
  'wxSizerFlags& HorzBorder()'
@@ -126,6 +126,10 @@ module WXRuby3
126
126
  else
127
127
  spec.ignore('wxWindow::SetAccessible',
128
128
  'wxWindow::GetAccessible')
129
+ if Config.instance.wx_version > '3.2.4'
130
+ spec.ignore('wxWindow::CreateAccessible',
131
+ 'wxWindow::GetOrCreateAccessible')
132
+ end
129
133
  end
130
134
  spec.ignore_unless('USE_HOTKEY', %w[wxWindow::RegisterHotKey wxWindow::UnregisterHotKey])
131
135
  spec.ignore('wxWindow::SetSize(int, int)') # not useful as the wxSize variant will also accept an array
@@ -117,6 +117,13 @@ module WXRuby3
117
117
  when 'file', 'namespace'
118
118
  Extractor.extracting_msg(kind, element, 'compoundname')
119
119
  element.xpath('sectiondef/memberdef').each { |node| self.add_element(node) }
120
+ # from doxygen 1.9.7 onwards some members are not included in the same XML file
121
+ # but referenced from another XML file; so we need to resolve such references
122
+ # and than add the resolved element
123
+ element.xpath('sectiondef/member').each do |node|
124
+ node = self.resolveRefId(node)
125
+ self.add_element(node)
126
+ end
120
127
 
121
128
  else
122
129
  raise ExtractorError.new('Unknown module item kind: %s' % kind)
@@ -124,6 +131,14 @@ module WXRuby3
124
131
  item
125
132
  end
126
133
 
134
+ def resolveRefId(node)
135
+ refid = node['refid'].split('_')
136
+ refid.pop
137
+ fname = File.join(Extractor.xml_dir, refid.join('_')+'.xml')
138
+ root = File.open(fname) {|f| Nokogiri::XML(f) }.root
139
+ root.at_xpath(".//sectiondef/memberdef[@id='#{node['refid']}']")
140
+ end
141
+
127
142
  # Add a new C++ function into the module that is written by hand, not
128
143
  # wrapped.
129
144
  def add_cpp_function(type, name, argsString, body, doc = nil, **kwargs)
@@ -0,0 +1,135 @@
1
+ ---
2
+ :wxComboCtrl:
3
+ :detail:
4
+ :pre:
5
+ :programlisting:
6
+ - :pattern: !ruby/regexp /wxDECLARE_EVENT_TABLE/
7
+ :replace: |
8
+
9
+ ```ruby
10
+ class ListViewComboPopup < Wx::ListView
11
+
12
+ include Wx::ComboPopup
13
+
14
+ # Allow only default ctor
15
+ def initialize
16
+ # call default control ctor; need to call Wx::ListView#create later
17
+ super
18
+ end
19
+
20
+ # Initialize member variables
21
+ def init
22
+ @value = -1
23
+ end
24
+
25
+ # Create popup control
26
+ def create(parent)
27
+ # need to finish creating the list view here
28
+ # as calling super here would just call Wx::ComboPopup#create and not Wx::ListView#create
29
+ # we need to use Ruby magic
30
+ wx_lv_create = (Wx::ListView.instance_method :create).bind(self)
31
+ wx_lv_create.call(parent, 1, [0,0], Wx::DEFAULT_SIZE)
32
+ evt_motion :on_mouse_move
33
+ evt_left_up :on_mouse_click
34
+ end
35
+
36
+ # Return pointer to the created control
37
+ def get_control
38
+ self
39
+ end
40
+
41
+ def lv_find_item(*args)
42
+ unless @wx_lv_find_item
43
+ @wx_lv_find_item = (Wx::ListView.instance_method :find_item).bind(self)
44
+ end
45
+ @wx_lv_find_item.call(*args)
46
+ end
47
+ protected :lv_find_item
48
+
49
+ # Translate string into a list selection
50
+ def set_string_value(s)
51
+ n = lv_find_item(-1, s)
52
+ if n >= 0 && n < get_item_count
53
+ select(n)
54
+ @value = n
55
+ end
56
+ end
57
+
58
+ # Get list selection as a string
59
+ def get_string_value
60
+ return get_item_text(@value) if @value >= 0
61
+ ''
62
+ end
63
+
64
+ # Do mouse hot-tracking (which is typical in list popups)
65
+ def on_mouse_move(event)
66
+ # Move selection to cursor ...
67
+ end
68
+
69
+ # On mouse left up, set the value and close the popup
70
+ def on_mouse_click(_event)
71
+ @value = get_first_selected
72
+
73
+ # Send event as well ...
74
+
75
+ dismiss
76
+ end
77
+
78
+ end
79
+ ```
80
+ - :pattern: !ruby/regexp /wxComboCtrl/
81
+ :replace: |
82
+
83
+ ```ruby
84
+ comboCtrl = Wx::ComboCtrl.new(self, Wx::ID_ANY, '')
85
+
86
+ popupCtrl = ListViewComboPopup.new
87
+
88
+ # It is important to call #set_popup_control as soon as possible
89
+ comboCtrl.set_popup_control(popupCtrl)
90
+
91
+ # Populate using Wx::ListView methods
92
+ popupCtrl.insert_item((popupCtrl.item_count, 'First Item')
93
+ popupCtrl.insert_item((popupCtrl.item_count, 'Second Item')
94
+ popupCtrl.insert_item((popupCtrl.item_count, 'Third Item')
95
+ ```
96
+ :wxComboCtrl.SetMainControl:
97
+ :detail:
98
+ :pre:
99
+ :programlisting:
100
+ - :pattern: !ruby/regexp /.*/
101
+ :replace: |
102
+
103
+ ```ruby
104
+ # Create the combo control using its default ctor.
105
+ combo = Wx::ComboCtrl.new
106
+
107
+ # Create the custom main control using its default ctor too.
108
+ main = SomeWindow.new
109
+
110
+ # Set the custom main control before creating the combo.
111
+ combo.set_main_control(main)
112
+
113
+ # And only create it now: Wx::TextCtrl won't be unnecessarily
114
+ # created because the combo already has a main window.
115
+ combo.create(panel, Wx::ID_ANY, '')
116
+
117
+ # Finally create the main window itself, now that its parent was
118
+ # created.
119
+ main.create(combo, ...)
120
+ ```
121
+ :wxComboCtrl.SetTextCtrlStyle:
122
+ :detail:
123
+ :pre:
124
+ :programlisting:
125
+ - :pattern: !ruby/regexp /.*/
126
+ :replace: |
127
+
128
+ ```ruby
129
+ comboCtrl = Wx::ComboCtrl.new
130
+
131
+ # Let's make the text right-aligned
132
+ comboCtrl.set_text_ctrl_style(Wx::TE_RIGHT)
133
+
134
+ comboCtrl.create(parent, Wx::ID_ANY, '')
135
+ ```
@@ -0,0 +1,62 @@
1
+ ---
2
+ :wxFileDialogCustomizeHook:
3
+ :detail:
4
+ :pre:
5
+ :programlisting:
6
+ - :pattern: !ruby/regexp /.*/
7
+ :replace: |
8
+
9
+ ```ruby
10
+ class EncryptHook < Wx::FileDialogCustomizeHook
11
+
12
+ attr_reader :encrypt
13
+
14
+ # Override to add custom controls using the provided customizer object.
15
+ def add_custom_controls(customizer)
16
+ # Suppose we can encrypt files when saving them.
17
+ @checkbox = customizer.add_check_box('Encrypt')
18
+
19
+ # While @checkbox is not a Wx::CheckBox, it looks almost like one
20
+ # and, in particular, we can bind to custom control events as usual.
21
+ @checkbox.evt_checkbox(Wx::ID_ANY) do |event|
22
+ # We can also call Wx::Window-like functions on them.
23
+ @button.enable(event.checked?)
24
+ end
25
+
26
+ # The encryption parameters can be edited in a dedicated dialog.
27
+ @button = customizer.add_button('Parameters...')
28
+ @button.evt_button(Wx::ID_ANY) do |event|
29
+ # ... show the encryption parameters dialog here ...
30
+ end
31
+ end
32
+
33
+ # Override to save the values of the custom controls.
34
+ def transfer_data_from_custom_controls
35
+ # Save the checkbox value, as we won't be able to use it any more
36
+ # once this function returns.
37
+ @encrypt = @checkbox.get_value
38
+ end
39
+
40
+ end
41
+
42
+ # ...
43
+
44
+ def some_method
45
+ Wx.FileDialog(nil, 'Save document', '', 'file.my',
46
+ 'My files (*.my)|*.my',
47
+ Wx::FD_SAVE | Wx::FD_OVERWRITE_PROMPT) do |dialog|
48
+
49
+ # This object may be destroyed before the dialog, but must remain
50
+ # alive until #show_modal returns.
51
+ customize_hook = EncryptHook.new
52
+ dialog.set_customize_hook(custom_hook)
53
+
54
+ if dialog.show_modal == Wx::ID_OK
55
+ if customize_hook.encrypt
56
+ # ... save with encryption ...
57
+ else
58
+ # ... save without encryption ...
59
+ end
60
+ end
61
+ end
62
+ ```
@@ -0,0 +1,28 @@
1
+ ---
2
+ :wxFileSystemHandler.CanOpen:
3
+ :detail:
4
+ :pre:
5
+ :para:
6
+ - :pattern: !ruby/regexp /Example:/
7
+ :subst: ''
8
+ :programlisting:
9
+ - :pattern: !ruby/regexp /.*/
10
+ :replace: ''
11
+ :wxFileSystemHandler.GetMimeTypeFromExt:
12
+ :detail:
13
+ :pre:
14
+ :para:
15
+ - :pattern: !ruby/regexp /Example:/
16
+ :subst: ''
17
+ :programlisting:
18
+ - :pattern: !ruby/regexp /.*/
19
+ :replace: ''
20
+ :wxMemoryFSHandler:
21
+ :detail:
22
+ :pre:
23
+ :para:
24
+ - :pattern: !ruby/regexp /Example:/
25
+ :subst: ''
26
+ :programlisting:
27
+ - :pattern: !ruby/regexp /.*/
28
+ :replace: ''