wxruby 1.9.1-i386-mswin32 → 1.9.2-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.
@@ -0,0 +1,18 @@
1
+ # Hierarchical control with items
2
+ class Wx::TreeCtrl
3
+ # Make these ruby enumerables so find, find_all, map etc are available
4
+ include Enumerable
5
+ # Iterate over all items
6
+ alias :each :traverse
7
+
8
+ # Return the children of +parent+ as an array of TreeItemIDs.
9
+ def get_children(parent)
10
+ kids = [ get_first_child(parent) ]
11
+ return [] if kids[0].zero?
12
+
13
+ while kid = get_next_sibling(kids.last) and not kid.zero?
14
+ kids << kid
15
+ end
16
+ kids
17
+ end
18
+ end
@@ -1,11 +1,17 @@
1
1
  # Copyright 2004-2007 by Kevin Smith
2
2
  # released under the MIT-style wxruby2 license
3
3
 
4
+ # The base class for all things displayed on screen
4
5
  class Wx::Window
5
- # Create a wx-specific name for get_id, to prevent confusion with
6
- # ruby's (deprecated) Object#id
6
+
7
+ # Ruby's Object#id is deprecated and will be removed in 1.9; therefore
8
+ # for classes inheriting from Wx::Window, the id method returns the
9
+ # wxRuby Window id
10
+ alias :id :get_id
11
+ # In case a more explicit option is preferred.
7
12
  alias :wx_id :get_id
8
13
 
14
+
9
15
  # Recursively searches all windows below +self+ and returns the first
10
16
  # window which has the id +an_id+. This corresponds to the find_window
11
17
  # method method in WxWidgets when called with an integer.
@@ -31,10 +37,11 @@ class Wx::Window
31
37
  # paint event is being handled just before running the event
32
38
  # handler. This ensures that any call to Window#paint within the
33
39
  # handler will supply a Wx::PaintDC (see swig/Window.i).
34
- def evt_paint(&block)
40
+ def evt_paint(meth = nil, &block)
41
+ paint_proc = acquire_handler(meth, block)
35
42
  wrapped_block = proc do | event |
36
43
  instance_variable_set("@__painting__", true)
37
- block.call(event)
44
+ paint_proc.call(event)
38
45
  remove_instance_variable("@__painting__")
39
46
  end
40
47
  __old_evt_paint(&wrapped_block)
@@ -101,6 +101,7 @@ module Wx
101
101
  :size => Wx::DEFAULT_SIZE,
102
102
  :pos => Wx::DEFAULT_POSITION,
103
103
  :style => 0,
104
+ :title => '',
104
105
  :validator => Wx::DEFAULT_VALIDATOR,
105
106
  :choices => [] # for Choice, ComboBox etc
106
107
  }
@@ -113,12 +114,6 @@ module Wx
113
114
  def param_spec
114
115
  @param_spec ||= []
115
116
  end
116
-
117
- attr_writer :param_flags
118
- def param_flags
119
- @param_flags ||= {}
120
- end
121
-
122
117
 
123
118
  # Adds a list of named parameters *params* to the parameter
124
119
  # specification for this Wx class's constructor. Each parameter
@@ -183,13 +178,6 @@ module Wx
183
178
  return
184
179
  end
185
180
 
186
- # Allow classes to ignore :id argument in positional args
187
- unless self.class < Wx::Dialog
188
- if not mixed_args[0].kind_of?(Fixnum)
189
- mixed_args.unshift(-1)
190
- end
191
- end
192
-
193
181
  real_args = [ parent ] + self.class.args_as_list(*mixed_args)
194
182
  begin
195
183
  pre_wx_kwctor_init(*real_args)
@@ -210,8 +198,6 @@ module Wx
210
198
  def klass.inherited(sub_klass)
211
199
  sub_klass.instance_variable_set(:@param_spec,
212
200
  instance_variable_get(:@param_spec) )
