wxruby 1.9.0-i386-mswin32 → 1.9.1-i386-mswin32
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/wx.rb +42 -35
- data/lib/wx/accessors.rb +52 -0
- data/lib/wx/classes/evthandler.rb +36 -32
- data/lib/wx/classes/grid.rb +13 -13
- data/lib/wx/classes/point.rb +43 -0
- data/lib/wx/classes/size.rb +44 -0
- data/lib/wx/classes/styledtextctrl.rb +92 -0
- data/lib/wx/classes/textctrl.rb +14 -0
- data/lib/wx/classes/window.rb +4 -0
- data/lib/wx/keyword_ctors.rb +219 -0
- data/lib/wx/keyword_defs.rb +455 -0
- data/lib/wx/version.rb +1 -1
- 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 +6 -5
- 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 +196 -196
- 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 +296 -296
- 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/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 +81 -81
- data/samples/event/event.rb +184 -0
- data/samples/images/images.rb +48 -48
- data/samples/listbook/listbook.rb +183 -183
- data/samples/listbook/listbook.xrc +370 -370
- data/samples/mdi/mdi.rb +87 -87
- data/samples/minimal/minimal.rb +83 -95
- data/samples/minimal/mondrian.png +0 -0
- data/samples/minimal/nothing.rb +46 -46
- data/samples/minimal/text.rb +35 -35
- data/samples/text/scintilla.rb +22 -28
- 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 +1210 -1210
- data/samples/xrc/samples.xrc +46 -46
- data/samples/xrc/xrc_sample.rb +107 -107
- metadata +13 -5
- data/samples/minimal/mondrian.ico +0 -0
- data/samples/minimal/mondrian.xpm +0 -44
@@ -1,74 +1,74 @@
|
|
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
|
-
$RBUT1 = 5000
|
15
|
-
$RBUT2 = 5001
|
16
|
-
$RBUT3 = 5002
|
17
|
-
$RBUT4 = 5003
|
18
|
-
|
19
|
-
$RBOX1 = 5004
|
20
|
-
$RBOX2 = 5005
|
21
|
-
|
22
|
-
class TestRadioButtons < Wx::Panel
|
23
|
-
def initialize(parent, log)
|
24
|
-
@log = log
|
25
|
-
super(parent, -1)
|
26
|
-
|
27
|
-
sampleList = %w(zero one two three four five six seven eight)
|
28
|
-
|
29
|
-
sizer = Wx::BoxSizer.new(Wx::VERTICAL)
|
30
|
-
# Here is a strange thing - when I originally created this demo, I used the WxRuby constant Wx::DEFAULT_SIZE in the two
|
31
|
-
# radiobox constructors (on Windows XP Prof). When I did this, the "box" around the radio buttons would resize in a
|
32
|
-
# groesque fashion (either when I clicked on another demo first, or on the second time that I ran the demo. But when I
|
33
|
-
# used Wx::Size.new(-1,-1), this behavior disappeared. If anyone figures this out, please post it to the list :)
|
34
|
-
rb = Wx::RadioBox.new(self, $RBOX1, "Wx::RadioBox", Wx::DEFAULT_POSITION, Wx::Size.new(-1,-1), sampleList, 2, Wx::RA_SPECIFY_COLS)
|
35
|
-
evt_radiobox($RBOX1) {|event| on_evt_radiobox(event)}
|
36
|
-
rb.set_tool_tip(Wx::ToolTip.new("This is a tooltip!"))
|
37
|
-
sizer.add(rb, 0, Wx::ALL, 20)
|
38
|
-
|
39
|
-
rb = Wx::RadioBox.new(self, $RBOX2, "", Wx::DEFAULT_POSITION, Wx::Size.new(-1,-1), sampleList, 3, Wx::RA_SPECIFY_COLS | Wx::NO_BORDER)
|
40
|
-
evt_radiobox($RBOX2) {|event| on_evt_radiobox(event)}
|
41
|
-
rb.set_tool_tip(Wx::ToolTip.new("This box has no label"))
|
42
|
-
sizer.add(rb, 0, Wx::ALL, 20)
|
43
|
-
|
44
|
-
set_sizer(sizer)
|
45
|
-
sizer.fit(self)
|
46
|
-
sizer.layout()
|
47
|
-
end
|
48
|
-
|
49
|
-
def on_evt_radiobox(event)
|
50
|
-
@log.write_text("evt_radiobox: " + event.get_int().to_s())
|
51
|
-
end
|
52
|
-
|
53
|
-
def on_evt_radio_button(event)
|
54
|
-
@log.write_text("evt_radiobutton: " + event.get_id().to_s())
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
module Demo
|
59
|
-
def Demo.run(frame,nb,log)
|
60
|
-
win = TestRadioButtons.new(nb, log)
|
61
|
-
return win
|
62
|
-
end
|
63
|
-
|
64
|
-
def Demo.overview
|
65
|
-
"A radio box item is used to select one of number of mutually exclusive choices. It is displayed as a vertical column or horizontal row of labelled buttons."
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
|
70
|
-
if __FILE__ == $0
|
71
|
-
run_solo_lib = File.join( File.dirname(__FILE__), 'run.rb')
|
72
|
-
load run_solo_lib
|
73
|
-
run File.basename($0)
|
74
|
-
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
|
+
$RBUT1 = 5000
|
15
|
+
$RBUT2 = 5001
|
16
|
+
$RBUT3 = 5002
|
17
|
+
$RBUT4 = 5003
|
18
|
+
|
19
|
+
$RBOX1 = 5004
|
20
|
+
$RBOX2 = 5005
|
21
|
+
|
22
|
+
class TestRadioButtons < Wx::Panel
|
23
|
+
def initialize(parent, log)
|
24
|
+
@log = log
|
25
|
+
super(parent, -1)
|
26
|
+
|
27
|
+
sampleList = %w(zero one two three four five six seven eight)
|
28
|
+
|
29
|
+
sizer = Wx::BoxSizer.new(Wx::VERTICAL)
|
30
|
+
# Here is a strange thing - when I originally created this demo, I used the WxRuby constant Wx::DEFAULT_SIZE in the two
|
31
|
+
# radiobox constructors (on Windows XP Prof). When I did this, the "box" around the radio buttons would resize in a
|
32
|
+
# groesque fashion (either when I clicked on another demo first, or on the second time that I ran the demo. But when I
|
33
|
+
# used Wx::Size.new(-1,-1), this behavior disappeared. If anyone figures this out, please post it to the list :)
|
34
|
+
rb = Wx::RadioBox.new(self, $RBOX1, "Wx::RadioBox", Wx::DEFAULT_POSITION, Wx::Size.new(-1,-1), sampleList, 2, Wx::RA_SPECIFY_COLS)
|
35
|
+
evt_radiobox($RBOX1) {|event| on_evt_radiobox(event)}
|
36
|
+
rb.set_tool_tip(Wx::ToolTip.new("This is a tooltip!"))
|
37
|
+
sizer.add(rb, 0, Wx::ALL, 20)
|
38
|
+
|
39
|
+
rb = Wx::RadioBox.new(self, $RBOX2, "", Wx::DEFAULT_POSITION, Wx::Size.new(-1,-1), sampleList, 3, Wx::RA_SPECIFY_COLS | Wx::NO_BORDER)
|
40
|
+
evt_radiobox($RBOX2) {|event| on_evt_radiobox(event)}
|
41
|
+
rb.set_tool_tip(Wx::ToolTip.new("This box has no label"))
|
42
|
+
sizer.add(rb, 0, Wx::ALL, 20)
|
43
|
+
|
44
|
+
set_sizer(sizer)
|
45
|
+
sizer.fit(self)
|
46
|
+
sizer.layout()
|
47
|
+
end
|
48
|
+
|
49
|
+
def on_evt_radiobox(event)
|
50
|
+
@log.write_text("evt_radiobox: " + event.get_int().to_s())
|
51
|
+
end
|
52
|
+
|
53
|
+
def on_evt_radio_button(event)
|
54
|
+
@log.write_text("evt_radiobutton: " + event.get_id().to_s())
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
module Demo
|
59
|
+
def Demo.run(frame,nb,log)
|
60
|
+
win = TestRadioButtons.new(nb, log)
|
61
|
+
return win
|
62
|
+
end
|
63
|
+
|
64
|
+
def Demo.overview
|
65
|
+
"A radio box item is used to select one of number of mutually exclusive choices. It is displayed as a vertical column or horizontal row of labelled buttons."
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
|
70
|
+
if __FILE__ == $0
|
71
|
+
run_solo_lib = File.join( File.dirname(__FILE__), 'run.rb')
|
72
|
+
load run_solo_lib
|
73
|
+
run File.basename($0)
|
74
|
+
end
|
@@ -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
|
@@ -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
|