wxruby 1.9.6-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +53 -0
- data/README +297 -0
- data/lib/wx/accessors.rb +52 -0
- data/lib/wx/classes/acceleratortable.rb +28 -0
- data/lib/wx/classes/animation.rb +18 -0
- data/lib/wx/classes/app.rb +45 -0
- data/lib/wx/classes/artprovider.rb +31 -0
- data/lib/wx/classes/bitmap.rb +28 -0
- data/lib/wx/classes/busycursor.rb +12 -0
- data/lib/wx/classes/checklistbox.rb +45 -0
- data/lib/wx/classes/choice.rb +4 -0
- data/lib/wx/classes/clientdc.rb +13 -0
- data/lib/wx/classes/clipboard.rb +16 -0
- data/lib/wx/classes/colour.rb +47 -0
- data/lib/wx/classes/combobox.rb +4 -0
- data/lib/wx/classes/commandevent.rb +7 -0
- data/lib/wx/classes/controlwithitems.rb +10 -0
- data/lib/wx/classes/dc.rb +57 -0
- data/lib/wx/classes/event.rb +5 -0
- data/lib/wx/classes/evthandler.rb +921 -0
- data/lib/wx/classes/font.rb +118 -0
- data/lib/wx/classes/functions.rb +44 -0
- data/lib/wx/classes/gauge.rb +12 -0
- data/lib/wx/classes/grid.rb +138 -0
- data/lib/wx/classes/helpcontroller.rb +5 -0
- data/lib/wx/classes/htmlhelpcontroller.rb +5 -0
- data/lib/wx/classes/htmlwindow.rb +14 -0
- data/lib/wx/classes/icon.rb +21 -0
- data/lib/wx/classes/iconbundle.rb +3 -0
- data/lib/wx/classes/image.rb +31 -0
- data/lib/wx/classes/imagelist.rb +3 -0
- data/lib/wx/classes/listbox.rb +4 -0
- data/lib/wx/classes/listctrl.rb +21 -0
- data/lib/wx/classes/locale.rb +28 -0
- data/lib/wx/classes/mediactrl.rb +22 -0
- data/lib/wx/classes/menu.rb +62 -0
- data/lib/wx/classes/menuitem.rb +7 -0
- data/lib/wx/classes/object.rb +7 -0
- data/lib/wx/classes/paintdc.rb +12 -0
- data/lib/wx/classes/point.rb +48 -0
- data/lib/wx/classes/previewframe.rb +13 -0
- data/lib/wx/classes/rect.rb +10 -0
- data/lib/wx/classes/size.rb +49 -0
- data/lib/wx/classes/sound.rb +23 -0
- data/lib/wx/classes/styledtextctrl.rb +92 -0
- data/lib/wx/classes/textctrl.rb +14 -0
- data/lib/wx/classes/texturlevent.rb +6 -0
- data/lib/wx/classes/timer.rb +94 -0
- data/lib/wx/classes/toolbartool.rb +4 -0
- data/lib/wx/classes/treectrl.rb +44 -0
- data/lib/wx/classes/window.rb +82 -0
- data/lib/wx/classes/xmlresource.rb +37 -0
- data/lib/wx/keyword_ctors.rb +222 -0
- data/lib/wx/keyword_defs.rb +492 -0
- data/lib/wx/version.rb +3 -0
- data/lib/wx.rb +42 -0
- data/lib/wxruby2.so +0 -0
- data/samples/SAMPLES-LICENSE.TXT +18 -0
- data/samples/aui/aui.rb +1356 -0
- data/samples/bigdemo/About.rbw +39 -0
- data/samples/bigdemo/ColorPanel.rbw +23 -0
- data/samples/bigdemo/GridSimple.rbw +78 -0
- data/samples/bigdemo/MDIDemo.rbw +57 -0
- data/samples/bigdemo/PopupMenu.rbw +149 -0
- data/samples/bigdemo/ShapedWindow.rbw +131 -0
- data/samples/bigdemo/Sizers.rbw +543 -0
- data/samples/bigdemo/bigdemo.rb +823 -0
- data/samples/bigdemo/demoTemplate.rbw +33 -0
- data/samples/bigdemo/helpfile.htb +0 -0
- data/samples/bigdemo/icons/Test 015.jpg +0 -0
- data/samples/bigdemo/icons/Test 015.png +0 -0
- data/samples/bigdemo/icons/choice.bmp +0 -0
- data/samples/bigdemo/icons/choice.xpm +27 -0
- data/samples/bigdemo/icons/combo.bmp +0 -0
- data/samples/bigdemo/icons/combo.xpm +27 -0
- data/samples/bigdemo/icons/copy.xpm +25 -0
- data/samples/bigdemo/icons/cut.xpm +24 -0
- data/samples/bigdemo/icons/gauge.bmp +0 -0
- data/samples/bigdemo/icons/gauge.xpm +27 -0
- data/samples/bigdemo/icons/help.xpm +25 -0
- data/samples/bigdemo/icons/list.bmp +0 -0
- data/samples/bigdemo/icons/list.xpm +27 -0
- data/samples/bigdemo/icons/mondrian.ico +0 -0
- data/samples/bigdemo/icons/mondrian.xpm +44 -0
- data/samples/bigdemo/icons/new.xpm +24 -0
- data/samples/bigdemo/icons/ogl.ico +0 -0
- data/samples/bigdemo/icons/ogl.xpm +45 -0
- data/samples/bigdemo/icons/open.xpm +26 -0
- data/samples/bigdemo/icons/paste.bmp +0 -0
- data/samples/bigdemo/icons/paste.xpm +38 -0
- data/samples/bigdemo/icons/pointy.png +0 -0
- data/samples/bigdemo/icons/preview.xpm +26 -0
- data/samples/bigdemo/icons/print.xpm +26 -0
- data/samples/bigdemo/icons/radio.bmp +0 -0
- data/samples/bigdemo/icons/radio.xpm +27 -0
- data/samples/bigdemo/icons/robert.xpm +415 -0
- data/samples/bigdemo/icons/ruby.png +0 -0
- data/samples/bigdemo/icons/sashtest.ico +0 -0
- data/samples/bigdemo/icons/save.xpm +25 -0
- data/samples/bigdemo/icons/smiles.bmp +0 -0
- data/samples/bigdemo/icons/smiles.xpm +39 -0
- data/samples/bigdemo/icons/smiley.ico +0 -0
- data/samples/bigdemo/icons/smiley.xpm +42 -0
- data/samples/bigdemo/icons/stattext.xpm +24 -0
- data/samples/bigdemo/icons/test2.bmp +0 -0
- data/samples/bigdemo/icons/test2.png +0 -0
- data/samples/bigdemo/icons/test2.xpm +79 -0
- data/samples/bigdemo/icons/text.bmp +0 -0
- data/samples/bigdemo/icons/text.xpm +27 -0
- data/samples/bigdemo/icons/tog1.bmp +0 -0
- data/samples/bigdemo/icons/tog1.xpm +38 -0
- data/samples/bigdemo/icons/tog2.bmp +0 -0
- data/samples/bigdemo/icons/tog2.xpm +38 -0
- data/samples/bigdemo/icons/wxwin.ico +0 -0
- data/samples/bigdemo/icons/wxwin16x16.png +0 -0
- data/samples/bigdemo/icons/wxwin16x16.xpm +25 -0
- data/samples/bigdemo/icons/wxwin32x32.png +0 -0
- data/samples/bigdemo/icons/wxwin48x48.png +0 -0
- data/samples/bigdemo/run.rb +90 -0
- data/samples/bigdemo/tips.txt +7 -0
- data/samples/bigdemo/utils.rb +12 -0
- data/samples/bigdemo/wxArtProvider.rbw +281 -0
- data/samples/bigdemo/wxBitmapButton.rbw +65 -0
- data/samples/bigdemo/wxButton.rbw +64 -0
- data/samples/bigdemo/wxCalendarCtrl.rbw +60 -0
- data/samples/bigdemo/wxCheckBox.rbw +50 -0
- data/samples/bigdemo/wxCheckListBox.rbw +75 -0
- data/samples/bigdemo/wxChoice.rbw +47 -0
- data/samples/bigdemo/wxChoicebook.rbw +78 -0
- data/samples/bigdemo/wxColourDialog.rbw +31 -0
- data/samples/bigdemo/wxComboBox.rbw +77 -0
- data/samples/bigdemo/wxCursor.rbw +136 -0
- data/samples/bigdemo/wxDialog.rbw +74 -0
- data/samples/bigdemo/wxDirDialog.rbw +29 -0
- data/samples/bigdemo/wxDragImage.rbw +70 -0
- data/samples/bigdemo/wxFileDialog.rbw +37 -0
- data/samples/bigdemo/wxFileDialog_Save.rbw +35 -0
- data/samples/bigdemo/wxFindReplaceDialog.rbw +82 -0
- data/samples/bigdemo/wxFontDialog.rbw +173 -0
- data/samples/bigdemo/wxFrame.rbw +53 -0
- data/samples/bigdemo/wxGauge.rbw +71 -0
- data/samples/bigdemo/wxGenericDirCtrl.rbw +74 -0
- data/samples/bigdemo/wxGrid.rbw +66 -0
- data/samples/bigdemo/wxHtmlHelpController.rbw +52 -0
- data/samples/bigdemo/wxListBox.rbw +140 -0
- data/samples/bigdemo/wxListCtrl_virtual.rbw +107 -0
- data/samples/bigdemo/wxMDIWindows.rbw +50 -0
- data/samples/bigdemo/wxMenu.rbw +236 -0
- data/samples/bigdemo/wxMessageDialog.rbw +27 -0
- data/samples/bigdemo/wxMiniFrame.rbw +70 -0
- data/samples/bigdemo/wxMultipleChoiceDialog.rbw +32 -0
- data/samples/bigdemo/wxNotebook.rbw +136 -0
- data/samples/bigdemo/wxProgressDialog.rbw +43 -0
- data/samples/bigdemo/wxRadioBox.rbw +72 -0
- data/samples/bigdemo/wxRadioButton.rbw +125 -0
- data/samples/bigdemo/wxSashWindow.rbw +141 -0
- data/samples/bigdemo/wxScrolledMessageDialog.rbw +57 -0
- data/samples/bigdemo/wxScrolledWindow.rbw +199 -0
- data/samples/bigdemo/wxSingleChoiceDialog.rbw +33 -0
- data/samples/bigdemo/wxSlider.rbw +42 -0
- data/samples/bigdemo/wxSpinButton.rbw +50 -0
- data/samples/bigdemo/wxSpinCtrl.rbw +51 -0
- data/samples/bigdemo/wxSplitterWindow.rbw +63 -0
- data/samples/bigdemo/wxStaticBitmap.rbw +51 -0
- data/samples/bigdemo/wxStaticText.rbw +55 -0
- data/samples/bigdemo/wxStatusBar.rbw +126 -0
- data/samples/bigdemo/wxTextCtrl.rbw +149 -0
- data/samples/bigdemo/wxTextEntryDialog.rbw +31 -0
- data/samples/bigdemo/wxToggleButton.rbw +49 -0
- data/samples/bigdemo/wxToolBar.rbw +131 -0
- data/samples/bigdemo/wxTreeCtrl.rbw +190 -0
- data/samples/calendar/calendar.rb +271 -0
- data/samples/caret/caret.rb +282 -0
- data/samples/caret/mondrian.xpm +44 -0
- data/samples/controls/controls.rb +1136 -0
- data/samples/controls/get_item_sample.rb +87 -0
- data/samples/controls/icons/choice.xpm +27 -0
- data/samples/controls/icons/combo.xpm +27 -0
- data/samples/controls/icons/gauge.xpm +27 -0
- data/samples/controls/icons/list.xpm +27 -0
- data/samples/controls/icons/radio.xpm +27 -0
- data/samples/controls/icons/stattext.xpm +24 -0
- data/samples/controls/icons/text.xpm +27 -0
- data/samples/controls/mondrian.ico +0 -0
- data/samples/controls/mondrian.xpm +44 -0
- data/samples/controls/test2.bmp +0 -0
- data/samples/dialogs/dialogs.rb +723 -0
- data/samples/dialogs/tips.txt +18 -0
- data/samples/drawing/graphics_drawing.rb +235 -0
- data/samples/drawing/images.rb +37 -0
- data/samples/drawing/paperclip.png +0 -0
- data/samples/etc/activation.rb +102 -0
- data/samples/etc/choice.rb +67 -0
- data/samples/etc/miniframe.rb +79 -0
- data/samples/etc/sash.rb +130 -0
- data/samples/etc/scrollwin.rb +110 -0
- data/samples/etc/system_settings.rb +252 -0
- data/samples/etc/threaded.rb +72 -0
- data/samples/etc/wizard.rb +74 -0
- data/samples/event/event.rb +182 -0
- data/samples/grid/grid.rb +198 -0
- data/samples/grid/gridtablebase.rb +134 -0
- data/samples/html/html.rb +262 -0
- data/samples/listbook/listbook.rb +174 -0
- data/samples/listbook/listbook.xrc +370 -0
- data/samples/mdi/mdi.rb +82 -0
- data/samples/media/mediactrl.rb +167 -0
- data/samples/minimal/minimal.rb +77 -0
- data/samples/minimal/mondrian.ico +0 -0
- data/samples/minimal/mondrian.png +0 -0
- data/samples/minimal/nothing.rb +16 -0
- data/samples/opengl/cube.rb +117 -0
- data/samples/printing/mondrian.ico +0 -0
- data/samples/printing/mondrian.xpm +44 -0
- data/samples/printing/printing.rb +310 -0
- data/samples/sockets/SocketPackets.rb +27 -0
- data/samples/sockets/res/message-new.png +0 -0
- data/samples/sockets/res/user.png +0 -0
- data/samples/sockets/wxClient.rb +395 -0
- data/samples/sockets/wxServer.rb +422 -0
- data/samples/sockets/wxSocketGUI.rb +97 -0
- data/samples/text/mondrian.ico +0 -0
- data/samples/text/mondrian.xpm +44 -0
- data/samples/text/scintilla.rb +169 -0
- data/samples/text/textctrl.rb +113 -0
- data/samples/text/unicode.rb +242 -0
- data/samples/text/utf8.txt +15 -0
- data/samples/treectrl/icon1.xpm +79 -0
- data/samples/treectrl/icon2.xpm +53 -0
- data/samples/treectrl/icon3.xpm +79 -0
- data/samples/treectrl/icon4.xpm +43 -0
- data/samples/treectrl/icon5.xpm +79 -0
- data/samples/treectrl/treectrl.rb +1174 -0
- data/samples/xrc/samples.xrc +46 -0
- data/samples/xrc/xrc_sample.rb +96 -0
- metadata +313 -0
data/samples/aui/aui.rb
ADDED
@@ -0,0 +1,1356 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
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
|
+
|
11
|
+
|
12
|
+
# A resizable control that displays its current size, and, if an AUI
|
13
|
+
# arrangement, its position and layer
|
14
|
+
class SizeReportCtrl < Wx::Control
|
15
|
+
def initialize(parent, id, pos, size, mgr = nil)
|
16
|
+
super(parent, id, pos, size)
|
17
|
+
@mgr = mgr
|
18
|
+
evt_paint { on_paint }
|
19
|
+
evt_size { on_size }
|
20
|
+
end
|
21
|
+
|
22
|
+
def on_paint
|
23
|
+
paint do | dc |
|
24
|
+
size = get_client_size
|
25
|
+
|
26
|
+
dc.set_font Wx::NORMAL_FONT
|
27
|
+
dc.set_brush Wx::WHITE_BRUSH
|
28
|
+
dc.set_pen Wx::WHITE_PEN
|
29
|
+
dc.draw_rectangle(0, 0, size.x, size.y)
|
30
|
+
dc.set_pen Wx::LIGHT_GREY_PEN
|
31
|
+
dc.set_pen Wx::LIGHT_GREY_PEN
|
32
|
+
dc.draw_line(0, 0, size.x, size.y)
|
33
|
+
dc.draw_line(0, size.y, size.x, 0)
|
34
|
+
|
35
|
+
msg = "Size: %d x %d" % [ size.x, size.y ]
|
36
|
+
width, height = dc.get_text_extent(msg)
|
37
|
+
height += 3
|
38
|
+
dc.draw_text(msg,
|
39
|
+
(size.x - width) / 2,
|
40
|
+
(size.y - ( height * 5 ) ) / 2 )
|
41
|
+
|
42
|
+
if @mgr
|
43
|
+
pi = @mgr.get_pane(self)
|
44
|
+
msg = "Layer: %d" % pi.dock_layer
|
45
|
+
width, height = dc.get_text_extent(msg)
|
46
|
+
dc.draw_text(msg,
|
47
|
+
(size.x - width) / 2,
|
48
|
+
( ( size.y - ( height * 5 ) ) / 2 ) + height )
|
49
|
+
|
50
|
+
msg = "Dock: %d Row: %d" % [ pi.dock_direction, pi.dock_row ]
|
51
|
+
width, height = dc.get_text_extent(msg)
|
52
|
+
dc.draw_text(msg,
|
53
|
+
(size.x - width) / 2,
|
54
|
+
( ( size.y - ( height * 5 ) ) / 2) + ( height * 2 ) )
|
55
|
+
|
56
|
+
msg = "Position: %d" % pi.dock_pos
|
57
|
+
width, height = dc.get_text_extent(msg)
|
58
|
+
dc.draw_text(msg,
|
59
|
+
(size.x - width) / 2 ,
|
60
|
+
( ( size.y - ( height * 5 ) ) / 2 ) + ( height * 3 ) )
|
61
|
+
|
62
|
+
msg = "Proportion: %d" % pi.dock_proportion
|
63
|
+
width, height = dc.get_text_extent(msg)
|
64
|
+
dc.draw_text(msg,
|
65
|
+
(size.x - width) / 2 ,
|
66
|
+
( ( size.y - ( height * 5 ) ) / 2 ) + ( height * 4 ) )
|
67
|
+
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def on_size
|
73
|
+
refresh
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
class SettingsPanel < Wx::Panel
|
78
|
+
consts = %w[
|
79
|
+
ID_PaneBorderSize
|
80
|
+
ID_SashSize
|
81
|
+
ID_CaptionSize
|
82
|
+
ID_BackgroundColour
|
83
|
+
ID_SashColour
|
84
|
+
ID_InactiveCaptionColour
|
85
|
+
ID_InactiveCaptionGradientColour
|
86
|
+
ID_InactiveCaptionTextColour
|
87
|
+
ID_ActiveCaptionColour
|
88
|
+
ID_ActiveCaptionGradientColour
|
89
|
+
ID_ActiveCaptionTextColour
|
90
|
+
ID_BorderColour
|
91
|
+
ID_GripperColour ]
|
92
|
+
|
93
|
+
consts.each_with_index do | c, i |
|
94
|
+
const_set(c, 1001 + i)
|
95
|
+
end
|
96
|
+
|
97
|
+
def initialize(parent, frame)
|
98
|
+
super(parent, Wx::ID_ANY)
|
99
|
+
@frame = frame
|
100
|
+
@base_bmp = create_colour_bitmap(Wx::BLACK)
|
101
|
+
|
102
|
+
# set up some spin ctrls for integer variables
|
103
|
+
@border_size, s1 = make_metric_spin_ctrl( ID_PaneBorderSize,
|
104
|
+
"Pane Border Size:",
|
105
|
+
Wx::AUI_DOCKART_PANE_BORDER_SIZE)
|
106
|
+
|
107
|
+
@sash_size, s2 = make_metric_spin_ctrl( ID_SashSize,
|
108
|
+
"Sash Size:",
|
109
|
+
Wx::AUI_DOCKART_SASH_SIZE)
|
110
|
+
|
111
|
+
@cap_size, s3 = make_metric_spin_ctrl( ID_CaptionSize,
|
112
|
+
"Caption Size:",
|
113
|
+
Wx::AUI_DOCKART_CAPTION_SIZE)
|
114
|
+
|
115
|
+
# colour controls
|
116
|
+
@bckg_colour, s4 = make_colour_button( ID_BackgroundColour,
|
117
|
+
"Background Colour:")
|
118
|
+
@sash_colour, s5 = make_colour_button( ID_SashColour,
|
119
|
+
"Sash Colour:")
|
120
|
+
@capt_colour, s6 = make_colour_button( ID_InactiveCaptionColour,
|
121
|
+
"Normal Caption:")
|
122
|
+
@capt_gradnt, s7 = make_colour_button( ID_InactiveCaptionGradientColour,
|
123
|
+
"Normal Caption Gradient:")
|
124
|
+
@capt_text, s8 = make_colour_button( ID_InactiveCaptionTextColour,
|
125
|
+
"Normal Caption Text:")
|
126
|
+
@acap_colour, s9 = make_colour_button( ID_ActiveCaptionColour,
|
127
|
+
"Active Caption:")
|
128
|
+
@acap_gradnt, s10 = make_colour_button( ID_ActiveCaptionGradientColour,
|
129
|
+
"Active Caption Gradient:")
|
130
|
+
@acap_text, s11 = make_colour_button( ID_ActiveCaptionTextColour,
|
131
|
+
"Active Caption Text:")
|
132
|
+
@brdr_colour, s12 = make_colour_button( ID_BorderColour,
|
133
|
+
"Border Colour:")
|
134
|
+
@grip_colour, s13 = make_colour_button( ID_GripperColour,
|
135
|
+
"Gripper Colour:")
|
136
|
+
|
137
|
+
|
138
|
+
grid_sizer = Wx::GridSizer.new(2)
|
139
|
+
grid_sizer.set_h_gap(5)
|
140
|
+
|
141
|
+
grid_sizer.add(s1); grid_sizer.add(s4)
|
142
|
+
grid_sizer.add(s2); grid_sizer.add(s5)
|
143
|
+
grid_sizer.add(s3); grid_sizer.add(s13)
|
144
|
+
grid_sizer.add(1,1); grid_sizer.add(s12)
|
145
|
+
grid_sizer.add(s6); grid_sizer.add(s9)
|
146
|
+
grid_sizer.add(s7); grid_sizer.add(s10)
|
147
|
+
grid_sizer.add(s8); grid_sizer.add(s11)
|
148
|
+
|
149
|
+
cont_sizer =Wx::BoxSizer.new(Wx::VERTICAL)
|
150
|
+
cont_sizer.add(grid_sizer, 1, Wx::EXPAND|Wx::ALL, 5)
|
151
|
+
self.set_sizer(cont_sizer)
|
152
|
+
get_sizer.set_size_hints(self)
|
153
|
+
update_colours
|
154
|
+
|
155
|
+
evt_spinctrl(ID_PaneBorderSize) { | e | on_pane_border_size(e) }
|
156
|
+
evt_spinctrl(ID_SashSize) { | e | on_sash_size(e) }
|
157
|
+
evt_spinctrl(ID_CaptionSize) { | e | on_caption_size(e) }
|
158
|
+
evt_button(ID_BackgroundColour) { | e | on_set_colour(e) }
|
159
|
+
evt_button(ID_SashColour) { | e | on_set_colour(e) }
|
160
|
+
evt_button(ID_InactiveCaptionColour) { | e | on_set_colour(e) }
|
161
|
+
evt_button(ID_InactiveCaptionGradientColour) { | e | on_set_colour(e) }
|
162
|
+
evt_button(ID_InactiveCaptionTextColour) { | e | on_set_colour(e) }
|
163
|
+
evt_button(ID_ActiveCaptionColour) { | e | on_set_colour(e) }
|
164
|
+
evt_button(ID_ActiveCaptionGradientColour) { | e | on_set_colour(e) }
|
165
|
+
evt_button(ID_ActiveCaptionTextColour) { | e | on_set_colour(e) }
|
166
|
+
evt_button(ID_BorderColour) { | e | on_set_colour(e) }
|
167
|
+
evt_button(ID_GripperColour) { | e | on_set_colour(e) }
|
168
|
+
end
|
169
|
+
|
170
|
+
|
171
|
+
def update_colours()
|
172
|
+
art = @frame.get_dock_art
|
173
|
+
|
174
|
+
col = art.get_color(Wx::AUI_DOCKART_BACKGROUND_COLOUR)
|
175
|
+
@bckg_colour.set_bitmap_label( create_colour_bitmap(col) )
|
176
|
+
|
177
|
+
col = art.get_color(Wx::AUI_DOCKART_SASH_COLOUR)
|
178
|
+
@sash_colour.set_bitmap_label( create_colour_bitmap(col) )
|
179
|
+
|
180
|
+
col = art.get_color(Wx::AUI_DOCKART_INACTIVE_CAPTION_COLOUR)
|
181
|
+
@capt_colour.set_bitmap_label( create_colour_bitmap(col) )
|
182
|
+
|
183
|
+
col = art.get_color(Wx::AUI_DOCKART_INACTIVE_CAPTION_GRADIENT_COLOUR)
|
184
|
+
@capt_gradnt.set_bitmap_label( create_colour_bitmap(col) )
|
185
|
+
|
186
|
+
col = art.get_color(Wx::AUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR)
|
187
|
+
@capt_text.set_bitmap_label( create_colour_bitmap(col) )
|
188
|
+
|
189
|
+
col = art.get_color(Wx::AUI_DOCKART_ACTIVE_CAPTION_COLOUR)
|
190
|
+
@acap_colour.set_bitmap_label( create_colour_bitmap(col) )
|
191
|
+
|
192
|
+
col = art.get_color(Wx::AUI_DOCKART_ACTIVE_CAPTION_GRADIENT_COLOUR)
|
193
|
+
@acap_gradnt.set_bitmap_label( create_colour_bitmap(col) )
|
194
|
+
|
195
|
+
col = art.get_color(Wx::AUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR)
|
196
|
+
@acap_text.set_bitmap_label( create_colour_bitmap(col) )
|
197
|
+
|
198
|
+
col = art.get_color(Wx::AUI_DOCKART_SASH_COLOUR)
|
199
|
+
@brdr_colour.set_bitmap_label( create_colour_bitmap(col) )
|
200
|
+
|
201
|
+
col = art.get_color(Wx::AUI_DOCKART_GRIPPER_COLOUR)
|
202
|
+
@grip_colour.set_bitmap_label( create_colour_bitmap(col) )
|
203
|
+
end
|
204
|
+
|
205
|
+
def on_pane_border_size(event)
|
206
|
+
@frame.get_dock_art.set_metric( Wx::AUI_DOCKART_PANE_BORDER_SIZE,
|
207
|
+
event.get_position )
|
208
|
+
@frame.do_update
|
209
|
+
end
|
210
|
+
|
211
|
+
def on_sash_size(event)
|
212
|
+
@frame.get_dock_art.set_metric( Wx::AUI_DOCKART_SASH_SIZE,
|
213
|
+
event.get_position )
|
214
|
+
@frame.do_update
|
215
|
+
end
|
216
|
+
|
217
|
+
def on_caption_size(event)
|
218
|
+
@frame.get_dock_art.set_metric( Wx::AUI_DOCKART_CAPTION_SIZE,
|
219
|
+
event.get_position )
|
220
|
+
@frame.do_update
|
221
|
+
end
|
222
|
+
|
223
|
+
def on_set_colour(event)
|
224
|
+
dlg = Wx::ColourDialog.new(@frame)
|
225
|
+
dlg.set_title("Colour Picker")
|
226
|
+
|
227
|
+
return unless dlg.show_modal == Wx::ID_OK
|
228
|
+
|
229
|
+
var = nil
|
230
|
+
case event.get_id()
|
231
|
+
when ID_BackgroundColour
|
232
|
+
var = Wx::AUI_DOCKART_BACKGROUND_COLOUR
|
233
|
+
when ID_SashColour
|
234
|
+
var = Wx::AUI_DOCKART_SASH_COLOUR
|
235
|
+
when ID_InactiveCaptionColour
|
236
|
+
var = Wx::AUI_DOCKART_INACTIVE_CAPTION_COLOUR
|
237
|
+
when ID_InactiveCaptionGradientColour
|
238
|
+
var = Wx::AUI_DOCKART_INACTIVE_CAPTION_GRADIENT_COLOUR
|
239
|
+
when ID_InactiveCaptionTextColour
|
240
|
+
var = Wx::AUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR
|
241
|
+
when ID_ActiveCaptionColour
|
242
|
+
var = Wx::AUI_DOCKART_ACTIVE_CAPTION_COLOUR
|
243
|
+
when ID_ActiveCaptionGradientColour
|
244
|
+
var = Wx::AUI_DOCKART_ACTIVE_CAPTION_GRADIENT_COLOUR
|
245
|
+
when ID_ActiveCaptionTextColour
|
246
|
+
var = Wx::AUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR
|
247
|
+
when ID_BorderColour
|
248
|
+
var = Wx::AUI_DOCKART_BORDER_COLOUR
|
249
|
+
when ID_GripperColour
|
250
|
+
var = Wx::AUI_DOCKART_GRIPPER_COLOUR
|
251
|
+
else
|
252
|
+
return
|
253
|
+
end
|
254
|
+
|
255
|
+
@frame.get_dock_art.set_colour(var, dlg.get_colour_data.get_colour )
|
256
|
+
@frame.do_update
|
257
|
+
update_colours
|
258
|
+
end
|
259
|
+
|
260
|
+
private
|
261
|
+
def make_metric_spin_ctrl(an_id, caption, metric)
|
262
|
+
metric_val = @frame.get_dock_art.get_metric(metric)
|
263
|
+
sp = Wx::SpinCtrl.new( self, an_id, metric_val.to_s,
|
264
|
+
Wx::DEFAULT_POSITION,
|
265
|
+
Wx::Size.new(50, 20),
|
266
|
+
Wx::SP_ARROW_KEYS,
|
267
|
+
0, 100, metric_val)
|
268
|
+
|
269
|
+
sz = Wx::BoxSizer.new(Wx::HORIZONTAL)
|
270
|
+
sz.add(1, 1, 1, Wx::EXPAND)
|
271
|
+
sz.add( Wx::StaticText.new(self, Wx::ID_ANY, caption) )
|
272
|
+
sz.add(sp)
|
273
|
+
sz.add(1, 1, 1, Wx::EXPAND)
|
274
|
+
sz.set_item_min_size(1, 180, 20)
|
275
|
+
return sp, sz
|
276
|
+
end
|
277
|
+
|
278
|
+
# utility to make a little captioned button;
|
279
|
+
# returns the button and a sizer containing the button and caption
|
280
|
+
def make_colour_button(an_id, caption)
|
281
|
+
bmp_butt = Wx::BitmapButton.new( self, an_id, @base_bmp,
|
282
|
+
Wx::DEFAULT_POSITION,
|
283
|
+
Wx::Size.new(50, 25) )
|
284
|
+
|
285
|
+
sz = Wx::BoxSizer.new(Wx::HORIZONTAL)
|
286
|
+
sz.add(1, 1, 1, Wx::EXPAND)
|
287
|
+
sz.add( Wx::StaticText.new(self, Wx::ID_ANY, caption) )
|
288
|
+
sz.add(bmp_butt)
|
289
|
+
sz.add(1, 1, 1, Wx::EXPAND)
|
290
|
+
sz.set_item_min_size(1, 180, 20)
|
291
|
+
return bmp_butt, sz
|
292
|
+
end
|
293
|
+
|
294
|
+
# returns a 25 x 14 image with solid colour +colour+, with a 1-pixel
|
295
|
+
# black border
|
296
|
+
def create_colour_bitmap(colour)
|
297
|
+
img = Wx::Image.new(25, 14)
|
298
|
+
0.upto(24) do | x |
|
299
|
+
0.upto(13) do | y |
|
300
|
+
if (x == 0 || x == 24 || y == 0 || y == 13)
|
301
|
+
pixcol = Wx::BLACK
|
302
|
+
else
|
303
|
+
pixcol = colour
|
304
|
+
end
|
305
|
+
img.set_rgb(x, y, pixcol.red, pixcol.green, pixcol.blue)
|
306
|
+
end
|
307
|
+
end
|
308
|
+
return Wx::Bitmap.new(img)
|
309
|
+
end
|
310
|
+
end
|
311
|
+
|
312
|
+
|
313
|
+
class AuiFrame < Wx::Frame
|
314
|
+
consts = %w[
|
315
|
+
ID_CreateTree
|
316
|
+
ID_CreateGrid
|
317
|
+
ID_CreateText
|
318
|
+
ID_CreateHTML
|
319
|
+
ID_CreateNotebook
|
320
|
+
ID_CreateSizeReport
|
321
|
+
ID_GridContent
|
322
|
+
ID_TextContent
|
323
|
+
ID_TreeContent
|
324
|
+
ID_HTMLContent
|
325
|
+
ID_NotebookContent
|
326
|
+
ID_SizeReportContent
|
327
|
+
ID_CreatePerspective
|
328
|
+
ID_CopyPerspectiveCode
|
329
|
+
ID_AllowFloating
|
330
|
+
ID_AllowActivePane
|
331
|
+
ID_TransparentHint
|
332
|
+
ID_VenetianBlindsHint
|
333
|
+
ID_RectangleHint
|
334
|
+
ID_NoHint
|
335
|
+
ID_HintFade
|
336
|
+
ID_NoVenetianFade
|
337
|
+
ID_TransparentDrag
|
338
|
+
ID_NoGradient
|
339
|
+
ID_VerticalGradient
|
340
|
+
ID_HorizontalGradient
|
341
|
+
ID_Settings
|
342
|
+
ID_NotebookNoCloseButton
|
343
|
+
ID_NotebookCloseButton
|
344
|
+
ID_NotebookCloseButtonAll
|
345
|
+
ID_NotebookCloseButtonActive
|
346
|
+
ID_NotebookAllowTabMove
|
347
|
+
ID_NotebookAllowTabExternalMove
|
348
|
+
ID_NotebookAllowTabSplit
|
349
|
+
ID_NotebookWindowList
|
350
|
+
ID_NotebookScrollButtons
|
351
|
+
ID_NotebookTabFixedWidth
|
352
|
+
ID_NotebookArtGloss
|
353
|
+
ID_NotebookArtSimple ]
|
354
|
+
|
355
|
+
consts.each_with_index do | c, i |
|
356
|
+
const_set(c, 2000 + i)
|
357
|
+
end
|
358
|
+
ID_FirstPerspective = ID_CreatePerspective + 1000
|
359
|
+
|
360
|
+
def initialize(*args)
|
361
|
+
super
|
362
|
+
@mgr = Wx::AuiManager.new
|
363
|
+
@mgr.set_managed_window(self)
|
364
|
+
@perspectives = []
|
365
|
+
|
366
|
+
# set up default notebook style
|
367
|
+
@notebook_style = Wx::AUI_NB_DEFAULT_STYLE|
|
368
|
+
Wx::AUI_NB_TAB_EXTERNAL_MOVE|Wx::NO_BORDER
|
369
|
+
@notebook_theme = 0
|
370
|
+
setup_menu
|
371
|
+
create_status_bar
|
372
|
+
get_status_bar.set_status_text("Ready")
|
373
|
+
set_min_size( Wx::Size.new(400,300) )
|
374
|
+
setup_toolbars
|
375
|
+
setup_panes
|
376
|
+
setup_perspectives
|
377
|
+
setup_events
|
378
|
+
@mgr.update
|
379
|
+
end
|
380
|
+
|
381
|
+
#
|
382
|
+
def setup_menu
|
383
|
+
mb = Wx::MenuBar.new
|
384
|
+
|
385
|
+
file_menu = Wx::Menu.new
|
386
|
+
file_menu.append(Wx::ID_EXIT, "Exit")
|
387
|
+
|
388
|
+
view_menu = Wx::Menu.new
|
389
|
+
view_menu.append(ID_CreateText, "Create Text Control")
|
390
|
+
view_menu.append(ID_CreateHTML, "Create HTML Control")
|
391
|
+
view_menu.append(ID_CreateTree, "Create Tree")
|
392
|
+
view_menu.append(ID_CreateGrid, "Create Grid")
|
393
|
+
view_menu.append(ID_CreateNotebook, "Create Notebook")
|
394
|
+
view_menu.append(ID_CreateSizeReport, "Create Size Reporter")
|
395
|
+
view_menu.append_separator
|
396
|
+
|
397
|
+
view_menu.append( ID_GridContent,
|
398
|
+
"Use a Grid for the Content Pane")
|
399
|
+
view_menu.append( ID_TextContent,
|
400
|
+
"Use a Text Control for the Content Pane")
|
401
|
+
view_menu.append( ID_HTMLContent,
|
402
|
+
"Use an HTML Control for the Content Pane")
|
403
|
+
view_menu.append( ID_TreeContent,
|
404
|
+
"Use a Tree Control for the Content Pane")
|
405
|
+
view_menu.append( ID_NotebookContent,
|
406
|
+
"Use a wxAuiNotebook control for the Content Pane")
|
407
|
+
view_menu.append(ID_SizeReportContent,
|
408
|
+
"Use a Size Reporter for the Content Pane")
|
409
|
+
|
410
|
+
options_menu = Wx::Menu.new
|
411
|
+
# Hints
|
412
|
+
options_menu.append_radio_item( ID_TransparentHint,
|
413
|
+
"Transparent Hint")
|
414
|
+
options_menu.append_radio_item( ID_VenetianBlindsHint,
|
415
|
+
"Venetian Blinds Hint")
|
416
|
+
options_menu.append_radio_item( ID_RectangleHint,
|
417
|
+
"Rectangle Hint")
|
418
|
+
options_menu.append_radio_item( ID_NoHint,
|
419
|
+
"No Hint")
|
420
|
+
|
421
|
+
options_menu.append_separator
|
422
|
+
# Hints Options
|
423
|
+
options_menu.append_check_item( ID_HintFade,
|
424
|
+
"Hint Fade-in")
|
425
|
+
options_menu.append_check_item( ID_AllowFloating,
|
426
|
+
"Allow Floating")
|
427
|
+
options_menu.append_check_item( ID_NoVenetianFade,
|
428
|
+
"Disable Venetian Blinds Hint Fade-in")
|
429
|
+
options_menu.append_check_item( ID_TransparentDrag,
|
430
|
+
"Transparent Drag")
|
431
|
+
options_menu.append_check_item( ID_AllowActivePane,
|
432
|
+
"Allow Active Pane")
|
433
|
+
options_menu.append_separator
|
434
|
+
options_menu.append_radio_item( ID_NoGradient,
|
435
|
+
"No Caption Gradient")
|
436
|
+
options_menu.append_radio_item( ID_VerticalGradient,
|
437
|
+
"Vertical Caption Gradient")
|
438
|
+
options_menu.append_radio_item( ID_HorizontalGradient,
|
439
|
+
"Horizontal Caption Gradient")
|
440
|
+
options_menu.append_separator
|
441
|
+
options_menu.append(ID_Settings, "Settings Pane")
|
442
|
+
|
443
|
+
notebook_menu = Wx::Menu.new
|
444
|
+
notebook_menu.append_radio_item( ID_NotebookArtGloss,
|
445
|
+
"Glossy Theme (Default)")
|
446
|
+
notebook_menu.append_radio_item( ID_NotebookArtSimple,
|
447
|
+
"Simple Theme")
|
448
|
+
|
449
|
+
notebook_menu.append_separator
|
450
|
+
|
451
|
+
notebook_menu.append_radio_item( ID_NotebookNoCloseButton,
|
452
|
+
"No Close Button")
|
453
|
+
notebook_menu.append_radio_item( ID_NotebookCloseButton,
|
454
|
+
"Close Button at Right")
|
455
|
+
notebook_menu.append_radio_item( ID_NotebookCloseButtonAll,
|
456
|
+
"Close Button on All Tabs")
|
457
|
+
notebook_menu.append_radio_item( ID_NotebookCloseButtonActive,
|
458
|
+
"Close Button on Active Tab")
|
459
|
+
|
460
|
+
notebook_menu.append_separator
|
461
|
+
notebook_menu.append_check_item( ID_NotebookAllowTabMove,
|
462
|
+
"Allow Tab Move")
|
463
|
+
notebook_menu.append_check_item( ID_NotebookAllowTabExternalMove,
|
464
|
+
"Allow External Tab Move")
|
465
|
+
notebook_menu.append_check_item( ID_NotebookAllowTabSplit,
|
466
|
+
"Allow Notebook Split")
|
467
|
+
notebook_menu.append_check_item( ID_NotebookScrollButtons,
|
468
|
+
"Scroll Buttons Visible")
|
469
|
+
notebook_menu.append_check_item( ID_NotebookWindowList,
|
470
|
+
"Window List Button Visible")
|
471
|
+
notebook_menu.append_check_item( ID_NotebookTabFixedWidth,
|
472
|
+
"Fixed-width Tabs")
|
473
|
+
|
474
|
+
@perspectives_menu = Wx::Menu.new
|
475
|
+
@perspectives_menu.append( ID_CreatePerspective,
|
476
|
+
"Create Perspective")
|
477
|
+
@perspectives_menu.append( ID_CopyPerspectiveCode,
|
478
|
+
"Copy Perspective Data To Clipboard")
|
479
|
+
@perspectives_menu.append_separator
|
480
|
+
@perspectives_menu.append( ID_FirstPerspective + 0, "Default Startup")
|
481
|
+
@perspectives_menu.append( ID_FirstPerspective + 1, "All Panes")
|
482
|
+
|
483
|
+
help_menu = Wx::Menu.new
|
484
|
+
help_menu.append(Wx::ID_ABOUT, "About...")
|
485
|
+
|
486
|
+
mb.append(file_menu, "File")
|
487
|
+
mb.append(view_menu, "View")
|
488
|
+
mb.append(@perspectives_menu, "Perspectives")
|
489
|
+
mb.append(options_menu, "Options")
|
490
|
+
mb.append(notebook_menu, "Notebook")
|
491
|
+
mb.append(help_menu, "Help")
|
492
|
+
|
493
|
+
set_menu_bar(mb)
|
494
|
+
end
|
495
|
+
|
496
|
+
def setup_events
|
497
|
+
evt_erase_background { | e | on_erase_background(e) }
|
498
|
+
evt_size{ | e | on_size(e) }
|
499
|
+
|
500
|
+
evt_menu(ID_CreateTree) { | e | on_create_tree }
|
501
|
+
evt_menu(ID_CreateGrid) { | e | on_create_grid }
|
502
|
+
evt_menu(ID_CreateText) { | e | on_create_text }
|
503
|
+
evt_menu(ID_CreateHTML) { | e | on_create_html }
|
504
|
+
evt_menu(ID_CreateSizeReport) { | e | on_create_size_report }
|
505
|
+
evt_menu(ID_CreateNotebook) { | e | on_create_notebook }
|
506
|
+
evt_menu(ID_CreatePerspective) { | e | on_create_perspective }
|
507
|
+
evt_menu(ID_CopyPerspectiveCode) { | e | on_copy_perspective_code}
|
508
|
+
evt_menu(ID_AllowFloating) { | e | on_manager_flag(e) }
|
509
|
+
evt_menu(ID_TransparentHint) { | e | on_manager_flag(e) }
|
510
|
+
evt_menu(ID_VenetianBlindsHint) { | e | on_manager_flag(e) }
|
511
|
+
evt_menu(ID_RectangleHint) { | e | on_manager_flag(e) }
|
512
|
+
evt_menu(ID_NoHint) { | e | on_manager_flag(e) }
|
513
|
+
evt_menu(ID_HintFade) { | e | on_manager_flag(e) }
|
514
|
+
evt_menu(ID_NoVenetianFade) { | e | on_manager_flag(e) }
|
515
|
+
evt_menu(ID_TransparentDrag) { | e | on_manager_flag(e) }
|
516
|
+
evt_menu(ID_AllowActivePane) { | e | on_manager_flag(e) }
|
517
|
+
evt_menu(ID_NotebookTabFixedWidth) { | e | on_notebook_flag(e) }
|
518
|
+
evt_menu(ID_NotebookNoCloseButton) { | e | on_notebook_flag(e) }
|
519
|
+
evt_menu(ID_NotebookCloseButton) { | e | on_notebook_flag(e) }
|
520
|
+
evt_menu(ID_NotebookCloseButtonAll) { | e | on_notebook_flag(e) }
|
521
|
+
evt_menu(ID_NotebookCloseButtonActive) { | e | on_notebook_flag(e) }
|
522
|
+
evt_menu(ID_NotebookAllowTabMove) { | e | on_notebook_flag(e) }
|
523
|
+
evt_menu(ID_NotebookAllowTabExternalMove) { | e | on_notebook_flag(e) }
|
524
|
+
evt_menu(ID_NotebookAllowTabSplit) { | e | on_notebook_flag(e) }
|
525
|
+
evt_menu(ID_NotebookScrollButtons) { | e | on_notebook_flag(e) }
|
526
|
+
evt_menu(ID_NotebookWindowList) { | e | on_notebook_flag(e) }
|
527
|
+
evt_menu(ID_NotebookArtGloss) { | e | on_notebook_flag(e) }
|
528
|
+
evt_menu(ID_NotebookArtSimple) { | e | on_notebook_flag(e) }
|
529
|
+
evt_menu(ID_NoGradient) { | e | on_gradient(e) }
|
530
|
+
evt_menu(ID_VerticalGradient) { | e | on_gradient(e) }
|
531
|
+
evt_menu(ID_HorizontalGradient) { | e | on_gradient(e) }
|
532
|
+
evt_menu(ID_Settings) { on_settings }
|
533
|
+
evt_menu(ID_GridContent) { | e | on_change_content_pane(e) }
|
534
|
+
evt_menu(ID_TreeContent) { | e | on_change_content_pane(e) }
|
535
|
+
evt_menu(ID_TextContent) { | e | on_change_content_pane(e) }
|
536
|
+
evt_menu(ID_SizeReportContent) { | e | on_change_content_pane(e) }
|
537
|
+
evt_menu(ID_HTMLContent) { | e | on_change_content_pane(e) }
|
538
|
+
evt_menu(ID_NotebookContent) { | e | on_change_content_pane(e) }
|
539
|
+
evt_menu(Wx::ID_EXIT) { | e | on_exit }
|
540
|
+
evt_menu(Wx::ID_ABOUT) { | e | on_about }
|
541
|
+
evt_update_ui(ID_NotebookTabFixedWidth) { | e | on_update_ui(e) }
|
542
|
+
evt_update_ui(ID_NotebookNoCloseButton) { | e | on_update_ui(e) }
|
543
|
+
evt_update_ui(ID_NotebookCloseButton) { | e | on_update_ui(e) }
|
544
|
+
evt_update_ui(ID_NotebookCloseButtonAll) { | e | on_update_ui(e) }
|
545
|
+
evt_update_ui(ID_NotebookCloseButtonActive) { | e | on_update_ui(e) }
|
546
|
+
evt_update_ui(ID_NotebookAllowTabMove) { | e | on_update_ui(e) }
|
547
|
+
evt_update_ui(ID_NotebookAllowTabExternalMove) { | e | on_update_ui(e) }
|
548
|
+
evt_update_ui(ID_NotebookAllowTabSplit) { | e | on_update_ui(e) }
|
549
|
+
evt_update_ui(ID_NotebookScrollButtons) { | e | on_update_ui(e) }
|
550
|
+
evt_update_ui(ID_NotebookWindowList) { | e | on_update_ui(e) }
|
551
|
+
evt_update_ui(ID_AllowFloating) { | e | on_update_ui(e) }
|
552
|
+
evt_update_ui(ID_TransparentHint) { | e | on_update_ui(e) }
|
553
|
+
evt_update_ui(ID_VenetianBlindsHint) { | e | on_update_ui(e) }
|
554
|
+
evt_update_ui(ID_RectangleHint) { | e | on_update_ui(e) }
|
555
|
+
evt_update_ui(ID_NoHint) { | e | on_update_ui(e) }
|
556
|
+
evt_update_ui(ID_HintFade) { | e | on_update_ui(e) }
|
557
|
+
evt_update_ui(ID_NoVenetianFade) { | e | on_update_ui(e) }
|
558
|
+
evt_update_ui(ID_TransparentDrag) { | e | on_update_ui(e) }
|
559
|
+
evt_update_ui(ID_NoGradient) { | e | on_update_ui(e) }
|
560
|
+
evt_update_ui(ID_VerticalGradient) { | e | on_update_ui(e) }
|
561
|
+
evt_update_ui(ID_HorizontalGradient) { | e | on_update_ui(e) }
|
562
|
+
evt_menu_range( ID_FirstPerspective,
|
563
|
+
ID_FirstPerspective +
|
564
|
+
@perspectives.length) { | e | on_restore_perspective(e) }
|
565
|
+
evt_aui_pane_close { | e | on_pane_close(e) }
|
566
|
+
evt_auinotebook_page_close(Wx::ID_ANY) { | e | on_notebook_page_close(e) }
|
567
|
+
end
|
568
|
+
|
569
|
+
# create some toolbars
|
570
|
+
def setup_toolbars
|
571
|
+
tb1 = Wx::ToolBar.new( self, Wx::ID_ANY,
|
572
|
+
Wx::DEFAULT_POSITION,
|
573
|
+
Wx::DEFAULT_SIZE,
|
574
|
+
Wx::TB_FLAT|Wx::TB_NODIVIDER)
|
575
|
+
tb1.set_tool_bitmap_size( Wx::Size.new(48,48) )
|
576
|
+
tb1.add_tool( 101, "Test",
|
577
|
+
Wx::ArtProvider::get_bitmap(Wx::ART_ERROR) )
|
578
|
+
tb1.add_separator
|
579
|
+
tb1.add_tool( 102, "Test",
|
580
|
+
Wx::ArtProvider::get_bitmap(Wx::ART_QUESTION) )
|
581
|
+
tb1.add_tool( 103, "Test",
|
582
|
+
Wx::ArtProvider::get_bitmap(Wx::ART_INFORMATION) )
|
583
|
+
tb1.add_tool( 103, "Test",
|
584
|
+
Wx::ArtProvider::get_bitmap(Wx::ART_WARNING));
|
585
|
+
tb1.add_tool( 103, "Test",
|
586
|
+
Wx::ArtProvider::get_bitmap(Wx::ART_MISSING_IMAGE));
|
587
|
+
tb1.realize
|
588
|
+
|
589
|
+
|
590
|
+
tb2 = Wx::ToolBar.new( self, Wx::ID_ANY, Wx::DEFAULT_POSITION,
|
591
|
+
Wx::DEFAULT_SIZE,
|
592
|
+
Wx::TB_FLAT|Wx::TB_NODIVIDER )
|
593
|
+
tb2.set_tool_bitmap_size( Wx::Size.new(16,16) )
|
594
|
+
|
595
|
+
tb2_bmp1 = Wx::ArtProvider::get_bitmap( Wx::ART_QUESTION,
|
596
|
+
Wx::ART_OTHER,
|
597
|
+
Wx::Size.new(16,16) )
|
598
|
+
tb2.add_tool(101, "Test", tb2_bmp1);
|
599
|
+
tb2.add_tool(101, "Test", tb2_bmp1);
|
600
|
+
tb2.add_tool(101, "Test", tb2_bmp1);
|
601
|
+
tb2.add_tool(101, "Test", tb2_bmp1);
|
602
|
+
tb2.add_separator
|
603
|
+
tb2.add_tool(101, "Test", tb2_bmp1);
|
604
|
+
tb2.add_tool(101, "Test", tb2_bmp1);
|
605
|
+
tb2.add_separator
|
606
|
+
tb2.add_tool(101, "Test", tb2_bmp1);
|
607
|
+
tb2.add_tool(101, "Test", tb2_bmp1);
|
608
|
+
tb2.add_tool(101, "Test", tb2_bmp1);
|
609
|
+
tb2.add_tool(101, "Test", tb2_bmp1);
|
610
|
+
tb2.realize
|
611
|
+
|
612
|
+
|
613
|
+
tb3 = Wx::ToolBar.new(self, Wx::ID_ANY,
|
614
|
+
Wx::DEFAULT_POSITION, Wx::DEFAULT_SIZE,
|
615
|
+
Wx::TB_FLAT|Wx::TB_NODIVIDER)
|
616
|
+
tb3.set_tool_bitmap_size( Wx::Size.new(16,16) )
|
617
|
+
tb3_bmp1 = Wx::ArtProvider::get_bitmap( Wx::ART_FOLDER,
|
618
|
+
Wx::ART_OTHER,
|
619
|
+
Wx::Size.new(16,16) )
|
620
|
+
tb3.add_tool(101, "Test", tb3_bmp1)
|
621
|
+
tb3.add_tool(101, "Test", tb3_bmp1)
|
622
|
+
tb3.add_tool(101, "Test", tb3_bmp1)
|
623
|
+
tb3.add_tool(101, "Test", tb3_bmp1)
|
624
|
+
tb3.add_separator
|
625
|
+
tb3.add_tool(101, "Test", tb3_bmp1)
|
626
|
+
tb3.add_tool(101, "Test", tb3_bmp1)
|
627
|
+
tb3.realize
|
628
|
+
|
629
|
+
|
630
|
+
tb4 = Wx::ToolBar.new( self, Wx::ID_ANY,
|
631
|
+
Wx::DEFAULT_POSITION, Wx::DEFAULT_SIZE,
|
632
|
+
Wx::TB_FLAT|Wx::TB_NODIVIDER|Wx::TB_HORZ_TEXT)
|
633
|
+
tb4.set_tool_bitmap_size( Wx::Size.new(16, 16) )
|
634
|
+
tb4_bmp1 = Wx::ArtProvider::get_bitmap( Wx::ART_NORMAL_FILE,
|
635
|
+
Wx::ART_OTHER,
|
636
|
+
Wx::Size.new(16, 16) )
|
637
|
+
tb4.add_tool(101, "Item 1", tb4_bmp1)
|
638
|
+
tb4.add_tool(101, "Item 2", tb4_bmp1)
|
639
|
+
tb4.add_tool(101, "Item 3", tb4_bmp1)
|
640
|
+
tb4.add_tool(101, "Item 4", tb4_bmp1)
|
641
|
+
tb4.add_separator
|
642
|
+
tb4.add_tool(101, "Item 5", tb4_bmp1)
|
643
|
+
tb4.add_tool(101, "Item 6", tb4_bmp1)
|
644
|
+
tb4.add_tool(101, "Item 7", tb4_bmp1)
|
645
|
+
tb4.add_tool(101, "Item 8", tb4_bmp1)
|
646
|
+
tb4.realize
|
647
|
+
|
648
|
+
# create some toolbars
|
649
|
+
tb5 = Wx::ToolBar.new( self, Wx::ID_ANY,
|
650
|
+
Wx::DEFAULT_POSITION, Wx::DEFAULT_SIZE,
|
651
|
+
Wx::TB_FLAT|Wx::TB_NODIVIDER|Wx::TB_VERTICAL)
|
652
|
+
tb5.set_tool_bitmap_size( Wx::Size.new(48,48))
|
653
|
+
tb5.add_tool( 101, "Test",
|
654
|
+
Wx::ArtProvider::get_bitmap(Wx::ART_ERROR) )
|
655
|
+
tb5.add_separator
|
656
|
+
tb5.add_tool( 102, "Test",
|
657
|
+
Wx::ArtProvider::get_bitmap(Wx::ART_QUESTION) )
|
658
|
+
tb5.add_tool( 103, "Test",
|
659
|
+
Wx::ArtProvider::get_bitmap(Wx::ART_INFORMATION) )
|
660
|
+
tb5.add_tool( 103, "Test",
|
661
|
+
Wx::ArtProvider::get_bitmap(Wx::ART_WARNING) )
|
662
|
+
tb5.add_tool( 103, "Test",
|
663
|
+
Wx::ArtProvider::get_bitmap(Wx::ART_MISSING_IMAGE) )
|
664
|
+
tb5.realize
|
665
|
+
|
666
|
+
# add the toolbars to the manager
|
667
|
+
pi = Wx::AuiPaneInfo.new
|
668
|
+
pi.set_name('tb1').set_caption("Big Toolbar").toolbar_pane
|
669
|
+
pi.top.set_left_dockable(false).set_right_dockable(false)
|
670
|
+
@mgr.add_pane(tb1, pi)
|
671
|
+
|
672
|
+
|
673
|
+
pi = Wx::AuiPaneInfo.new
|
674
|
+
pi.set_name('tb2').set_caption("Toolbar 2").toolbar_pane
|
675
|
+
pi.top.set_row(1)
|
676
|
+
pi.set_left_dockable(false).set_right_dockable(false)
|
677
|
+
@mgr.add_pane(tb2, pi)
|
678
|
+
|
679
|
+
pi = Wx::AuiPaneInfo.new
|
680
|
+
pi.set_name('tb3').set_caption("Toolbar 3").toolbar_pane
|
681
|
+
pi.top.set_row(1).set_position(1)
|
682
|
+
pi.set_left_dockable(false).set_right_dockable(false)
|
683
|
+
@mgr.add_pane(tb3, pi)
|
684
|
+
|
685
|
+
pi = Wx::AuiPaneInfo.new
|
686
|
+
pi.set_name('tb4').set_caption("Sample Bookmark Toolbar")
|
687
|
+
pi.toolbar_pane.top.set_row(2)
|
688
|
+
pi.set_left_dockable(false).set_right_dockable(false)
|
689
|
+
@mgr.add_pane(tb4, pi)
|
690
|
+
|
691
|
+
pi = Wx::AuiPaneInfo.new
|
692
|
+
pi.set_name('tb5').set_caption("Sample Vertical Toolbar")
|
693
|
+
pi.toolbar_pane.left.set_gripper_top
|
694
|
+
pi.set_left_dockable(false).set_right_dockable(false)
|
695
|
+
@mgr.add_pane(tb5, pi)
|
696
|
+
end
|
697
|
+
|
698
|
+
def setup_panes
|
699
|
+
# add a bunch of panes
|
700
|
+
pi = Wx::AuiPaneInfo.new
|
701
|
+
pi.set_name('test1').set_caption('Pane Caption').top
|
702
|
+
@mgr.add_pane(create_size_report_ctrl, pi)
|
703
|
+
|
704
|
+
pi = Wx::AuiPaneInfo.new
|
705
|
+
pi.set_name('test2').set_caption('Client Size Reporter').bottom
|
706
|
+
pi.set_position(1).set_close_button.set_maximize_button
|
707
|
+
@mgr.add_pane(create_size_report_ctrl, pi)
|
708
|
+
|
709
|
+
pi = Wx::AuiPaneInfo.new
|
710
|
+
pi.set_name('test3').set_caption('Client Size Reporter').bottom
|
711
|
+
pi.set_close_button.set_maximize_button
|
712
|
+
@mgr.add_pane(create_size_report_ctrl, pi)
|
713
|
+
|
714
|
+
pi = Wx::AuiPaneInfo.new
|
715
|
+
pi.set_name('test4').set_caption('Pane Caption').left
|
716
|
+
@mgr.add_pane(create_size_report_ctrl, pi)
|
717
|
+
|
718
|
+
pi = Wx::AuiPaneInfo.new
|
719
|
+
pi.set_name('test5').set_caption('No Close Button').right
|
720
|
+
pi.set_close_button(false)
|
721
|
+
@mgr.add_pane(create_size_report_ctrl, pi)
|
722
|
+
|
723
|
+
pi = Wx::AuiPaneInfo.new
|
724
|
+
pi.set_name('test6').set_caption('Client Size Report').right
|
725
|
+
pi.set_row(1).set_close_button.set_maximize_button
|
726
|
+
@mgr.add_pane(create_size_report_ctrl, pi)
|
727
|
+
|
728
|
+
pi = Wx::AuiPaneInfo.new
|
729
|
+
pi.set_name('test7').set_caption('Client Size Report').left
|
730
|
+
pi.set_layer(1).set_close_button.set_maximize_button
|
731
|
+
@mgr.add_pane(create_size_report_ctrl, pi)
|
732
|
+
|
733
|
+
pi = Wx::AuiPaneInfo.new
|
734
|
+
pi.set_name('test8').set_caption('Tree Pane').left
|
735
|
+
pi.set_layer(1).set_position(1).set_close_button.set_maximize_button
|
736
|
+
@mgr.add_pane(create_tree_ctrl, pi)
|
737
|
+
|
738
|
+
pi = Wx::AuiPaneInfo.new
|
739
|
+
pi_size = Wx::Size.new(200, 100)
|
740
|
+
pi.set_name('test9').set_caption('Min Size 200x100').bottom
|
741
|
+
pi.set_best_size(pi_size).set_min_size(pi_size)
|
742
|
+
pi.set_layer(1).set_close_button.set_maximize_button
|
743
|
+
@mgr.add_pane(create_size_report_ctrl, pi)
|
744
|
+
|
745
|
+
wnd10 = create_text_ctrl("This pane will prompt the user before hiding.")
|
746
|
+
pi = Wx::AuiPaneInfo.new
|
747
|
+
pi.set_name('test10').set_caption('Text Pane with hide prompt')
|
748
|
+
pi.bottom.set_layer(1).set_position(1)
|
749
|
+
@mgr.add_pane(wnd10, pi)
|
750
|
+
|
751
|
+
pi = Wx::AuiPaneInfo.new
|
752
|
+
pi.set_name('test11').set_caption('Fixed Pane').bottom
|
753
|
+
pi.set_layer(1).set_position(2).fixed
|
754
|
+
@mgr.add_pane(create_size_report_ctrl, pi)
|
755
|
+
|
756
|
+
|
757
|
+
pi = Wx::AuiPaneInfo.new
|
758
|
+
pi.set_name('settings').set_caption('Dock Manager Settings')
|
759
|
+
pi.set_dockable(false).float.hide
|
760
|
+
|
761
|
+
@mgr.add_pane(SettingsPanel.new(self, self), pi)
|
762
|
+
|
763
|
+
# create some center panes
|
764
|
+
|
765
|
+
pi = Wx::AuiPaneInfo.new
|
766
|
+
pi.set_name('grid_content').center_pane.hide
|
767
|
+
@mgr.add_pane(create_grid, pi)
|
768
|
+
|
769
|
+
pi = Wx::AuiPaneInfo.new
|
770
|
+
pi.set_name('tree_content').center_pane.hide
|
771
|
+
@mgr.add_pane(create_tree_ctrl, pi)
|
772
|
+
|
773
|
+
pi = Wx::AuiPaneInfo.new
|
774
|
+
pi.set_name('sizereport_content').center_pane.hide
|
775
|
+
@mgr.add_pane(create_size_report_ctrl, pi)
|
776
|
+
|
777
|
+
pi = Wx::AuiPaneInfo.new
|
778
|
+
pi.set_name('text_content').center_pane.hide
|
779
|
+
@mgr.add_pane(create_text_ctrl, pi)
|
780
|
+
|
781
|
+
pi = Wx::AuiPaneInfo.new
|
782
|
+
pi.set_name('html_content').center_pane.hide
|
783
|
+
@mgr.add_pane(create_html_ctrl, pi)
|
784
|
+
|
785
|
+
pi = Wx::AuiPaneInfo.new
|
786
|
+
pi.set_name('notebook_content').center_pane.hide
|
787
|
+
@mgr.add_pane(create_notebook, pi)
|
788
|
+
|
789
|
+
pi = Wx::AuiPaneInfo.new
|
790
|
+
pi.set_name('tb6').toolbar_pane.top
|
791
|
+
pi.set_row(2).set_position(1)
|
792
|
+
pi.set_left_dockable(false).set_right_dockable(false)
|
793
|
+
@mgr.add_pane(Wx::Button.new(self, Wx::ID_ANY, "Test Button"), pi)
|
794
|
+
end
|
795
|
+
|
796
|
+
# make some default perspectives
|
797
|
+
def setup_perspectives
|
798
|
+
perspective_all = @mgr.save_perspective
|
799
|
+
|
800
|
+
@mgr.each_pane do | pane |
|
801
|
+
pane.hide unless pane.is_toolbar
|
802
|
+
end
|
803
|
+
|
804
|
+
@mgr.get_pane("tb1").hide
|
805
|
+
@mgr.get_pane("tb6").hide
|
806
|
+
@mgr.get_pane("test8").show.left.set_layer(0).set_row(0).set_position(0)
|
807
|
+
@mgr.get_pane("test10").show.bottom.set_layer(0).set_row(0).set_position(0)
|
808
|
+
@mgr.get_pane("notebook_content").show()
|
809
|
+
perspective_default = @mgr.save_perspective
|
810
|
+
|
811
|
+
@perspectives << perspective_default
|
812
|
+
@perspectives << perspective_all
|
813
|
+
end
|
814
|
+
|
815
|
+
def get_dock_art
|
816
|
+
@mgr.get_art_provider
|
817
|
+
end
|
818
|
+
|
819
|
+
def do_update
|
820
|
+
@mgr.update
|
821
|
+
end
|
822
|
+
|
823
|
+
def on_erase_background(event)
|
824
|
+
event.skip
|
825
|
+
end
|
826
|
+
|
827
|
+
def on_size(event)
|
828
|
+
event.skip
|
829
|
+
end
|
830
|
+
|
831
|
+
def on_settings
|
832
|
+
float_pane = @mgr.get_pane("settings").float.show
|
833
|
+
if float_pane.get_floating_position == Wx::DEFAULT_POSITION
|
834
|
+
float_pane.set_floating_position( get_start_position )
|
835
|
+
end
|
836
|
+
@mgr.update
|
837
|
+
end
|
838
|
+
|
839
|
+
def on_gradient(event)
|
840
|
+
gradient = nil
|
841
|
+
case event.get_id
|
842
|
+
when ID_NoGradient
|
843
|
+
gradient = Wx::AUI_GRADIENT_NONE
|
844
|
+
when ID_VerticalGradient
|
845
|
+
gradient = Wx::AUI_GRADIENT_VERTICAL
|
846
|
+
when ID_HorizontalGradient
|
847
|
+
gradient = Wx::AUI_GRADIENT_HORIZONTAL
|
848
|
+
end
|
849
|
+
return if not gradient
|
850
|
+
@mgr.get_art_provider.set_metric( Wx::AUI_DOCKART_GRADIENT_TYPE,
|
851
|
+
gradient)
|
852
|
+
@mgr.update
|
853
|
+
end
|
854
|
+
|
855
|
+
def on_manager_flag(event)
|
856
|
+
e_id = event.get_id
|
857
|
+
if e_id == ID_TransparentHint or
|
858
|
+
e_id == ID_VenetianBlindsHint or
|
859
|
+
e_id == ID_RectangleHint or
|
860
|
+
e_id == ID_NoHint
|
861
|
+
flags = @mgr.get_flags
|
862
|
+
flags &= ~Wx::AUI_MGR_TRANSPARENT_HINT
|
863
|
+
flags &= ~Wx::AUI_MGR_VENETIAN_BLINDS_HINT
|
864
|
+
flags &= ~Wx::AUI_MGR_RECTANGLE_HINT
|
865
|
+
@mgr.set_flags(flags)
|
866
|
+
end
|
867
|
+
|
868
|
+
flag = nil
|
869
|
+
case e_id
|
870
|
+
when ID_AllowFloating
|
871
|
+
flag = Wx::AUI_MGR_ALLOW_FLOATING
|
872
|
+
when ID_TransparentDrag
|
873
|
+
flag = Wx::AUI_MGR_TRANSPARENT_DRAG
|
874
|
+
when ID_HintFade
|
875
|
+
flag = Wx::AUI_MGR_HINT_FADE
|
876
|
+
when ID_NoVenetianFade
|
877
|
+
flag = Wx::AUI_MGR_NO_VENETIAN_BLINDS_FADE
|
878
|
+
when ID_AllowActivePane
|
879
|
+
flag = Wx::AUI_MGR_ALLOW_ACTIVE_PANE
|
880
|
+
when ID_TransparentHint
|
881
|
+
flag = Wx::AUI_MGR_TRANSPARENT_HINT
|
882
|
+
when ID_VenetianBlindsHint
|
883
|
+
flag = Wx::AUI_MGR_VENETIAN_BLINDS_HINT
|
884
|
+
when ID_RectangleHint
|
885
|
+
flag = Wx::AUI_MGR_RECTANGLE_HINT
|
886
|
+
end
|
887
|
+
|
888
|
+
if flag
|
889
|
+
@mgr.set_flags(@mgr.get_flags ^ flag)
|
890
|
+
end
|
891
|
+
|
892
|
+
@mgr.update
|
893
|
+
end
|
894
|
+
|
895
|
+
def on_notebook_flag(event)
|
896
|
+
e_id = event.get_id
|
897
|
+
|
898
|
+
# TODO - Notebook styles not currently supported; not SO important
|
899
|
+
if e_id = ID_NotebookArtGloss or
|
900
|
+
e_id = ID_NotebookArtSimple
|
901
|
+
Wx::message_box("AUI Notebook Art styles not currently supported in wxRuby")
|
902
|
+
return
|
903
|
+
end
|
904
|
+
|
905
|
+
if e_id == ID_NotebookNoCloseButton or
|
906
|
+
e_id == ID_NotebookCloseButton or
|
907
|
+
e_id == ID_NotebookCloseButtonAll or
|
908
|
+
e_id == ID_NotebookCloseButtonActive
|
909
|
+
@notebook_style &= ~( Wx::AUI_NB_CLOSE_BUTTON|
|
910
|
+
Wx::AUI_NB_CLOSE_ON_ACTIVE_TAB|
|
911
|
+
Wx::AUI_NB_CLOSE_ON_ALL_TABS )
|
912
|
+
end
|
913
|
+
|
914
|
+
case e_id
|
915
|
+
when ID_NotebookNoCloseButton
|
916
|
+
# nothing
|
917
|
+
when ID_NotebookCloseButton
|
918
|
+
@notebook_style |= Wx::AUI_NB_CLOSE_BUTTON
|
919
|
+
when ID_NotebookCloseButtonAll
|
920
|
+
@notebook_style |= Wx::AUI_NB_CLOSE_ON_ALL_TABS
|
921
|
+
when ID_NotebookCloseButtonActive
|
922
|
+
@notebook_style |= Wx::AUI_NB_CLOSE_ON_ACTIVE_TAB
|
923
|
+
end
|
924
|
+
|
925
|
+
if e_id == ID_NotebookAllowTabMove
|
926
|
+
@notebook_style ^= Wx::AUI_NB_TAB_MOVE
|
927
|
+
end
|
928
|
+
|
929
|
+
if e_id == ID_NotebookAllowTabExternalMove
|
930
|
+
@notebook_style ^= Wx::AUI_NB_TAB_EXTERNAL_MOVE
|
931
|
+
elsif e_id == ID_NotebookAllowTabSplit
|
932
|
+
@notebook_style ^= Wx::AUI_NB_TAB_SPLIT
|
933
|
+
elsif e_id == ID_NotebookWindowList
|
934
|
+
@notebook_style ^= Wx::AUI_NB_WINDOWLIST_BUTTON
|
935
|
+
elsif e_id == ID_NotebookScrollButtons
|
936
|
+
@notebook_style ^= Wx::AUI_NB_SCROLL_BUTTONS
|
937
|
+
elsif e_id == ID_NotebookTabFixedWidth
|
938
|
+
@notebook_style ^= Wx::AUI_NB_TAB_FIXED_WIDTH
|
939
|
+
end
|
940
|
+
|
941
|
+
|
942
|
+
@mgr.each_pane do | pane |
|
943
|
+
maybe_nb = pane.get_window
|
944
|
+
next unless maybe_nb.kind_of?(Wx::AuiNotebook)
|
945
|
+
if e_id == ID_NotebookArtGloss
|
946
|
+
maybe_nb.set_art_provider(Wx::AuiDefaultTabArt.new)
|
947
|
+
@notebook_theme = 0
|
948
|
+
elsif e_id == ID_NotebookArtSimple
|
949
|
+
maybe_nb.set_art_provider(Wx::AuiSimpleTabArt.new)
|
950
|
+
@notebook_theme = 1
|
951
|
+
end
|
952
|
+
|
953
|
+
maybe_nb.set_window_style_flag(@notebook_style)
|
954
|
+
maybe_nb.refresh()
|
955
|
+
end
|
956
|
+
end
|
957
|
+
|
958
|
+
def on_update_ui(event)
|
959
|
+
flags = @mgr.get_flags
|
960
|
+
|
961
|
+
case event.get_id
|
962
|
+
when ID_NoGradient
|
963
|
+
event.check(@mgr.get_art_provider.get_metric(Wx::AUI_DOCKART_GRADIENT_TYPE) == Wx::AUI_GRADIENT_NONE)
|
964
|
+
when ID_VerticalGradient
|
965
|
+
event.check(@mgr.get_art_provider.get_metric(Wx::AUI_DOCKART_GRADIENT_TYPE) == Wx::AUI_GRADIENT_VERTICAL)
|
966
|
+
when ID_HorizontalGradient
|
967
|
+
event.check(@mgr.get_art_provider.get_metric(Wx::AUI_DOCKART_GRADIENT_TYPE) == Wx::AUI_GRADIENT_HORIZONTAL)
|
968
|
+
when ID_AllowFloating
|
969
|
+
event.check((flags & Wx::AUI_MGR_ALLOW_FLOATING) != 0)
|
970
|
+
when ID_TransparentDrag
|
971
|
+
event.check((flags & Wx::AUI_MGR_TRANSPARENT_DRAG) != 0)
|
972
|
+
when ID_TransparentHint
|
973
|
+
event.check((flags & Wx::AUI_MGR_TRANSPARENT_HINT) != 0)
|
974
|
+
when ID_VenetianBlindsHint
|
975
|
+
event.check((flags & Wx::AUI_MGR_VENETIAN_BLINDS_HINT) != 0)
|
976
|
+
when ID_RectangleHint
|
977
|
+
event.check((flags & Wx::AUI_MGR_RECTANGLE_HINT) != 0)
|
978
|
+
when ID_NoHint
|
979
|
+
event.check( (Wx::AUI_MGR_TRANSPARENT_HINT|
|
980
|
+
Wx::AUI_MGR_VENETIAN_BLINDS_HINT|
|
981
|
+
Wx::AUI_MGR_RECTANGLE_HINT) & flags == 0)
|
982
|
+
when ID_HintFade
|
983
|
+
event.check((flags & Wx::AUI_MGR_HINT_FADE) != 0)
|
984
|
+
when ID_NoVenetianFade
|
985
|
+
event.check((flags & Wx::AUI_MGR_NO_VENETIAN_BLINDS_FADE) != 0)
|
986
|
+
when ID_NotebookNoCloseButton
|
987
|
+
event.check( (@notebook_style &
|
988
|
+
( Wx::AUI_NB_CLOSE_BUTTON|
|
989
|
+
Wx::AUI_NB_CLOSE_ON_ALL_TABS|
|
990
|
+
Wx::AUI_NB_CLOSE_ON_ACTIVE_TAB) ) != 0)
|
991
|
+
when ID_NotebookCloseButton
|
992
|
+
event.check((@notebook_style & Wx::AUI_NB_CLOSE_BUTTON) != 0)
|
993
|
+
when ID_NotebookCloseButtonAll
|
994
|
+
event.check((@notebook_style & Wx::AUI_NB_CLOSE_ON_ALL_TABS) != 0)
|
995
|
+
when ID_NotebookCloseButtonActive
|
996
|
+
event.check((@notebook_style & Wx::AUI_NB_CLOSE_ON_ACTIVE_TAB) != 0)
|
997
|
+
when ID_NotebookAllowTabSplit:
|
998
|
+
event.check((@notebook_style & Wx::AUI_NB_TAB_SPLIT) != 0)
|
999
|
+
when ID_NotebookAllowTabMove
|
1000
|
+
event.check((@notebook_style & Wx::AUI_NB_TAB_MOVE) != 0)
|
1001
|
+
when ID_NotebookAllowTabExternalMove
|
1002
|
+
event.check((@notebook_style & Wx::AUI_NB_TAB_EXTERNAL_MOVE) != 0)
|
1003
|
+
when ID_NotebookScrollButtons
|
1004
|
+
event.check((@notebook_style & Wx::AUI_NB_SCROLL_BUTTONS) != 0)
|
1005
|
+
when ID_NotebookWindowList
|
1006
|
+
event.check((@notebook_style & Wx::AUI_NB_WINDOWLIST_BUTTON) != 0)
|
1007
|
+
when ID_NotebookTabFixedWidth
|
1008
|
+
event.check((@notebook_style & Wx::AUI_NB_TAB_FIXED_WIDTH) != 0)
|
1009
|
+
when ID_NotebookArtGloss
|
1010
|
+
event.check(@notebook_style == 0)
|
1011
|
+
when ID_NotebookArtSimple
|
1012
|
+
event.check(@notebook_style == 1)
|
1013
|
+
end
|
1014
|
+
end
|
1015
|
+
|
1016
|
+
def on_pane_close(event)
|
1017
|
+
if event.get_pane.get_name == "test10"
|
1018
|
+
msg = "Are you sure you want to close/hide this pane?"
|
1019
|
+
dlg = Wx::MessageDialog.new(self, msg, "Wx::AUI", Wx::YES_NO)
|
1020
|
+
if dlg.show_modal != Wx::ID_YES
|
1021
|
+
return event.veto
|
1022
|
+
end
|
1023
|
+
end
|
1024
|
+
end
|
1025
|
+
|
1026
|
+
|
1027
|
+
def on_create_perspective
|
1028
|
+
msg = "Enter a name for the new perspective:"
|
1029
|
+
dlg = Wx::TextEntryDialog.new(self, msg, "Wx::AUI Test")
|
1030
|
+
dlg.set_value("Perspective %d" % [ @perspectives.length + 1 ] )
|
1031
|
+
return unless dlg.show_modal == Wx::ID_OK
|
1032
|
+
if @perspectives.length.zero?
|
1033
|
+
@perspectives_menu.append_separator
|
1034
|
+
end
|
1035
|
+
@perspectives_menu.append(ID_FirstPerspective + @perspectives.length,
|
1036
|
+
dlg.get_value)
|
1037
|
+
@perspectives << @mgr.save_perspective
|
1038
|
+
end
|
1039
|
+
|
1040
|
+
def on_copy_perspective_code
|
1041
|
+
Kernel.raise NotImplementedError
|
1042
|
+
end
|
1043
|
+
|
1044
|
+
def on_restore_perspective(event)
|
1045
|
+
perspective = @perspectives[ event.get_id - ID_FirstPerspective]
|
1046
|
+
@mgr.load_perspective(perspective)
|
1047
|
+
end
|
1048
|
+
|
1049
|
+
def on_notebook_page_close(event)
|
1050
|
+
notebook = event.get_event_object
|
1051
|
+
if notebook.get_page(event.get_selection).kind_of?(Wx::HtmlWindow)
|
1052
|
+
msg = "Are you sure you want to close/hide this notebook page?"
|
1053
|
+
dlg = Wx::MessageDialog.new(self, msg, "Wx::AUI", Wx::YES_NO)
|
1054
|
+
if dlg.show_modal != Wx::ID_YES
|
1055
|
+
event.veto
|
1056
|
+
else
|
1057
|
+
event.allow
|
1058
|
+
end
|
1059
|
+
end
|
1060
|
+
end
|
1061
|
+
|
1062
|
+
def get_start_position
|
1063
|
+
origin = client_to_screen( Wx::Point.new(0, 0) )
|
1064
|
+
return Wx::Point.new(origin.x + 20, origin.y + 20)
|
1065
|
+
end
|
1066
|
+
|
1067
|
+
def on_create_tree
|
1068
|
+
pi = Wx::AuiPaneInfo.new
|
1069
|
+
pi.set_caption("Tree Control").float
|
1070
|
+
pi.set_floating_position(get_start_position)
|
1071
|
+
pi.set_floating_size(Wx::Size.new(150, 300))
|
1072
|
+
@mgr.add_pane( create_tree_ctrl, pi)
|
1073
|
+
@mgr.update
|
1074
|
+
end
|
1075
|
+
|
1076
|
+
def on_create_grid
|
1077
|
+
pi = Wx::AuiPaneInfo.new
|
1078
|
+
pi.set_caption("Grid").float
|
1079
|
+
pi.set_floating_position(get_start_position)
|
1080
|
+
pi.set_floating_size(Wx::Size.new(300, 200))
|
1081
|
+
@mgr.add_pane( create_grid, pi)
|
1082
|
+
@mgr.update
|
1083
|
+
end
|
1084
|
+
|
1085
|
+
def on_create_html
|
1086
|
+
pi = Wx::AuiPaneInfo.new
|
1087
|
+
pi.set_caption("HTML Control").float
|
1088
|
+
pi.set_floating_position(get_start_position)
|
1089
|
+
pi.set_floating_size(Wx::Size.new(300, 200))
|
1090
|
+
@mgr.add_pane( create_html_ctrl, pi)
|
1091
|
+
@mgr.update
|
1092
|
+
end
|
1093
|
+
|
1094
|
+
def on_create_notebook
|
1095
|
+
pi = Wx::AuiPaneInfo.new
|
1096
|
+
pi.set_caption("Notebook").float
|
1097
|
+
pi.set_floating_position(get_start_position)
|
1098
|
+
pi.set_close_button.set_maximize_button
|
1099
|
+
@mgr.add_pane( create_notebook, pi)
|
1100
|
+
@mgr.update
|
1101
|
+
end
|
1102
|
+
|
1103
|
+
def on_create_text
|
1104
|
+
pi = Wx::AuiPaneInfo.new
|
1105
|
+
pi.set_caption("Text Control").float
|
1106
|
+
pi.set_floating_position(get_start_position)
|
1107
|
+
@mgr.add_pane( create_text_ctrl, pi)
|
1108
|
+
@mgr.update
|
1109
|
+
end
|
1110
|
+
|
1111
|
+
def on_create_size_report
|
1112
|
+
pi = Wx::AuiPaneInfo.new
|
1113
|
+
pi.set_caption("Client Size Reporter").float
|
1114
|
+
pi.set_floating_position(get_start_position)
|
1115
|
+
pi.set_close_button.set_maximize_button
|
1116
|
+
@mgr.add_pane( create_size_report_ctrl, pi)
|
1117
|
+
@mgr.update
|
1118
|
+
end
|
1119
|
+
|
1120
|
+
def on_change_content_pane(event)
|
1121
|
+
e_id = event.get_id
|
1122
|
+
@mgr.get_pane("grid_content").show(e_id == ID_GridContent)
|
1123
|
+
@mgr.get_pane("text_content").show(e_id == ID_TextContent)
|
1124
|
+
@mgr.get_pane("tree_content").show(e_id == ID_TreeContent)
|
1125
|
+
@mgr.get_pane("sizereport_content").show(e_id == ID_SizeReportContent)
|
1126
|
+
@mgr.get_pane("html_content").show(e_id == ID_HTMLContent)
|
1127
|
+
@mgr.get_pane("notebook_content").show(e_id == ID_NotebookContent)
|
1128
|
+
@mgr.update
|
1129
|
+
end
|
1130
|
+
|
1131
|
+
def on_exit
|
1132
|
+
close(true)
|
1133
|
+
end
|
1134
|
+
|
1135
|
+
def on_about
|
1136
|
+
msg = "Wx::AUI Demo\nAn advanced window management library for wxRuby\nAdapted by Alex Fenton from the wxWidgets AUI Demo\n which is (c) Copyright 2005-2006, Kirix Corporation"
|
1137
|
+
dlg = Wx::MessageDialog.new(self, msg, "Wx::AUI", Wx::OK)
|
1138
|
+
dlg.show_modal
|
1139
|
+
end
|
1140
|
+
|
1141
|
+
def create_text_ctrl(text = "")
|
1142
|
+
if text.empty?
|
1143
|
+
text = "This is a test text box"
|
1144
|
+
end
|
1145
|
+
Wx::TextCtrl.new( self, Wx::ID_ANY, text,
|
1146
|
+
Wx::Point.new(0, 0), Wx::Size.new(150, 90),
|
1147
|
+
Wx::NO_BORDER|Wx::TE_MULTILINE)
|
1148
|
+
end
|
1149
|
+
|
1150
|
+
def create_grid
|
1151
|
+
grid = Wx::Grid.new(self, Wx::ID_ANY,
|
1152
|
+
Wx::Point.new(0, 0),
|
1153
|
+
Wx::Size.new(150, 250),
|
1154
|
+
Wx::NO_BORDER|Wx::WANTS_CHARS)
|
1155
|
+
grid.create_grid(50, 20)
|
1156
|
+
grid
|
1157
|
+
end
|
1158
|
+
|
1159
|
+
|
1160
|
+
def create_tree_ctrl
|
1161
|
+
tree = Wx::TreeCtrl.new( self, Wx::ID_ANY,
|
1162
|
+
Wx::Point.new(0, 0), Wx::Size.new(160, 250),
|
1163
|
+
Wx::TR_DEFAULT_STYLE|Wx::NO_BORDER)
|
1164
|
+
|
1165
|
+
img_list = Wx::ImageList.new(16, 16, true, 2)
|
1166
|
+
img_list.add( Wx::ArtProvider::get_bitmap( Wx::ART_FOLDER,
|
1167
|
+
Wx::ART_OTHER,
|
1168
|
+
Wx::Size.new(16, 16) ) )
|
1169
|
+
img_list.add( Wx::ArtProvider::get_bitmap( Wx::ART_NORMAL_FILE,
|
1170
|
+
Wx::ART_OTHER,
|
1171
|
+
Wx::Size.new(16, 16) ) )
|
1172
|
+
tree.set_image_list(img_list)
|
1173
|
+
root = tree.add_root("Wx::AUI Project", 0)
|
1174
|
+
items = []
|
1175
|
+
1.upto(5) { | i | items << tree.append_item(root, "Item #{i}", 0) }
|
1176
|
+
|
1177
|
+
items.each do | id |
|
1178
|
+
1.upto(5) { | i | tree.append_item(id, "Subitem #{i}", 0) }
|
1179
|
+
end
|
1180
|
+
|
1181
|
+
tree.expand(root)
|
1182
|
+
tree
|
1183
|
+
end
|
1184
|
+
|
1185
|
+
def create_size_report_ctrl(width = 80, height = 80)
|
1186
|
+
SizeReportCtrl.new( self, Wx::ID_ANY,
|
1187
|
+
Wx::DEFAULT_POSITION,
|
1188
|
+
Wx::Size.new(width, height), @mgr )
|
1189
|
+
end
|
1190
|
+
|
1191
|
+
def create_html_ctrl(parent = nil)
|
1192
|
+
if not parent
|
1193
|
+
parent = self
|
1194
|
+
end
|
1195
|
+
ctrl = Wx::HtmlWindow.new(parent, Wx::ID_ANY,
|
1196
|
+
Wx::DEFAULT_POSITION,
|
1197
|
+
Wx::Size.new(400, 300) )
|
1198
|
+
ctrl.set_page(DATA.read)
|
1199
|
+
ctrl
|
1200
|
+
end
|
1201
|
+
|
1202
|
+
def create_notebook
|
1203
|
+
# create the notebook off-window to avoid flicker
|
1204
|
+
client_size = get_client_size
|
1205
|
+
|
1206
|
+
ctrl = Wx::AuiNotebook.new( self, Wx::ID_ANY,
|
1207
|
+
Wx::Point.new(client_size.x, client_size.y),
|
1208
|
+
Wx::Size.new(430, 200),
|
1209
|
+
@notebook_style)
|
1210
|
+
|
1211
|
+
page_bmp = Wx::ArtProvider::get_bitmap( Wx::ART_NORMAL_FILE,
|
1212
|
+
Wx::ART_OTHER,
|
1213
|
+
Wx::Size.new(16,16) )
|
1214
|
+
|
1215
|
+
ctrl.add_page( create_html_ctrl(ctrl),
|
1216
|
+
"Welcome to Wx::AUI", false, page_bmp)
|
1217
|
+
|
1218
|
+
panel = Wx::Panel.new(ctrl, Wx::ID_ANY)
|
1219
|
+
flex = Wx::FlexGridSizer.new( 2 )
|
1220
|
+
flex.add_growable_row( 0 )
|
1221
|
+
flex.add_growable_row( 3 )
|
1222
|
+
flex.add_growable_row( 1 )
|
1223
|
+
|
1224
|
+
flex.add( 5, 5 )
|
1225
|
+
flex.add( 5, 5 )
|
1226
|
+
flex.add( Wx::StaticText.new( panel, -1, "Wx::TextCtrl:" ),
|
1227
|
+
0, Wx::ALL|Wx::ALIGN_CENTRE, 5 )
|
1228
|
+
flex.add( Wx::TextCtrl.new( panel, -1, "",
|
1229
|
+
Wx::DEFAULT_POSITION, Wx::Size.new(100,-1) ),
|
1230
|
+
1, Wx::ALL|Wx::ALIGN_CENTRE, 5 )
|
1231
|
+
|
1232
|
+
flex.add( Wx::StaticText.new( panel, -1, "Wx::SpinCtrl:" ),
|
1233
|
+
0, Wx::ALL|Wx::ALIGN_CENTRE, 5 )
|
1234
|
+
flex.add( Wx::SpinCtrl.new( panel, -1, "5",
|
1235
|
+
Wx::DEFAULT_POSITION, Wx::Size.new(100,-1),
|
1236
|
+
Wx::SP_ARROW_KEYS, 5, 50, 5 ),
|
1237
|
+
1, Wx::ALL|Wx::ALIGN_CENTRE, 5 )
|
1238
|
+
|
1239
|
+
flex.add( 5,5 )
|
1240
|
+
flex.add( 5,5 )
|
1241
|
+
panel.set_sizer( flex )
|
1242
|
+
ctrl.add_page( panel, "wxPanel", false, page_bmp )
|
1243
|
+
|
1244
|
+
|
1245
|
+
ctrl.add_page( Wx::TextCtrl.new( ctrl, Wx::ID_ANY, "Some text",
|
1246
|
+
Wx::DEFAULT_POSITION, Wx::DEFAULT_SIZE,
|
1247
|
+
Wx::TE_MULTILINE|Wx::NO_BORDER),
|
1248
|
+
"wxTextCtrl 1", false, page_bmp )
|
1249
|
+
|
1250
|
+
ctrl.add_page( Wx::TextCtrl.new( ctrl, Wx::ID_ANY, "Some more text",
|
1251
|
+
Wx::DEFAULT_POSITION, Wx::DEFAULT_SIZE,
|
1252
|
+
Wx::TE_MULTILINE|Wx::NO_BORDER),
|
1253
|
+
"wxTextCtrl 2" )
|
1254
|
+
|
1255
|
+
ctrl.add_page( Wx::TextCtrl.new( ctrl, Wx::ID_ANY, "Some more text",
|
1256
|
+
Wx::DEFAULT_POSITION, Wx::DEFAULT_SIZE,
|
1257
|
+
Wx::TE_MULTILINE|Wx::NO_BORDER),
|
1258
|
+
"wxTextCtrl 3" )
|
1259
|
+
|
1260
|
+
ctrl.add_page( Wx::TextCtrl.new( ctrl, Wx::ID_ANY, "Some more text",
|
1261
|
+
Wx::DEFAULT_POSITION, Wx::DEFAULT_SIZE,
|
1262
|
+
Wx::TE_MULTILINE|Wx::NO_BORDER),
|
1263
|
+
"wxTextCtrl 4" )
|
1264
|
+
|
1265
|
+
ctrl.add_page( Wx::TextCtrl.new( ctrl, Wx::ID_ANY, "Some more text",
|
1266
|
+
Wx::DEFAULT_POSITION, Wx::DEFAULT_SIZE,
|
1267
|
+
Wx::TE_MULTILINE|Wx::NO_BORDER),
|
1268
|
+
"wxTextCtrl 5" )
|
1269
|
+
|
1270
|
+
ctrl.add_page( Wx::TextCtrl.new( ctrl, Wx::ID_ANY, "Some more text",
|
1271
|
+
Wx::DEFAULT_POSITION, Wx::DEFAULT_SIZE,
|
1272
|
+
Wx::TE_MULTILINE|Wx::NO_BORDER),
|
1273
|
+
"wxTextCtrl 6" )
|
1274
|
+
|
1275
|
+
ctrl.add_page( Wx::TextCtrl.new( ctrl, Wx::ID_ANY, "Some more text",
|
1276
|
+
Wx::DEFAULT_POSITION, Wx::DEFAULT_SIZE,
|
1277
|
+
Wx::TE_MULTILINE|Wx::NO_BORDER),
|
1278
|
+
"wxTextCtrl 7 (longer title)" )
|
1279
|
+
|
1280
|
+
ctrl.add_page( Wx::TextCtrl.new( ctrl, Wx::ID_ANY, "Some more text",
|
1281
|
+
Wx::DEFAULT_POSITION, Wx::DEFAULT_SIZE,
|
1282
|
+
Wx::TE_MULTILINE|Wx::NO_BORDER),
|
1283
|
+
"wxTextCtrl 8" )
|
1284
|
+
return ctrl
|
1285
|
+
end
|
1286
|
+
end
|
1287
|
+
|
1288
|
+
|
1289
|
+
class AuiDemoApp < Wx::App
|
1290
|
+
def on_init
|
1291
|
+
frame = AuiFrame.new( nil, Wx::ID_ANY, "Wx::AUI Sample Application",
|
1292
|
+
Wx::DEFAULT_POSITION,
|
1293
|
+
Wx::Size.new(800, 600) )
|
1294
|
+
set_top_window(frame)
|
1295
|
+
frame.show
|
1296
|
+
return true
|
1297
|
+
end
|
1298
|
+
end
|
1299
|
+
|
1300
|
+
AuiDemoApp.new.main_loop()
|
1301
|
+
|
1302
|
+
|
1303
|
+
__END__
|
1304
|
+
|
1305
|
+
<html><body>
|
1306
|
+
<h3>Welcome to Wx::AUI</h3>
|
1307
|
+
<br/><b>Overview</b><br/>
|
1308
|
+
<p>Wx::AUI is an Advanced User Interface library for the wxWidgets toolkit
|
1309
|
+
that allows developers to create high-quality, cross-platform user
|
1310
|
+
interfaces quickly and easily.</p>
|
1311
|
+
<p><b>Features</b></p>
|
1312
|
+
<p>With Wx::AUI, developers can create application frameworks with:</p>
|
1313
|
+
<ul>
|
1314
|
+
<li>Native, dockable floating frames</li>
|
1315
|
+
<li>Perspective saving and loading</li>
|
1316
|
+
<li>Native toolbars incorporating real-time, "spring-loaded" dragging</li>
|
1317
|
+
<li>Customizable floating/docking behavior</li>
|
1318
|
+
<li>Completely customizable look-and-feel</li>
|
1319
|
+
<li>Optional transparent window effects (while dragging or docking)</li>
|
1320
|
+
<li>Splittable notebook control</li>
|
1321
|
+
</ul>
|
1322
|
+
<p><b>What's new in 0.9.3?</b></p>
|
1323
|
+
<p>Wx::AUI 0.9.3, which is now bundled with wxWidgets, adds the following features:
|
1324
|
+
<ul>
|
1325
|
+
<li>New wxAuiNotebook class, a dynamic splittable notebook control</li>
|
1326
|
+
<li>New wxAuiMDI* classes, a tab-based MDI and drop-in replacement for classic MDI</li>
|
1327
|
+
<li>Maximize/Restore buttons implemented</li>
|
1328
|
+
<li>Better hinting with wxGTK</li>
|
1329
|
+
<li>Class rename. 'wxAui' is now the standard class prefix for all Wx::AUI classes</li>
|
1330
|
+
<li>Lots of bug fixes</li>
|
1331
|
+
</ul>
|
1332
|
+
<p><b>What's new in 0.9.2?</b></p>
|
1333
|
+
<p>The following features/fixes have been added since the last version of Wx::AUI:</p>
|
1334
|
+
<ul>
|
1335
|
+
<li>Support for wxMac</li>
|
1336
|
+
<li>Updates for wxWidgets 2.6.3</li>
|
1337
|
+
<li>Fix to pass more unused events through</li>
|
1338
|
+
<li>Fix to allow floating windows to receive idle events</li>
|
1339
|
+
<li>Fix for minimizing/maximizing problem with transparent hint pane</li>
|
1340
|
+
<li>Fix to not paint empty hint rectangles</li>
|
1341
|
+
<li>Fix for 64-bit compilation</li>
|
1342
|
+
</ul>
|
1343
|
+
<p><b>What changed in 0.9.1?</b></p>
|
1344
|
+
<p>The following features/fixes were added in Wx::AUIy 0.9.1:</p>
|
1345
|
+
<ul>
|
1346
|
+
<li>Support for MDI frames</li>
|
1347
|
+
<li>Gradient captions option</li>
|
1348
|
+
<li>Active/Inactive panes option</li>
|
1349
|
+
<li>Fix for screen artifacts/paint problems</li>
|
1350
|
+
<li>Fix for hiding/showing floated window problem</li>
|
1351
|
+
<li>Fix for floating pane sizing problem</li>
|
1352
|
+
<li>Fix for drop position problem when dragging around center pane margins</li>
|
1353
|
+
<li>LF-only text file formatting for source code</li>
|
1354
|
+
</ul>
|
1355
|
+
<p>See README.txt for more information.</p>
|
1356
|
+
</body></html>
|