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,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
|