wxruby 1.9.2-i386-mswin32 → 1.9.3-i386-mswin32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (149) hide show
  1. data/LICENSE +53 -53
  2. data/README +299 -299
  3. data/lib/wx/classes/app.rb +6 -0
  4. data/lib/wx/classes/checklistbox.rb +45 -30
  5. data/lib/wx/classes/clipboard.rb +16 -0
  6. data/lib/wx/classes/event.rb +5 -0
  7. data/lib/wx/classes/evthandler.rb +20 -10
  8. data/lib/wx/classes/grid.rb +38 -39
  9. data/lib/wx/classes/listctrl.rb +12 -0
  10. data/lib/wx/classes/mediactrl.rb +22 -0
  11. data/lib/wx/classes/menu.rb +6 -6
  12. data/lib/wx/classes/sound.rb +23 -0
  13. data/lib/wx/classes/styledtextctrl.rb +2 -2
  14. data/lib/wx/classes/treectrl.rb +26 -0
  15. data/lib/wx/keyword_ctors.rb +19 -5
  16. data/lib/wx/keyword_defs.rb +20 -0
  17. data/lib/wx/version.rb +1 -1
  18. data/lib/wx.rb +42 -42
  19. data/lib/wxruby2.exp +0 -0
  20. data/lib/wxruby2.lib +0 -0
  21. data/lib/wxruby2.so +0 -0
  22. data/samples/SAMPLES-LICENSE.TXT +17 -17
  23. data/samples/aui/aui.rb +8 -1
  24. data/samples/bigdemo/About.rbw +39 -39
  25. data/samples/bigdemo/ColorPanel.rbw +25 -25
  26. data/samples/bigdemo/GridSimple.rbw +80 -80
  27. data/samples/bigdemo/MDIDemo.rbw +59 -59
  28. data/samples/bigdemo/PopupMenu.rbw +151 -151
  29. data/samples/bigdemo/Sizers.rbw +545 -545
  30. data/samples/bigdemo/bigdemo.rb +826 -826
  31. data/samples/bigdemo/demoTemplate.rbw +37 -37
  32. data/samples/bigdemo/icons/choice.xpm +27 -27
  33. data/samples/bigdemo/icons/combo.xpm +27 -27
  34. data/samples/bigdemo/icons/copy.xpm +25 -25
  35. data/samples/bigdemo/icons/cut.xpm +24 -24
  36. data/samples/bigdemo/icons/gauge.xpm +27 -27
  37. data/samples/bigdemo/icons/help.xpm +25 -25
  38. data/samples/bigdemo/icons/list.xpm +27 -27
  39. data/samples/bigdemo/icons/mondrian.xpm +44 -44
  40. data/samples/bigdemo/icons/new.xpm +24 -24
  41. data/samples/bigdemo/icons/ogl.ico +0 -0
  42. data/samples/bigdemo/icons/ogl.xpm +45 -45
  43. data/samples/bigdemo/icons/open.xpm +26 -26
  44. data/samples/bigdemo/icons/paste.xpm +38 -38
  45. data/samples/bigdemo/icons/preview.xpm +26 -26
  46. data/samples/bigdemo/icons/print.xpm +26 -26
  47. data/samples/bigdemo/icons/radio.xpm +27 -27
  48. data/samples/bigdemo/icons/robert.xpm +415 -415
  49. data/samples/bigdemo/icons/save.xpm +25 -25
  50. data/samples/bigdemo/icons/smiles.xpm +39 -39
  51. data/samples/bigdemo/icons/smiley.xpm +42 -42
  52. data/samples/bigdemo/icons/stattext.xpm +24 -24
  53. data/samples/bigdemo/icons/test2.bmp +0 -0
  54. data/samples/bigdemo/icons/test2.xpm +79 -79
  55. data/samples/bigdemo/icons/text.xpm +27 -27
  56. data/samples/bigdemo/icons/tog1.xpm +38 -38
  57. data/samples/bigdemo/icons/tog2.xpm +38 -38
  58. data/samples/bigdemo/icons/wxwin16x16.xpm +25 -25
  59. data/samples/bigdemo/tips.txt +7 -7
  60. data/samples/bigdemo/utils.rb +11 -11
  61. data/samples/bigdemo/wxButton.rbw +66 -66
  62. data/samples/bigdemo/wxCalendarCtrl.rbw +72 -72
  63. data/samples/bigdemo/wxCheckBox.rbw +52 -52
  64. data/samples/bigdemo/wxCheckListBox.rbw +77 -77
  65. data/samples/bigdemo/wxChoice.rbw +49 -49
  66. data/samples/bigdemo/wxColourDialog.rbw +34 -34
  67. data/samples/bigdemo/wxComboBox.rbw +79 -79
  68. data/samples/bigdemo/wxDialog.rbw +92 -92
  69. data/samples/bigdemo/wxDirDialog.rbw +32 -32
  70. data/samples/bigdemo/wxFileDialog.rbw +39 -39
  71. data/samples/bigdemo/wxFileDialog_Save.rbw +38 -38
  72. data/samples/bigdemo/wxFindReplaceDialog.rbw +85 -85
  73. data/samples/bigdemo/wxFontDialog.rbw +176 -176
  74. data/samples/bigdemo/wxFrame.rbw +55 -55
  75. data/samples/bigdemo/wxGauge.rbw +73 -73
  76. data/samples/bigdemo/wxGrid.rbw +68 -68
  77. data/samples/bigdemo/wxListBox.rbw +142 -142
  78. data/samples/bigdemo/wxListCtrl_virtual.rbw +109 -109
  79. data/samples/bigdemo/wxMDIWindows.rbw +52 -52
  80. data/samples/bigdemo/wxMenu.rbw +238 -238
  81. data/samples/bigdemo/wxMessageDialog.rbw +30 -30
  82. data/samples/bigdemo/wxMultipleChoiceDialog.rbw +34 -34
  83. data/samples/bigdemo/wxNotebook.rbw +138 -138
  84. data/samples/bigdemo/wxProgressDialog.rbw +45 -45
  85. data/samples/bigdemo/wxRadioBox.rbw +74 -74
  86. data/samples/bigdemo/wxRadioButton.rbw +127 -127
  87. data/samples/bigdemo/wxSashWindow.rbw +94 -104
  88. data/samples/bigdemo/wxScrolledMessageDialog.rbw +59 -59
  89. data/samples/bigdemo/wxScrolledWindow.rbw +201 -201
  90. data/samples/bigdemo/wxSingleChoiceDialog.rbw +35 -35
  91. data/samples/bigdemo/wxSlider.rbw +44 -44
  92. data/samples/bigdemo/wxSpinButton.rbw +52 -52
  93. data/samples/bigdemo/wxSpinCtrl.rbw +53 -53
  94. data/samples/bigdemo/wxSplitterWindow.rbw +65 -65
  95. data/samples/bigdemo/wxStaticBitmap.rbw +53 -53
  96. data/samples/bigdemo/wxStaticText.rbw +57 -57
  97. data/samples/bigdemo/wxStatusBar.rbw +128 -128
  98. data/samples/bigdemo/wxTextCtrl.rbw +151 -151
  99. data/samples/bigdemo/wxTextEntryDialog.rbw +34 -34
  100. data/samples/bigdemo/wxToggleButton.rbw +51 -51
  101. data/samples/bigdemo/wxToolBar.rbw +133 -133
  102. data/samples/bigdemo/wxTreeCtrl.rbw +192 -192
  103. data/samples/calendar/calendar.rb +275 -275
  104. data/samples/caret/caret.rb +286 -286
  105. data/samples/caret/mondrian.xpm +44 -44
  106. data/samples/controls/controls.rb +1140 -1140
  107. data/samples/controls/get_item_sample.rb +87 -87
  108. data/samples/controls/icons/choice.xpm +27 -27
  109. data/samples/controls/icons/combo.xpm +27 -27
  110. data/samples/controls/icons/gauge.xpm +27 -27
  111. data/samples/controls/icons/list.xpm +27 -27
  112. data/samples/controls/icons/radio.xpm +27 -27
  113. data/samples/controls/icons/stattext.xpm +24 -24
  114. data/samples/controls/icons/text.xpm +27 -27
  115. data/samples/controls/mondrian.xpm +44 -44
  116. data/samples/dialogs/dialogs.rb +724 -724
  117. data/samples/dialogs/tips.txt +18 -18
  118. data/samples/drawing/graphics_drawing.rb +232 -0
  119. data/samples/{images → drawing}/images.rb +48 -48
  120. data/samples/{images → drawing}/paperclip.png +0 -0
  121. data/samples/etc/activation.rb +108 -108
  122. data/samples/etc/choice.rb +72 -72
  123. data/samples/etc/miniframe.rb +84 -84
  124. data/samples/etc/sash.rb +135 -135
  125. data/samples/etc/scrollwin.rb +116 -116
  126. data/samples/etc/system_settings.rb +258 -258
  127. data/samples/etc/wizard.rb +79 -79
  128. data/samples/grid/grid.rb +1 -0
  129. data/samples/listbook/listbook.rb +181 -181
  130. data/samples/listbook/listbook.xrc +370 -370
  131. data/samples/mdi/mdi.rb +87 -87
  132. data/samples/media/mediactrl.rb +173 -0
  133. data/samples/minimal/minimal.rb +85 -85
  134. data/samples/minimal/nothing.rb +21 -21
  135. data/samples/opengl/cube.rb +123 -0
  136. data/samples/sockets/SocketPackets.rb +27 -0
  137. data/samples/sockets/res/message-new.png +0 -0
  138. data/samples/sockets/res/user.png +0 -0
  139. data/samples/sockets/wxClient.rb +395 -0
  140. data/samples/sockets/wxServer.rb +422 -0
  141. data/samples/sockets/wxSocketGUI.rb +97 -0
  142. data/samples/text/textctrl.rb +124 -124
  143. data/samples/text/unicode.rb +238 -238
  144. data/samples/text/utf8.txt +14 -14
  145. data/samples/treectrl/treectrl.rb +1180 -1181
  146. data/samples/xrc/samples.xrc +46 -46
  147. data/samples/xrc/xrc_sample.rb +107 -107
  148. metadata +26 -9
  149. data/samples/images/Thumbs.db +0 -0
