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