wxruby 1.9.3-i386-mswin32 → 1.9.4-i386-mswin32
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +53 -53
- data/README +299 -299
- data/lib/wx/classes/evthandler.rb +9 -0
- data/lib/wx/classes/timer.rb +25 -0
- data/lib/wx/version.rb +1 -1
- data/lib/wx.rb +42 -42
- data/lib/wxruby2.exp +0 -0
- data/lib/wxruby2.lib +0 -0
- data/lib/wxruby2.so +0 -0
- data/samples/SAMPLES-LICENSE.TXT +17 -17
- data/samples/bigdemo/About.rbw +39 -39
- data/samples/bigdemo/ColorPanel.rbw +25 -25
- data/samples/bigdemo/GridSimple.rbw +80 -80
- data/samples/bigdemo/MDIDemo.rbw +59 -59
- data/samples/bigdemo/PopupMenu.rbw +151 -151
- data/samples/bigdemo/Sizers.rbw +545 -545
- data/samples/bigdemo/bigdemo.rb +826 -826
- data/samples/bigdemo/demoTemplate.rbw +37 -37
- data/samples/bigdemo/icons/choice.xpm +27 -27
- data/samples/bigdemo/icons/combo.xpm +27 -27
- data/samples/bigdemo/icons/copy.xpm +25 -25
- data/samples/bigdemo/icons/cut.xpm +24 -24
- data/samples/bigdemo/icons/gauge.xpm +27 -27
- data/samples/bigdemo/icons/help.xpm +25 -25
- data/samples/bigdemo/icons/list.xpm +27 -27
- data/samples/bigdemo/icons/mondrian.xpm +44 -44
- data/samples/bigdemo/icons/new.xpm +24 -24
- data/samples/bigdemo/icons/ogl.ico +0 -0
- data/samples/bigdemo/icons/ogl.xpm +45 -45
- data/samples/bigdemo/icons/open.xpm +26 -26
- data/samples/bigdemo/icons/paste.xpm +38 -38
- data/samples/bigdemo/icons/preview.xpm +26 -26
- data/samples/bigdemo/icons/print.xpm +26 -26
- data/samples/bigdemo/icons/radio.xpm +27 -27
- data/samples/bigdemo/icons/robert.xpm +415 -415
- data/samples/bigdemo/icons/save.xpm +25 -25
- data/samples/bigdemo/icons/smiles.xpm +39 -39
- data/samples/bigdemo/icons/smiley.xpm +42 -42
- data/samples/bigdemo/icons/stattext.xpm +24 -24
- data/samples/bigdemo/icons/test2.bmp +0 -0
- data/samples/bigdemo/icons/test2.xpm +79 -79
- data/samples/bigdemo/icons/text.xpm +27 -27
- data/samples/bigdemo/icons/tog1.xpm +38 -38
- data/samples/bigdemo/icons/tog2.xpm +38 -38
- data/samples/bigdemo/icons/wxwin16x16.xpm +25 -25
- data/samples/bigdemo/tips.txt +7 -7
- data/samples/bigdemo/utils.rb +11 -11
- data/samples/bigdemo/wxButton.rbw +66 -66
- data/samples/bigdemo/wxCalendarCtrl.rbw +72 -72
- data/samples/bigdemo/wxCheckBox.rbw +52 -52
- data/samples/bigdemo/wxCheckListBox.rbw +77 -77
- data/samples/bigdemo/wxChoice.rbw +49 -49
- data/samples/bigdemo/wxColourDialog.rbw +34 -34
- data/samples/bigdemo/wxComboBox.rbw +79 -79
- data/samples/bigdemo/wxDialog.rbw +92 -92
- data/samples/bigdemo/wxDirDialog.rbw +32 -32
- data/samples/bigdemo/wxFileDialog.rbw +39 -39
- data/samples/bigdemo/wxFileDialog_Save.rbw +38 -38
- data/samples/bigdemo/wxFindReplaceDialog.rbw +85 -85
- data/samples/bigdemo/wxFontDialog.rbw +176 -176
- data/samples/bigdemo/wxFrame.rbw +55 -55
- data/samples/bigdemo/wxGauge.rbw +73 -73
- data/samples/bigdemo/wxGrid.rbw +68 -68
- data/samples/bigdemo/wxListBox.rbw +142 -142
- data/samples/bigdemo/wxListCtrl_virtual.rbw +109 -109
- data/samples/bigdemo/wxMDIWindows.rbw +52 -52
- data/samples/bigdemo/wxMenu.rbw +238 -238
- data/samples/bigdemo/wxMessageDialog.rbw +30 -30
- data/samples/bigdemo/wxMultipleChoiceDialog.rbw +34 -34
- data/samples/bigdemo/wxNotebook.rbw +138 -138
- data/samples/bigdemo/wxProgressDialog.rbw +45 -45
- data/samples/bigdemo/wxRadioBox.rbw +74 -74
- data/samples/bigdemo/wxRadioButton.rbw +127 -127
- data/samples/bigdemo/wxScrolledMessageDialog.rbw +59 -59
- data/samples/bigdemo/wxScrolledWindow.rbw +201 -201
- data/samples/bigdemo/wxSingleChoiceDialog.rbw +35 -35
- data/samples/bigdemo/wxSlider.rbw +44 -44
- data/samples/bigdemo/wxSpinButton.rbw +52 -52
- data/samples/bigdemo/wxSpinCtrl.rbw +53 -53
- data/samples/bigdemo/wxSplitterWindow.rbw +65 -65
- data/samples/bigdemo/wxStaticBitmap.rbw +53 -53
- data/samples/bigdemo/wxStaticText.rbw +57 -57
- data/samples/bigdemo/wxStatusBar.rbw +128 -128
- data/samples/bigdemo/wxTextCtrl.rbw +151 -151
- data/samples/bigdemo/wxTextEntryDialog.rbw +34 -34
- data/samples/bigdemo/wxToggleButton.rbw +51 -51
- data/samples/bigdemo/wxToolBar.rbw +133 -133
- data/samples/bigdemo/wxTreeCtrl.rbw +192 -192
- data/samples/calendar/calendar.rb +275 -275
- data/samples/caret/caret.rb +286 -286
- data/samples/caret/mondrian.xpm +44 -44
- data/samples/controls/controls.rb +1140 -1140
- data/samples/controls/get_item_sample.rb +87 -87
- data/samples/controls/icons/choice.xpm +27 -27
- data/samples/controls/icons/combo.xpm +27 -27
- data/samples/controls/icons/gauge.xpm +27 -27
- data/samples/controls/icons/list.xpm +27 -27
- data/samples/controls/icons/radio.xpm +27 -27
- data/samples/controls/icons/stattext.xpm +24 -24
- data/samples/controls/icons/text.xpm +27 -27
- data/samples/controls/mondrian.xpm +44 -44
- data/samples/dialogs/dialogs.rb +724 -724
- data/samples/dialogs/tips.txt +18 -18
- data/samples/drawing/graphics_drawing.rb +22 -18
- data/samples/drawing/images.rb +48 -48
- data/samples/etc/activation.rb +108 -108
- data/samples/etc/choice.rb +72 -72
- data/samples/etc/miniframe.rb +84 -84
- data/samples/etc/sash.rb +135 -135
- data/samples/etc/scrollwin.rb +116 -116
- data/samples/etc/system_settings.rb +258 -258
- data/samples/etc/threaded.rb +5 -8
- data/samples/etc/wizard.rb +79 -79
- data/samples/html/html.rb +14 -10
- data/samples/listbook/listbook.rb +181 -181
- data/samples/listbook/listbook.xrc +370 -370
- data/samples/mdi/mdi.rb +87 -87
- data/samples/minimal/minimal.rb +85 -85
- data/samples/minimal/nothing.rb +21 -21
- data/samples/text/textctrl.rb +124 -124
- data/samples/text/unicode.rb +238 -238
- data/samples/text/utf8.txt +14 -14
- data/samples/treectrl/treectrl.rb +1180 -1180
- data/samples/xrc/samples.xrc +46 -46
- data/samples/xrc/xrc_sample.rb +107 -107
- metadata +3 -3
@@ -1,192 +1,192 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
begin
|
4
|
-
require 'wx'
|
5
|
-
rescue LoadError => no_wx_err
|
6
|
-
begin
|
7
|
-
require 'rubygems'
|
8
|
-
require 'wx'
|
9
|
-
rescue LoadError
|
10
|
-
raise no_wx_err
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
class MyTreeCtrl < Wx::TreeCtrl
|
15
|
-
def initialize(parent, id, pos, size, style, log)
|
16
|
-
super(parent,id,pos,size,style)
|
17
|
-
@log = log
|
18
|
-
|
19
|
-
evt_left_dclick {|event| on_left_dclick(event)}
|
20
|
-
evt_right_down {|event| on_right_click(event)}
|
21
|
-
evt_right_up {|event| on_right_up(event)}
|
22
|
-
end
|
23
|
-
|
24
|
-
def on_left_dclick(event)
|
25
|
-
pt = Wx::Point.new(event.get_x(), event.get_y())
|
26
|
-
|
27
|
-
end
|
28
|
-
|
29
|
-
def on_right_click(event)
|
30
|
-
pt = Wx::Point.new(event.get_x(), event.get_y())
|
31
|
-
id = hit_test(pt)
|
32
|
-
if id
|
33
|
-
@log.write_text("on_right_click: ")# + @tree.get_item_text(id))
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
def on_right_up(event)
|
38
|
-
pt = Wx::Point.new(event.get_x(), event.get_y())
|
39
|
-
id = hit_test(pt)
|
40
|
-
if id
|
41
|
-
@log.write_text("on_right_up: ")#+ @tree.get_item_text(id) + " (manually starting label edit)")
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
def on_compare_items(item1, item2)
|
46
|
-
t1 = get_item_text(item1)
|
47
|
-
t2 = get_item_text(item2)
|
48
|
-
@log.write_text('compare: ' + t1 + ' <> ' + t2)
|
49
|
-
if t1 < t2 then return -1 end
|
50
|
-
if t1 == t2 then return 0 end
|
51
|
-
return 1
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
class TestTreeCtrlPanel < Wx::Panel
|
56
|
-
def initialize(parent, log)
|
57
|
-
# Use the WANTS_CHARS style so the panel doesn't eat the Return key
|
58
|
-
super(parent, -1, Wx::DEFAULT_POSITION, Wx::DEFAULT_SIZE, Wx::WANTS_CHARS)
|
59
|
-
evt_size {|event| on_size(event)}
|
60
|
-
|
61
|
-
@log = log
|
62
|
-
tID = 5000
|
63
|
-
|
64
|
-
@tree = MyTreeCtrl.new(self, tID, Wx::DEFAULT_POSITION, Wx::DEFAULT_SIZE, Wx::TR_HAS_BUTTONS | Wx::TR_EDIT_LABELS, @log)
|
65
|
-
|
66
|
-
isz = Wx::Size.new(16,16)
|
67
|
-
il = Wx::ImageList.new(16,16)
|
68
|
-
bm = Wx::Bitmap.new
|
69
|
-
bm.copy_from_icon(Wx::ArtProvider::get_icon(Wx::ART_FOLDER, Wx::ART_OTHER, isz))
|
70
|
-
fldridx = il.add(bm)
|
71
|
-
bm.copy_from_icon(Wx::ArtProvider::get_icon(Wx::ART_FILE_OPEN, Wx::ART_OTHER, isz))
|
72
|
-
fldropenidx = il.add(bm)
|
73
|
-
bm.copy_from_icon(Wx::ArtProvider::get_icon(Wx::ART_FILE_OPEN, Wx::ART_OTHER, isz))
|
74
|
-
fileidx = il.add(bm)
|
75
|
-
bmp_file = File.join(File.dirname(__FILE__), 'icons', 'wxwin16x16.xpm')
|
76
|
-
smileidx = il.add(Wx::Bitmap.new(bmp_file))
|
77
|
-
|
78
|
-
@tree.set_image_list(il)
|
79
|
-
@il = il
|
80
|
-
|
81
|
-
@root = @tree.add_root("The Root Item")
|
82
|
-
@tree.set_item_image(@root, fldridx, Wx::TREE_ITEM_ICON_NORMAL)
|
83
|
-
@tree.set_item_image(@root, fldropenidx, Wx::TREE_ITEM_ICON_EXPANDED)
|
84
|
-
|
85
|
-
0.upto(15) do |x|
|
86
|
-
child = @tree.append_item(@root, "Item " + x.to_s())
|
87
|
-
@tree.set_item_image(child, fldridx, Wx::TREE_ITEM_ICON_NORMAL)
|
88
|
-
@tree.set_item_image(child, fldropenidx, Wx::TREE_ITEM_ICON_EXPANDED)
|
89
|
-
0.upto(4) do |y|
|
90
|
-
last = @tree.append_item(child, "item " + x.to_s() + "-" + (?a + y).chr)
|
91
|
-
@tree.set_item_image(last, fldridx, Wx::TREE_ITEM_ICON_NORMAL)
|
92
|
-
@tree.set_item_image(last, fldropenidx, Wx::TREE_ITEM_ICON_EXPANDED)
|
93
|
-
0.upto(4) do |z|
|
94
|
-
item = @tree.append_item(last, "item " + x.to_s() + "-" + (?a + y).chr + "-" + z.to_s())
|
95
|
-
@tree.set_item_image(item, fileidx, Wx::TREE_ITEM_ICON_NORMAL)
|
96
|
-
@tree.set_item_image(item, smileidx, Wx::TREE_ITEM_ICON_SELECTED)
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
@tree.expand(@root)
|
102
|
-
evt_tree_item_expanded(tID) {|event| on_item_expanded(event)}
|
103
|
-
evt_tree_item_collapsed(tID) {|event| on_item_collapsed(event)}
|
104
|
-
evt_tree_sel_changed(tID) {|event| on_sel_changed(event)}
|
105
|
-
evt_tree_begin_label_edit(tID) {|event| on_begin_edit(event)}
|
106
|
-
evt_tree_end_label_edit(tID) {|event| on_end_edit(event)}
|
107
|
-
evt_tree_item_activated(tID) {|event| on_activate(event)}
|
108
|
-
|
109
|
-
|
110
|
-
end
|
111
|
-
|
112
|
-
|
113
|
-
def on_begin_edit(event)
|
114
|
-
@log.write_text("on_begin_edit")
|
115
|
-
# show how to prevent edit
|
116
|
-
if @tree.get_item_text(event.get_item()) == "The Root Item"
|
117
|
-
@log.write_text("You can't edit this one...")
|
118
|
-
|
119
|
-
# Let's just see what's visible of its children
|
120
|
-
cookie = 0
|
121
|
-
root = event.get_item()
|
122
|
-
child, cookie = @tree.get_first_child(root)
|
123
|
-
while child != nil
|
124
|
-
@log.write_text("Child [" + @tree.get_item_text(child) + "] visible = " + @tree.is_visible(child).to_s())
|
125
|
-
child,cookie = @tree.get_next_child(root, cookie)
|
126
|
-
end
|
127
|
-
event.veto()
|
128
|
-
end
|
129
|
-
end
|
130
|
-
|
131
|
-
def on_end_edit(event)
|
132
|
-
@log.write_text("on_end_edit")
|
133
|
-
#show how to reject edit, we'll not allow any digits
|
134
|
-
nums = ("0".."9").to_a()
|
135
|
-
x = event.get_label()
|
136
|
-
x.each_byte do |byte|
|
137
|
-
if nums.include?(byte.chr())
|
138
|
-
@log.write_text("You can't enter digits...")
|
139
|
-
event.veto()
|
140
|
-
return
|
141
|
-
end
|
142
|
-
end
|
143
|
-
end
|
144
|
-
|
145
|
-
def on_size(event)
|
146
|
-
size = get_client_size()
|
147
|
-
@tree.set_dimensions(0,0,size.x, size.y)
|
148
|
-
end
|
149
|
-
|
150
|
-
def on_item_expanded(event)
|
151
|
-
item = event.get_item()
|
152
|
-
@log.write_text("on_item_expanded: " + @tree.get_item_text(item))
|
153
|
-
end
|
154
|
-
|
155
|
-
def on_item_collapsed(event)
|
156
|
-
item = event.get_item()
|
157
|
-
@log.write_text("on_item_collapsed: " + @tree.get_item_text(item))
|
158
|
-
end
|
159
|
-
|
160
|
-
def on_sel_changed(event)
|
161
|
-
@item = event.get_item()
|
162
|
-
if @item.nonzero?
|
163
|
-
@log.write_text("on_sel_changed: " + @tree.get_item_text(@item))
|
164
|
-
# if Wx::PLATFORM == "WXMSW"
|
165
|
-
#@log.write_text("BoundingRect: " + @tree.get_bounding_rect(@item))
|
166
|
-
#end
|
167
|
-
end
|
168
|
-
event.skip()
|
169
|
-
end
|
170
|
-
|
171
|
-
def on_activate(event)
|
172
|
-
@log.write_text("on_activate: " + @tree.get_item_text(@item))
|
173
|
-
end
|
174
|
-
end
|
175
|
-
|
176
|
-
module Demo
|
177
|
-
def Demo.run(frame, nb, log)
|
178
|
-
win = TestTreeCtrlPanel.new(nb, log)
|
179
|
-
return win
|
180
|
-
end
|
181
|
-
|
182
|
-
def Demo.overview
|
183
|
-
return ""
|
184
|
-
end
|
185
|
-
end
|
186
|
-
|
187
|
-
|
188
|
-
if __FILE__ == $0
|
189
|
-
run_solo_lib = File.join( File.dirname(__FILE__), 'run.rb')
|
190
|
-
load run_solo_lib
|
191
|
-
run File.basename($0)
|
192
|
-
end
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
begin
|
4
|
+
require 'wx'
|
5
|
+
rescue LoadError => no_wx_err
|
6
|
+
begin
|
7
|
+
require 'rubygems'
|
8
|
+
require 'wx'
|
9
|
+
rescue LoadError
|
10
|
+
raise no_wx_err
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
class MyTreeCtrl < Wx::TreeCtrl
|
15
|
+
def initialize(parent, id, pos, size, style, log)
|
16
|
+
super(parent,id,pos,size,style)
|
17
|
+
@log = log
|
18
|
+
|
19
|
+
evt_left_dclick {|event| on_left_dclick(event)}
|
20
|
+
evt_right_down {|event| on_right_click(event)}
|
21
|
+
evt_right_up {|event| on_right_up(event)}
|
22
|
+
end
|
23
|
+
|
24
|
+
def on_left_dclick(event)
|
25
|
+
pt = Wx::Point.new(event.get_x(), event.get_y())
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
def on_right_click(event)
|
30
|
+
pt = Wx::Point.new(event.get_x(), event.get_y())
|
31
|
+
id = hit_test(pt)
|
32
|
+
if id
|
33
|
+
@log.write_text("on_right_click: ")# + @tree.get_item_text(id))
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def on_right_up(event)
|
38
|
+
pt = Wx::Point.new(event.get_x(), event.get_y())
|
39
|
+
id = hit_test(pt)
|
40
|
+
if id
|
41
|
+
@log.write_text("on_right_up: ")#+ @tree.get_item_text(id) + " (manually starting label edit)")
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def on_compare_items(item1, item2)
|
46
|
+
t1 = get_item_text(item1)
|
47
|
+
t2 = get_item_text(item2)
|
48
|
+
@log.write_text('compare: ' + t1 + ' <> ' + t2)
|
49
|
+
if t1 < t2 then return -1 end
|
50
|
+
if t1 == t2 then return 0 end
|
51
|
+
return 1
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
class TestTreeCtrlPanel < Wx::Panel
|
56
|
+
def initialize(parent, log)
|
57
|
+
# Use the WANTS_CHARS style so the panel doesn't eat the Return key
|
58
|
+
super(parent, -1, Wx::DEFAULT_POSITION, Wx::DEFAULT_SIZE, Wx::WANTS_CHARS)
|
59
|
+
evt_size {|event| on_size(event)}
|
60
|
+
|
61
|
+
@log = log
|
62
|
+
tID = 5000
|
63
|
+
|
64
|
+
@tree = MyTreeCtrl.new(self, tID, Wx::DEFAULT_POSITION, Wx::DEFAULT_SIZE, Wx::TR_HAS_BUTTONS | Wx::TR_EDIT_LABELS, @log)
|
65
|
+
|
66
|
+
isz = Wx::Size.new(16,16)
|
67
|
+
il = Wx::ImageList.new(16,16)
|
68
|
+
bm = Wx::Bitmap.new
|
69
|
+
bm.copy_from_icon(Wx::ArtProvider::get_icon(Wx::ART_FOLDER, Wx::ART_OTHER, isz))
|
70
|
+
fldridx = il.add(bm)
|
71
|
+
bm.copy_from_icon(Wx::ArtProvider::get_icon(Wx::ART_FILE_OPEN, Wx::ART_OTHER, isz))
|
72
|
+
fldropenidx = il.add(bm)
|
73
|
+
bm.copy_from_icon(Wx::ArtProvider::get_icon(Wx::ART_FILE_OPEN, Wx::ART_OTHER, isz))
|
74
|
+
fileidx = il.add(bm)
|
75
|
+
bmp_file = File.join(File.dirname(__FILE__), 'icons', 'wxwin16x16.xpm')
|
76
|
+
smileidx = il.add(Wx::Bitmap.new(bmp_file))
|
77
|
+
|
78
|
+
@tree.set_image_list(il)
|
79
|
+
@il = il
|
80
|
+
|
81
|
+
@root = @tree.add_root("The Root Item")
|
82
|
+
@tree.set_item_image(@root, fldridx, Wx::TREE_ITEM_ICON_NORMAL)
|
83
|
+
@tree.set_item_image(@root, fldropenidx, Wx::TREE_ITEM_ICON_EXPANDED)
|
84
|
+
|
85
|
+
0.upto(15) do |x|
|
86
|
+
child = @tree.append_item(@root, "Item " + x.to_s())
|
87
|
+
@tree.set_item_image(child, fldridx, Wx::TREE_ITEM_ICON_NORMAL)
|
88
|
+
@tree.set_item_image(child, fldropenidx, Wx::TREE_ITEM_ICON_EXPANDED)
|
89
|
+
0.upto(4) do |y|
|
90
|
+
last = @tree.append_item(child, "item " + x.to_s() + "-" + (?a + y).chr)
|
91
|
+
@tree.set_item_image(last, fldridx, Wx::TREE_ITEM_ICON_NORMAL)
|
92
|
+
@tree.set_item_image(last, fldropenidx, Wx::TREE_ITEM_ICON_EXPANDED)
|
93
|
+
0.upto(4) do |z|
|
94
|
+
item = @tree.append_item(last, "item " + x.to_s() + "-" + (?a + y).chr + "-" + z.to_s())
|
95
|
+
@tree.set_item_image(item, fileidx, Wx::TREE_ITEM_ICON_NORMAL)
|
96
|
+
@tree.set_item_image(item, smileidx, Wx::TREE_ITEM_ICON_SELECTED)
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
@tree.expand(@root)
|
102
|
+
evt_tree_item_expanded(tID) {|event| on_item_expanded(event)}
|
103
|
+
evt_tree_item_collapsed(tID) {|event| on_item_collapsed(event)}
|
104
|
+
evt_tree_sel_changed(tID) {|event| on_sel_changed(event)}
|
105
|
+
evt_tree_begin_label_edit(tID) {|event| on_begin_edit(event)}
|
106
|
+
evt_tree_end_label_edit(tID) {|event| on_end_edit(event)}
|
107
|
+
evt_tree_item_activated(tID) {|event| on_activate(event)}
|
108
|
+
|
109
|
+
|
110
|
+
end
|
111
|
+
|
112
|
+
|
113
|
+
def on_begin_edit(event)
|
114
|
+
@log.write_text("on_begin_edit")
|
115
|
+
# show how to prevent edit
|
116
|
+
if @tree.get_item_text(event.get_item()) == "The Root Item"
|
117
|
+
@log.write_text("You can't edit this one...")
|
118
|
+
|
119
|
+
# Let's just see what's visible of its children
|
120
|
+
cookie = 0
|
121
|
+
root = event.get_item()
|
122
|
+
child, cookie = @tree.get_first_child(root)
|
123
|
+
while child != nil
|
124
|
+
@log.write_text("Child [" + @tree.get_item_text(child) + "] visible = " + @tree.is_visible(child).to_s())
|
125
|
+
child,cookie = @tree.get_next_child(root, cookie)
|
126
|
+
end
|
127
|
+
event.veto()
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
def on_end_edit(event)
|
132
|
+
@log.write_text("on_end_edit")
|
133
|
+
#show how to reject edit, we'll not allow any digits
|
134
|
+
nums = ("0".."9").to_a()
|
135
|
+
x = event.get_label()
|
136
|
+
x.each_byte do |byte|
|
137
|
+
if nums.include?(byte.chr())
|
138
|
+
@log.write_text("You can't enter digits...")
|
139
|
+
event.veto()
|
140
|
+
return
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
def on_size(event)
|
146
|
+
size = get_client_size()
|
147
|
+
@tree.set_dimensions(0,0,size.x, size.y)
|
148
|
+
end
|
149
|
+
|
150
|
+
def on_item_expanded(event)
|
151
|
+
item = event.get_item()
|
152
|
+
@log.write_text("on_item_expanded: " + @tree.get_item_text(item))
|
153
|
+
end
|
154
|
+
|
155
|
+
def on_item_collapsed(event)
|
156
|
+
item = event.get_item()
|
157
|
+
@log.write_text("on_item_collapsed: " + @tree.get_item_text(item))
|
158
|
+
end
|
159
|
+
|
160
|
+
def on_sel_changed(event)
|
161
|
+
@item = event.get_item()
|
162
|
+
if @item.nonzero?
|
163
|
+
@log.write_text("on_sel_changed: " + @tree.get_item_text(@item))
|
164
|
+
# if Wx::PLATFORM == "WXMSW"
|
165
|
+
#@log.write_text("BoundingRect: " + @tree.get_bounding_rect(@item))
|
166
|
+
#end
|
167
|
+
end
|
168
|
+
event.skip()
|
169
|
+
end
|
170
|
+
|
171
|
+
def on_activate(event)
|
172
|
+
@log.write_text("on_activate: " + @tree.get_item_text(@item))
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
module Demo
|
177
|
+
def Demo.run(frame, nb, log)
|
178
|
+
win = TestTreeCtrlPanel.new(nb, log)
|
179
|
+
return win
|
180
|
+
end
|
181
|
+
|
182
|
+
def Demo.overview
|
183
|
+
return ""
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
|
188
|
+
if __FILE__ == $0
|
189
|
+
run_solo_lib = File.join( File.dirname(__FILE__), 'run.rb')
|
190
|
+
load run_solo_lib
|
191
|
+
run File.basename($0)
|
192
|
+
end
|