wxruby3 0.9.3 → 0.9.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/INSTALL.md +1 -1
- data/README.md +2 -2
- data/ext/wxruby3/include/wxruby-ComboPopup.h +777 -0
- data/ext/wxruby3/include/wxruby-Config.h +23 -5
- data/ext/wxruby3/include/wxruby-Persistence.h +79 -0
- data/ext/wxruby3/swig/memory_management.i +6 -0
- data/lib/wx/core/book_ctrl_base.rb +16 -0
- data/lib/wx/core/combo_ctrl.rb +171 -0
- data/lib/wx/core/config.rb +454 -83
- data/lib/wx/core/notebook.rb +10 -8
- data/lib/wx/core/peristent_object.rb +15 -0
- data/lib/wx/core/persistence_manager.rb +39 -0
- data/lib/wx/core/persistent_window.rb +16 -0
- data/lib/wx/core/top_level_window.rb +16 -0
- data/lib/wx/core/treebook.rb +18 -0
- data/lib/wx/core.rb +4 -0
- data/lib/wx/doc/book_ctrl_base.rb +19 -0
- data/lib/wx/doc/comboctrl.rb +128 -3
- data/lib/wx/doc/config.rb +101 -41
- data/lib/wx/doc/extra/14_config.md +101 -0
- data/lib/wx/doc/extra/15_persistence.md +148 -0
- data/lib/wx/doc/owner_drawn_combobox.rb +5 -1
- data/lib/wx/doc/persistence_manager.rb +36 -0
- data/lib/wx/doc/persistent_object.rb +27 -0
- data/lib/wx/doc/top_level_window.rb +19 -0
- data/lib/wx/doc/treebook.rb +6 -1
- data/lib/wx/version.rb +1 -1
- data/rakelib/build.rb +1 -1
- data/rakelib/lib/core/include/funcall.inc +2 -1
- data/rakelib/lib/core/package.rb +22 -1
- data/rakelib/lib/core/spec.rb +10 -0
- data/rakelib/lib/core/spec_helper.rb +1 -1
- data/rakelib/lib/director/comboctrl.rb +104 -3
- data/rakelib/lib/director/config_base.rb +490 -19
- data/rakelib/lib/director/defs.rb +1 -3
- data/rakelib/lib/director/event_filter.rb +1 -1
- data/rakelib/lib/director/event_loop.rb +1 -1
- data/rakelib/lib/director/file_dialog_customize_hook.rb +2 -2
- data/rakelib/lib/director/gdicommon.rb +6 -0
- data/rakelib/lib/director/grid_cell_attr.rb +1 -1
- data/rakelib/lib/director/grid_cell_editor.rb +1 -1
- data/rakelib/lib/director/grid_cell_renderer.rb +1 -1
- data/rakelib/lib/director/header_ctrl.rb +3 -0
- data/rakelib/lib/director/html_listbox.rb +2 -1
- data/rakelib/lib/director/menu_item.rb +1 -1
- data/rakelib/lib/director/num_validator.rb +5 -7
- data/rakelib/lib/director/owner_drawn_combobox.rb +1 -0
- data/rakelib/lib/director/persistence_manager.rb +410 -0
- data/rakelib/lib/director/persistent_object.rb +70 -0
- data/rakelib/lib/director/persistent_window.rb +73 -0
- data/rakelib/lib/director/pgeditor.rb +1 -1
- data/rakelib/lib/director/pgproperties.rb +3 -3
- data/rakelib/lib/director/pgproperty.rb +5 -1
- data/rakelib/lib/director/richtext_style_listbox.rb +5 -0
- data/rakelib/lib/director/sizer.rb +1 -1
- data/rakelib/lib/director/static_bitmap.rb +4 -0
- data/rakelib/lib/director/text_entry.rb +1 -1
- data/rakelib/lib/director/window.rb +4 -0
- data/rakelib/lib/extractor/module.rb +15 -0
- data/rakelib/lib/generate/analyzer.rb +43 -43
- data/rakelib/lib/generate/doc/combo_ctrl.yaml +135 -0
- data/rakelib/lib/generate/doc/file_dialog_customize_hook.yaml +62 -0
- data/rakelib/lib/generate/doc/file_system.yaml +28 -0
- data/rakelib/lib/generate/doc.rb +1 -1
- data/rakelib/lib/generate/interface.rb +12 -4
- data/rakelib/lib/specs/interfaces.rb +3 -0
- data/rakelib/lib/swig_runner.rb +7 -4
- data/rakelib/lib/typemap/combo_popup.rb +42 -0
- data/rakelib/lib/typemap/config.rb +8 -0
- data/samples/widgets/widgets.rb +5 -9
- data/tests/test_combo_ctrl.rb +196 -0
- data/tests/test_config.rb +207 -42
- data/tests/test_persistence.rb +142 -0
- metadata +26 -2
@@ -45,6 +45,10 @@ module WXRuby3
|
|
45
45
|
spec.add_swig_code %Q{typedef wxStaticBitmap::ScaleMode ScaleMode; }
|
46
46
|
spec.add_header_code %Q{typedef wxStaticBitmap::ScaleMode ScaleMode; }
|
47
47
|
defmod.items << def_genstatbmp
|
48
|
+
# as we already called super before adding wxGenericStaticBitmap the no_proxy settings from the
|
49
|
+
# base Window director are missing; just copy all those set for wxStaticBitmap
|
50
|
+
list = spec.no_proxies.select { |name| name.start_with?('wxStaticBitmap::') }
|
51
|
+
spec.no_proxy(*list.collect { |name| name.sub(/\AwxStaticBitmap::/, 'wxGenericStaticBitmap::')})
|
48
52
|
defmod
|
49
53
|
end
|
50
54
|
|
@@ -15,7 +15,7 @@ module WXRuby3
|
|
15
15
|
def setup
|
16
16
|
super
|
17
17
|
spec.items << 'wxTextCompleter' << 'wxTextCompleterSimple'
|
18
|
-
spec.
|
18
|
+
spec.gc_as_marked 'wxTextCompleter', 'wxTextCompleterSimple' # untracked but cached in Ruby
|
19
19
|
spec.gc_as_untracked 'wxTextEntry' # actually no GC control necessary as this is a mixin only
|
20
20
|
# turn wxTextEntry into a mixin module
|
21
21
|
spec.make_mixin 'wxTextEntry'
|
@@ -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)
|
@@ -540,53 +540,53 @@ module WXRuby3
|
|
540
540
|
# check the preprocessed definitions
|
541
541
|
errors = []
|
542
542
|
warnings = []
|
543
|
-
|
544
|
-
|
543
|
+
# select eligible ClassDef
|
544
|
+
cls_items = def_items.select do |item|
|
545
|
+
Extractor::ClassDef === item && !item_ignored(item, doc_gen) &&
|
545
546
|
(!item.is_template? || template_as_class?(item.name)) &&
|
546
547
|
!is_folded_base?(item.name)
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
end
|
548
|
+
end
|
549
|
+
cls_items.each do |item|
|
550
|
+
intf_class_name = if item.is_template? || template_as_class?(item.name)
|
551
|
+
template_class_name(item.name)
|
552
|
+
else
|
553
|
+
item.name
|
554
|
+
end
|
555
|
+
# this should not happen
|
556
|
+
raise "Missing preprocessed data for class #{intf_class_name}" unless has_class_interface(intf_class_name)
|
557
|
+
# get the class's method registry
|
558
|
+
cls_mtdreg = class_interface_methods(intf_class_name)
|
559
|
+
# check all directly inherited generated methods
|
560
|
+
mtdlist = ::Set.new # remember handled signatures
|
561
|
+
base_list(item).each do |base_name|
|
562
|
+
# make sure the base class has been preprocessed
|
563
|
+
get_class_interface(package, base_name, doc_gen) unless has_class_interface(base_name)
|
564
|
+
# generate any required enum typemaps for inherited virtuals
|
565
|
+
gen_base_class_enum_typemaps(base_name, enum_maps)
|
566
|
+
# iterate the base class's method registrations
|
567
|
+
class_interface_methods(base_name).each_pair do |mtdsig, mtdreg|
|
568
|
+
# only check on methods we have not handled yet
|
569
|
+
if !mtdlist.include?(mtdsig)
|
570
|
+
# did we inherit a virtual method that was not proxied in the base
|
571
|
+
if mtdreg[:virtual] && !mtdreg[:proxy]
|
572
|
+
# # if we did NOT generate a wrapper override and we do not have the proxy suppressed we're in trouble
|
573
|
+
# if !cls_mtdreg.has_key?(mtdsig) && has_method_proxy?(item.name, mtdreg[:method])
|
574
|
+
# warnings << "* WARNING: disabling proxy for virtual method #{mtdreg[:method].signature} without wrapper implementation in class #{item.name} since it is NOT proxied in base class #{base_name}!"
|
575
|
+
# els
|
576
|
+
if cls_mtdreg.has_key?(mtdsig) && !cls_mtdreg[mtdsig][:extension] && !has_method_proxy?(item.name, cls_mtdreg[mtdsig][:method])
|
577
|
+
# if this is not a custom extension and we do have an override wrapper and no proxy this is unnecessary code bloat
|
578
|
+
warnings << " * WARNING: Unnecessary override #{mtdreg[:method].signature} in class #{item.name} for non-proxied base in #{base_name}. Ignoring."
|
579
|
+
cls_mtdreg[mtdsig][:ignore] = true
|
580
|
+
end
|
581
|
+
# or did we inherit a virtual method that was proxied in the base
|
582
|
+
# for which we DO generate a wrapper override
|
583
|
+
elsif mtdreg[:virtual] && mtdreg[:proxy] && cls_mtdreg.has_key?(mtdsig)
|
584
|
+
# if we do not have a proxy as well we're in trouble
|
585
|
+
if !has_method_proxy?(item, mtdreg[:method])
|
586
|
+
errors << "* ERROR: method #{mtdreg[:method].signature} is NOT proxied with an overriden wrapper implementation in class #{item.name} but is also implemented and proxied in base class #{base_name}!"
|
587
587
|
end
|
588
|
-
mtdlist << mtdsig
|
589
588
|
end
|
589
|
+
mtdlist << mtdsig
|
590
590
|
end
|
591
591
|
end
|
592
592
|
end
|
@@ -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: ''
|
data/rakelib/lib/generate/doc.rb
CHANGED
@@ -480,7 +480,7 @@ module WXRuby3
|
|
480
480
|
/\A\s*Include\s+file:/ # Include file note
|
481
481
|
''
|
482
482
|
else
|
483
|
-
para.sub!(/Include\s+file:\s
|
483
|
+
para.sub!(/Include\s+file:\s+\\?#include\s+<[^>]+> */, '')
|
484
484
|
if event_section?
|
485
485
|
case para
|
486
486
|
when /The following event handler macros redirect.*(\{.*})/
|
@@ -547,10 +547,18 @@ module WXRuby3
|
|
547
547
|
if Extractor::EnumDef === item && !item.ignored && !item.items.all? {|e| e.ignored }
|
548
548
|
fout.puts
|
549
549
|
fout.puts "// from enum #{item.is_anonymous ? '' : item.name}"
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
550
|
+
if item.is_anonymous
|
551
|
+
item.items.each do |e|
|
552
|
+
unless e.ignored
|
553
|
+
fout.puts "%constant int #{e.name} = #{e.fqn};"
|
554
|
+
end
|
555
|
+
end
|
556
|
+
else
|
557
|
+
fout.puts "enum #{item.name};"
|
558
|
+
item.items.each do |e|
|
559
|
+
unless e.ignored
|
560
|
+
fout.puts "%constant int #{item.name}_#{e.name} = #{e.fqn};"
|
561
|
+
end
|
554
562
|
end
|
555
563
|
end
|
556
564
|
end
|
@@ -230,6 +230,9 @@ module WXRuby3
|
|
230
230
|
Director.Spec(pkg, 'wxFileSystem', requirements: %w[USE_FILESYSTEM])
|
231
231
|
Director.Spec(pkg, 'wxDialUpManager', requirements: %w[USE_DIALUP_MANAGER])
|
232
232
|
Director.Spec(pkg, 'wxDialUpEvent', requirements: %w[USE_DIALUP_MANAGER])
|
233
|
+
Director.Spec(pkg, 'wxPersistenceManager', requirements: %w[USE_CONFIG])
|
234
|
+
Director.Spec(pkg, 'wxPersistentObject', requirements: %w[USE_CONFIG])
|
235
|
+
Director.Spec(pkg, 'wxPersistentWindow', requirements: %w[USE_CONFIG])
|
233
236
|
}
|
234
237
|
|
235
238
|
Director.Package('Wx::PRT', 'USE_PRINTING_ARCHITECTURE') do |pkg|
|
data/rakelib/lib/swig_runner.rb
CHANGED
@@ -262,7 +262,7 @@ module WXRuby3
|
|
262
262
|
def_items.each do |item|
|
263
263
|
case item
|
264
264
|
when Extractor::EnumDef
|
265
|
-
item.items.each { |e| enumerators[rb_wx_name(e.name
|
265
|
+
item.items.each { |e| enumerators["#{rb_wx_name(item.name)}_#{e.name}"] = item } if item.is_type
|
266
266
|
when Extractor::ClassDef
|
267
267
|
item.items.select { |itm| Extractor::EnumDef === itm }.each do |enum|
|
268
268
|
enum.items.each { |e| enumerators[rb_wx_name(e.name)] = enum } if enum.is_type
|
@@ -334,6 +334,7 @@ module WXRuby3
|
|
334
334
|
fix_enum = true
|
335
335
|
enum_item = enum_table[md[2]]
|
336
336
|
enum_name = rb_wx_name(enum_item.name)
|
337
|
+
enumerator_name = rb_wx_name(md[2].sub(/\A#{enum_name}_/, ''))
|
337
338
|
enum_id = enum_item.scope.empty? ? enum_name : "#{rb_wx_name(enum_item.scope)}::#{enum_name}"
|
338
339
|
enum_var = enum_id.gsub('::', '_')
|
339
340
|
line = [
|
@@ -343,7 +344,7 @@ module WXRuby3
|
|
343
344
|
# add enum class constant to current module (use unscoped name)
|
344
345
|
" rb_define_const(#{md[1]}, \"#{enum_name}\", cWx#{enum_var}); // Inserted by fixmodule.rb",
|
345
346
|
# create enumerator value const under new enum class
|
346
|
-
" wxRuby_AddEnumValue(cWx#{enum_var}, \"#{
|
347
|
+
" wxRuby_AddEnumValue(cWx#{enum_var}, \"#{enumerator_name}\"#{md[3]} // Updated by fixmodule.rb"
|
347
348
|
].join("\n")
|
348
349
|
end
|
349
350
|
else
|
@@ -352,13 +353,15 @@ module WXRuby3
|
|
352
353
|
# of the same enum?
|
353
354
|
if enum_item && enum_table[md[2]] == enum_item
|
354
355
|
enum_name = rb_wx_name(enum_item.name)
|
356
|
+
enumerator_name = rb_wx_name(md[2].sub(/\A#{enum_name}_/, ''))
|
355
357
|
enum_id = enum_item.scope.empty? ? enum_name : "#{rb_wx_name(enum_item.scope)}::#{enum_name}"
|
356
358
|
enum_var = enum_id.gsub('::', '_')
|
357
359
|
# create enumerator value const under new enum class
|
358
|
-
line = " wxRuby_AddEnumValue(cWx#{enum_var}, \"#{
|
360
|
+
line = " wxRuby_AddEnumValue(cWx#{enum_var}, \"#{enumerator_name}\"#{md[3]} // Updated by fixmodule.rb"
|
359
361
|
else # we found the start of another enum
|
360
362
|
enum_item = enum_table[md[2]]
|
361
363
|
enum_name = rb_wx_name(enum_item.name)
|
364
|
+
enumerator_name = rb_wx_name(md[2].sub(/\A#{enum_name}_/, ''))
|
362
365
|
enum_id = enum_item.scope.empty? ? enum_name : "#{rb_wx_name(enum_item.scope)}::#{enum_name}"
|
363
366
|
enum_var = enum_id.gsub('::', '_')
|
364
367
|
line = [
|
@@ -368,7 +371,7 @@ module WXRuby3
|
|
368
371
|
# add enum class constant to current module (use unscoped name)
|
369
372
|
" rb_define_const(#{md[1]}, \"#{enum_name}\", cWx#{enum_var}); // Inserted by fixmodule.rb",
|
370
373
|
# create enumerator value const under new enum class
|
371
|
-
" wxRuby_AddEnumValue(cWx#{enum_var}, \"#{
|
374
|
+
" wxRuby_AddEnumValue(cWx#{enum_var}, \"#{enumerator_name}\"#{md[3]} // Updated by fixmodule.rb"
|
372
375
|
].join("\n")
|
373
376
|
end
|
374
377
|
else # end of enum def
|
@@ -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 wxComboPopup typemap definition
|
7
|
+
###
|
8
|
+
|
9
|
+
require_relative '../core/mapping'
|
10
|
+
|
11
|
+
module WXRuby3
|
12
|
+
|
13
|
+
module Typemap
|
14
|
+
|
15
|
+
module ComboPopup
|
16
|
+
|
17
|
+
include Typemap::Module
|
18
|
+
|
19
|
+
define do
|
20
|
+
|
21
|
+
# for DoSetPopupControl
|
22
|
+
map 'wxComboPopup* popup' => 'Wx::ComboPopup,nil' do
|
23
|
+
|
24
|
+
add_header_code <<~__CODE
|
25
|
+
#include <wx/combo.h>
|
26
|
+
|
27
|
+
WXRUBY_EXPORT wxComboPopup* wxRuby_ComboPopupFromRuby(VALUE popup);
|
28
|
+
WXRUBY_EXPORT VALUE wxRuby_ComboPopupToRuby(wxComboPopup* popup);
|
29
|
+
__CODE
|
30
|
+
|
31
|
+
map_in code: '$1 = wxRuby_ComboPopupFromRuby($input);'
|
32
|
+
|
33
|
+
map_directorin code: '$input = wxRuby_ComboPopupToRuby($1);'
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
@@ -44,6 +44,14 @@ module WXRuby3
|
|
44
44
|
$input = wxRuby_ConfigBase2Ruby($1);
|
45
45
|
__CODE
|
46
46
|
|
47
|
+
map_out code: <<~__CODE
|
48
|
+
$result = wxRuby_ConfigBase2Ruby($1);
|
49
|
+
__CODE
|
50
|
+
|
51
|
+
map_directorout code: <<~__CODE
|
52
|
+
$result = wxRuby_Ruby2ConfigBase($1);
|
53
|
+
__CODE
|
54
|
+
|
47
55
|
end
|
48
56
|
|
49
57
|
end
|
data/samples/widgets/widgets.rb
CHANGED
@@ -456,12 +456,10 @@ module Widgets
|
|
456
456
|
|
457
457
|
@panel.set_sizer(sizerTop)
|
458
458
|
|
459
|
-
|
460
|
-
|
461
|
-
|
459
|
+
sizeSet = Wx.persistent_register_and_restore(self, "Main")
|
460
|
+
|
462
461
|
sizeMin = @panel.get_best_size
|
463
|
-
|
464
|
-
set_client_size(sizeMin)
|
462
|
+
set_client_size(sizeMin) unless sizeSet
|
465
463
|
set_min_client_size(sizeMin)
|
466
464
|
|
467
465
|
# connect the event handlers
|
@@ -1068,10 +1066,8 @@ module Widgets
|
|
1068
1066
|
evt_choicebook_page_changed(ID::Widgets_BookCtrl, :on_page_changed)
|
1069
1067
|
end
|
1070
1068
|
|
1071
|
-
|
1072
|
-
|
1073
|
-
pageSet = false
|
1074
|
-
|
1069
|
+
pageSet = Wx.persistent_register_and_restore(@book)
|
1070
|
+
|
1075
1071
|
if Wx.has_feature?(:USE_TREEBOOK)
|
1076
1072
|
# for treebook page #0 is empty parent page only so select the first page
|
1077
1073
|
# with some contents
|