213
- sub_klass.instance_variable_set(:@param_flags,
214
- instance_variable_get(:@param_flags) )
215
201
  end
216
202
  end
217
203
  end
@@ -4,7 +4,18 @@
4
4
  # widgets, windows and frames. It's for use with *Keyword Constructors*
5
5
  # and is no use on its own - except if you are looking for a bug or want
6
6
  # to add a missing class.
7
-
7
+ #
8
+ # For each class, the parameters *must* be declared in the order that
9
+ # they are supplied to wxRuby. A parameter is specified by a symbol
10
+ # name, and, optionally, a default argument which will of whatever type
11
+ # the wxRuby core library accepts. Because hashes are unordered in Ruby
12
+ # 1.8, if a default argument is specified, this must be the last in a
13
+ # list of parameters.
14
+ #
15
+ # Some common parameters to constructors such as size, position, title,
16
+ # id and so forth always have a standard default argumnet, which is
17
+ # defined in keyword_ctors. In these cases, it is not necessary to
18
+ # supply the default argument in the definition.
8
19
  module Wx
9
20
  @defined_kw_classes = {}
10
21
 
@@ -27,18 +38,13 @@ module Wx
27
38
  return nil
28
39
  end
29
40
  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
41
  klass.instance_eval(&block)
36
42
  end
37
43
  end
38
44
 
39
45
  # Window : base class for all widgets and frames
40
46
  Wx::define_keyword_ctors('Window') do
41
- wx_ctor_params :pos, :size, :style
47
+ wx_ctor_params :id, :pos, :size, :style
42
48
  wx_ctor_params :name => 'window'
43
49
  end
44
50
 
@@ -49,30 +55,26 @@ end
49
55
 
50
56
  # Normal frame
51
57
  Wx::define_keyword_ctors('Frame') do
52
- wx_ctor_params :title => ''
53
- wx_ctor_params :pos, :size, :style => Wx::DEFAULT_FRAME_STYLE
58
+ wx_ctor_params :id, :title, :pos, :size, :style => Wx::DEFAULT_FRAME_STYLE
54
59
  wx_ctor_params :name => 'frame'
55
60
  end
56
61
 
57
62
  # MDI child frame
58
63
  Wx::define_keyword_ctors('MDIChildFrame') do
59
- wx_ctor_params :title => ''
60
- wx_ctor_params :pos, :size, :style => Wx::DEFAULT_FRAME_STYLE
64
+ wx_ctor_params :id, :title, :pos, :size, :style => Wx::DEFAULT_FRAME_STYLE
61
65
  wx_ctor_params :name => 'frame'
62
66
  end
63
67
 
64
68
  # MDI parent frame
65
69
  Wx::define_keyword_ctors('MDIParentFrame') do
66
- wx_ctor_params :title => ''
67
- wx_ctor_params :pos, :size
70
+ wx_ctor_params :id, :title, :pos, :size
68
71
  wx_ctor_params :style => Wx::DEFAULT_FRAME_STYLE|Wx::VSCROLL|Wx::HSCROLL
69
72
  wx_ctor_params :name => 'frame'
70
73
  end
71
74
 
72
75
  # wxMiniFrame A frame with a small title bar
73
76
  Wx::define_keyword_ctors('MiniFrame') do
74
- wx_ctor_params :title => ''
75
- wx_ctor_params :pos, :size
77
+ wx_ctor_params :id, :title, :pos, :size
76
78
  wx_ctor_params :style => Wx::DEFAULT_FRAME_STYLE
77
79
  wx_ctor_params :name => 'frame'
78
80
  end
@@ -95,9 +97,8 @@ end
95
97
 
96
98
  # wxWizard A wizard dialog
97
99
  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
100
+ wx_ctor_params :id, :title, :bitmap => Wx::NULL_BITMAP
101
+ wx_ctor_params :pos # NB - no size argument for this class
101
102
  wx_ctor_params :style => Wx::DEFAULT_DIALOG_STYLE