@@ -1,286 +1,286 @@
1
- #!/usr/bin/env ruby
2
- # wxRuby2 Sample Code. Copyright (c) 2004-2006 Kevin B. Smith
3
- # Freely reusable code: see SAMPLES-LICENSE.TXT for details
4
-
5
- begin
6
- require 'wx'
7
- rescue LoadError => no_wx_err
8
- begin
9
- require 'rubygems'
10
- require 'wx'
11
- rescue LoadError
12
- raise no_wx_err
13
- end
14
- end
15
- include Wx
16
-
17
- # menu items
18
- Caret_set_blink_time = 3
19
- Caret_Move = 4
20
-
21
- # controls start here (the numbers are, of course, arbitrary)
22
- Caret_Text = 1000
23
-
24
-
25
- # MyCanvas is a canvas on which you can type
26
- class MyCanvas < ScrolledWindow
27
- def initialize(parent)
28
- super(parent, :style => SUNKEN_BORDER)
29
-
30
- self.background_colour = WHITE
31
-
32
- @font = Font.new(12, FONTFAMILY_TELETYPE,
33
- FONTSTYLE_NORMAL, FONTWEIGHT_NORMAL)
34
-
35
- @x_caret = @y_caret = @x_chars = @y_chars = 0
36
- @x_margin = @y_margin = 5
37
- @text = nil
38
-
39
- create_caret
40
-
41
- evt_paint :on_paint
42
- evt_size :on_size
43
- evt_char :on_char
44
- end
45
-
46
- def [](x,y)
47
- @text[x + @x_chars * y,1]
48
- end
49
-
50
- def []=(x,y,z)
51
- @text[x + @x_chars * y,1] = z
52
- end
53
-
54
- # caret movement
55
- def home_pos
56
- @x_caret = 0
57
- end
58
-
59
- def end_pos
60
- @x_caret = @x_chars - 1
61
- end
62
-
63
- def first_line
64
- @y_caret = 0
65
- end
66
-
67
- def last_line
68
- @y_caret = @y_chars - 1
69
- end
70
-
71
- def prev_char
72
- if @x_caret == 0
73
- end_pos
74
- prev_line
75
- else
76
- @x_caret -= 1
77
- end
78
- end
79
-
80
- def next_char
81
- @x_caret += 1
82
- if @x_caret == @x_chars
83
- home_pos
84
- next_line
85
- end
86
- end
87
-
88
- def prev_line
89
- if @y_caret == 0
90
- last_line
91
- else
92
- @y_caret -= 1
93
- end
94
- end
95
-
96
- def next_line
97
- @y_caret += 1
98
- if @y_caret == @y_chars
99
- first_line
100
- end
101
- end
102
-
103
- def create_caret
104
- paint do | dc |
105
- dc.font = @font
106
- @height_char = dc.char_height
107
- @width_char = dc.char_width
108
-
109
- my_caret = Caret.new(self, Size.new(@width_char, @height_char))
110
- self.caret = my_caret
111
-
112
- caret.move [ @x_margin, @y_margin ]
113
- caret.show
114
- end
115
- end
116
-
117
- def move_caret(x,y)
118
- @x_caret = x
119
- @y_caret = y
120
-
121
- do_move_caret
122
- end
123
-
124
- def do_move_caret
125
- log_status("Caret is at (%d, %d)", @x_caret, @y_caret)
126
-
127
- caret.move_xy( @x_margin + @x_caret * @width_char,
128
- @y_margin + @y_caret * @height_char)
129
- end
130
-
131
- def on_size(event)
132
- @x_chars = (event.size.x - 2 * @x_margin) / @width_char
133
- @y_chars = (event.size.y - 2 * @y_margin) / @height_char
134
- if @x_chars <= 0
135
- @x_chars = 1
136
- end
137
- if @y_chars <= 0
138
- @y_chars = 1
139
- end
140
- if @x_caret >= @x_chars
141
- @x_caret = @x_chars-1
142
- end
143
- if @y_caret >= @y_chars
144
- @y_caret = @y_chars-1
145
- end
146
-
147
- @text = " " * @x_chars * @y_chars
148
-
149
- if parent && parent.status_bar
150
- msg = sprintf("Panel size is (%d, %d)", @x_chars, @y_chars)
151
- parent.set_status_text(msg, 1)
152
- parent.refresh
153
- end
154
- event.skip
155
- end
156
-
157
- def on_paint
158
- if caret
159
- caret.hide
160
- end
161
-
162
- paint do | dc |
163
- dc.clear
164
- dc.set_font(@font)
165
-
166
- for y in 0 ... @y_chars
167
- line = @text[@x_chars * y,@x_chars]
168
- dc.draw_text( line, @x_margin, @y_margin + y * @height_char )
169
- end
170
- end
171
-
172
- if caret
173
- caret.show
174
- end
175
- end
176
-
177
- def on_char(event)
178
- case event.key_code
179
- when K_LEFT, K_BACK
180
- prev_char
181
- when K_RIGHT
182
- next_char
183
- when K_UP
184
- prev_line
185
- when K_DOWN
186
- next_line
187
- when K_HOME
188
- home_pos
189
- when K_END
190
- end_pos
191
- when K_RETURN
192
- home_pos
193
- next_line
194
- else
195
- ch = event.key_code
196
- if !event.alt_down and (ch >= K_SPACE) and (ch < K_DELETE)
197
- self[@x_caret, @y_caret] = ch.chr
198
- refresh
199
- next_char
200
- else
201
- event.skip
202
- end
203
- end
204
- do_move_caret
205
- end
206
- end
207
-
208
- class MyFrame < Frame
209
- def initialize(title, pos, size)
210
- super(nil, -1, title, pos, size)
211
- # set the frame icon
212
- icon_file = File.join(File.dirname(__FILE__), 'mondrian.xpm')
213
- self.icon = Icon.new(icon_file, BITMAP_TYPE_XPM)
214
-
215
- # create a menu bar
216
- menu_file = Menu.new
217
-
218
- menu_file.append(Caret_set_blink_time, "&Blink time...\tCtrl-B")
219
- menu_file.append(Caret_Move, "&Move caret\tCtrl-C")
220
- menu_file.append_separator
221
- menu_file.append(Wx::ID_ABOUT, "&About...\tCtrl-A", "Show about dialog")
222
- menu_file.append_separator
223
- menu_file.append(Wx::ID_EXIT, "E&xit\tAlt-X", "Quit self program")
224
-
225
- # now append the freshly created menu to the menu bar...
226
- menu_bar = MenuBar.new
227
- menu_bar.append(menu_file, "&File")
228
-
229
- # ... and attach self menu bar to the frame
230
- self.menu_bar = menu_bar
231
-
232
- @canvas = MyCanvas.new(self)
233
-
234
- # This is required to set focus so that key events are directed to
235
- # this Window, on Linux/GTK in particular
236
- @canvas.set_focus
237
-
238
- # create a status bar just for fun (by default with 1 pane only)
239
- create_status_bar(2)
240
- self.status_text = "Welcome to Windows!"
241
-
242
- evt_menu Wx::ID_EXIT, :on_quit
243
- evt_menu Wx::ID_ABOUT, :on_about
244
- evt_menu Caret_set_blink_time, :on_set_blink_time
245
- evt_menu Caret_Move, :on_caret_move
246
- end
247
-
248
- def on_quit
249
- # true is to force the frame to close
250
- close(true)
251
- end
252
-
253
- def on_about
254
- message_box("The caret Windows sample, adapted for WxRuby",
255
- "About Caret", OK | ICON_INFORMATION, self)
256
- end
257
-
258
- def on_caret_move
259
- @canvas.move_caret(10, 10)
260
- end
261
-
262
- def on_set_blink_time
263
- blink_time = get_number_from_user(
264
- "The caret blink time is the time between two blinks",
265
- "Time in milliseconds:",
266
- "Caret sample",
267
- Caret::get_blink_time, 0, 10000,
268
- self)
269
- if blink_time != -1
270
- Caret::set_blink_time(blink_time)
271
- @canvas.create_caret
272
- log_status(self,"Blink time set to %d milliseconds.", blink_time)
273
- end
274
- end
275
- end
276
-
277
- class CaretApp < App
278
- def on_init
279
- frame = MyFrame.new("Caret Windows sample",
280
- Point.new(50, 50), Size.new(450, 340))
281
- frame.show(true)
282
- end
283
- end
284
-
285
- a = CaretApp.new
286
- a.main_loop
1
+ #!/usr/bin/env ruby
2
+ # wxRuby2 Sample Code. Copyright (c) 2004-2006 Kevin B. Smith
3
+ # Freely reusable code: see SAMPLES-LICENSE.TXT for details
4
+
5
+ begin
6
+ require 'wx'
7
+ rescue LoadError => no_wx_err
8
+ begin
9
+ require 'rubygems'
10
+ require 'wx'
11
+ rescue LoadError
12
+ raise no_wx_err
13
+ end
14
+ end
15
+ include Wx
16
+
17
+ # menu items
18
+ Caret_set_blink_time = 3
19
+ Caret_Move = 4
20
+
21
+ # controls start here (the numbers are, of course, arbitrary)
22
+ Caret_Text = 1000
23
+
24
+
25
+ # MyCanvas is a canvas on which you can type
26
+ class MyCanvas < ScrolledWindow
27
+ def initialize(parent)
28
+ super(parent, :style => SUNKEN_BORDER)
29
+
30
+ self.background_colour = WHITE
31
+
32
+ @font = Font.new(12, FONTFAMILY_TELETYPE,
33
+ FONTSTYLE_NORMAL, FONTWEIGHT_NORMAL)
34
+
35
+ @x_caret = @y_caret = @x_chars = @y_chars = 0
36
+ @x_margin = @y_margin = 5
37
+ @text = nil
38
+
39
+ create_caret
40
+
41
+ evt_paint :on_paint
42
+ evt_size :on_size
43
+ evt_char :on_char
44
+ end
45
+
46
+ def [](x,y)
47
+ @text[x + @x_chars * y,1]
48
+ end
49
+
50
+ def []=(x,y,z)
51
+ @text[x + @x_chars * y,1] = z
52
+ end
53
+
54
+ # caret movement
55
+ def home_pos
56
+ @x_caret = 0
57
+ end
58
+
59
+ def end_pos
60
+ @x_caret = @x_chars - 1
61
+ end
62
+
63
+ def first_line
64
+ @y_caret = 0
65
+ end
66
+
67
+ def last_line
68
+ @y_caret = @y_chars - 1
69
+ end
70
+
71
+ def prev_char
72
+ if @x_caret == 0
73
+ end_pos
74
+ prev_line
75
+ else
76
+ @x_caret -= 1
77
+ end
78
+ end
79
+
80
+ def next_char
81
+ @x_caret += 1
82
+ if @x_caret == @x_chars
83
+ home_pos
84
+ next_line
85
+ end
86
+ end
87
+
88
+ def prev_line
89
+ if @y_caret == 0
90
+ last_line
91
+ else
92
+ @y_caret -= 1
93
+ end
94
+ end
95
+
96
+ def next_line
97
+ @y_caret += 1
98
+ if @y_caret == @y_chars
99
+ first_line
100
+ end
101
+ end
102
+
103
+ def create_caret
104
+ paint do | dc |
105
+ dc.font = @font
106
+ @height_char = dc.char_height
107
+ @width_char = dc.char_width
108
+
109
+ my_caret = Caret.new(self, Size.new(@width_char, @height_char))
110
+ self.caret = my_caret
111
+
112
+ caret.move [ @x_margin, @y_margin ]
113
+ caret.show
114
+ end
115
+ end
116
+
117
+ def move_caret(x,y)
118
+ @x_caret = x
119
+ @y_caret = y
120
+
121
+ do_move_caret
122
+ end
123
+
124
+ def do_move_caret
125
+ log_status("Caret is at (%d, %d)", @x_caret, @y_caret)
126
+
127
+ caret.move_xy( @x_margin + @x_caret * @width_char,
128
+ @y_margin + @y_caret * @height_char)
129
+ end
130
+
131
+ def on_size(event)
132
+ @x_chars = (event.size.x - 2 * @x_margin) / @width_char
133
+ @y_chars = (event.size.y - 2 * @y_margin) / @height_char
134
+ if @x_chars <= 0
135
+ @x_chars = 1
136
+ end
137
+ if @y_chars <= 0
138
+ @y_chars = 1
139
+ end
140
+ if @x_caret >= @x_chars
141
+ @x_caret = @x_chars-1
142
+ end
143
+ if @y_caret >= @y_chars
144
+ @y_caret = @y_chars-1
145
+ end
146
+
147
+ @text = " " * @x_chars * @y_chars
148
+
149
+ if parent && parent.status_bar
150
+ msg = sprintf("Panel size is (%d, %d)", @x_chars, @y_chars)
151
+ parent.set_status_text(msg, 1)
152
+ parent.refresh
153
+ end
154
+ event.skip
155
+ end
156
+
157
+ def on_paint
158
+ if caret
159
+ caret.hide
160
+ end
161
+
162
+ paint do | dc |
163
+ dc.clear
164
+ dc.set_font(@font)
165
+
166
+ for y in 0 ... @y_chars
167
+ line = @text[@x_chars * y,@x_chars]
168
+ dc.draw_text( line, @x_margin, @y_margin + y * @height_char )
169
+ end
170
+ end
171
+
172
+ if caret
173
+ caret.show
174
+ end
175
+ end
176
+
177
+ def on_char(event)
178
+ case event.key_code
179
+ when K_LEFT, K_BACK
180
+ prev_char
181
+ when K_RIGHT
182
+ next_char
183
+ when K_UP
184
+ prev_line
185
+ when K_DOWN
186
+ next_line
187
+ when K_HOME
188
+ home_pos
189
+ when K_END
190
+ end_pos
191
+ when K_RETURN
192
+ home_pos
193
+ next_line
194
+ else
195
+ ch = event.key_code
196
+ if !event.alt_down and (ch >= K_SPACE) and (ch < K_DELETE)
197
+ self[@x_caret, @y_caret] = ch.chr
198
+ refresh
199
+ next_char
200
+ else
201
+ event.skip
202
+ end
203
+ end
204
+ do_move_caret
205
+ end
206
+ end
207
+
208
+ class MyFrame < Frame
209
+ def initialize(title, pos, size)
210
+ super(nil, -1, title, pos, size)
211
+ # set the frame icon
212
+ icon_file = File.join(File.dirname(__FILE__), 'mondrian.xpm')
213
+ self.icon = Icon.new(icon_file, BITMAP_TYPE_XPM)
214
+
215
+ # create a menu bar
216
+ menu_file = Menu.new
217
+
218
+ menu_file.append(Caret_set_blink_time, "&Blink time...\tCtrl-B")
219
+ menu_file.append(Caret_Move, "&Move caret\tCtrl-C")
220
+ menu_file.append_separator
221
+ menu_file.append(Wx::ID_ABOUT, "&About...\tCtrl-A", "Show about dialog")
222
+ menu_file.append_separator
223
+ menu_file.append(Wx::ID_EXIT, "E&xit\tAlt-X", "Quit self program")
224
+
225
+ # now append the freshly created menu to the menu bar...
226
+ menu_bar = MenuBar.new
227
+ menu_bar.append(menu_file, "&File")
228
+
229
+ # ... and attach self menu bar to the frame
230
+ self.menu_bar = menu_bar
231
+
232
+ @canvas = MyCanvas.new(self)
233
+
234
+ # This is required to set focus so that key events are directed to
235
+ # this Window, on Linux/GTK in particular
236
+ @canvas.set_focus
237
+
238
+ # create a status bar just for fun (by default with 1 pane only)
239
+ create_status_bar(2)
240
+ self.status_text = "Welcome to Windows!"
241
+
242
+ evt_menu Wx::ID_EXIT, :on_quit
243
+ evt_menu Wx::ID_ABOUT, :on_about
244
+ evt_menu Caret_set_blink_time, :on_set_blink_time
245
+ evt_menu Caret_Move, :on_caret_move
246
+ end
247
+
248
+ def on_quit
249
+ # true is to force the frame to close
250
+ close(true)
251
+ end
252
+
253
+ def on_about
254
+ message_box("The caret Windows sample, adapted for WxRuby",
255
+ "About Caret", OK | ICON_INFORMATION, self)
256
+ end
257
+
258
+ def on_caret_move
259
+ @canvas.move_caret(10, 10)
260
+ end
261
+
262
+ def on_set_blink_time
263
+ blink_time = get_number_from_user(
264
+ "The caret blink time is the time between two blinks",
265
+ "Time in milliseconds:",
266
+ "Caret sample",
267
+ Caret::get_blink_time, 0, 10000,
268
+ self)
269
+ if blink_time != -1
270
+ Caret::set_blink_time(blink_time)
271
+ @canvas.create_caret
272
+ log_status(self,"Blink time set to %d milliseconds.", blink_time)
273
+ end
274
+ end
275
+ end
276
+
277
+ class CaretApp < App
278
+ def on_init
279
+ frame = MyFrame.new("Caret Windows sample",
280
+ Point.new(50, 50), Size.new(450, 340))
281
+ frame.show(true)
282
+ end
283
+ end
284
+
285
+ a = CaretApp.new
286
+ a.main_loop
@@ -1,44 +1,44 @@
1
- /* XPM */
2
- static char *mondrian_xpm[] = {
3
- /* columns rows colors chars-per-pixel */
4
- "32 32 6 1",
5
- " c Black",
6
- ". c Blue",
7
- "X c #00bf00",
8
- "o c Red",
9
- "O c Yellow",
10
- "+ c Gray100",
11
- /* pixels */
12
- " ",
13
- " oooooo +++++++++++++++++++++++ ",
14
- " oooooo +++++++++++++++++++++++ ",
15
- " oooooo +++++++++++++++++++++++ ",
16
- " oooooo +++++++++++++++++++++++ ",
17
- " oooooo +++++++++++++++++++++++ ",
18
- " oooooo +++++++++++++++++++++++ ",
19
- " oooooo +++++++++++++++++++++++ ",
20
- " ",
21
- " ++++++ ++++++++++++++++++ .... ",
22
- " ++++++ ++++++++++++++++++ .... ",
23
- " ++++++ ++++++++++++++++++ .... ",
24
- " ++++++ ++++++++++++++++++ .... ",
25
- " ++++++ ++++++++++++++++++ .... ",
26
- " ++++++ ++++++++++++++++++ ",
27
- " ++++++ ++++++++++++++++++ ++++ ",
28
- " ++++++ ++++++++++++++++++ ++++ ",
29
- " ++++++ ++++++++++++++++++ ++++ ",
30
- " ++++++ ++++++++++++++++++ ++++ ",
31
- " ++++++ ++++++++++++++++++ ++++ ",
32
- " ++++++ ++++++++++++++++++ ++++ ",
33
- " ++++++ ++++++++++++++++++ ++++ ",
34
- " ++++++ ++++++++++++++++++ ++++ ",
35
- " ++++++ ++++++++++++++++++ ++++ ",
36
- " ++++++ ++++ ",
37
- " ++++++ OOOOOOOOOOOO XXXXX ++++ ",
38
- " ++++++ OOOOOOOOOOOO XXXXX ++++ ",
39
- " ++++++ OOOOOOOOOOOO XXXXX ++++ ",
40
- " ++++++ OOOOOOOOOOOO XXXXX ++++ ",
41
- " ++++++ OOOOOOOOOOOO XXXXX ++++ ",
42
- " ++++++ OOOOOOOOOOOO XXXXX ++++ ",
43
- " "
44
- };
1
+ /* XPM */
2
+ static char *mondrian_xpm[] = {
3
+ /* columns rows colors chars-per-pixel */
4
+ "32 32 6 1",
5
+ " c Black",
6
+ ". c Blue",
7
+ "X c #00bf00",
8
+ "o c Red",
9
+ "O c Yellow",
10
+ "+ c Gray100",
11
+ /* pixels */
12
+ " ",
13
+ " oooooo +++++++++++++++++++++++ ",
14
+ " oooooo +++++++++++++++++++++++ ",
15
+ " oooooo +++++++++++++++++++++++ ",
16
+ " oooooo +++++++++++++++++++++++ ",
17
+ " oooooo +++++++++++++++++++++++ ",
18
+ " oooooo +++++++++++++++++++++++ ",
19
+ " oooooo +++++++++++++++++++++++ ",
20
+ " ",
21
+ " ++++++ ++++++++++++++++++ .... ",
22
+ " ++++++ ++++++++++++++++++ .... ",
23
+ " ++++++ ++++++++++++++++++ .... ",
24
+ " ++++++ ++++++++++++++++++ .... ",
25
+ " ++++++ ++++++++++++++++++ .... ",
26
+ " ++++++ ++++++++++++++++++ ",
27
+ " ++++++ ++++++++++++++++++ ++++ ",
28
+ " ++++++ ++++++++++++++++++ ++++ ",
29
+ " ++++++ ++++++++++++++++++ ++++ ",
30
+ " ++++++ ++++++++++++++++++ ++++ ",
31
+ " ++++++ ++++++++++++++++++ ++++ ",
32
+ " ++++++ ++++++++++++++++++ ++++ ",
33
+ " ++++++ ++++++++++++++++++ ++++ ",
34
+ " ++++++ ++++++++++++++++++ ++++ ",
35
+ " ++++++ ++++++++++++++++++ ++++ ",
36
+ " ++++++ ++++ ",
37
+ " ++++++ OOOOOOOOOOOO XXXXX ++++ ",
38
+ " ++++++ OOOOOOOOOOOO XXXXX ++++ ",
39
+ " ++++++ OOOOOOOOOOOO XXXXX ++++ ",
40
+ " ++++++ OOOOOOOOOOOO XXXXX ++++ ",
41
+ " ++++++ OOOOOOOOOOOO XXXXX ++++ ",
42
+ " ++++++ OOOOOOOOOOOO XXXXX ++++ ",
43
+ " "
44
+ };