wxruby 1.9.2-i386-mswin32 → 1.9.3-i386-mswin32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE +53 -53
- data/README +299 -299
- data/lib/wx/classes/app.rb +6 -0
- data/lib/wx/classes/checklistbox.rb +45 -30
- data/lib/wx/classes/clipboard.rb +16 -0
- data/lib/wx/classes/event.rb +5 -0
- data/lib/wx/classes/evthandler.rb +20 -10
- data/lib/wx/classes/grid.rb +38 -39
- data/lib/wx/classes/listctrl.rb +12 -0
- data/lib/wx/classes/mediactrl.rb +22 -0
- data/lib/wx/classes/menu.rb +6 -6
- data/lib/wx/classes/sound.rb +23 -0
- data/lib/wx/classes/styledtextctrl.rb +2 -2
- data/lib/wx/classes/treectrl.rb +26 -0
- data/lib/wx/keyword_ctors.rb +19 -5
- data/lib/wx/keyword_defs.rb +20 -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/aui/aui.rb +8 -1
- 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/wxSashWindow.rbw +94 -104
- 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 +232 -0
- data/samples/{images → drawing}/images.rb +48 -48
- data/samples/{images → drawing}/paperclip.png +0 -0
- 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/wizard.rb +79 -79
- data/samples/grid/grid.rb +1 -0
- data/samples/listbook/listbook.rb +181 -181
- data/samples/listbook/listbook.xrc +370 -370
- data/samples/mdi/mdi.rb +87 -87
- data/samples/media/mediactrl.rb +173 -0
- data/samples/minimal/minimal.rb +85 -85
- data/samples/minimal/nothing.rb +21 -21
- data/samples/opengl/cube.rb +123 -0
- data/samples/sockets/SocketPackets.rb +27 -0
- data/samples/sockets/res/message-new.png +0 -0
- data/samples/sockets/res/user.png +0 -0
- data/samples/sockets/wxClient.rb +395 -0
- data/samples/sockets/wxServer.rb +422 -0
- data/samples/sockets/wxSocketGUI.rb +97 -0
- 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 -1181
- data/samples/xrc/samples.xrc +46 -46
- data/samples/xrc/xrc_sample.rb +107 -107
- metadata +26 -9
- data/samples/images/Thumbs.db +0 -0
@@ -1,127 +1,127 @@
|
|
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 TestPanel < Wx::Panel
|
15
|
-
def initialize(parent, log)
|
16
|
-
super(parent, -1)
|
17
|
-
@log = log
|
18
|
-
panel = Wx::Panel.new(self, -1)
|
19
|
-
|
20
|
-
# 1st group of controls
|
21
|
-
@group1_ctrls = {}
|
22
|
-
radio1 = Wx::RadioButton.new(panel, -1, "Radio1", Wx::DEFAULT_POSITION, Wx::DEFAULT_SIZE, Wx::RB_GROUP)
|
23
|
-
text1 = Wx::TextCtrl.new(panel, -1, "")
|
24
|
-
radio2 = Wx::RadioButton.new(panel, -1, "Radio2")
|
25
|
-
text2 = Wx::TextCtrl.new(panel, -1, "")
|
26
|
-
radio3 = Wx::RadioButton.new(panel, -1, "Radio3")
|
27
|
-
text3 = Wx::TextCtrl.new(panel, -1, "")
|
28
|
-
@group1_ctrls["one"] = [radio1, text1]
|
29
|
-
@group1_ctrls["two"] = [radio2, text2]
|
30
|
-
@group1_ctrls["three"] = [radio3, text3]
|
31
|
-
|
32
|
-
# 2nd group of controls
|
33
|
-
#@group2_ctrls = {}
|
34
|
-
#radio4 = Wx::RadioButton.new(panel, -1, "Radio1", Wx::DEFAULT_POSITION, Wx::DEFAULT_SIZE, Wx::RB_GROUP)
|
35
|
-
#text4 = Wx::TextCtrl.new(panel, -1, "")
|
36
|
-
#radio5 = Wx::RadioButton.new(panel, -1, "Radio2")
|
37
|
-
#text5 = Wx::TextCtrl.new(panel, -1, "")
|
38
|
-
#radio6 = Wx::RadioButton.new(panel, -1, "Radio3")
|
39
|
-
#text6 = Wx::TextCtrl.new(panel, -1, "")
|
40
|
-
#@group2_ctrls["one"] = [radio4, text4]
|
41
|
-
#@group2_ctrls["two"] = [radio5, text5]
|
42
|
-
#@group2_ctrls["three"] = [radio6, text6]
|
43
|
-
|
44
|
-
# Layout controls on panel
|
45
|
-
vs = Wx::BoxSizer.new(Wx::VERTICAL)
|
46
|
-
|
47
|
-
box1_title = Wx::StaticBox.new(panel, -1, "Group 1", Wx::DEFAULT_POSITION, Wx::Size.new(-1,-1))
|
48
|
-
box1 = Wx::StaticBoxSizer.new(box1_title, Wx::HORIZONTAL)
|
49
|
-
grid1 = Wx::FlexGridSizer.new(0,2,0,0)
|
50
|
-
|
51
|
-
@group1_ctrls.each_value do |ctrl|
|
52
|
-
grid1.add(ctrl[0], 0, Wx::ALIGN_CENTER, 5)
|
53
|
-
grid1.add(ctrl[1], 0, Wx::ALIGN_CENTER, 5)
|
54
|
-
end
|
55
|
-
box1.add(grid1, 0, Wx::ALIGN_CENTER | Wx::ALL, 5)
|
56
|
-
vs.add(box1, 0, Wx::ALL, 5)
|
57
|
-
|
58
|
-
#box2_title = Wx::StaticBox.new(panel, -1, "Group 2")
|
59
|
-
#box2 = Wx::StaticBoxSizer.new(box2_title, Wx::HORIZONTAL)
|
60
|
-
#grid2 = Wx::FlexGridSizer.new(0,2,0,0)
|
61
|
-
|
62
|
-
#@group2_ctrls.each_value do |ctrl|
|
63
|
-
#grid2.add(ctrl[0], 0, Wx::ALIGN_CENTER, 5)
|
64
|
-
#grid2.add(ctrl[1], 0, Wx::ALIGN_CENTER, 5)
|
65
|
-
#end
|
66
|
-
#box2.add(grid2, 0, Wx::ALIGN_CENTER | Wx::ALL, 5)
|
67
|
-
#vs.add(box2, 0, Wx::ALIGN_CENTER | Wx::ALL, 5)
|
68
|
-
|
69
|
-
panel.set_sizer(vs)
|
70
|
-
vs.fit(panel)
|
71
|
-
|
72
|
-
panel.move(Wx::Point.new(50,50))
|
73
|
-
@panel = panel
|
74
|
-
|
75
|
-
@group1_ctrls.each_value do |ctrl|
|
76
|
-
evt_radiobutton(ctrl[0].get_id()) {|event| on_group1_select(event)}
|
77
|
-
ctrl[0].set_value(0)
|
78
|
-
ctrl[1].enable(false)
|
79
|
-
end
|
80
|
-
#@group2_ctrls.each_value do |ctrl|
|
81
|
-
# evt_radiobutton(ctrl[0].get_id()) {|event| on_group2_select(event)}
|
82
|
-
# ctrl[0].set_value(0)
|
83
|
-
# ctrl[1].enable(false)
|
84
|
-
#end
|
85
|
-
end
|
86
|
-
|
87
|
-
def on_group1_select(event)
|
88
|
-
@group1_ctrls.each_value do |ctrl|
|
89
|
-
if ctrl[0].get_value() == true
|
90
|
-
ctrl[1].enable(true)
|
91
|
-
@log.write_text("Group 1 " + ctrl[0].get_label() + " selected")
|
92
|
-
else
|
93
|
-
ctrl[1].enable(false)
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
def on_group2_select(event)
|
99
|
-
@group2_ctrls.each_value do |ctrl|
|
100
|
-
if ctrl[0].get_value() == true
|
101
|
-
ctrl[1].enable(true)
|
102
|
-
@log.write_text("Group 2 " + ctrl[0].get_label() + " selected")
|
103
|
-
else
|
104
|
-
ctrl[1].enable(false)
|
105
|
-
end
|
106
|
-
end
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
module Demo
|
111
|
-
def Demo.run(frame,nb,log)
|
112
|
-
win = TestPanel.new(nb, log)
|
113
|
-
return win
|
114
|
-
end
|
115
|
-
|
116
|
-
def Demo.overview
|
117
|
-
"This demo shows how individual radio buttons can be used to build more complicated selection mechanisms...\n" +
|
118
|
-
"It uses 2 groups of wxRadioButtons, where the groups are defined by instantiation. When a wxRadioButton is created with the Wx::RB_GROUP style, all subsequent wxRadioButtons created without it are implicitly added to that group by the framework."
|
119
|
-
end
|
120
|
-
end
|
121
|
-
|
122
|
-
|
123
|
-
if __FILE__ == $0
|
124
|
-
run_solo_lib = File.join( File.dirname(__FILE__), 'run.rb')
|
125
|
-
load run_solo_lib
|
126
|
-
run File.basename($0)
|
127
|
-
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 TestPanel < Wx::Panel
|
15
|
+
def initialize(parent, log)
|
16
|
+
super(parent, -1)
|
17
|
+
@log = log
|
18
|
+
panel = Wx::Panel.new(self, -1)
|
19
|
+
|
20
|
+
# 1st group of controls
|
21
|
+
@group1_ctrls = {}
|
22
|
+
radio1 = Wx::RadioButton.new(panel, -1, "Radio1", Wx::DEFAULT_POSITION, Wx::DEFAULT_SIZE, Wx::RB_GROUP)
|
23
|
+
text1 = Wx::TextCtrl.new(panel, -1, "")
|
24
|
+
radio2 = Wx::RadioButton.new(panel, -1, "Radio2")
|
25
|
+
text2 = Wx::TextCtrl.new(panel, -1, "")
|
26
|
+
radio3 = Wx::RadioButton.new(panel, -1, "Radio3")
|
27
|
+
text3 = Wx::TextCtrl.new(panel, -1, "")
|
28
|
+
@group1_ctrls["one"] = [radio1, text1]
|
29
|
+
@group1_ctrls["two"] = [radio2, text2]
|
30
|
+
@group1_ctrls["three"] = [radio3, text3]
|
31
|
+
|
32
|
+
# 2nd group of controls
|
33
|
+
#@group2_ctrls = {}
|
34
|
+
#radio4 = Wx::RadioButton.new(panel, -1, "Radio1", Wx::DEFAULT_POSITION, Wx::DEFAULT_SIZE, Wx::RB_GROUP)
|
35
|
+
#text4 = Wx::TextCtrl.new(panel, -1, "")
|
36
|
+
#radio5 = Wx::RadioButton.new(panel, -1, "Radio2")
|
37
|
+
#text5 = Wx::TextCtrl.new(panel, -1, "")
|
38
|
+
#radio6 = Wx::RadioButton.new(panel, -1, "Radio3")
|
39
|
+
#text6 = Wx::TextCtrl.new(panel, -1, "")
|
40
|
+
#@group2_ctrls["one"] = [radio4, text4]
|
41
|
+
#@group2_ctrls["two"] = [radio5, text5]
|
42
|
+
#@group2_ctrls["three"] = [radio6, text6]
|
43
|
+
|
44
|
+
# Layout controls on panel
|
45
|
+
vs = Wx::BoxSizer.new(Wx::VERTICAL)
|
46
|
+
|
47
|
+
box1_title = Wx::StaticBox.new(panel, -1, "Group 1", Wx::DEFAULT_POSITION, Wx::Size.new(-1,-1))
|
48
|
+
box1 = Wx::StaticBoxSizer.new(box1_title, Wx::HORIZONTAL)
|
49
|
+
grid1 = Wx::FlexGridSizer.new(0,2,0,0)
|
50
|
+
|
51
|
+
@group1_ctrls.each_value do |ctrl|
|
52
|
+
grid1.add(ctrl[0], 0, Wx::ALIGN_CENTER, 5)
|
53
|
+
grid1.add(ctrl[1], 0, Wx::ALIGN_CENTER, 5)
|
54
|
+
end
|
55
|
+
box1.add(grid1, 0, Wx::ALIGN_CENTER | Wx::ALL, 5)
|
56
|
+
vs.add(box1, 0, Wx::ALL, 5)
|
57
|
+
|
58
|
+
#box2_title = Wx::StaticBox.new(panel, -1, "Group 2")
|
59
|
+
#box2 = Wx::StaticBoxSizer.new(box2_title, Wx::HORIZONTAL)
|
60
|
+
#grid2 = Wx::FlexGridSizer.new(0,2,0,0)
|
61
|
+
|
62
|
+
#@group2_ctrls.each_value do |ctrl|
|
63
|
+
#grid2.add(ctrl[0], 0, Wx::ALIGN_CENTER, 5)
|
64
|
+
#grid2.add(ctrl[1], 0, Wx::ALIGN_CENTER, 5)
|
65
|
+
#end
|
66
|
+
#box2.add(grid2, 0, Wx::ALIGN_CENTER | Wx::ALL, 5)
|
67
|
+
#vs.add(box2, 0, Wx::ALIGN_CENTER | Wx::ALL, 5)
|
68
|
+
|
69
|
+
panel.set_sizer(vs)
|
70
|
+
vs.fit(panel)
|
71
|
+
|
72
|
+
panel.move(Wx::Point.new(50,50))
|
73
|
+
@panel = panel
|
74
|
+
|
75
|
+
@group1_ctrls.each_value do |ctrl|
|
76
|
+
evt_radiobutton(ctrl[0].get_id()) {|event| on_group1_select(event)}
|
77
|
+
ctrl[0].set_value(0)
|
78
|
+
ctrl[1].enable(false)
|
79
|
+
end
|
80
|
+
#@group2_ctrls.each_value do |ctrl|
|
81
|
+
# evt_radiobutton(ctrl[0].get_id()) {|event| on_group2_select(event)}
|
82
|
+
# ctrl[0].set_value(0)
|
83
|
+
# ctrl[1].enable(false)
|
84
|
+
#end
|
85
|
+
end
|
86
|
+
|
87
|
+
def on_group1_select(event)
|
88
|
+
@group1_ctrls.each_value do |ctrl|
|
89
|
+
if ctrl[0].get_value() == true
|
90
|
+
ctrl[1].enable(true)
|
91
|
+
@log.write_text("Group 1 " + ctrl[0].get_label() + " selected")
|
92
|
+
else
|
93
|
+
ctrl[1].enable(false)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
def on_group2_select(event)
|
99
|
+
@group2_ctrls.each_value do |ctrl|
|
100
|
+
if ctrl[0].get_value() == true
|
101
|
+
ctrl[1].enable(true)
|
102
|
+
@log.write_text("Group 2 " + ctrl[0].get_label() + " selected")
|
103
|
+
else
|
104
|
+
ctrl[1].enable(false)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
module Demo
|
111
|
+
def Demo.run(frame,nb,log)
|
112
|
+
win = TestPanel.new(nb, log)
|
113
|
+
return win
|
114
|
+
end
|
115
|
+
|
116
|
+
def Demo.overview
|
117
|
+
"This demo shows how individual radio buttons can be used to build more complicated selection mechanisms...\n" +
|
118
|
+
"It uses 2 groups of wxRadioButtons, where the groups are defined by instantiation. When a wxRadioButton is created with the Wx::RB_GROUP style, all subsequent wxRadioButtons created without it are implicitly added to that group by the framework."
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
|
123
|
+
if __FILE__ == $0
|
124
|
+
run_solo_lib = File.join( File.dirname(__FILE__), 'run.rb')
|
125
|
+
load run_solo_lib
|
126
|
+
run File.basename($0)
|
127
|
+
end
|
@@ -14,125 +14,115 @@ rescue LoadError => no_wx_err
|
|
14
14
|
end
|
15
15
|
|
16
16
|
class TestPanel < Wx::Panel
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
winids << @leftwin2.get_id
|
86
|
-
|
87
|
-
# will occupy the space not used by the Layout Algorithm
|
88
|
-
@remaining_space = Wx::Panel.new(self, -1, Wx::DEFAULT_POSITION, Wx::DEFAULT_SIZE, Wx::SUNKEN_BORDER)
|
89
|
-
|
90
|
-
evt_sash_dragged_range(winids.min, winids.max) {|event| on_sash_drag(event) }
|
91
|
-
evt_size {|event| on_size(event) }
|
92
|
-
end
|
93
|
-
|
94
|
-
|
95
|
-
def on_sash_drag(event)
|
96
|
-
if event.get_drag_status == Wx::SASH_STATUS_OUT_OF_RANGE:
|
97
|
-
@log.write_text('drag == out of range')
|
98
|
-
return
|
99
|
-
end
|
17
|
+
def initialize(parent, log)
|
18
|
+
super(parent, :style => Wx::NO_FULL_REPAINT_ON_RESIZE)
|
19
|
+
@log = log
|
20
|
+
|
21
|
+
winids = []
|
22
|
+
|
23
|
+
# Create some layout windows
|
24
|
+
# A window like a toolbar
|
25
|
+
@topwin = Wx::SashLayoutWindow.new( self,
|
26
|
+
:size => [200, 30],
|
27
|
+
:style => Wx::NO_BORDER|Wx::SW_3D)
|
28
|
+
@topwin.default_size = [1000, 30]
|
29
|
+
@topwin.orientation = Wx::LAYOUT_HORIZONTAL
|
30
|
+
@topwin.alignment = Wx::LAYOUT_TOP
|
31
|
+
@topwin.background_colour = Wx::RED
|
32
|
+
@topwin.set_sash_visible(Wx::SASH_BOTTOM, true)
|
33
|
+
|
34
|
+
winids << @topwin.id
|
35
|
+
|
36
|
+
# A window like a statusbar
|
37
|
+
@bottomwin = Wx::SashLayoutWindow.new( self,
|
38
|
+
:size => [200, 30],
|
39
|
+
:style => Wx::NO_BORDER|Wx::SW_3D )
|
40
|
+
|
41
|
+
@bottomwin.default_size = [1000, 30]
|
42
|
+
@bottomwin.orientation = Wx::LAYOUT_HORIZONTAL
|
43
|
+
@bottomwin.alignment = Wx::LAYOUT_BOTTOM
|
44
|
+
@bottomwin.background_colour = Wx::GREEN
|
45
|
+
@bottomwin.set_sash_visible(Wx::SASH_TOP, true)
|
46
|
+
|
47
|
+
winids << @bottomwin.id
|
48
|
+
|
49
|
+
# A window to the left of the client window
|
50
|
+
@leftwin1 = Wx::SashLayoutWindow.new( self,
|
51
|
+
:size => [200, 30],
|
52
|
+
:style => Wx::NO_BORDER|Wx::SW_3D )
|
53
|
+
|
54
|
+
@leftwin1.default_size = [120, 1000]
|
55
|
+
@leftwin1.orientation = Wx::LAYOUT_VERTICAL
|
56
|
+
@leftwin1.alignment = Wx::LAYOUT_LEFT
|
57
|
+
@leftwin1.background_colour = Wx::BLUE
|
58
|
+
@leftwin1.set_sash_visible(Wx::SASH_RIGHT, true)
|
59
|
+
@leftwin1.extra_border_size = 10
|
60
|
+
|
61
|
+
text_window = Wx::TextCtrl.new( @leftwin1,
|
62
|
+
:value => 'A sub window',
|
63
|
+
:style => Wx::TE_MULTILINE|Wx::SUNKEN_BORDER)
|
64
|
+
winids << @leftwin1.id
|
65
|
+
|
66
|
+
# Another window to the left of the client window
|
67
|
+
@leftwin2 = Wx::SashLayoutWindow.new( self,
|
68
|
+
:size => [200, 30],
|
69
|
+
:style => Wx::NO_BORDER|Wx::SW_3D)
|
70
|
+
|
71
|
+
@leftwin2.default_size = [120, 1000]
|
72
|
+
@leftwin2.orientation = Wx::LAYOUT_VERTICAL
|
73
|
+
@leftwin2.alignment = Wx::LAYOUT_LEFT
|
74
|
+
@leftwin2.background_colour = Wx::Colour.new(0, 255, 255)
|
75
|
+
@leftwin2.set_sash_visible(Wx::SASH_RIGHT, true)
|
76
|
+
|
77
|
+
winids << @leftwin2.id
|
78
|
+
|
79
|
+
# will occupy the space not used by the Layout Algorithm
|
80
|
+
@remaining_space = Wx::Panel.new(self, :style => Wx::SUNKEN_BORDER)
|
81
|
+
|
82
|
+
evt_sash_dragged_range(winids.min, winids.max, :on_sash_drag)
|
83
|
+
evt_size :on_size
|
84
|
+
end
|
100
85
|
|
101
|
-
eobj = event.get_event_object
|
102
|
-
if eobj == @topwin
|
103
|
-
@log.write_text('topwin received drag event')
|
104
|
-
@topwin.set_default_size(Wx::Size.new(1000, event.get_drag_rect.height))
|
105
86
|
|
106
|
-
|
107
|
-
|
108
|
-
|
87
|
+
def on_sash_drag(event)
|
88
|
+
if event.get_drag_status == Wx::SASH_STATUS_OUT_OF_RANGE:
|
89
|
+
@log.write_text('drag == out of range')
|
90
|
+
return
|
91
|
+
end
|
109
92
|
|
93
|
+
eobj = event.get_event_object
|
94
|
+
if eobj == @topwin
|
95
|
+
@log.write_text('topwin received drag event')
|
96
|
+
@topwin.default_size = Wx::Size.new(1000, event.drag_rect.height)
|
110
97
|
|
111
|
-
|
112
|
-
|
113
|
-
|
98
|
+
elsif eobj == @leftwin1
|
99
|
+
@log.write_text('leftwin1 received drag event')
|
100
|
+
@leftwin1.default_size = Wx::Size.new(event.drag_rect.width, 1000)
|
114
101
|
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
end
|
102
|
+
elsif eobj == @leftwin2
|
103
|
+
@log.write_text('leftwin2 received drag event')
|
104
|
+
@leftwin2.default_size = Wx::Size.new(event.drag_rect.width, 1000)
|
119
105
|
|
120
|
-
|
121
|
-
|
106
|
+
elsif eobj == @bottomwin
|
107
|
+
@log.write_text('bottomwin received drag event')
|
108
|
+
@bottomwin.default_size = Wx::Size.new(1000, event.drag_rect.height)
|
122
109
|
end
|
123
110
|
|
124
|
-
|
125
|
-
|
126
|
-
|
111
|
+
Wx::LayoutAlgorithm.new.layout_window(self, @remaining_space)
|
112
|
+
@remaining_space.refresh
|
113
|
+
end
|
114
|
+
|
115
|
+
def on_size(event)
|
116
|
+
Wx::LayoutAlgorithm.new.layout_window(self, @remaining_space)
|
117
|
+
end
|
127
118
|
|
128
119
|
end
|
129
120
|
|
130
121
|
module Demo
|
131
|
-
|
132
122
|
def Demo.run(frame, nb, log)
|
133
123
|
TestPanel.new(nb, log)
|
134
124
|
end
|
135
|
-
|
125
|
+
|
136
126
|
def Demo.overview
|
137
127
|
return <<EOS
|
138
128
|
Wx::SashLayoutWindow responds to OnCalculateLayout events generated by
|
@@ -1,59 +1,59 @@
|
|
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 ScrolledMessageDialog < Wx::Dialog
|
15
|
-
def initialize(parent, msg, caption,
|
16
|
-
pos = Wx::DEFAULT_POSITION,
|
17
|
-
size = Wx::Size.new(500,300) )
|
18
|
-
super(parent, -1, caption, pos, size)
|
19
|
-
x,y = pos.x, pos.y
|
20
|
-
if x == -1 and y == -1
|
21
|
-
center_on_screen(Wx::BOTH)
|
22
|
-
end
|
23
|
-
sizer = Wx::BoxSizer.new(Wx::VERTICAL)
|
24
|
-
text = Wx::TextCtrl.new(self, -1, msg,
|
25
|
-
Wx::DEFAULT_POSITION, Wx::DEFAULT_SIZE,
|
26
|
-
Wx::TE_MULTILINE|Wx::TE_READONLY)
|
27
|
-
|
28
|
-
sizer.add(text, 1, Wx::EXPAND|Wx::ALL, 5)
|
29
|
-
|
30
|
-
button_sizer = Wx::StdDialogButtonSizer.new
|
31
|
-
button_sizer.add_button( Wx::Button.new(self, Wx::ID_OK, "OK") )
|
32
|
-
button_sizer.realize
|
33
|
-
|
34
|
-
sizer.add(button_sizer, 0, Wx::EXPAND|Wx::ALL, 5)
|
35
|
-
|
36
|
-
set_sizer(sizer)
|
37
|
-
layout
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
module Demo
|
42
|
-
def Demo.run(frame, nb, log)
|
43
|
-
f = open(__FILE__, "r")
|
44
|
-
msg = f.read()
|
45
|
-
dlg = ScrolledMessageDialog.new(frame, msg, "message test")
|
46
|
-
dlg.show_modal()
|
47
|
-
end
|
48
|
-
|
49
|
-
def Demo.overview
|
50
|
-
return "A simple ruby example of a custom dialog displaying a " +
|
51
|
-
"long message in a scrolled TextCtrl"
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
if __FILE__ == $0
|
56
|
-
run_solo_lib = File.join( File.dirname(__FILE__), 'run.rb')
|
57
|
-
load run_solo_lib
|
58
|
-
run File.basename($0)
|
59
|
-
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 ScrolledMessageDialog < Wx::Dialog
|
15
|
+
def initialize(parent, msg, caption,
|
16
|
+
pos = Wx::DEFAULT_POSITION,
|
17
|
+
size = Wx::Size.new(500,300) )
|
18
|
+
super(parent, -1, caption, pos, size)
|
19
|
+
x,y = pos.x, pos.y
|
20
|
+
if x == -1 and y == -1
|
21
|
+
center_on_screen(Wx::BOTH)
|
22
|
+
end
|
23
|
+
sizer = Wx::BoxSizer.new(Wx::VERTICAL)
|
24
|
+
text = Wx::TextCtrl.new(self, -1, msg,
|
25
|
+
Wx::DEFAULT_POSITION, Wx::DEFAULT_SIZE,
|
26
|
+
Wx::TE_MULTILINE|Wx::TE_READONLY)
|
27
|
+
|
28
|
+
sizer.add(text, 1, Wx::EXPAND|Wx::ALL, 5)
|
29
|
+
|
30
|
+
button_sizer = Wx::StdDialogButtonSizer.new
|
31
|
+
button_sizer.add_button( Wx::Button.new(self, Wx::ID_OK, "OK") )
|
32
|
+
button_sizer.realize
|
33
|
+
|
34
|
+
sizer.add(button_sizer, 0, Wx::EXPAND|Wx::ALL, 5)
|
35
|
+
|
36
|
+
set_sizer(sizer)
|
37
|
+
layout
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
module Demo
|
42
|
+
def Demo.run(frame, nb, log)
|
43
|
+
f = open(__FILE__, "r")
|
44
|
+
msg = f.read()
|
45
|
+
dlg = ScrolledMessageDialog.new(frame, msg, "message test")
|
46
|
+
dlg.show_modal()
|
47
|
+
end
|
48
|
+
|
49
|
+
def Demo.overview
|
50
|
+
return "A simple ruby example of a custom dialog displaying a " +
|
51
|
+
"long message in a scrolled TextCtrl"
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
if __FILE__ == $0
|
56
|
+
run_solo_lib = File.join( File.dirname(__FILE__), 'run.rb')
|
57
|
+
load run_solo_lib
|
58
|
+
run File.basename($0)
|
59
|
+
end
|