102
103
  end
103
104
 
@@ -106,58 +107,58 @@ end
106
107
 
107
108
  # A window whose colour changes according to current user settings
108
109
  Wx::define_keyword_ctors('Panel') do
109
- wx_ctor_params :pos, :size, :style => Wx::TAB_TRAVERSAL
110
+ wx_ctor_params :id, :pos, :size, :style => Wx::TAB_TRAVERSAL
110
111
  wx_ctor_params :name => 'panel'
111
112
  end
112
113
 
113
114
  # wxScrolledWindow Window with automatically managed scrollbars
114
115
  Wx::define_keyword_ctors('ScrolledWindow') do
115
- wx_ctor_params :pos, :size, :style => Wx::VSCROLL|Wx::HSCROLL
116
+ wx_ctor_params :id, :pos, :size, :style => Wx::VSCROLL|Wx::HSCROLL
116
117
  wx_ctor_params :name => 'scrolledWindow'
117
118
  end
118
119
 
119
120
  # wxGrid A grid (table) window
120
121
  Wx::define_keyword_ctors('Grid') do
121
- wx_ctor_params :pos, :size, :style => Wx::WANTS_CHARS
122
+ wx_ctor_params :id, :pos, :size, :style => Wx::WANTS_CHARS
122
123
  wx_ctor_params :name => 'grid'
123
124
  end
124
125
 
125
126
  # Window which can be split vertically or horizontally
126
127
  Wx::define_keyword_ctors('SplitterWindow') do
127
- wx_ctor_params :pos, :size, :style => Wx::SP_3D
128
+ wx_ctor_params :id, :pos, :size, :style => Wx::SP_3D
128
129
  wx_ctor_params :name => 'splitterWindow'
129
130
  end
130
131
 
131
132
  # Implements the status bar on a frame
132
133
  Wx::define_keyword_ctors('StatusBar') do
133
- wx_ctor_params :style => Wx::ST_SIZEGRIP
134
+ wx_ctor_params :id, :style => Wx::ST_SIZEGRIP
134
135
  wx_ctor_params :name => 'statusBar'
135
136
  end
136
137
 
137
138
  # Toolbar class
138
139
  Wx::define_keyword_ctors('ToolBar') do
139
- wx_ctor_params :pos, :size, :style => Wx::TB_HORIZONTAL|Wx::NO_BORDER
140
+ wx_ctor_params :id, :pos, :size, :style => Wx::TB_HORIZONTAL|Wx::NO_BORDER
140
141
  wx_ctor_params :name => 'toolBar' # not as documented in Wx 2.6.3
141
142
  end
142
143
 
143
144
  # Notebook class
144
145
  Wx::define_keyword_ctors('Notebook') do
145
- wx_ctor_params :pos, :size, :style, :name => 'noteBook'
146
+ wx_ctor_params :id, :pos, :size, :style, :name => 'noteBook'
146
147
  end
147
148
 
148
149
  # Similar to notebook but using list control - undocumented
149
150
  Wx::define_keyword_ctors('Listbook') do
150
- wx_ctor_params :pos, :size, :style, :name => 'listBook'
151
+ wx_ctor_params :id, :pos, :size, :style, :name => 'listBook'
151
152
  end
152
153
 
153
154
  # Similar to notebook but using choice control
154
155
  Wx::define_keyword_ctors('Choicebook') do
155
- wx_ctor_params :pos, :size, :style, :name => 'choiceBook'
156
+ wx_ctor_params :id, :pos, :size, :style, :name => 'choiceBook'
156
157
  end
157
158
 
158
159
  # wxSashWindow: Window with four optional sashes that can be dragged
159
160
  Wx::define_keyword_ctors('SashWindow') do
160
- wx_ctor_params :pos, :size
161
+ wx_ctor_params :id, :pos, :size
161
162
  wx_ctor_params :style => Wx::CLIP_CHILDREN|Wx::SW_3D
