wxruby 1.9.0-i686-linux → 1.9.1-i686-linux

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,455 @@
1
+ # = WxSugar - Keyword Constructors Classes
2
+ #
3
+ # This extension defines the keyword parameters for +new+ methods for
4
+ # widgets, windows and frames. It's for use with *Keyword Constructors*
5
+ # and is no use on its own - except if you are looking for a bug or want
6
+ # to add a missing class.
7
+
8
+ module Wx
9
+ @defined_kw_classes = {}
10
+
11
+ # accepts a string unadorned name of a WxWidgets class, and block, which
12
+ # defines the constructor parameters and style flags for that class.
13
+ # If the named class exists in the available WxRuby, the block is run and
14
+ # the class may use keyword constructors. If the class is not available, the
15
+ # block is ignored.
16
+ def self.define_keyword_ctors(klass_name, &block)
17
+ # check this class hasn't already been defined
18
+ if @defined_kw_classes[klass_name]
19
+ raise ArgumentError, "Keyword ctor for #{klass_name} already defined"
20
+ else
21
+ @defined_kw_classes[klass_name] = true
22
+ end
23
+
24
+ begin
25
+ klass = Wx::const_get(klass_name)
26
+ rescue NameError
27
+ return nil
28
+ end
29
+ klass.module_eval { include Wx::KeywordConstructor }
30
+ # automatically add :id as the first argument, unless this is a
31
+ # Dialog subclass - which don't require this argument
32
+ unless klass < Wx::Dialog
33
+ klass.wx_ctor_params :id
34
+ end
35
+ klass.instance_eval(&block)
36
+ end
37
+ end
38
+
39
+ # Window : base class for all widgets and frames
40
+ Wx::define_keyword_ctors('Window') do
41
+ wx_ctor_params :pos, :size, :style
42
+ wx_ctor_params :name => 'window'
43
+ end
44
+
45
+
46
+ ### FRAMES
47
+
48
+ # wxTopLevelWindow ABSTRACT: Any top level window, dialog or frame
49
+
50
+ # Normal frame
51
+ Wx::define_keyword_ctors('Frame') do
52
+ wx_ctor_params :title => ''
53
+ wx_ctor_params :pos, :size, :style => Wx::DEFAULT_FRAME_STYLE
54
+ wx_ctor_params :name => 'frame'
55
+ end
56
+
57
+ # MDI child frame
58
+ Wx::define_keyword_ctors('MDIChildFrame') do
59
+ wx_ctor_params :title => ''
60
+ wx_ctor_params :pos, :size, :style => Wx::DEFAULT_FRAME_STYLE
61
+ wx_ctor_params :name => 'frame'
62
+ end
63
+
64
+ # MDI parent frame
65
+ Wx::define_keyword_ctors('MDIParentFrame') do
66
+ wx_ctor_params :title => ''
67
+ wx_ctor_params :pos, :size
68
+ wx_ctor_params :style => Wx::DEFAULT_FRAME_STYLE|Wx::VSCROLL|Wx::HSCROLL
69
+ wx_ctor_params :name => 'frame'
70
+ end
71
+
72
+ # wxMiniFrame A frame with a small title bar
73
+ Wx::define_keyword_ctors('MiniFrame') do
74
+ wx_ctor_params :title => ''
75
+ wx_ctor_params :pos, :size
76
+ wx_ctor_params :style => Wx::DEFAULT_FRAME_STYLE
77
+ wx_ctor_params :name => 'frame'
78
+ end
79
+
80
+ # wxSplashScreen Splash screen class
81
+ # FIXME - this probably won't work at present because the 'parent' arg
82
+ # comes in a funny place in this class's ctor
83
+ #
84
+ # Wx::define_keyword_ctors('SplashScreen') do
85
+ # wx_ctor_params :bitmap => Wx::NULL_BITMAP
86
+ # wx_ctor_params :splashstyle, :milliseconds, :id => 1
87
+ # wx_ctor_params :parent => nil
88
+ # wx_ctor_params :title => ''
89
+ # wx_ctor_params :pos, :size
90
+ # wx_ctor_params :style => Wx::SIMPLE_BORDER|Wx::FRAME_NO_TASKBAR|Wx::STAY_ON_TOP
91
+ # end
92
+
93
+ # wxPropertySheetDialog Property sheet dialog
94
+ # wxTipWindow Shows text in a small window
95
+
96
+ # wxWizard A wizard dialog
97
+ Wx::define_keyword_ctors('Wizard') do
98
+ wx_ctor_params :title => ''
99
+ wx_ctor_params :bitmap => Wx::NULL_BITMAP
100
+ wx_ctor_params :pos, :size
101
+ wx_ctor_params :style => Wx::DEFAULT_DIALOG_STYLE
102
+ end
103
+
104
+
105
+ # MISCELLANEOUS WINDOWS
106
+
107
+ # A window whose colour changes according to current user settings
108
+ Wx::define_keyword_ctors('Panel') do
109
+ wx_ctor_params :pos, :size, :style => Wx::TAB_TRAVERSAL
110
+ wx_ctor_params :name => 'panel'
111
+ end
112
+
113
+ # wxScrolledWindow Window with automatically managed scrollbars
114
+ Wx::define_keyword_ctors('ScrolledWindow') do
115
+ wx_ctor_params :pos, :size, :style => Wx::VSCROLL|Wx::HSCROLL
116
+ wx_ctor_params :name => 'scrolledWindow'
117
+ end
118
+
119
+ # wxGrid A grid (table) window
120
+ Wx::define_keyword_ctors('Grid') do
121
+ wx_ctor_params :pos, :size, :style => Wx::WANTS_CHARS
122
+ wx_ctor_params :name => 'grid'
123
+ end
124
+
125
+ # Window which can be split vertically or horizontally
126
+ Wx::define_keyword_ctors('SplitterWindow') do
127
+ wx_ctor_params :pos, :size, :style => Wx::SP_3D
128
+ wx_ctor_params :name => 'splitterWindow'
129
+ end
130
+
131
+ # Implements the status bar on a frame
132
+ Wx::define_keyword_ctors('StatusBar') do
133
+ wx_ctor_params :style => Wx::ST_SIZEGRIP
134
+ wx_ctor_params :name => 'statusBar'
135
+ end
136
+
137
+ # Toolbar class
138
+ Wx::define_keyword_ctors('ToolBar') do
139
+ wx_ctor_params :pos, :size, :style => Wx::TB_HORIZONTAL|Wx::NO_BORDER
140
+ wx_ctor_params :name => 'toolBar' # not as documented in Wx 2.6.3
141
+ end
142
+
143
+ # Notebook class
144
+ Wx::define_keyword_ctors('Notebook') do
145
+ wx_ctor_params :pos, :size, :style, :name => 'noteBook'
146
+ end
147
+
148
+ # Similar to notebook but using list control - undocumented
149
+ Wx::define_keyword_ctors('Listbook') do
150
+ wx_ctor_params :pos, :size, :style, :name => 'listBook'
151
+ end
152
+
153
+ # Similar to notebook but using choice control
154
+ Wx::define_keyword_ctors('Choicebook') do
155
+ wx_ctor_params :pos, :size, :style, :name => 'choiceBook'
156
+ end
157
+
158
+ # wxSashWindow: Window with four optional sashes that can be dragged
159
+ Wx::define_keyword_ctors('SashWindow') do
160
+ wx_ctor_params :pos, :size
161
+ wx_ctor_params :style => Wx::CLIP_CHILDREN|Wx::SW_3D
162
+ wx_ctor_params :name => 'sashWindow'
163
+ end
164
+
165
+ # wxSashLayoutWindow: Window that can be involved in an IDE-like layout
166
+ # arrangement
167
+ Wx::define_keyword_ctors('SashLayoutWindow') do
168
+ wx_ctor_params :pos, :size
169
+ wx_ctor_params :style => Wx::CLIP_CHILDREN|Wx::SW_3D
170
+ wx_ctor_params :name => 'layoutWindow'
171
+ end
172
+
173
+ # wxVScrolledWindow: As wxScrolledWindow but supports lines of variable height
174
+
175
+ # wxWizardPage: A base class for the page in wizard dialog.
176
+ Wx::define_keyword_ctors('WizardPage') do
177
+ wx_ctor_params :bitmap => Wx::NULL_BITMAP
178
+ end
179
+
180
+ # wxWizardPageSimple: A page in wizard dialog.
181
+ Wx::define_keyword_ctors('WizardPageSimple') do
182
+ wx_ctor_params :prev, :next, :bitmap => Wx::NULL_BITMAP
183
+ end
184
+
185
+ ### DIALOGS
186
+ # wxDialog Base class for common dialogs
187
+ Wx::define_keyword_ctors('Dialog') do
188
+ wx_ctor_params :title => ''
189
+ wx_ctor_params :pos, :size, :style => Wx::DEFAULT_DIALOG_STYLE
190
+ wx_ctor_params :name => 'dialogBox'
191
+ end
192
+
193
+ # wxColourDialog Colour chooser dialog
194
+ Wx::define_keyword_ctors('ColourDialog') do
195
+ wx_ctor_params :colour_data => nil
196
+ end
197
+
198
+ # wxDirDialog Directory selector dialog
199
+ Wx::define_keyword_ctors('DirDialog') do
200
+ wx_ctor_params :message => 'Choose a directory'
201
+ wx_ctor_params :default_path => ''
202
+ wx_ctor_params :style, :pos, :size, :name => 'wxDirCtrl'
203
+ end
204
+
205
+ # wxFileDialog File selector dialog
206
+ Wx::define_keyword_ctors('FileDialog') do
207
+ wx_ctor_params :message => 'Choose a file'
208
+ wx_ctor_params :default_dir => ''
209
+ wx_ctor_params :default_file => ''
210
+ wx_ctor_params :wildcard => '*.*'
211
+ wx_ctor_params :style, :pos
212
+ end
213
+
214
+ # wxFindReplaceDialog Text search/replace dialog
215
+ Wx::define_keyword_ctors('FindReplaceDialog') do
216
+ wx_ctor_params :find_replace_data => Wx::FindReplaceData.new()
217
+ wx_ctor_params :title => 'findReplaceDialog'
218
+ wx_ctor_params :style
219
+ end
220
+
221
+ # wxMultiChoiceDialog Dialog to get one or more selections from a list
222
+ # wxSingleChoiceDialog Dialog to get a single selection from a list and return the string
223
+
224
+ # Dialog to get a single line of text from the user
225
+ Wx::define_keyword_ctors('TextEntryDialog') do
226
+ wx_ctor_params :message => ''
227
+ wx_ctor_params :caption => 'Please enter text'
228
+ wx_ctor_params :default_value => ''
229
+ wx_ctor_params :style => Wx::OK|Wx::CANCEL|Wx::CENTRE
230
+ wx_ctor_params :pos
231
+ end
232
+
233
+ # wxPasswordEntryDialog Dialog to get a password from the user
234
+ # Wx::define_keyword_ctors('PasswordEntryDialog') do
235
+ # wx_ctor_params :message => ''
236
+ # wx_ctor_params :caption => 'Enter password'
237
+ # wx_ctor_params :default_value => ''
238
+ # wx_ctor_params :style => Wx::OK|Wx::CANCEL|Wx::CENTRE
239
+ # wx_ctor_params :pos
240
+ # end
241
+
242
+ # wxFontDialog Font chooser dialog
243
+ # wxPageSetupDialog Standard page setup dialog
244
+ Wx::define_keyword_ctors('PageSetupDialog') do
245
+ wx_ctor_params :data
246
+ end
247
+
248
+ # wxPrintDialog Standard print dialog
249
+ Wx::define_keyword_ctors('PrintDialog') do
250
+ wx_ctor_params :data
251
+ end
252
+
253
+
254
+ # Simple message box dialog
255
+ Wx::define_keyword_ctors('MessageDialog') do
256
+ wx_ctor_params :message => ''
257
+ wx_ctor_params :caption => 'Message box'
258
+ wx_ctor_params :style => Wx::OK|Wx::CANCEL
259
+ wx_ctor_params :pos
260
+ end
261
+
262
+ ### CONTROLS
263
+
264
+ # Push button control, displaying text
265
+ Wx::define_keyword_ctors('Button') do
266
+ wx_ctor_params :label => ''
267
+ wx_ctor_params :pos, :size, :style
268
+ wx_ctor_params :validator, :name => 'button'
269
+ end
270
+
271
+ # Push button control, displaying a bitmap
272
+ Wx::define_keyword_ctors('BitmapButton') do
273
+ wx_ctor_params :bitmap, :pos, :size, :style => Wx::BU_AUTODRAW
274
+ wx_ctor_params :validator, :name => 'button'
275
+ end
276
+
277
+ # A button which stays pressed when clicked by user.
278
+ Wx::define_keyword_ctors('ToggleButton') do
279
+ wx_ctor_params :label, :pos, :size, :style
280
+ wx_ctor_params :validator, :name => 'checkBox'
281
+ end
282
+
283
+ # Control showing an entire calendar month
284
+ Wx::define_keyword_ctors('CalendarCtrl') do
285
+ wx_ctor_params :date => Time.now()
286
+ wx_ctor_params :pos, :size, :style => Wx::CAL_SHOW_HOLIDAYS
287
+ wx_ctor_params :name => 'calendar'
288
+ end
289
+
290
+ # Checkbox control
291
+ Wx::define_keyword_ctors('CheckBox') do
292
+ wx_ctor_params :label => ''
293
+ wx_ctor_params :pos, :size, :style
294
+ wx_ctor_params :validator, :name => 'checkBox'
295
+ end
296
+
297
+ # A listbox with a checkbox to the left of each item
298
+ Wx::define_keyword_ctors('CheckListBox') do
299
+ wx_ctor_params :pos, :size, :choices, :style
300
+ wx_ctor_params :validator, :name => 'listBox'
301
+ end
302
+
303
+ # wxChoice Choice control (a combobox without the editable area)
304
+ Wx::define_keyword_ctors('Choice') do
305
+ wx_ctor_params :pos, :size, :choices, :style
306
+ wx_ctor_params :validator, :name => 'choice'
307
+ end
308
+
309
+ # wxComboBox A choice with an editable area
310
+ Wx::define_keyword_ctors('ComboBox') do
311
+ wx_ctor_params :value => ''
312
+ wx_ctor_params :pos, :size, :choices => []
313
+ wx_ctor_params :style
314
+ wx_ctor_params :validator, :name => 'comboBox'
315
+ end
316
+
317
+ # wxBitmapComboBox A choice with an editable area
318
+ Wx::define_keyword_ctors('BitmapComboBox') do
319
+ wx_ctor_params :value => ''
320
+ wx_ctor_params :pos, :size, :choices => []
321
+ wx_ctor_params :style
322
+ wx_ctor_params :validator, :name => 'comboBox'
323
+ end
324
+
325
+ # wxDatePickerCtrl Small date picker control
326
+
327
+ # wxGauge A control to represent a varying quantity, such as time
328
+ # remaining
329
+ Wx::define_keyword_ctors('Gauge') do
330
+ wx_ctor_params :range, :pos, :size, :style => Wx::GA_HORIZONTAL
331
+ wx_ctor_params :validator, :name => 'gauge'
332
+ end
333
+
334
+ # wxGenericDirCtrl A control for displaying a directory tree
335
+ Wx::define_keyword_ctors('GenericDirCtrl') do
336
+ # TODO :dir => Wx::DIR_DIALOG_DEFAULT_FOLDER_STR
337
+ wx_ctor_params :dir => ''
338
+ wx_ctor_params :pos, :size,
339
+ :style => Wx::DIRCTRL_3D_INTERNAL|Wx::SUNKEN_BORDER
340
+ wx_ctor_params :filter => ''
341
+ wx_ctor_params :default_filter => 0
342
+ wx_ctor_params :name => 'genericDirCtrl'
343
+ end
344
+
345
+
346
+ # wxHtmlListBox A listbox showing HTML content
347
+ # wxListBox A list of strings for single or multiple selection
348
+ Wx::define_keyword_ctors('ListBox') do
349
+ wx_ctor_params :pos, :size, :choices => []
350
+ wx_ctor_params :style
351
+ wx_ctor_params :validator, :name => 'listBox'
352
+ end
353
+
354
+ # wxListCtrl A control for displaying lists of strings and/or icons, plus a multicolumn report view
355
+ Wx::define_keyword_ctors('ListCtrl') do
356
+ wx_ctor_params :pos, :size, :style => Wx::LC_ICON
357
+ wx_ctor_params :validator, :name => 'listCtrl'
358
+ end
359
+
360
+ # wxListView A simpler interface (facade for wxListCtrl in report mode
361
+
362
+ # wxTreeCtrl Tree (hierarchy) control
363
+ Wx::define_keyword_ctors('TreeCtrl') do
364
+ wx_ctor_params :pos, :size, :style => Wx::TR_HAS_BUTTONS
365
+ wx_ctor_params :validator, :name => 'treeCtrl'
366
+ end
367
+
368
+ # wxSpinCtrl A spin control - i.e. spin button and text control
369
+ Wx::define_keyword_ctors('SpinCtrl') do
370
+ wx_ctor_params :value => ''
371
+ wx_ctor_params :pos, :size, :style => Wx::SP_ARROW_KEYS
372
+ wx_ctor_params :min => 0
373
+ wx_ctor_params :max => 100
374
+ wx_ctor_params :initial => 0
375
+ wx_ctor_params :name => 'spinCtrl'
376
+ end
377
+
378
+ # One or more lines of non-editable text
379
+ Wx::define_keyword_ctors('StaticText') do
380
+ wx_ctor_params :label, :pos, :size, :style, :name => 'staticText'
381
+ end
382
+
383
+ Wx::define_keyword_ctors('StaticBox') do
384
+ wx_ctor_params :label, :pos, :size, :style, :name => 'staticBox'
385
+ end
386
+
387
+ Wx::define_keyword_ctors('StaticLine') do
388
+ wx_ctor_params :pos, :size, :style => Wx::LI_HORIZONTAL
389
+ wx_ctor_params :name => 'staticBox'
390
+ end
391
+
392
+ # wxStaticBitmap A control to display a bitmap
393
+ Wx::define_keyword_ctors('StaticBitmap') do
394
+ wx_ctor_params :label, :pos, :size, :style
395
+ end
396
+
397
+
398
+ # wxRadioBox A group of radio buttons
399
+ Wx::define_keyword_ctors('RadioBox') do
400
+ wx_ctor_params :label => ''
401
+ wx_ctor_params :pos, :size, :choices => []
402
+ wx_ctor_params :major_dimension => 0
403
+ wx_ctor_params :style => Wx::RA_SPECIFY_COLS
404
+ wx_ctor_params :validator, :name => 'radioBox'
405
+ end
406
+
407
+ # wxRadioButton: A round button used with others in a mutually exclusive way
408
+ Wx::define_keyword_ctors('RadioButton') do
409
+ wx_ctor_params :label => ''
410
+ wx_ctor_params :pos, :size, :style => 0
411
+ wx_ctor_params :validator, :name => 'radioButton'
412
+ end
413
+
414
+ # wxSlider A slider that can be dragged by the user
415
+ Wx::define_keyword_ctors('Slider') do
416
+ wx_ctor_params :value => 0
417
+ wx_ctor_params :min_value, :max_value
418
+ wx_ctor_params :pos, :size, :style => Wx::SL_HORIZONTAL
419
+ wx_ctor_params :validator, :name => 'slider'
420
+ end
421
+
422
+ # wxSpinButton - Has two small up and down (or left and right) arrow buttons
423
+ Wx::define_keyword_ctors('SpinButton') do
424
+ wx_ctor_params :pos, :size, :style => Wx::SP_HORIZONTAL
425
+ wx_ctor_params :name => 'spinButton'
426
+ end
427
+
428
+ # wxVListBox A listbox supporting variable height rows
429
+
430
+ # wxTextCtrl Single or multiline text editing control
431
+ Wx::define_keyword_ctors('TextCtrl') do
432
+ wx_ctor_params :value => ''
433
+ wx_ctor_params :pos, :size, :style
434
+ wx_ctor_params :validator, :name => 'textCtrl'
435
+ end
436
+
437
+ # wxHtmlWindow - Control for displaying HTML
438
+ Wx::define_keyword_ctors('HtmlWindow') do
439
+ wx_ctor_params :pos, :size, :style => Wx::HW_DEFAULT_STYLE
440
+ wx_ctor_params :name => 'htmlWindow'
441
+ end
442
+
443
+ # wxHyperTextCtrl - display a clickable URL
444
+ Wx::define_keyword_ctors('HyperlinkCtrl') do
445
+ wx_ctor_params :label => ''
446
+ wx_ctor_params :url => ''
447
+ wx_ctor_params :pos, :size, :style => 0
448
+ wx_ctor_params :name => 'hyperlink'
449
+ end
450
+
451
+ Wx::define_keyword_ctors('StyledTextCtrl') do
452
+ wx_ctor_params :pos, :size, :style => 0
453
+ wx_ctor_params :name => 'styledTextCtrl'
454
+ end
455
+