wxruby 1.9.5-x86-linux → 1.9.6-x86-linux
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/wx/classes/acceleratortable.rb +28 -0
- data/lib/wx/classes/animation.rb +18 -0
- data/lib/wx/classes/bitmap.rb +5 -0
- data/lib/wx/classes/busycursor.rb +12 -0
- data/lib/wx/classes/evthandler.rb +36 -21
- data/lib/wx/classes/functions.rb +44 -0
- data/lib/wx/classes/grid.rb +16 -7
- data/lib/wx/classes/htmlwindow.rb +8 -0
- data/lib/wx/classes/icon.rb +7 -0
- data/lib/wx/classes/iconbundle.rb +3 -0
- data/lib/wx/classes/image.rb +17 -0
- data/lib/wx/classes/imagelist.rb +3 -0
- data/lib/wx/classes/toolbartool.rb +4 -0
- data/lib/wx/classes/xmlresource.rb +21 -0
- data/lib/wx/keyword_ctors.rb +9 -6
- data/lib/wx/keyword_defs.rb +7 -0
- data/lib/wx/version.rb +1 -1
- data/lib/wxruby2.so +0 -0
- data/samples/aui/aui.rb +6 -10
- data/samples/bigdemo/About.rbw +0 -0
- data/samples/bigdemo/ColorPanel.rbw +7 -9
- data/samples/bigdemo/GridSimple.rbw +7 -9
- data/samples/bigdemo/MDIDemo.rbw +7 -9
- data/samples/bigdemo/PopupMenu.rbw +7 -9
- data/samples/bigdemo/ShapedWindow.rbw +6 -10
- data/samples/bigdemo/Sizers.rbw +7 -9
- data/samples/bigdemo/bigdemo.rb +24 -25
- data/samples/bigdemo/demoTemplate.rbw +6 -10
- data/samples/bigdemo/run.rb +6 -10
- data/samples/bigdemo/utils.rb +0 -0
- data/samples/bigdemo/wxArtProvider.rbw +6 -10
- data/samples/bigdemo/wxBitmapButton.rbw +42 -41
- data/samples/bigdemo/wxButton.rbw +7 -9
- data/samples/bigdemo/wxCalendarCtrl.rbw +41 -53
- data/samples/bigdemo/wxCheckBox.rbw +7 -9
- data/samples/bigdemo/wxCheckListBox.rbw +7 -9
- data/samples/bigdemo/wxChoice.rbw +7 -9
- data/samples/bigdemo/wxChoicebook.rbw +7 -9
- data/samples/bigdemo/wxColourDialog.rbw +7 -10
- data/samples/bigdemo/wxComboBox.rbw +7 -9
- data/samples/bigdemo/wxCursor.rbw +6 -10
- data/samples/bigdemo/wxDialog.rbw +7 -9
- data/samples/bigdemo/wxDirDialog.rbw +7 -10
- data/samples/bigdemo/wxDragImage.rbw +6 -10
- data/samples/bigdemo/wxFileDialog.rbw +7 -9
- data/samples/bigdemo/wxFileDialog_Save.rbw +7 -10
- data/samples/bigdemo/wxFindReplaceDialog.rbw +7 -10
- data/samples/bigdemo/wxFontDialog.rbw +7 -10
- data/samples/bigdemo/wxFrame.rbw +7 -9
- data/samples/bigdemo/wxGauge.rbw +7 -9
- data/samples/bigdemo/wxGenericDirCtrl.rbw +6 -10
- data/samples/bigdemo/wxGrid.rbw +7 -9
- data/samples/bigdemo/wxHtmlHelpController.rbw +6 -11
- data/samples/bigdemo/wxListBox.rbw +7 -9
- data/samples/bigdemo/wxListCtrl_virtual.rbw +7 -9
- data/samples/bigdemo/wxMDIWindows.rbw +7 -9
- data/samples/bigdemo/wxMenu.rbw +7 -9
- data/samples/bigdemo/wxMessageDialog.rbw +7 -10
- data/samples/bigdemo/wxMiniFrame.rbw +6 -10
- data/samples/bigdemo/wxMultipleChoiceDialog.rbw +7 -9
- data/samples/bigdemo/wxNotebook.rbw +7 -9
- data/samples/bigdemo/wxProgressDialog.rbw +7 -9
- data/samples/bigdemo/wxRadioBox.rbw +7 -9
- data/samples/bigdemo/wxRadioButton.rbw +7 -9
- data/samples/bigdemo/wxSashWindow.rbw +6 -10
- data/samples/bigdemo/wxScrolledMessageDialog.rbw +7 -9
- data/samples/bigdemo/wxScrolledWindow.rbw +7 -9
- data/samples/bigdemo/wxSingleChoiceDialog.rbw +7 -9
- data/samples/bigdemo/wxSlider.rbw +7 -9
- data/samples/bigdemo/wxSpinButton.rbw +7 -9
- data/samples/bigdemo/wxSpinCtrl.rbw +7 -9
- data/samples/bigdemo/wxSplitterWindow.rbw +7 -9
- data/samples/bigdemo/wxStaticBitmap.rbw +7 -9
- data/samples/bigdemo/wxStaticText.rbw +7 -9
- data/samples/bigdemo/wxStatusBar.rbw +7 -9
- data/samples/bigdemo/wxTextCtrl.rbw +7 -9
- data/samples/bigdemo/wxTextEntryDialog.rbw +7 -10
- data/samples/bigdemo/wxToggleButton.rbw +7 -9
- data/samples/bigdemo/wxToolBar.rbw +7 -9
- data/samples/bigdemo/wxTreeCtrl.rbw +7 -9
- data/samples/calendar/calendar.rb +6 -10
- data/samples/caret/caret.rb +6 -10
- data/samples/controls/controls.rb +6 -10
- data/samples/controls/get_item_sample.rb +0 -0
- data/samples/dialogs/dialogs.rb +10 -11
- data/samples/drawing/graphics_drawing.rb +6 -7
- data/samples/drawing/images.rb +5 -10
- data/samples/drawing/paperclip.png +0 -0
- data/samples/etc/activation.rb +4 -10
- data/samples/etc/choice.rb +5 -10
- data/samples/etc/miniframe.rb +5 -10
- data/samples/etc/sash.rb +5 -10
- data/samples/etc/scrollwin.rb +4 -10
- data/samples/etc/system_settings.rb +4 -10
- data/samples/etc/threaded.rb +4 -10
- data/samples/etc/wizard.rb +5 -10
- data/samples/event/event.rb +3 -5
- data/samples/grid/grid.rb +5 -9
- data/samples/grid/gridtablebase.rb +134 -0
- data/samples/html/html.rb +4 -10
- data/samples/listbook/listbook.rb +4 -11
- data/samples/mdi/mdi.rb +5 -10
- data/samples/media/mediactrl.rb +4 -10
- data/samples/minimal/minimal.rb +18 -26
- data/samples/minimal/nothing.rb +5 -10
- data/samples/opengl/cube.rb +8 -14
- data/samples/printing/mondrian.ico +0 -0
- data/samples/printing/mondrian.xpm +0 -0
- data/samples/printing/printing.rb +5 -179
- data/samples/text/mondrian.ico +0 -0
- data/samples/text/mondrian.xpm +0 -0
- data/samples/text/scintilla.rb +5 -10
- data/samples/text/textctrl.rb +27 -38
- data/samples/text/unicode.rb +6 -2
- data/samples/treectrl/treectrl.rb +4 -10
- data/samples/xrc/xrc_sample.rb +6 -17
- metadata +98 -90
data/samples/bigdemo/bigdemo.rb
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
#
|
3
|
-
#
|
4
|
-
|
2
|
+
# wxRuby2 Sample Code. Copyright (c) 2004-2008 wxRuby development team
|
3
|
+
# Freely reusable code: see SAMPLES-LICENSE.TXT for details
|
4
|
+
begin
|
5
|
+
require 'rubygems'
|
6
|
+
rescue LoadError
|
7
|
+
end
|
8
|
+
require 'wx'
|
9
|
+
|
10
|
+
# Demo created by Robert Carlin, based on the wxPython demo by Robin Dunn
|
11
|
+
# Modified by Kevin Smith, Roy Sutton, Alex Fenton
|
12
|
+
|
5
13
|
|
6
14
|
# TODO:
|
7
15
|
# Finish Scintilla integration
|
@@ -11,18 +19,6 @@
|
|
11
19
|
# Finish 'rubification' of source
|
12
20
|
# Fix non-scintilla code viewer
|
13
21
|
|
14
|
-
begin
|
15
|
-
require 'wx'
|
16
|
-
rescue LoadError => no_wx_err
|
17
|
-
begin
|
18
|
-
require 'rubygems'
|
19
|
-
require 'wx'
|
20
|
-
rescue LoadError
|
21
|
-
raise no_wx_err
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
|
26
22
|
OVR_TEXT = "This is the WxRuby Demo. It was ported from the wxPython Demo, created by Robin Dunn. Many thanks to him for all his hard work - this demo is what it is because of him. Click on any of the items in the tree control to start the demo. Don't forget to check out the Demo Code tab - you can see the source code for each demo!\nHope you like it!"
|
27
23
|
|
28
24
|
$tree_list = [
|
@@ -311,10 +307,9 @@ class WxRubyDemo < Wx::Frame
|
|
311
307
|
|
312
308
|
|
313
309
|
# Create a Notebook
|
314
|
-
@nb = Wx::Notebook.new(splitter2,
|
310
|
+
@nb = Wx::Notebook.new(splitter2, :style => Wx::CLIP_CHILDREN)
|
315
311
|
|
316
|
-
@ovr = Wx::TextCtrl.new(@nb,
|
317
|
-
Wx::Size.new(400,400),
|
312
|
+
@ovr = Wx::TextCtrl.new(@nb, :value => OVR_TEXT, :style =>
|
318
313
|
Wx::TE_MULTILINE|Wx::TE_READONLY|
|
319
314
|
Wx::TE_RICH|Wx::TE_NOHIDESEL)
|
320
315
|
@nb.add_page(@ovr, "Overview")
|
@@ -326,10 +321,10 @@ class WxRubyDemo < Wx::Frame
|
|
326
321
|
# FIXME: Should use DemoCodeViewer, but when we do (on Windows) it
|
327
322
|
# puts all text on one line! Can remove instance_eval
|
328
323
|
# once that's resolved
|
329
|
-
@txt = Wx::TextCtrl.new(@nb,
|
330
|
-
|
331
|
-
|
332
|
-
|
324
|
+
@txt = Wx::TextCtrl.new(@nb, :value => OVR_TEXT, :style =>
|
325
|
+
Wx::TE_MULTILINE|Wx::TE_READONLY|
|
326
|
+
Wx::HSCROLL|Wx::TE_RICH|Wx::TE_RICH2|
|
327
|
+
Wx::TE_NOHIDESEL)
|
333
328
|
@txt.instance_eval { alias clear_all clear }
|
334
329
|
@txt.set_max_length(0)
|
335
330
|
@nb.add_page(@txt, "Demo Code")
|
@@ -349,8 +344,8 @@ class WxRubyDemo < Wx::Frame
|
|
349
344
|
@log.set_max_length(0)
|
350
345
|
Wx::Log::set_active_target(Wx::LogTextCtrl.new(@log))
|
351
346
|
|
352
|
-
splitter.split_vertically(@tree, splitter2,
|
353
|
-
splitter2.split_horizontally(@nb, @log,
|
347
|
+
splitter.split_vertically(@tree, splitter2, 220)
|
348
|
+
splitter2.split_horizontally(@nb, @log, 300)
|
354
349
|
|
355
350
|
|
356
351
|
splitter.set_minimum_pane_size(20)
|
@@ -390,7 +385,9 @@ class WxRubyDemo < Wx::Frame
|
|
390
385
|
end
|
391
386
|
|
392
387
|
def on_tree_sel_changed(event)
|
388
|
+
|
393
389
|
item = event.get_item()
|
390
|
+
|
394
391
|
if item.nonzero?
|
395
392
|
itemText = @tree.get_item_text(item)
|
396
393
|
run_demo(itemText)
|
@@ -403,7 +400,9 @@ class WxRubyDemo < Wx::Frame
|
|
403
400
|
if item == @tree.get_selection()
|
404
401
|
set_overview(@tree.get_item_text(item) + " Overview", @curOverview)
|
405
402
|
Wx::log_message(@tree.get_item_text(item) + " Overview")
|
403
|
+
|
406
404
|
end
|
405
|
+
|
407
406
|
event.skip()
|
408
407
|
end
|
409
408
|
|
@@ -543,7 +542,7 @@ class WxRubyDemo < Wx::Frame
|
|
543
542
|
@finddlg.set_focus()
|
544
543
|
return
|
545
544
|
else
|
546
|
-
@finddlg.
|
545
|
+
@finddlg.hide()
|
547
546
|
end
|
548
547
|
end
|
549
548
|
@txt.show_position(loc)
|
@@ -1,17 +1,13 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
# wxRuby2 Sample Code. Copyright (c) 2004-
|
2
|
+
# wxRuby2 Sample Code. Copyright (c) 2004-2008 wxRuby development team
|
3
3
|
# Freely reusable code: see SAMPLES-LICENSE.TXT for details
|
4
|
-
|
5
4
|
begin
|
6
|
-
require '
|
7
|
-
rescue LoadError
|
8
|
-
begin
|
9
|
-
require 'rubygems'
|
10
|
-
require 'wx'
|
11
|
-
rescue LoadError
|
12
|
-
raise no_wx_err
|
13
|
-
end
|
5
|
+
require 'rubygems'
|
6
|
+
rescue LoadError
|
14
7
|
end
|
8
|
+
require 'wx'
|
9
|
+
|
10
|
+
|
15
11
|
|
16
12
|
class
|
17
13
|
def initialize()
|
data/samples/bigdemo/run.rb
CHANGED
@@ -1,17 +1,13 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
# wxRuby2 Sample Code. Copyright (c) 2004-
|
2
|
+
# wxRuby2 Sample Code. Copyright (c) 2004-2008 wxRuby development team
|
3
3
|
# Freely reusable code: see SAMPLES-LICENSE.TXT for details
|
4
|
-
|
5
4
|
begin
|
6
|
-
require '
|
7
|
-
rescue LoadError
|
8
|
-
begin
|
9
|
-
require 'rubygems'
|
10
|
-
require 'wx'
|
11
|
-
rescue LoadError
|
12
|
-
raise no_wx_err
|
13
|
-
end
|
5
|
+
require 'rubygems'
|
6
|
+
rescue LoadError
|
14
7
|
end
|
8
|
+
require 'wx'
|
9
|
+
|
10
|
+
|
15
11
|
|
16
12
|
class Log
|
17
13
|
def write_text(txt)
|
data/samples/bigdemo/utils.rb
CHANGED
File without changes
|
@@ -1,17 +1,13 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
# wxRuby2 Sample Code. Copyright (c) 2004-
|
2
|
+
# wxRuby2 Sample Code. Copyright (c) 2004-2008 wxRuby development team
|
3
3
|
# Freely reusable code: see SAMPLES-LICENSE.TXT for details
|
4
|
-
|
5
4
|
begin
|
6
|
-
require '
|
7
|
-
rescue LoadError
|
8
|
-
begin
|
9
|
-
require 'rubygems'
|
10
|
-
require 'wx'
|
11
|
-
rescue LoadError
|
12
|
-
raise no_wx_err
|
13
|
-
end
|
5
|
+
require 'rubygems'
|
6
|
+
rescue LoadError
|
14
7
|
end
|
8
|
+
require 'wx'
|
9
|
+
|
10
|
+
|
15
11
|
|
16
12
|
ArtClients = [ "Wx::ART_TOOLBAR",
|
17
13
|
"Wx::ART_MENU",
|
@@ -1,59 +1,60 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
# wxRuby2 Sample Code. Copyright (c) 2004-
|
2
|
+
# wxRuby2 Sample Code. Copyright (c) 2004-2008 wxRuby development team
|
3
3
|
# Freely reusable code: see SAMPLES-LICENSE.TXT for details
|
4
|
-
|
5
4
|
begin
|
6
|
-
require '
|
7
|
-
rescue LoadError
|
8
|
-
begin
|
9
|
-
require 'rubygems'
|
10
|
-
require 'wx'
|
11
|
-
rescue LoadError
|
12
|
-
raise no_wx_err
|
13
|
-
end
|
5
|
+
require 'rubygems'
|
6
|
+
rescue LoadError
|
14
7
|
end
|
8
|
+
require 'wx'
|
15
9
|
|
16
|
-
class TestPanel < Wx::Panel
|
17
|
-
def initialize(parent, log)
|
18
|
-
super(parent, -1, Wx::DEFAULT_POSITION, Wx::DEFAULT_SIZE, Wx::NO_FULL_REPAINT_ON_RESIZE)
|
19
|
-
@log = log
|
20
|
-
|
21
|
-
bmp_file = File.join( File.dirname(__FILE__), 'icons', 'test2.bmp')
|
22
|
-
bmp = Wx::Bitmap.new(bmp_file, Wx::BITMAP_TYPE_BMP)
|
23
|
-
mask = Wx::Mask.new(bmp, Wx::BLUE)
|
24
10
|
|
25
|
-
|
26
|
-
b = Wx::BitmapButton.new(self, 10, bmp, Wx::Point.new(20,20), Wx::Size.new(bmp.get_width + 10, bmp.get_height + 10))
|
27
|
-
evt_button(10) {|event| on_click(event)}
|
28
|
-
b.set_tool_tip('This is a bitmap button.')
|
29
|
-
|
30
|
-
b = Wx::BitmapButton.new(self, 20, bmp, Wx::Point.new(20,120), Wx::Size.new(bmp.get_width + 10, bmp.get_height + 10), Wx::NO_BORDER)
|
31
|
-
evt_button(20) {|event| on_click(event)}
|
32
|
-
b.set_tool_tip("This is a Bitmap button with\nWx::NO_BORDER style.")
|
11
|
+
require 'wx'
|
33
12
|
|
34
|
-
bmp_file = File.join( File.dirname(__FILE__), 'icons', 'smiles.bmp')
|
35
|
-
bmp = Wx::Bitmap.new(bmp_file, Wx::BITMAP_TYPE_BMP)
|
36
|
-
b.set_bitmap_selected(bmp)
|
37
13
|
|
38
|
-
|
14
|
+
class TestPanel < Wx::Panel
|
15
|
+
def initialize(parent, log)
|
16
|
+
super(parent, :style => Wx::NO_FULL_REPAINT_ON_RESIZE)
|
17
|
+
@log = log
|
39
18
|
|
40
|
-
|
41
|
-
|
42
|
-
|
19
|
+
bmp_file = File.join( File.dirname(__FILE__), 'icons', 'test2.bmp')
|
20
|
+
bmp = Wx::Bitmap.new(bmp_file, Wx::BITMAP_TYPE_BMP)
|
21
|
+
bmp.mask= Wx::Mask.new(bmp, Wx::BLUE)
|
43
22
|
|
23
|
+
b = Wx::BitmapButton.new( self,
|
24
|
+
:bitmap => bmp,
|
25
|
+
:pos => [ 20, 20 ],
|
26
|
+
:size => [ bmp.width + 10,bmp.height + 10] )
|
27
|
+
evt_button b, :on_click
|
28
|
+
b.tool_tip = 'This is a bitmap button.'
|
29
|
+
|
30
|
+
b = Wx::BitmapButton.new( self,
|
31
|
+
:bitmap => bmp,
|
32
|
+
:pos => [ 20, 120 ],
|
33
|
+
:size => [ bmp.width + 10,bmp.height + 10],
|
34
|
+
:style => Wx::NO_BORDER)
|
35
|
+
evt_button b, :on_click
|
36
|
+
b.tool_tip = "This is a Bitmap button with\nWx::NO_BORDER style."
|
44
37
|
|
38
|
+
bmp_file = File.join( File.dirname(__FILE__), 'icons', 'smiles.bmp')
|
39
|
+
bmp = Wx::Bitmap.new(bmp_file, Wx::BITMAP_TYPE_BMP)
|
40
|
+
b.bitmap_selected = bmp
|
41
|
+
end
|
42
|
+
|
43
|
+
def on_click(event)
|
44
|
+
@log.write_text("Click! %d" % event.id)
|
45
|
+
end
|
45
46
|
end
|
46
47
|
|
47
48
|
module Demo
|
48
49
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
50
|
+
def Demo.run(frame, nb, log)
|
51
|
+
win = TestPanel.new(nb, log)
|
52
|
+
return win
|
53
|
+
end
|
54
|
+
|
55
|
+
def Demo.overview
|
56
|
+
return "A BitmapButton control displays a bitmap. It can have a separate bitmap for each button state: normal, selected, disabled.\n\nThe bitmaps to be displayed should have a small number of colours, such as 16, to avoid palette problems.\n\nA bitmap can be derived from most image formats using the Wx::Image class."
|
57
|
+
end
|
57
58
|
|
58
59
|
end
|
59
60
|
|
@@ -1,15 +1,13 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
2
|
+
# wxRuby2 Sample Code. Copyright (c) 2004-2008 wxRuby development team
|
3
|
+
# Freely reusable code: see SAMPLES-LICENSE.TXT for details
|
3
4
|
begin
|
4
|
-
require '
|
5
|
-
rescue LoadError
|
6
|
-
begin
|
7
|
-
require 'rubygems'
|
8
|
-
require 'wx'
|
9
|
-
rescue LoadError
|
10
|
-
raise no_wx_err
|
11
|
-
end
|
5
|
+
require 'rubygems'
|
6
|
+
rescue LoadError
|
12
7
|
end
|
8
|
+
require 'wx'
|
9
|
+
|
10
|
+
|
13
11
|
|
14
12
|
class TestPanel < Wx::Panel
|
15
13
|
def initialize(parent, log)
|
@@ -1,68 +1,56 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
2
|
+
# wxRuby2 Sample Code. Copyright (c) 2004-2008 wxRuby development team
|
3
|
+
# Freely reusable code: see SAMPLES-LICENSE.TXT for details
|
3
4
|
begin
|
4
|
-
require '
|
5
|
-
rescue LoadError
|
6
|
-
begin
|
7
|
-
require 'rubygems'
|
8
|
-
require 'wx'
|
9
|
-
rescue LoadError
|
10
|
-
raise no_wx_err
|
11
|
-
end
|
5
|
+
require 'rubygems'
|
6
|
+
rescue LoadError
|
12
7
|
end
|
8
|
+
require 'wx'
|
13
9
|
require 'date'
|
14
10
|
|
15
11
|
class TestPanel < Wx::Panel
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
cal = Wx::CalendarCtrl.new(self, -1, date, Wx::Point.new(25,50), Wx::DEFAULT_SIZE,
|
22
|
-
Wx::CAL_SHOW_HOLIDAYS | Wx::CAL_SUNDAY_FIRST | Wx::CAL_SEQUENTIAL_MONTH_SELECTION)
|
23
|
-
|
24
|
-
evt_calendar(cal.get_id()) {|event| on_cal_selected(event)}
|
25
|
-
|
26
|
-
#b = Wx::Button.new(self, -1, "Destroy the Calendar", Wx::Point.new(250,50))
|
27
|
-
#evt_button(b.get_id()) {|event| on_button(event)}
|
28
|
-
@cal = cal
|
29
|
-
|
30
|
-
# Set up control to display a set of holidays:
|
31
|
-
evt_calendar_month(cal.get_id()) {|event| on_change_month(event)}
|
32
|
-
@holidays = [[1,1], [10,31], [12,25]] #(these don't move around)
|
33
|
-
|
34
|
-
end
|
35
|
-
|
36
|
-
#def on_button(event)
|
37
|
-
# @cal.destroy()
|
38
|
-
# @cal = nil
|
39
|
-
#end
|
12
|
+
attr_reader :cal
|
13
|
+
|
14
|
+
def initialize(parent, id, log)
|
15
|
+
super(parent, id)
|
16
|
+
@log = log
|
40
17
|
|
41
|
-
|
42
|
-
|
43
|
-
|
18
|
+
date = DateTime.now
|
19
|
+
@cal = Wx::CalendarCtrl.new(self, :date => date, :pos => [ 25, 50 ],
|
20
|
+
:style => Wx::CAL_SHOW_HOLIDAYS|
|
21
|
+
Wx::CAL_SUNDAY_FIRST|
|
22
|
+
Wx::CAL_SEQUENTIAL_MONTH_SELECTION)
|
44
23
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
24
|
+
evt_calendar cal, :on_cal_selected
|
25
|
+
# Set up control to display a set of holidays:
|
26
|
+
evt_calendar_month cal, :on_change_month
|
27
|
+
@holidays = [ [1,1], [10,31], [12,25] ] #(these don't move around)
|
28
|
+
end
|
29
|
+
def on_cal_selected(event)
|
30
|
+
@log.write_text( "on_cal_selected: " + event.date.strftime("%F") )
|
31
|
+
end
|
32
|
+
|
33
|
+
# missing get_current_month() method
|
34
|
+
def on_change_month(event)
|
35
|
+
#~ cur_month = @cal.get_date().get_current_month() + 1
|
36
|
+
#~ @holidays.each do |date|
|
37
|
+
#~ if date[0] == cur_month
|
38
|
+
#~ @cal.set_holiday(date[1])
|
39
|
+
#~ end
|
40
|
+
#~ end
|
41
|
+
event.skip()
|
42
|
+
end
|
55
43
|
end
|
56
44
|
|
57
45
|
module Demo
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
46
|
+
def Demo.run(frame, nb, log)
|
47
|
+
win = TestPanel.new(nb, -1, log)
|
48
|
+
return win
|
49
|
+
end
|
62
50
|
|
63
|
-
|
64
|
-
|
65
|
-
|
51
|
+
def Demo.overview
|
52
|
+
return "The calendar control allows the user to pick a date interactively. For this, it displays a window containing several parts: the control to pick the month and the year at the top (either or both of them may be disabled) and a month area below them which shows all the days in the month. The user can move the current selection using the keyboard and select the date (generating EVT_CALENDAR event) by pressing <Return> or double clicking it."
|
53
|
+
end
|
66
54
|
end
|
67
55
|
|
68
56
|
if __FILE__ == $0
|
@@ -1,15 +1,13 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
2
|
+
# wxRuby2 Sample Code. Copyright (c) 2004-2008 wxRuby development team
|
3
|
+
# Freely reusable code: see SAMPLES-LICENSE.TXT for details
|
3
4
|
begin
|
4
|
-
require '
|
5
|
-
rescue LoadError
|
6
|
-
begin
|
7
|
-
require 'rubygems'
|
8
|
-
require 'wx'
|
9
|
-
rescue LoadError
|
10
|
-
raise no_wx_err
|
11
|
-
end
|
5
|
+
require 'rubygems'
|
6
|
+
rescue LoadError
|
12
7
|
end
|
8
|
+
require 'wx'
|
9
|
+
|
10
|
+
|
13
11
|
|
14
12
|
class TestCheckBox < Wx::Panel
|
15
13
|
def initialize(parent, log)
|
@@ -1,15 +1,13 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
2
|
+
# wxRuby2 Sample Code. Copyright (c) 2004-2008 wxRuby development team
|
3
|
+
# Freely reusable code: see SAMPLES-LICENSE.TXT for details
|
3
4
|
begin
|
4
|
-
require '
|
5
|
-
rescue LoadError
|
6
|
-
begin
|
7
|
-
require 'rubygems'
|
8
|
-
require 'wx'
|
9
|
-
rescue LoadError
|
10
|
-
raise no_wx_err
|
11
|
-
end
|
5
|
+
require 'rubygems'
|
6
|
+
rescue LoadError
|
12
7
|
end
|
8
|
+
require 'wx'
|
9
|
+
|
10
|
+
|
13
11
|
|
14
12
|
class TestPanel < Wx::Panel
|
15
13
|
def initialize(parent, log)
|
@@ -1,15 +1,13 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
2
|
+
# wxRuby2 Sample Code. Copyright (c) 2004-2008 wxRuby development team
|
3
|
+
# Freely reusable code: see SAMPLES-LICENSE.TXT for details
|
3
4
|
begin
|
4
|
-
require '
|
5
|
-
rescue LoadError
|
6
|
-
begin
|
7
|
-
require 'rubygems'
|
8
|
-
require 'wx'
|
9
|
-
rescue LoadError
|
10
|
-
raise no_wx_err
|
11
|
-
end
|
5
|
+
require 'rubygems'
|
6
|
+
rescue LoadError
|
12
7
|
end
|
8
|
+
require 'wx'
|
9
|
+
|
10
|
+
|
13
11
|
|
14
12
|
class TestChoice < Wx::Panel
|
15
13
|
def initialize(parent, log)
|
@@ -1,15 +1,13 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
2
|
+
# wxRuby2 Sample Code. Copyright (c) 2004-2008 wxRuby development team
|
3
|
+
# Freely reusable code: see SAMPLES-LICENSE.TXT for details
|
3
4
|
begin
|
4
|
-
require '
|
5
|
-
rescue LoadError
|
6
|
-
begin
|
7
|
-
require 'rubygems'
|
8
|
-
require 'wx'
|
9
|
-
rescue LoadError
|
10
|
-
raise no_wx_err
|
11
|
-
end
|
5
|
+
require 'rubygems'
|
6
|
+
rescue LoadError
|
12
7
|
end
|
8
|
+
require 'wx'
|
9
|
+
|
10
|
+
|
13
11
|
|
14
12
|
class TestCB < Wx::Choicebook
|
15
13
|
def initialize(parent, log)
|
@@ -1,15 +1,13 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
2
|
+
# wxRuby2 Sample Code. Copyright (c) 2004-2008 wxRuby development team
|
3
|
+
# Freely reusable code: see SAMPLES-LICENSE.TXT for details
|
3
4
|
begin
|
4
|
-
require '
|
5
|
-
rescue LoadError
|
6
|
-
begin
|
7
|
-
require 'rubygems'
|
8
|
-
require 'wx'
|
9
|
-
rescue LoadError
|
10
|
-
raise no_wx_err
|
11
|
-
end
|
5
|
+
require 'rubygems'
|
6
|
+
rescue LoadError
|
12
7
|
end
|
8
|
+
require 'wx'
|
9
|
+
|
10
|
+
|
13
11
|
|
14
12
|
module Demo
|
15
13
|
def Demo.run(frame, nb, log)
|
@@ -19,7 +17,6 @@ module Demo
|
|
19
17
|
data = dlg.get_colour_data().get_colour()
|
20
18
|
log.write_text("You selected: (%d, %d, %d)" % [data.red, data.green, data.blue])
|
21
19
|
end
|
22
|
-
dlg.destroy()
|
23
20
|
end
|
24
21
|
|
25
22
|
def Demo.overview
|
@@ -1,15 +1,13 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
2
|
+
# wxRuby2 Sample Code. Copyright (c) 2004-2008 wxRuby development team
|
3
|
+
# Freely reusable code: see SAMPLES-LICENSE.TXT for details
|
3
4
|
begin
|
4
|
-
require '
|
5
|
-
rescue LoadError
|
6
|
-
begin
|
7
|
-
require 'rubygems'
|
8
|
-
require 'wx'
|
9
|
-
rescue LoadError
|
10
|
-
raise no_wx_err
|
11
|
-
end
|
5
|
+
require 'rubygems'
|
6
|
+
rescue LoadError
|
12
7
|
end
|
8
|
+
require 'wx'
|
9
|
+
|
10
|
+
|
13
11
|
|
14
12
|
class TestComboBox < Wx::Panel
|
15
13
|
|
@@ -1,17 +1,13 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
# wxRuby2 Sample Code. Copyright (c) 2004-
|
2
|
+
# wxRuby2 Sample Code. Copyright (c) 2004-2008 wxRuby development team
|
3
3
|
# Freely reusable code: see SAMPLES-LICENSE.TXT for details
|
4
|
-
|
5
4
|
begin
|
6
|
-
require '
|
7
|
-
rescue LoadError
|
8
|
-
begin
|
9
|
-
require 'rubygems'
|
10
|
-
require 'wx'
|
11
|
-
rescue LoadError
|
12
|
-
raise no_wx_err
|
13
|
-
end
|
5
|
+
require 'rubygems'
|
6
|
+
rescue LoadError
|
14
7
|
end
|
8
|
+
require 'wx'
|
9
|
+
|
10
|
+
|
15
11
|
|
16
12
|
Cursors = [
|
17
13
|
"Wx::CURSOR_ARROW",
|
@@ -1,15 +1,13 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
2
|
+
# wxRuby2 Sample Code. Copyright (c) 2004-2008 wxRuby development team
|
3
|
+
# Freely reusable code: see SAMPLES-LICENSE.TXT for details
|
3
4
|
begin
|
4
|
-
require '
|
5
|
-
rescue LoadError
|
6
|
-
begin
|
7
|
-
require 'rubygems'
|
8
|
-
require 'wx'
|
9
|
-
rescue LoadError
|
10
|
-
raise no_wx_err
|
11
|
-
end
|
5
|
+
require 'rubygems'
|
6
|
+
rescue LoadError
|
12
7
|
end
|
8
|
+
require 'wx'
|
9
|
+
|
10
|
+
|
13
11
|
|
14
12
|
class TestDialog < Wx::Dialog
|
15
13
|
def initialize(parent, id, title)
|
@@ -1,15 +1,13 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
2
|
+
# wxRuby2 Sample Code. Copyright (c) 2004-2008 wxRuby development team
|
3
|
+
# Freely reusable code: see SAMPLES-LICENSE.TXT for details
|
3
4
|
begin
|
4
|
-
require '
|
5
|
-
rescue LoadError
|
6
|
-
begin
|
7
|
-
require 'rubygems'
|
8
|
-
require 'wx'
|
9
|
-
rescue LoadError
|
10
|
-
raise no_wx_err
|
11
|
-
end
|
5
|
+
require 'rubygems'
|
6
|
+
rescue LoadError
|
12
7
|
end
|
8
|
+
require 'wx'
|
9
|
+
|
10
|
+
|
13
11
|
|
14
12
|
module Demo
|
15
13
|
def Demo.run(frame, nb, log)
|
@@ -17,7 +15,6 @@ module Demo
|
|
17
15
|
if dlg.show_modal() == Wx::ID_OK
|
18
16
|
log.write_text("You selected: " + dlg.get_path())
|
19
17
|
end
|
20
|
-
dlg.destroy()
|
21
18
|
end
|
22
19
|
|
23
20
|
def Demo.overview
|
@@ -1,17 +1,13 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
# wxRuby2 Sample Code. Copyright (c) 2004-
|
2
|
+
# wxRuby2 Sample Code. Copyright (c) 2004-2008 wxRuby development team
|
3
3
|
# Freely reusable code: see SAMPLES-LICENSE.TXT for details
|
4
|
-
|
5
4
|
begin
|
6
|
-
require '
|
7
|
-
rescue LoadError
|
8
|
-
begin
|
9
|
-
require 'rubygems'
|
10
|
-
require 'wx'
|
11
|
-
rescue LoadError
|
12
|
-
raise no_wx_err
|
13
|
-
end
|
5
|
+
require 'rubygems'
|
6
|
+
rescue LoadError
|
14
7
|
end
|
8
|
+
require 'wx'
|
9
|
+
|
10
|
+
|
15
11
|
|
16
12
|
class DragPanel < Wx::Panel
|
17
13
|
|