162
163
  wx_ctor_params :name => 'sashWindow'
163
164
  end
@@ -165,7 +166,7 @@ end
165
166
  # wxSashLayoutWindow: Window that can be involved in an IDE-like layout
166
167
  # arrangement
167
168
  Wx::define_keyword_ctors('SashLayoutWindow') do
168
- wx_ctor_params :pos, :size
169
+ wx_ctor_params :id, :pos, :size
169
170
  wx_ctor_params :style => Wx::CLIP_CHILDREN|Wx::SW_3D
170
171
  wx_ctor_params :name => 'layoutWindow'
171
172
  end
@@ -179,13 +180,15 @@ end
179
180
 
180
181
  # wxWizardPageSimple: A page in wizard dialog.
181
182
  Wx::define_keyword_ctors('WizardPageSimple') do
182
- wx_ctor_params :prev, :next, :bitmap => Wx::NULL_BITMAP
183
+ wx_ctor_params :prev => nil
184
+ wx_ctor_params :next => nil
185
+ wx_ctor_params :bitmap => Wx::NULL_BITMAP
183
186
  end
184
187
 
185
188
  ### DIALOGS
186
189
  # wxDialog Base class for common dialogs
187
190
  Wx::define_keyword_ctors('Dialog') do
188
- wx_ctor_params :title => ''
191
+ wx_ctor_params :id, :title => ''
189
192
  wx_ctor_params :pos, :size, :style => Wx::DEFAULT_DIALOG_STYLE
190
193
  wx_ctor_params :name => 'dialogBox'
191
194
  end
@@ -263,52 +266,52 @@ end
263
266
 
264
267
  # Push button control, displaying text
265
268
  Wx::define_keyword_ctors('Button') do
266
- wx_ctor_params :label => ''
269
+ wx_ctor_params :id, :label => ''
267
270
  wx_ctor_params :pos, :size, :style
268
271
  wx_ctor_params :validator, :name => 'button'
269
272
  end
270
273
 
271
274
  # Push button control, displaying a bitmap
272
275
  Wx::define_keyword_ctors('BitmapButton') do
273
- wx_ctor_params :bitmap, :pos, :size, :style => Wx::BU_AUTODRAW
276
+ wx_ctor_params :id, :bitmap, :pos, :size, :style => Wx::BU_AUTODRAW
274
277
  wx_ctor_params :validator, :name => 'button'
275
278
  end
276
279
 
277
280
  # A button which stays pressed when clicked by user.
278
281
  Wx::define_keyword_ctors('ToggleButton') do
279
- wx_ctor_params :label, :pos, :size, :style
282
+ wx_ctor_params :id, :label, :pos, :size, :style
280
283
  wx_ctor_params :validator, :name => 'checkBox'
281
284
  end
282
285
 
283
286
  # Control showing an entire calendar month
284
287
  Wx::define_keyword_ctors('CalendarCtrl') do
285
- wx_ctor_params :date => Time.now()
288
+ wx_ctor_params :id, :date => Time.now()
286
289
  wx_ctor_params :pos, :size, :style => Wx::CAL_SHOW_HOLIDAYS
287
290
  wx_ctor_params :name => 'calendar'
288
291
  end
289
292
 
290
293
  # Checkbox control
291
294
  Wx::define_keyword_ctors('CheckBox') do
292
- wx_ctor_params :label => ''
295
+ wx_ctor_params :id, :label => ''
293
296
  wx_ctor_params :pos, :size, :style
294
297
  wx_ctor_params :validator, :name => 'checkBox'
295
298
  end
296
299
 
297
300
  # A listbox with a checkbox to the left of each item
298
301
  Wx::define_keyword_ctors('CheckListBox') do
299
- wx_ctor_params :pos, :size, :choices, :style
302
+ wx_ctor_params :id, :pos, :size, :choices, :style
300
303
  wx_ctor_params :validator, :name => 'listBox'
301
304
  end
302
305
 
303
306
  # wxChoice Choice control (a combobox without the editable area)
304
307
  Wx::define_keyword_ctors('Choice') do
305
- wx_ctor_params :pos, :size, :choices, :style
308
+ wx_ctor_params :id, :pos, :size, :choices, :style
306
309
  wx_ctor_params :validator, :name => 'choice'
307
310
  end
308
311
 
309
312
  # wxComboBox A choice with an editable area
310
313
  Wx::define_keyword_ctors('ComboBox') do
311
- wx_ctor_params :value => ''
314
+ wx_ctor_params :id, :value => ''
312
315
  wx_ctor_params :pos, :size, :choices => []
313
316
  wx_ctor_params :style
314
317
  wx_ctor_params :validator, :name => 'comboBox'
@@ -316,7 +319,7 @@ end
316
319
 
317
320
  # wxBitmapComboBox A choice with an editable area
318
321
  Wx::define_keyword_ctors('BitmapComboBox') do
319
- wx_ctor_params :value => ''
322
+ wx_ctor_params :id, :value => ''
320
323
  wx_ctor_params :pos, :size, :choices => []
321
324
  wx_ctor_params :style
322
325
  wx_ctor_params :validator, :name => 'comboBox'
@@ -327,14 +330,14 @@ end
327
330
  # wxGauge A control to represent a varying quantity, such as time
328
331
  # remaining
329
332
  Wx::define_keyword_ctors('Gauge') do
330
- wx_ctor_params :range, :pos, :size, :style => Wx::GA_HORIZONTAL
333
+ wx_ctor_params :id, :range, :pos, :size, :style => Wx::GA_HORIZONTAL
331
334
  wx_ctor_params :validator, :name => 'gauge'
332
335
  end
333
336
 
334
337
  # wxGenericDirCtrl A control for displaying a directory tree
335
338
  Wx::define_keyword_ctors('GenericDirCtrl') do
336
339
  # TODO :dir => Wx::DIR_DIALOG_DEFAULT_FOLDER_STR
337
- wx_ctor_params :dir => ''
340
+ wx_ctor_params :id, :dir => ''
338
341
  wx_ctor_params :pos, :size,
339
342
  :style => Wx::DIRCTRL_3D_INTERNAL|Wx::SUNKEN_BORDER
340
343
  wx_ctor_params :filter => ''
@@ -346,14 +349,14 @@ end
346
349
  # wxHtmlListBox A listbox showing HTML content
347
350
  # wxListBox A list of strings for single or multiple selection
348
351
  Wx::define_keyword_ctors('ListBox') do
349
- wx_ctor_params :pos, :size, :choices => []
352
+ wx_ctor_params :id, :pos, :size, :choices => []
350
353
  wx_ctor_params :style
351
354
  wx_ctor_params :validator, :name => 'listBox'
352
355
  end
353
356
 
354
357
  # wxListCtrl A control for displaying lists of strings and/or icons, plus a multicolumn report view
355
358
  Wx::define_keyword_ctors('ListCtrl') do
356
- wx_ctor_params :pos, :size, :style => Wx::LC_ICON
359
+ wx_ctor_params :id, :pos, :size, :style => Wx::LC_ICON
357
360
  wx_ctor_params :validator, :name => 'listCtrl'
358
361
  end
359
362
 
@@ -361,13 +364,13 @@ end
361
364
 
362
365
  # wxTreeCtrl Tree (hierarchy) control
363
366
  Wx::define_keyword_ctors('TreeCtrl') do
364
- wx_ctor_params :pos, :size, :style => Wx::TR_HAS_BUTTONS
367
+ wx_ctor_params :id, :pos, :size, :style => Wx::TR_HAS_BUTTONS
365
368
  wx_ctor_params :validator, :name => 'treeCtrl'
366
369
  end
367
370
 
368
371
  # wxSpinCtrl A spin control - i.e. spin button and text control
369
372
  Wx::define_keyword_ctors('SpinCtrl') do
370
- wx_ctor_params :value => ''
373
+ wx_ctor_params :id, :value => ''
371
374
  wx_ctor_params :pos, :size, :style => Wx::SP_ARROW_KEYS
372
375
  wx_ctor_params :min => 0
373
376
  wx_ctor_params :max => 100
@@ -377,27 +380,27 @@ end
377
380
 
378
381
  # One or more lines of non-editable text
379
382
  Wx::define_keyword_ctors('StaticText') do
380
- wx_ctor_params :label, :pos, :size, :style, :name => 'staticText'
383
+ wx_ctor_params :id, :label, :pos, :size, :style, :name => 'staticText'
381
384
  end
382
385
 
383
386
  Wx::define_keyword_ctors('StaticBox') do
384
- wx_ctor_params :label, :pos, :size, :style, :name => 'staticBox'
387
+ wx_ctor_params :id, :label, :pos, :size, :style, :name => 'staticBox'
385
388
  end
386
389
 
387
390
  Wx::define_keyword_ctors('StaticLine') do
388
- wx_ctor_params :pos, :size, :style => Wx::LI_HORIZONTAL
391
+ wx_ctor_params :id, :pos, :size, :style => Wx::LI_HORIZONTAL
389
392
  wx_ctor_params :name => 'staticBox'
390
393
  end
391
394
 
392
395
  # wxStaticBitmap A control to display a bitmap
393
396
  Wx::define_keyword_ctors('StaticBitmap') do
394
- wx_ctor_params :label, :pos, :size, :style
397
+ wx_ctor_params :id, :label, :pos, :size, :style
395
398
  end
396
399
 
397
400
 
398
401
  # wxRadioBox A group of radio buttons
399
402
  Wx::define_keyword_ctors('RadioBox') do
400
- wx_ctor_params :label => ''
403
+ wx_ctor_params :id, :label => ''
401
404
  wx_ctor_params :pos, :size, :choices => []
402
405
  wx_ctor_params :major_dimension => 0
403
406
  wx_ctor_params :style => Wx::RA_SPECIFY_COLS
@@ -406,14 +409,14 @@ end
406
409
 
407
410
  # wxRadioButton: A round button used with others in a mutually exclusive way
408
411
  Wx::define_keyword_ctors('RadioButton') do
409
- wx_ctor_params :label => ''
412
+ wx_ctor_params :id, :label => ''
410
413
  wx_ctor_params :pos, :size, :style => 0
411
414
  wx_ctor_params :validator, :name => 'radioButton'
412
415
  end
413
416
 
414
417
  # wxSlider A slider that can be dragged by the user
415
418
  Wx::define_keyword_ctors('Slider') do
416
- wx_ctor_params :value => 0
419
+ wx_ctor_params :id, :value => 0
417
420
  wx_ctor_params :min_value, :max_value
418
421
  wx_ctor_params :pos, :size, :style => Wx::SL_HORIZONTAL
419
422
  wx_ctor_params :validator, :name => 'slider'
@@ -421,7 +424,7 @@ end
421
424
 
422
425
  # wxSpinButton - Has two small up and down (or left and right) arrow buttons
423
426
  Wx::define_keyword_ctors('SpinButton') do
424
- wx_ctor_params :pos, :size, :style => Wx::SP_HORIZONTAL
427
+ wx_ctor_params :id, :pos, :size, :style => Wx::SP_HORIZONTAL
425
428
  wx_ctor_params :name => 'spinButton'
426
429
  end
427
430
 
@@ -429,27 +432,34 @@ end
429
432
 
430
433
  # wxTextCtrl Single or multiline text editing control
431
434
  Wx::define_keyword_ctors('TextCtrl') do
432
- wx_ctor_params :value => ''
435
+ wx_ctor_params :id, :value => ''
433
436
  wx_ctor_params :pos, :size, :style
434
437
  wx_ctor_params :validator, :name => 'textCtrl'
435
438
  end
436
439
 
437
440
  # wxHtmlWindow - Control for displaying HTML
438
441
  Wx::define_keyword_ctors('HtmlWindow') do
439
- wx_ctor_params :pos, :size, :style => Wx::HW_DEFAULT_STYLE
442
+ wx_ctor_params :id, :pos, :size, :style => Wx::HW_DEFAULT_STYLE
440
443
  wx_ctor_params :name => 'htmlWindow'
441
444
  end
442
445
 
443
446
  # wxHyperTextCtrl - display a clickable URL
444
447
  Wx::define_keyword_ctors('HyperlinkCtrl') do
445
- wx_ctor_params :label => ''
448
+ wx_ctor_params :id, :label => ''
446
449
  wx_ctor_params :url => ''
447
450
  wx_ctor_params :pos, :size, :style => 0
448
451
  wx_ctor_params :name => 'hyperlink'
449
452
  end
450
453
 
451
454
  Wx::define_keyword_ctors('StyledTextCtrl') do
452
- wx_ctor_params :pos, :size, :style => 0
455
+ wx_ctor_params :id, :pos, :size, :style => 0
453
456
  wx_ctor_params :name => 'styledTextCtrl'
454
457
  end
455
458
 
459
+
460
+ Wx::define_keyword_ctors('CollapsiblePane') do
461
+ wx_ctor_params :id, :label => ''
462
+ wx_ctor_params :pos, :size, :style => 0
463
+ wx_ctor_params :validator, :name => 'collapsiblePane'
464
+ end
465
+
data/lib/wx/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Wx
2
- WXRUBY_VERSION = '1.9.1'
2
+ WXRUBY_VERSION = '1.9.2'
3
3
  end
data/lib/wxruby2.so CHANGED
Binary file
@@ -139,6 +139,8 @@ class MyCanvas < Wx::ScrolledWindow
139
139
  if event.left_is_down() and !@drawing
140
140
  set_focus()
141
141
  set_XY(event)
142
+ @event_x_old = event.get_x # added this to save the current absolute...
143
+ @event_y_old = event.get_y # ... mouse position
142
144
  @curLine = []
143
145
  capture_mouse()
144
146
  @drawing = true
@@ -167,11 +169,14 @@ class MyCanvas < Wx::ScrolledWindow
167
169
 
168
170
  paint do | dc |
169
171
  dc.set_pen(Wx::Pen.new("MEDIUM FOREST GREEN", 4, Wx::SOLID))
170
- coords = [@x, @y] + convert_event_coords(event)
171
- @curLine.push(coords)
172
+ save_coords = [@x, @y] + convert_event_coords(event) # translate the absolute coords to save them in the array
173
+ coords = [@event_x_old, @event_y_old, event.get_x, event.get_y] # the absolute coords to use for the first draw
174
+ @curLine.push(save_coords) # use the translated coords here
172
175
  coords.flatten!()
173
- dc.draw_line(coords[0], coords[1], coords[2], coords[3])
176
+ dc.draw_line(coords[0], coords[1], coords[2], coords[3]) # and the absolute coords here
174
177
  set_XY(event)
178
+ @event_x_old = event.get_x # saving the new ...
179
+ @event_y_old = event.get_y # ... absolute coords
175
180
  end
176
181
  end
177
182
  end
@@ -232,7 +232,7 @@ class MyFrame < Frame
232
232
  end
233
233
  @calendar = MyCalendar.new(@panel, self, date, style)
234
234
  @sizer.add(@calendar, 0, Wx::ALIGN_CENTRE|Wx::ALL, 5)
235
- layout
235
+ @panel.layout
236
236
  end
237
237
 
238
238
  def highlight_special(on)