]>
Commit | Line | Data |
---|---|---|
50acee04 JS |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // Name: auidemo.cpp | |
3 | // Purpose: wxaui: wx advanced user interface - sample/test program | |
4 | // Author: Benjamin I. Williams | |
5 | // Modified by: | |
6 | // Created: 2005-10-03 | |
bfeed34c | 7 | // RCS-ID: $Id$ |
50acee04 JS |
8 | // Copyright: (C) Copyright 2005, Kirix Corporation, All Rights Reserved. |
9 | // Licence: wxWindows Library Licence, Version 3.1 | |
10 | /////////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | // For compilers that support precompilation, includes "wx/wx.h". | |
13 | #include "wx/wxprec.h" | |
14 | ||
15 | #ifdef __BORLANDC__ | |
bfeed34c | 16 | #pragma hdrstop |
50acee04 JS |
17 | #endif |
18 | ||
87d658e5 | 19 | #include "wx/app.h" |
50acee04 JS |
20 | #include "wx/grid.h" |
21 | #include "wx/treectrl.h" | |
22 | #include "wx/spinctrl.h" | |
23 | #include "wx/artprov.h" | |
24 | #include "wx/clipbrd.h" | |
25 | #include "wx/image.h" | |
26 | #include "wx/colordlg.h" | |
27 | #include "wx/wxhtml.h" | |
3a745867 | 28 | #include "wx/imaglist.h" |
6c73e20d | 29 | #include "wx/dataobj.h" |
87d658e5 PC |
30 | #include "wx/dcclient.h" |
31 | #include "wx/bmpbuttn.h" | |
32 | #include "wx/menu.h" | |
33 | #include "wx/toolbar.h" | |
34 | #include "wx/statusbr.h" | |
35 | #include "wx/msgdlg.h" | |
36 | #include "wx/textdlg.h" | |
50acee04 JS |
37 | |
38 | #include "wx/aui/aui.h" | |
39 | #include "../sample.xpm" | |
40 | ||
41 | // -- application -- | |
42 | ||
43 | class MyApp : public wxApp | |
44 | { | |
45 | public: | |
46 | bool OnInit(); | |
47 | }; | |
48 | ||
004f4002 VZ |
49 | DECLARE_APP(MyApp) |
50 | IMPLEMENT_APP(MyApp) | |
50acee04 JS |
51 | |
52 | ||
53 | class wxSizeReportCtrl; | |
54 | ||
55 | // -- frame -- | |
56 | ||
57 | class MyFrame : public wxFrame | |
58 | { | |
59 | enum | |
60 | { | |
61 | ID_CreateTree = wxID_HIGHEST+1, | |
62 | ID_CreateGrid, | |
63 | ID_CreateText, | |
64 | ID_CreateHTML, | |
8bfde0a8 | 65 | ID_CreateNotebook, |
50acee04 JS |
66 | ID_CreateSizeReport, |
67 | ID_GridContent, | |
68 | ID_TextContent, | |
69 | ID_TreeContent, | |
70 | ID_HTMLContent, | |
df00bdf7 | 71 | ID_NotebookContent, |
50acee04 JS |
72 | ID_SizeReportContent, |
73 | ID_CreatePerspective, | |
74 | ID_CopyPerspectiveCode, | |
75 | ID_AllowFloating, | |
76 | ID_AllowActivePane, | |
77 | ID_TransparentHint, | |
cf6fec73 BW |
78 | ID_VenetianBlindsHint, |
79 | ID_RectangleHint, | |
80 | ID_NoHint, | |
81 | ID_HintFade, | |
82 | ID_NoVenetianFade, | |
50acee04 JS |
83 | ID_TransparentDrag, |
84 | ID_NoGradient, | |
85 | ID_VerticalGradient, | |
86 | ID_HorizontalGradient, | |
68030cae | 87 | ID_LiveUpdate, |
e5dcae09 | 88 | ID_AllowToolbarResizing, |
50acee04 | 89 | ID_Settings, |
b5d196c1 BW |
90 | ID_CustomizeToolbar, |
91 | ID_DropDownToolbarItem, | |
931483d7 | 92 | ID_NotebookNoCloseButton, |
c50fa29f BW |
93 | ID_NotebookCloseButton, |
94 | ID_NotebookCloseButtonAll, | |
95 | ID_NotebookCloseButtonActive, | |
51100f50 | 96 | ID_NotebookAllowTabMove, |
5d3aeb0f | 97 | ID_NotebookAllowTabExternalMove, |
51100f50 | 98 | ID_NotebookAllowTabSplit, |
01372b8f BW |
99 | ID_NotebookWindowList, |
100 | ID_NotebookScrollButtons, | |
b0d17f7c BW |
101 | ID_NotebookTabFixedWidth, |
102 | ID_NotebookArtGloss, | |
103 | ID_NotebookArtSimple, | |
b5d196c1 BW |
104 | ID_NotebookAlignTop, |
105 | ID_NotebookAlignBottom, | |
16a6495d | 106 | |
b5d196c1 | 107 | ID_SampleItem, |
16a6495d | 108 | |
50acee04 JS |
109 | ID_FirstPerspective = ID_CreatePerspective+1000 |
110 | }; | |
111 | ||
112 | public: | |
113 | MyFrame(wxWindow* parent, | |
114 | wxWindowID id, | |
115 | const wxString& title, | |
116 | const wxPoint& pos = wxDefaultPosition, | |
117 | const wxSize& size = wxDefaultSize, | |
118 | long style = wxDEFAULT_FRAME_STYLE | wxSUNKEN_BORDER); | |
119 | ||
120 | ~MyFrame(); | |
121 | ||
a3a5df9d | 122 | wxAuiDockArt* GetDockArt(); |
50acee04 JS |
123 | void DoUpdate(); |
124 | ||
125 | private: | |
58754643 | 126 | wxTextCtrl* CreateTextCtrl(const wxString& text = wxEmptyString); |
50acee04 JS |
127 | wxGrid* CreateGrid(); |
128 | wxTreeCtrl* CreateTreeCtrl(); | |
129 | wxSizeReportCtrl* CreateSizeReportCtrl(int width = 80, int height = 80); | |
130 | wxPoint GetStartPosition(); | |
dbd2f790 | 131 | wxHtmlWindow* CreateHTMLCtrl(wxWindow* parent = NULL); |
a3a5df9d | 132 | wxAuiNotebook* CreateNotebook(); |
50acee04 JS |
133 | |
134 | wxString GetIntroText(); | |
135 | ||
136 | private: | |
137 | ||
58754643 BW |
138 | void OnEraseBackground(wxEraseEvent& evt); |
139 | void OnSize(wxSizeEvent& evt); | |
140 | ||
141 | void OnCreateTree(wxCommandEvent& evt); | |
142 | void OnCreateGrid(wxCommandEvent& evt); | |
143 | void OnCreateHTML(wxCommandEvent& evt); | |
df00bdf7 | 144 | void OnCreateNotebook(wxCommandEvent& evt); |
58754643 BW |
145 | void OnCreateText(wxCommandEvent& evt); |
146 | void OnCreateSizeReport(wxCommandEvent& evt); | |
147 | void OnChangeContentPane(wxCommandEvent& evt); | |
b5d196c1 | 148 | void OnDropDownToolbarItem(wxAuiToolBarEvent& evt); |
58754643 BW |
149 | void OnCreatePerspective(wxCommandEvent& evt); |
150 | void OnCopyPerspectiveCode(wxCommandEvent& evt); | |
151 | void OnRestorePerspective(wxCommandEvent& evt); | |
152 | void OnSettings(wxCommandEvent& evt); | |
b5d196c1 | 153 | void OnCustomizeToolbar(wxCommandEvent& evt); |
5d3aeb0f | 154 | void OnAllowNotebookDnD(wxAuiNotebookEvent& evt); |
3fd8c988 | 155 | void OnNotebookPageClose(wxAuiNotebookEvent& evt); |
917f228a | 156 | void OnNotebookPageClosed(wxAuiNotebookEvent& evt); |
58754643 BW |
157 | void OnExit(wxCommandEvent& evt); |
158 | void OnAbout(wxCommandEvent& evt); | |
b5d196c1 | 159 | void OnTabAlignment(wxCommandEvent &evt); |
58754643 BW |
160 | |
161 | void OnGradient(wxCommandEvent& evt); | |
e5dcae09 | 162 | void OnToolbarResizing(wxCommandEvent& evt); |
58754643 | 163 | void OnManagerFlag(wxCommandEvent& evt); |
c50fa29f | 164 | void OnNotebookFlag(wxCommandEvent& evt); |
58754643 BW |
165 | void OnUpdateUI(wxUpdateUIEvent& evt); |
166 | ||
a3a5df9d | 167 | void OnPaneClose(wxAuiManagerEvent& evt); |
b5d196c1 | 168 | |
50acee04 JS |
169 | private: |
170 | ||
a3a5df9d | 171 | wxAuiManager m_mgr; |
50acee04 JS |
172 | wxArrayString m_perspectives; |
173 | wxMenu* m_perspectives_menu; | |
c50fa29f | 174 | long m_notebook_style; |
b0d17f7c | 175 | long m_notebook_theme; |
bfeed34c | 176 | |
6dcf9888 | 177 | DECLARE_EVENT_TABLE() |
50acee04 JS |
178 | }; |
179 | ||
180 | ||
50acee04 JS |
181 | // -- wxSizeReportCtrl -- |
182 | // (a utility control that always reports it's client size) | |
183 | ||
184 | class wxSizeReportCtrl : public wxControl | |
185 | { | |
186 | public: | |
187 | ||
bfeed34c | 188 | wxSizeReportCtrl(wxWindow* parent, wxWindowID id = wxID_ANY, |
50acee04 JS |
189 | const wxPoint& pos = wxDefaultPosition, |
190 | const wxSize& size = wxDefaultSize, | |
a3a5df9d | 191 | wxAuiManager* mgr = NULL) |
50acee04 JS |
192 | : wxControl(parent, id, pos, size, wxNO_BORDER) |
193 | { | |
194 | m_mgr = mgr; | |
195 | } | |
196 | ||
197 | private: | |
198 | ||
bfeed34c | 199 | void OnPaint(wxPaintEvent& WXUNUSED(evt)) |
50acee04 JS |
200 | { |
201 | wxPaintDC dc(this); | |
202 | wxSize size = GetClientSize(); | |
203 | wxString s; | |
204 | int h, w, height; | |
205 | ||
206 | s.Printf(wxT("Size: %d x %d"), size.x, size.y); | |
207 | ||
208 | dc.SetFont(*wxNORMAL_FONT); | |
209 | dc.GetTextExtent(s, &w, &height); | |
210 | height += 3; | |
211 | dc.SetBrush(*wxWHITE_BRUSH); | |
212 | dc.SetPen(*wxWHITE_PEN); | |
213 | dc.DrawRectangle(0, 0, size.x, size.y); | |
214 | dc.SetPen(*wxLIGHT_GREY_PEN); | |
215 | dc.DrawLine(0, 0, size.x, size.y); | |
216 | dc.DrawLine(0, size.y, size.x, 0); | |
217 | dc.DrawText(s, (size.x-w)/2, ((size.y-(height*5))/2)); | |
bfeed34c | 218 | |
50acee04 JS |
219 | if (m_mgr) |
220 | { | |
a3a5df9d | 221 | wxAuiPaneInfo pi = m_mgr->GetPane(this); |
bfeed34c | 222 | |
50acee04 JS |
223 | s.Printf(wxT("Layer: %d"), pi.dock_layer); |
224 | dc.GetTextExtent(s, &w, &h); | |
225 | dc.DrawText(s, (size.x-w)/2, ((size.y-(height*5))/2)+(height*1)); | |
bfeed34c | 226 | |
50acee04 JS |
227 | s.Printf(wxT("Dock: %d Row: %d"), pi.dock_direction, pi.dock_row); |
228 | dc.GetTextExtent(s, &w, &h); | |
229 | dc.DrawText(s, (size.x-w)/2, ((size.y-(height*5))/2)+(height*2)); | |
bfeed34c | 230 | |
50acee04 JS |
231 | s.Printf(wxT("Position: %d"), pi.dock_pos); |
232 | dc.GetTextExtent(s, &w, &h); | |
233 | dc.DrawText(s, (size.x-w)/2, ((size.y-(height*5))/2)+(height*3)); | |
bfeed34c | 234 | |
50acee04 JS |
235 | s.Printf(wxT("Proportion: %d"), pi.dock_proportion); |
236 | dc.GetTextExtent(s, &w, &h); | |
237 | dc.DrawText(s, (size.x-w)/2, ((size.y-(height*5))/2)+(height*4)); | |
238 | } | |
239 | } | |
240 | ||
bfeed34c | 241 | void OnEraseBackground(wxEraseEvent& WXUNUSED(evt)) |
50acee04 JS |
242 | { |
243 | // intentionally empty | |
244 | } | |
245 | ||
bfeed34c | 246 | void OnSize(wxSizeEvent& WXUNUSED(evt)) |
50acee04 JS |
247 | { |
248 | Refresh(); | |
249 | } | |
250 | private: | |
251 | ||
a3a5df9d | 252 | wxAuiManager* m_mgr; |
bfeed34c | 253 | |
6dcf9888 | 254 | DECLARE_EVENT_TABLE() |
50acee04 JS |
255 | }; |
256 | ||
257 | BEGIN_EVENT_TABLE(wxSizeReportCtrl, wxControl) | |
258 | EVT_PAINT(wxSizeReportCtrl::OnPaint) | |
259 | EVT_SIZE(wxSizeReportCtrl::OnSize) | |
260 | EVT_ERASE_BACKGROUND(wxSizeReportCtrl::OnEraseBackground) | |
261 | END_EVENT_TABLE() | |
262 | ||
263 | ||
50acee04 JS |
264 | class SettingsPanel : public wxPanel |
265 | { | |
266 | enum | |
267 | { | |
268 | ID_PaneBorderSize = wxID_HIGHEST+1, | |
269 | ID_SashSize, | |
270 | ID_CaptionSize, | |
271 | ID_BackgroundColor, | |
272 | ID_SashColor, | |
273 | ID_InactiveCaptionColor, | |
274 | ID_InactiveCaptionGradientColor, | |
275 | ID_InactiveCaptionTextColor, | |
276 | ID_ActiveCaptionColor, | |
277 | ID_ActiveCaptionGradientColor, | |
278 | ID_ActiveCaptionTextColor, | |
279 | ID_BorderColor, | |
280 | ID_GripperColor | |
281 | }; | |
282 | ||
283 | public: | |
284 | ||
285 | SettingsPanel(wxWindow* parent, MyFrame* frame) | |
75d0223f VZ |
286 | : wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize), |
287 | m_frame(frame) | |
50acee04 JS |
288 | { |
289 | //wxBoxSizer* vert = new wxBoxSizer(wxVERTICAL); | |
290 | ||
291 | //vert->Add(1, 1, 1, wxEXPAND); | |
292 | ||
293 | wxBoxSizer* s1 = new wxBoxSizer(wxHORIZONTAL); | |
5edb3cb5 | 294 | m_border_size = new wxSpinCtrl(this, ID_PaneBorderSize, wxString::Format(wxT("%d"), frame->GetDockArt()->GetMetric(wxAUI_DOCKART_PANE_BORDER_SIZE)), wxDefaultPosition, wxSize(50,20), wxSP_ARROW_KEYS, 0, 100, frame->GetDockArt()->GetMetric(wxAUI_DOCKART_PANE_BORDER_SIZE)); |
50acee04 | 295 | s1->Add(1, 1, 1, wxEXPAND); |
bfeed34c | 296 | s1->Add(new wxStaticText(this, wxID_ANY, wxT("Pane Border Size:"))); |
50acee04 JS |
297 | s1->Add(m_border_size); |
298 | s1->Add(1, 1, 1, wxEXPAND); | |
299 | s1->SetItemMinSize((size_t)1, 180, 20); | |
300 | //vert->Add(s1, 0, wxEXPAND | wxLEFT | wxBOTTOM, 5); | |
301 | ||
302 | wxBoxSizer* s2 = new wxBoxSizer(wxHORIZONTAL); | |
5edb3cb5 | 303 | m_sash_size = new wxSpinCtrl(this, ID_SashSize, wxString::Format(wxT("%d"), frame->GetDockArt()->GetMetric(wxAUI_DOCKART_SASH_SIZE)), wxDefaultPosition, wxSize(50,20), wxSP_ARROW_KEYS, 0, 100, frame->GetDockArt()->GetMetric(wxAUI_DOCKART_SASH_SIZE)); |
50acee04 | 304 | s2->Add(1, 1, 1, wxEXPAND); |
bfeed34c | 305 | s2->Add(new wxStaticText(this, wxID_ANY, wxT("Sash Size:"))); |
50acee04 JS |
306 | s2->Add(m_sash_size); |
307 | s2->Add(1, 1, 1, wxEXPAND); | |
308 | s2->SetItemMinSize((size_t)1, 180, 20); | |
309 | //vert->Add(s2, 0, wxEXPAND | wxLEFT | wxBOTTOM, 5); | |
310 | ||
311 | wxBoxSizer* s3 = new wxBoxSizer(wxHORIZONTAL); | |
5edb3cb5 | 312 | m_caption_size = new wxSpinCtrl(this, ID_CaptionSize, wxString::Format(wxT("%d"), frame->GetDockArt()->GetMetric(wxAUI_DOCKART_CAPTION_SIZE)), wxDefaultPosition, wxSize(50,20), wxSP_ARROW_KEYS, 0, 100, frame->GetDockArt()->GetMetric(wxAUI_DOCKART_CAPTION_SIZE)); |
50acee04 | 313 | s3->Add(1, 1, 1, wxEXPAND); |
bfeed34c | 314 | s3->Add(new wxStaticText(this, wxID_ANY, wxT("Caption Size:"))); |
50acee04 JS |
315 | s3->Add(m_caption_size); |
316 | s3->Add(1, 1, 1, wxEXPAND); | |
317 | s3->SetItemMinSize((size_t)1, 180, 20); | |
318 | //vert->Add(s3, 0, wxEXPAND | wxLEFT | wxBOTTOM, 5); | |
319 | ||
320 | //vert->Add(1, 1, 1, wxEXPAND); | |
321 | ||
322 | ||
323 | wxBitmap b = CreateColorBitmap(*wxBLACK); | |
324 | ||
325 | wxBoxSizer* s4 = new wxBoxSizer(wxHORIZONTAL); | |
326 | m_background_color = new wxBitmapButton(this, ID_BackgroundColor, b, wxDefaultPosition, wxSize(50,25)); | |
327 | s4->Add(1, 1, 1, wxEXPAND); | |
bfeed34c | 328 | s4->Add(new wxStaticText(this, wxID_ANY, wxT("Background Color:"))); |
50acee04 JS |
329 | s4->Add(m_background_color); |
330 | s4->Add(1, 1, 1, wxEXPAND); | |
331 | s4->SetItemMinSize((size_t)1, 180, 20); | |
332 | ||
333 | wxBoxSizer* s5 = new wxBoxSizer(wxHORIZONTAL); | |
334 | m_sash_color = new wxBitmapButton(this, ID_SashColor, b, wxDefaultPosition, wxSize(50,25)); | |
335 | s5->Add(1, 1, 1, wxEXPAND); | |
bfeed34c | 336 | s5->Add(new wxStaticText(this, wxID_ANY, wxT("Sash Color:"))); |
50acee04 JS |
337 | s5->Add(m_sash_color); |
338 | s5->Add(1, 1, 1, wxEXPAND); | |
339 | s5->SetItemMinSize((size_t)1, 180, 20); | |
340 | ||
341 | wxBoxSizer* s6 = new wxBoxSizer(wxHORIZONTAL); | |
342 | m_inactive_caption_color = new wxBitmapButton(this, ID_InactiveCaptionColor, b, wxDefaultPosition, wxSize(50,25)); | |
343 | s6->Add(1, 1, 1, wxEXPAND); | |
bfeed34c | 344 | s6->Add(new wxStaticText(this, wxID_ANY, wxT("Normal Caption:"))); |
50acee04 JS |
345 | s6->Add(m_inactive_caption_color); |
346 | s6->Add(1, 1, 1, wxEXPAND); | |
347 | s6->SetItemMinSize((size_t)1, 180, 20); | |
348 | ||
349 | wxBoxSizer* s7 = new wxBoxSizer(wxHORIZONTAL); | |
350 | m_inactive_caption_gradient_color = new wxBitmapButton(this, ID_InactiveCaptionGradientColor, b, wxDefaultPosition, wxSize(50,25)); | |
351 | s7->Add(1, 1, 1, wxEXPAND); | |
bfeed34c | 352 | s7->Add(new wxStaticText(this, wxID_ANY, wxT("Normal Caption Gradient:"))); |
50acee04 JS |
353 | s7->Add(m_inactive_caption_gradient_color); |
354 | s7->Add(1, 1, 1, wxEXPAND); | |
355 | s7->SetItemMinSize((size_t)1, 180, 20); | |
356 | ||
357 | wxBoxSizer* s8 = new wxBoxSizer(wxHORIZONTAL); | |
358 | m_inactive_caption_text_color = new wxBitmapButton(this, ID_InactiveCaptionTextColor, b, wxDefaultPosition, wxSize(50,25)); | |
359 | s8->Add(1, 1, 1, wxEXPAND); | |
bfeed34c | 360 | s8->Add(new wxStaticText(this, wxID_ANY, wxT("Normal Caption Text:"))); |
50acee04 JS |
361 | s8->Add(m_inactive_caption_text_color); |
362 | s8->Add(1, 1, 1, wxEXPAND); | |
363 | s8->SetItemMinSize((size_t)1, 180, 20); | |
364 | ||
365 | wxBoxSizer* s9 = new wxBoxSizer(wxHORIZONTAL); | |
366 | m_active_caption_color = new wxBitmapButton(this, ID_ActiveCaptionColor, b, wxDefaultPosition, wxSize(50,25)); | |
367 | s9->Add(1, 1, 1, wxEXPAND); | |
bfeed34c | 368 | s9->Add(new wxStaticText(this, wxID_ANY, wxT("Active Caption:"))); |
50acee04 JS |
369 | s9->Add(m_active_caption_color); |
370 | s9->Add(1, 1, 1, wxEXPAND); | |
371 | s9->SetItemMinSize((size_t)1, 180, 20); | |
372 | ||
373 | wxBoxSizer* s10 = new wxBoxSizer(wxHORIZONTAL); | |
374 | m_active_caption_gradient_color = new wxBitmapButton(this, ID_ActiveCaptionGradientColor, b, wxDefaultPosition, wxSize(50,25)); | |
375 | s10->Add(1, 1, 1, wxEXPAND); | |
bfeed34c | 376 | s10->Add(new wxStaticText(this, wxID_ANY, wxT("Active Caption Gradient:"))); |
50acee04 JS |
377 | s10->Add(m_active_caption_gradient_color); |
378 | s10->Add(1, 1, 1, wxEXPAND); | |
379 | s10->SetItemMinSize((size_t)1, 180, 20); | |
380 | ||
381 | wxBoxSizer* s11 = new wxBoxSizer(wxHORIZONTAL); | |
382 | m_active_caption_text_color = new wxBitmapButton(this, ID_ActiveCaptionTextColor, b, wxDefaultPosition, wxSize(50,25)); | |
383 | s11->Add(1, 1, 1, wxEXPAND); | |
bfeed34c | 384 | s11->Add(new wxStaticText(this, wxID_ANY, wxT("Active Caption Text:"))); |
50acee04 JS |
385 | s11->Add(m_active_caption_text_color); |
386 | s11->Add(1, 1, 1, wxEXPAND); | |
387 | s11->SetItemMinSize((size_t)1, 180, 20); | |
388 | ||
389 | wxBoxSizer* s12 = new wxBoxSizer(wxHORIZONTAL); | |
390 | m_border_color = new wxBitmapButton(this, ID_BorderColor, b, wxDefaultPosition, wxSize(50,25)); | |
391 | s12->Add(1, 1, 1, wxEXPAND); | |
bfeed34c | 392 | s12->Add(new wxStaticText(this, wxID_ANY, wxT("Border Color:"))); |
50acee04 JS |
393 | s12->Add(m_border_color); |
394 | s12->Add(1, 1, 1, wxEXPAND); | |
395 | s12->SetItemMinSize((size_t)1, 180, 20); | |
396 | ||
397 | wxBoxSizer* s13 = new wxBoxSizer(wxHORIZONTAL); | |
398 | m_gripper_color = new wxBitmapButton(this, ID_GripperColor, b, wxDefaultPosition, wxSize(50,25)); | |
399 | s13->Add(1, 1, 1, wxEXPAND); | |
bfeed34c | 400 | s13->Add(new wxStaticText(this, wxID_ANY, wxT("Gripper Color:"))); |
50acee04 JS |
401 | s13->Add(m_gripper_color); |
402 | s13->Add(1, 1, 1, wxEXPAND); | |
403 | s13->SetItemMinSize((size_t)1, 180, 20); | |
bfeed34c | 404 | |
50acee04 JS |
405 | wxGridSizer* grid_sizer = new wxGridSizer(2); |
406 | grid_sizer->SetHGap(5); | |
407 | grid_sizer->Add(s1); grid_sizer->Add(s4); | |
408 | grid_sizer->Add(s2); grid_sizer->Add(s5); | |
409 | grid_sizer->Add(s3); grid_sizer->Add(s13); | |
410 | grid_sizer->Add(1,1); grid_sizer->Add(s12); | |
411 | grid_sizer->Add(s6); grid_sizer->Add(s9); | |
412 | grid_sizer->Add(s7); grid_sizer->Add(s10); | |
413 | grid_sizer->Add(s8); grid_sizer->Add(s11); | |
bfeed34c | 414 | |
50acee04 JS |
415 | wxBoxSizer* cont_sizer = new wxBoxSizer(wxVERTICAL); |
416 | cont_sizer->Add(grid_sizer, 1, wxEXPAND | wxALL, 5); | |
417 | SetSizer(cont_sizer); | |
418 | GetSizer()->SetSizeHints(this); | |
419 | ||
254a3429 BW |
420 | m_border_size->SetValue(frame->GetDockArt()->GetMetric(wxAUI_DOCKART_PANE_BORDER_SIZE)); |
421 | m_sash_size->SetValue(frame->GetDockArt()->GetMetric(wxAUI_DOCKART_SASH_SIZE)); | |
422 | m_caption_size->SetValue(frame->GetDockArt()->GetMetric(wxAUI_DOCKART_CAPTION_SIZE)); | |
bfeed34c | 423 | |
50acee04 JS |
424 | UpdateColors(); |
425 | } | |
426 | ||
427 | private: | |
428 | ||
429 | wxBitmap CreateColorBitmap(const wxColour& c) | |
430 | { | |
431 | wxImage image; | |
432 | image.Create(25,14); | |
433 | for (int x = 0; x < 25; ++x) | |
434 | for (int y = 0; y < 14; ++y) | |
435 | { | |
436 | wxColour pixcol = c; | |
437 | if (x == 0 || x == 24 || y == 0 || y == 13) | |
438 | pixcol = *wxBLACK; | |
439 | image.SetRGB(x, y, pixcol.Red(), pixcol.Green(), pixcol.Blue()); | |
440 | } | |
441 | return wxBitmap(image); | |
442 | } | |
bfeed34c | 443 | |
50acee04 JS |
444 | void UpdateColors() |
445 | { | |
254a3429 | 446 | wxColour bk = m_frame->GetDockArt()->GetColor(wxAUI_DOCKART_BACKGROUND_COLOUR); |
50acee04 | 447 | m_background_color->SetBitmapLabel(CreateColorBitmap(bk)); |
bfeed34c | 448 | |
254a3429 | 449 | wxColour cap = m_frame->GetDockArt()->GetColor(wxAUI_DOCKART_INACTIVE_CAPTION_COLOUR); |
50acee04 | 450 | m_inactive_caption_color->SetBitmapLabel(CreateColorBitmap(cap)); |
bfeed34c | 451 | |
254a3429 | 452 | wxColour capgrad = m_frame->GetDockArt()->GetColor(wxAUI_DOCKART_INACTIVE_CAPTION_GRADIENT_COLOUR); |
50acee04 | 453 | m_inactive_caption_gradient_color->SetBitmapLabel(CreateColorBitmap(capgrad)); |
bfeed34c | 454 | |
254a3429 | 455 | wxColour captxt = m_frame->GetDockArt()->GetColor(wxAUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR); |
50acee04 | 456 | m_inactive_caption_text_color->SetBitmapLabel(CreateColorBitmap(captxt)); |
bfeed34c | 457 | |
254a3429 | 458 | wxColour acap = m_frame->GetDockArt()->GetColor(wxAUI_DOCKART_ACTIVE_CAPTION_COLOUR); |
50acee04 | 459 | m_active_caption_color->SetBitmapLabel(CreateColorBitmap(acap)); |
bfeed34c | 460 | |
254a3429 | 461 | wxColour acapgrad = m_frame->GetDockArt()->GetColor(wxAUI_DOCKART_ACTIVE_CAPTION_GRADIENT_COLOUR); |
50acee04 | 462 | m_active_caption_gradient_color->SetBitmapLabel(CreateColorBitmap(acapgrad)); |
bfeed34c | 463 | |
254a3429 | 464 | wxColour acaptxt = m_frame->GetDockArt()->GetColor(wxAUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR); |
50acee04 JS |
465 | m_active_caption_text_color->SetBitmapLabel(CreateColorBitmap(acaptxt)); |
466 | ||
254a3429 | 467 | wxColour sash = m_frame->GetDockArt()->GetColor(wxAUI_DOCKART_SASH_COLOUR); |
50acee04 | 468 | m_sash_color->SetBitmapLabel(CreateColorBitmap(sash)); |
bfeed34c | 469 | |
254a3429 | 470 | wxColour border = m_frame->GetDockArt()->GetColor(wxAUI_DOCKART_BORDER_COLOUR); |
50acee04 | 471 | m_border_color->SetBitmapLabel(CreateColorBitmap(border)); |
bfeed34c | 472 | |
254a3429 | 473 | wxColour gripper = m_frame->GetDockArt()->GetColor(wxAUI_DOCKART_GRIPPER_COLOUR); |
50acee04 JS |
474 | m_gripper_color->SetBitmapLabel(CreateColorBitmap(gripper)); |
475 | } | |
bfeed34c | 476 | |
50acee04 JS |
477 | void OnPaneBorderSize(wxSpinEvent& event) |
478 | { | |
254a3429 | 479 | m_frame->GetDockArt()->SetMetric(wxAUI_DOCKART_PANE_BORDER_SIZE, |
50acee04 JS |
480 | event.GetPosition()); |
481 | m_frame->DoUpdate(); | |
482 | } | |
483 | ||
484 | void OnSashSize(wxSpinEvent& event) | |
485 | { | |
254a3429 | 486 | m_frame->GetDockArt()->SetMetric(wxAUI_DOCKART_SASH_SIZE, |
50acee04 JS |
487 | event.GetPosition()); |
488 | m_frame->DoUpdate(); | |
489 | } | |
490 | ||
491 | void OnCaptionSize(wxSpinEvent& event) | |
492 | { | |
254a3429 | 493 | m_frame->GetDockArt()->SetMetric(wxAUI_DOCKART_CAPTION_SIZE, |
50acee04 JS |
494 | event.GetPosition()); |
495 | m_frame->DoUpdate(); | |
496 | } | |
497 | ||
498 | void OnSetColor(wxCommandEvent& event) | |
499 | { | |
500 | wxColourDialog dlg(m_frame); | |
501 | dlg.SetTitle(_("Color Picker")); | |
502 | if (dlg.ShowModal() != wxID_OK) | |
503 | return; | |
bfeed34c | 504 | |
50acee04 JS |
505 | int var = 0; |
506 | switch (event.GetId()) | |
507 | { | |
254a3429 BW |
508 | case ID_BackgroundColor: var = wxAUI_DOCKART_BACKGROUND_COLOUR; break; |
509 | case ID_SashColor: var = wxAUI_DOCKART_SASH_COLOUR; break; | |
510 | case ID_InactiveCaptionColor: var = wxAUI_DOCKART_INACTIVE_CAPTION_COLOUR; break; | |
511 | case ID_InactiveCaptionGradientColor: var = wxAUI_DOCKART_INACTIVE_CAPTION_GRADIENT_COLOUR; break; | |
512 | case ID_InactiveCaptionTextColor: var = wxAUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR; break; | |
513 | case ID_ActiveCaptionColor: var = wxAUI_DOCKART_ACTIVE_CAPTION_COLOUR; break; | |
514 | case ID_ActiveCaptionGradientColor: var = wxAUI_DOCKART_ACTIVE_CAPTION_GRADIENT_COLOUR; break; | |
515 | case ID_ActiveCaptionTextColor: var = wxAUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR; break; | |
516 | case ID_BorderColor: var = wxAUI_DOCKART_BORDER_COLOUR; break; | |
517 | case ID_GripperColor: var = wxAUI_DOCKART_GRIPPER_COLOUR; break; | |
50acee04 JS |
518 | default: return; |
519 | } | |
bfeed34c | 520 | |
50acee04 JS |
521 | m_frame->GetDockArt()->SetColor(var, dlg.GetColourData().GetColour()); |
522 | m_frame->DoUpdate(); | |
523 | UpdateColors(); | |
524 | } | |
bfeed34c | 525 | |
50acee04 JS |
526 | private: |
527 | ||
528 | MyFrame* m_frame; | |
529 | wxSpinCtrl* m_border_size; | |
530 | wxSpinCtrl* m_sash_size; | |
531 | wxSpinCtrl* m_caption_size; | |
532 | wxBitmapButton* m_inactive_caption_text_color; | |
533 | wxBitmapButton* m_inactive_caption_gradient_color; | |
534 | wxBitmapButton* m_inactive_caption_color; | |
535 | wxBitmapButton* m_active_caption_text_color; | |
536 | wxBitmapButton* m_active_caption_gradient_color; | |
537 | wxBitmapButton* m_active_caption_color; | |
538 | wxBitmapButton* m_sash_color; | |
539 | wxBitmapButton* m_background_color; | |
540 | wxBitmapButton* m_border_color; | |
541 | wxBitmapButton* m_gripper_color; | |
bfeed34c | 542 | |
50acee04 JS |
543 | DECLARE_EVENT_TABLE() |
544 | }; | |
545 | ||
546 | BEGIN_EVENT_TABLE(SettingsPanel, wxPanel) | |
547 | EVT_SPINCTRL(ID_PaneBorderSize, SettingsPanel::OnPaneBorderSize) | |
548 | EVT_SPINCTRL(ID_SashSize, SettingsPanel::OnSashSize) | |
549 | EVT_SPINCTRL(ID_CaptionSize, SettingsPanel::OnCaptionSize) | |
550 | EVT_BUTTON(ID_BackgroundColor, SettingsPanel::OnSetColor) | |
551 | EVT_BUTTON(ID_SashColor, SettingsPanel::OnSetColor) | |
552 | EVT_BUTTON(ID_InactiveCaptionColor, SettingsPanel::OnSetColor) | |
553 | EVT_BUTTON(ID_InactiveCaptionGradientColor, SettingsPanel::OnSetColor) | |
554 | EVT_BUTTON(ID_InactiveCaptionTextColor, SettingsPanel::OnSetColor) | |
555 | EVT_BUTTON(ID_ActiveCaptionColor, SettingsPanel::OnSetColor) | |
556 | EVT_BUTTON(ID_ActiveCaptionGradientColor, SettingsPanel::OnSetColor) | |
557 | EVT_BUTTON(ID_ActiveCaptionTextColor, SettingsPanel::OnSetColor) | |
558 | EVT_BUTTON(ID_BorderColor, SettingsPanel::OnSetColor) | |
bfeed34c | 559 | EVT_BUTTON(ID_GripperColor, SettingsPanel::OnSetColor) |
50acee04 JS |
560 | END_EVENT_TABLE() |
561 | ||
562 | ||
50acee04 JS |
563 | bool MyApp::OnInit() |
564 | { | |
45e6e6f8 VZ |
565 | if ( !wxApp::OnInit() ) |
566 | return false; | |
567 | ||
50acee04 JS |
568 | wxFrame* frame = new MyFrame(NULL, |
569 | wxID_ANY, | |
70476471 | 570 | wxT("wxAUI Sample Application"), |
50acee04 JS |
571 | wxDefaultPosition, |
572 | wxSize(800, 600)); | |
573 | SetTopWindow(frame); | |
574 | frame->Show(); | |
575 | ||
576 | return true; | |
577 | } | |
578 | ||
50acee04 JS |
579 | BEGIN_EVENT_TABLE(MyFrame, wxFrame) |
580 | EVT_ERASE_BACKGROUND(MyFrame::OnEraseBackground) | |
581 | EVT_SIZE(MyFrame::OnSize) | |
582 | EVT_MENU(MyFrame::ID_CreateTree, MyFrame::OnCreateTree) | |
583 | EVT_MENU(MyFrame::ID_CreateGrid, MyFrame::OnCreateGrid) | |
584 | EVT_MENU(MyFrame::ID_CreateText, MyFrame::OnCreateText) | |
585 | EVT_MENU(MyFrame::ID_CreateHTML, MyFrame::OnCreateHTML) | |
586 | EVT_MENU(MyFrame::ID_CreateSizeReport, MyFrame::OnCreateSizeReport) | |
8bfde0a8 | 587 | EVT_MENU(MyFrame::ID_CreateNotebook, MyFrame::OnCreateNotebook) |
50acee04 JS |
588 | EVT_MENU(MyFrame::ID_CreatePerspective, MyFrame::OnCreatePerspective) |
589 | EVT_MENU(MyFrame::ID_CopyPerspectiveCode, MyFrame::OnCopyPerspectiveCode) | |
590 | EVT_MENU(ID_AllowFloating, MyFrame::OnManagerFlag) | |
591 | EVT_MENU(ID_TransparentHint, MyFrame::OnManagerFlag) | |
cf6fec73 BW |
592 | EVT_MENU(ID_VenetianBlindsHint, MyFrame::OnManagerFlag) |
593 | EVT_MENU(ID_RectangleHint, MyFrame::OnManagerFlag) | |
594 | EVT_MENU(ID_NoHint, MyFrame::OnManagerFlag) | |
595 | EVT_MENU(ID_HintFade, MyFrame::OnManagerFlag) | |
596 | EVT_MENU(ID_NoVenetianFade, MyFrame::OnManagerFlag) | |
50acee04 | 597 | EVT_MENU(ID_TransparentDrag, MyFrame::OnManagerFlag) |
68030cae | 598 | EVT_MENU(ID_LiveUpdate, MyFrame::OnManagerFlag) |
50acee04 | 599 | EVT_MENU(ID_AllowActivePane, MyFrame::OnManagerFlag) |
b0d17f7c | 600 | EVT_MENU(ID_NotebookTabFixedWidth, MyFrame::OnNotebookFlag) |
931483d7 | 601 | EVT_MENU(ID_NotebookNoCloseButton, MyFrame::OnNotebookFlag) |
c50fa29f BW |
602 | EVT_MENU(ID_NotebookCloseButton, MyFrame::OnNotebookFlag) |
603 | EVT_MENU(ID_NotebookCloseButtonAll, MyFrame::OnNotebookFlag) | |
604 | EVT_MENU(ID_NotebookCloseButtonActive, MyFrame::OnNotebookFlag) | |
51100f50 | 605 | EVT_MENU(ID_NotebookAllowTabMove, MyFrame::OnNotebookFlag) |
5d3aeb0f | 606 | EVT_MENU(ID_NotebookAllowTabExternalMove, MyFrame::OnNotebookFlag) |
51100f50 | 607 | EVT_MENU(ID_NotebookAllowTabSplit, MyFrame::OnNotebookFlag) |
01372b8f BW |
608 | EVT_MENU(ID_NotebookScrollButtons, MyFrame::OnNotebookFlag) |
609 | EVT_MENU(ID_NotebookWindowList, MyFrame::OnNotebookFlag) | |
b0d17f7c BW |
610 | EVT_MENU(ID_NotebookArtGloss, MyFrame::OnNotebookFlag) |
611 | EVT_MENU(ID_NotebookArtSimple, MyFrame::OnNotebookFlag) | |
b5d196c1 BW |
612 | EVT_MENU(ID_NotebookAlignTop, MyFrame::OnTabAlignment) |
613 | EVT_MENU(ID_NotebookAlignBottom, MyFrame::OnTabAlignment) | |
50acee04 JS |
614 | EVT_MENU(ID_NoGradient, MyFrame::OnGradient) |
615 | EVT_MENU(ID_VerticalGradient, MyFrame::OnGradient) | |
616 | EVT_MENU(ID_HorizontalGradient, MyFrame::OnGradient) | |
e5dcae09 | 617 | EVT_MENU(ID_AllowToolbarResizing, MyFrame::OnToolbarResizing) |
50acee04 | 618 | EVT_MENU(ID_Settings, MyFrame::OnSettings) |
b5d196c1 | 619 | EVT_MENU(ID_CustomizeToolbar, MyFrame::OnCustomizeToolbar) |
50acee04 JS |
620 | EVT_MENU(ID_GridContent, MyFrame::OnChangeContentPane) |
621 | EVT_MENU(ID_TreeContent, MyFrame::OnChangeContentPane) | |
622 | EVT_MENU(ID_TextContent, MyFrame::OnChangeContentPane) | |
623 | EVT_MENU(ID_SizeReportContent, MyFrame::OnChangeContentPane) | |
624 | EVT_MENU(ID_HTMLContent, MyFrame::OnChangeContentPane) | |
df00bdf7 | 625 | EVT_MENU(ID_NotebookContent, MyFrame::OnChangeContentPane) |
50acee04 JS |
626 | EVT_MENU(wxID_EXIT, MyFrame::OnExit) |
627 | EVT_MENU(wxID_ABOUT, MyFrame::OnAbout) | |
b0d17f7c | 628 | EVT_UPDATE_UI(ID_NotebookTabFixedWidth, MyFrame::OnUpdateUI) |
931483d7 | 629 | EVT_UPDATE_UI(ID_NotebookNoCloseButton, MyFrame::OnUpdateUI) |
c50fa29f BW |
630 | EVT_UPDATE_UI(ID_NotebookCloseButton, MyFrame::OnUpdateUI) |
631 | EVT_UPDATE_UI(ID_NotebookCloseButtonAll, MyFrame::OnUpdateUI) | |
632 | EVT_UPDATE_UI(ID_NotebookCloseButtonActive, MyFrame::OnUpdateUI) | |
51100f50 | 633 | EVT_UPDATE_UI(ID_NotebookAllowTabMove, MyFrame::OnUpdateUI) |
5d3aeb0f | 634 | EVT_UPDATE_UI(ID_NotebookAllowTabExternalMove, MyFrame::OnUpdateUI) |
51100f50 | 635 | EVT_UPDATE_UI(ID_NotebookAllowTabSplit, MyFrame::OnUpdateUI) |
01372b8f BW |
636 | EVT_UPDATE_UI(ID_NotebookScrollButtons, MyFrame::OnUpdateUI) |
637 | EVT_UPDATE_UI(ID_NotebookWindowList, MyFrame::OnUpdateUI) | |
50acee04 JS |
638 | EVT_UPDATE_UI(ID_AllowFloating, MyFrame::OnUpdateUI) |
639 | EVT_UPDATE_UI(ID_TransparentHint, MyFrame::OnUpdateUI) | |
cf6fec73 BW |
640 | EVT_UPDATE_UI(ID_VenetianBlindsHint, MyFrame::OnUpdateUI) |
641 | EVT_UPDATE_UI(ID_RectangleHint, MyFrame::OnUpdateUI) | |
642 | EVT_UPDATE_UI(ID_NoHint, MyFrame::OnUpdateUI) | |
643 | EVT_UPDATE_UI(ID_HintFade, MyFrame::OnUpdateUI) | |
644 | EVT_UPDATE_UI(ID_NoVenetianFade, MyFrame::OnUpdateUI) | |
50acee04 | 645 | EVT_UPDATE_UI(ID_TransparentDrag, MyFrame::OnUpdateUI) |
68030cae | 646 | EVT_UPDATE_UI(ID_LiveUpdate, MyFrame::OnUpdateUI) |
50acee04 JS |
647 | EVT_UPDATE_UI(ID_NoGradient, MyFrame::OnUpdateUI) |
648 | EVT_UPDATE_UI(ID_VerticalGradient, MyFrame::OnUpdateUI) | |
649 | EVT_UPDATE_UI(ID_HorizontalGradient, MyFrame::OnUpdateUI) | |
e5dcae09 | 650 | EVT_UPDATE_UI(ID_AllowToolbarResizing, MyFrame::OnUpdateUI) |
50acee04 JS |
651 | EVT_MENU_RANGE(MyFrame::ID_FirstPerspective, MyFrame::ID_FirstPerspective+1000, |
652 | MyFrame::OnRestorePerspective) | |
b5d196c1 | 653 | EVT_AUITOOLBAR_TOOL_DROPDOWN(ID_DropDownToolbarItem, MyFrame::OnDropDownToolbarItem) |
bc07ab17 | 654 | EVT_AUI_PANE_CLOSE(MyFrame::OnPaneClose) |
5d3aeb0f | 655 | EVT_AUINOTEBOOK_ALLOW_DND(wxID_ANY, MyFrame::OnAllowNotebookDnD) |
3fd8c988 | 656 | EVT_AUINOTEBOOK_PAGE_CLOSE(wxID_ANY, MyFrame::OnNotebookPageClose) |
917f228a | 657 | EVT_AUINOTEBOOK_PAGE_CLOSED(wxID_ANY, MyFrame::OnNotebookPageClosed) |
50acee04 JS |
658 | END_EVENT_TABLE() |
659 | ||
660 | ||
50acee04 JS |
661 | MyFrame::MyFrame(wxWindow* parent, |
662 | wxWindowID id, | |
663 | const wxString& title, | |
664 | const wxPoint& pos, | |
665 | const wxSize& size, | |
666 | long style) | |
667 | : wxFrame(parent, id, title, pos, size, style) | |
668 | { | |
a3a5df9d | 669 | // tell wxAuiManager to manage this frame |
461125ea | 670 | m_mgr.SetManagedWindow(this); |
bfeed34c | 671 | |
50acee04 JS |
672 | // set frame icon |
673 | SetIcon(wxIcon(sample_xpm)); | |
674 | ||
c50fa29f | 675 | // set up default notebook style |
5d3aeb0f | 676 | m_notebook_style = wxAUI_NB_DEFAULT_STYLE | wxAUI_NB_TAB_EXTERNAL_MOVE | wxNO_BORDER; |
b0d17f7c | 677 | m_notebook_theme = 0; |
b5d196c1 | 678 | |
50acee04 JS |
679 | // create menu |
680 | wxMenuBar* mb = new wxMenuBar; | |
681 | ||
682 | wxMenu* file_menu = new wxMenu; | |
88fff2a7 | 683 | file_menu->Append(wxID_EXIT); |
50acee04 JS |
684 | |
685 | wxMenu* view_menu = new wxMenu; | |
686 | view_menu->Append(ID_CreateText, _("Create Text Control")); | |
687 | view_menu->Append(ID_CreateHTML, _("Create HTML Control")); | |
688 | view_menu->Append(ID_CreateTree, _("Create Tree")); | |
689 | view_menu->Append(ID_CreateGrid, _("Create Grid")); | |
8bfde0a8 | 690 | view_menu->Append(ID_CreateNotebook, _("Create Notebook")); |
50acee04 JS |
691 | view_menu->Append(ID_CreateSizeReport, _("Create Size Reporter")); |
692 | view_menu->AppendSeparator(); | |
693 | view_menu->Append(ID_GridContent, _("Use a Grid for the Content Pane")); | |
694 | view_menu->Append(ID_TextContent, _("Use a Text Control for the Content Pane")); | |
695 | view_menu->Append(ID_HTMLContent, _("Use an HTML Control for the Content Pane")); | |
696 | view_menu->Append(ID_TreeContent, _("Use a Tree Control for the Content Pane")); | |
73212f35 | 697 | view_menu->Append(ID_NotebookContent, _("Use a wxAuiNotebook control for the Content Pane")); |
bfeed34c WS |
698 | view_menu->Append(ID_SizeReportContent, _("Use a Size Reporter for the Content Pane")); |
699 | ||
50acee04 | 700 | wxMenu* options_menu = new wxMenu; |
cf6fec73 BW |
701 | options_menu->AppendRadioItem(ID_TransparentHint, _("Transparent Hint")); |
702 | options_menu->AppendRadioItem(ID_VenetianBlindsHint, _("Venetian Blinds Hint")); | |
703 | options_menu->AppendRadioItem(ID_RectangleHint, _("Rectangle Hint")); | |
704 | options_menu->AppendRadioItem(ID_NoHint, _("No Hint")); | |
705 | options_menu->AppendSeparator(); | |
706 | options_menu->AppendCheckItem(ID_HintFade, _("Hint Fade-in")); | |
50acee04 | 707 | options_menu->AppendCheckItem(ID_AllowFloating, _("Allow Floating")); |
cf6fec73 | 708 | options_menu->AppendCheckItem(ID_NoVenetianFade, _("Disable Venetian Blinds Hint Fade-in")); |
50acee04 JS |
709 | options_menu->AppendCheckItem(ID_TransparentDrag, _("Transparent Drag")); |
710 | options_menu->AppendCheckItem(ID_AllowActivePane, _("Allow Active Pane")); | |
68030cae | 711 | options_menu->AppendCheckItem(ID_LiveUpdate, _("Live Resize Update")); |
50acee04 JS |
712 | options_menu->AppendSeparator(); |
713 | options_menu->AppendRadioItem(ID_NoGradient, _("No Caption Gradient")); | |
714 | options_menu->AppendRadioItem(ID_VerticalGradient, _("Vertical Caption Gradient")); | |
715 | options_menu->AppendRadioItem(ID_HorizontalGradient, _("Horizontal Caption Gradient")); | |
716 | options_menu->AppendSeparator(); | |
e5dcae09 VZ |
717 | options_menu->AppendCheckItem(ID_AllowToolbarResizing, _("Allow Toolbar Resizing")); |
718 | options_menu->AppendSeparator(); | |
50acee04 | 719 | options_menu->Append(ID_Settings, _("Settings Pane")); |
bfeed34c | 720 | |
c50fa29f | 721 | wxMenu* notebook_menu = new wxMenu; |
b0d17f7c BW |
722 | notebook_menu->AppendRadioItem(ID_NotebookArtGloss, _("Glossy Theme (Default)")); |
723 | notebook_menu->AppendRadioItem(ID_NotebookArtSimple, _("Simple Theme")); | |
724 | notebook_menu->AppendSeparator(); | |
931483d7 | 725 | notebook_menu->AppendRadioItem(ID_NotebookNoCloseButton, _("No Close Button")); |
c50fa29f BW |
726 | notebook_menu->AppendRadioItem(ID_NotebookCloseButton, _("Close Button at Right")); |
727 | notebook_menu->AppendRadioItem(ID_NotebookCloseButtonAll, _("Close Button on All Tabs")); | |
728 | notebook_menu->AppendRadioItem(ID_NotebookCloseButtonActive, _("Close Button on Active Tab")); | |
51100f50 | 729 | notebook_menu->AppendSeparator(); |
b5d196c1 BW |
730 | notebook_menu->AppendRadioItem(ID_NotebookAlignTop, _("Tab Top Alignment")); |
731 | notebook_menu->AppendRadioItem(ID_NotebookAlignBottom, _("Tab Bottom Alignment")); | |
732 | notebook_menu->AppendSeparator(); | |
51100f50 | 733 | notebook_menu->AppendCheckItem(ID_NotebookAllowTabMove, _("Allow Tab Move")); |
5d3aeb0f | 734 | notebook_menu->AppendCheckItem(ID_NotebookAllowTabExternalMove, _("Allow External Tab Move")); |
51100f50 | 735 | notebook_menu->AppendCheckItem(ID_NotebookAllowTabSplit, _("Allow Notebook Split")); |
01372b8f BW |
736 | notebook_menu->AppendCheckItem(ID_NotebookScrollButtons, _("Scroll Buttons Visible")); |
737 | notebook_menu->AppendCheckItem(ID_NotebookWindowList, _("Window List Button Visible")); | |
b0d17f7c | 738 | notebook_menu->AppendCheckItem(ID_NotebookTabFixedWidth, _("Fixed-width Tabs")); |
c50fa29f | 739 | |
50acee04 JS |
740 | m_perspectives_menu = new wxMenu; |
741 | m_perspectives_menu->Append(ID_CreatePerspective, _("Create Perspective")); | |
742 | m_perspectives_menu->Append(ID_CopyPerspectiveCode, _("Copy Perspective Data To Clipboard")); | |
743 | m_perspectives_menu->AppendSeparator(); | |
744 | m_perspectives_menu->Append(ID_FirstPerspective+0, _("Default Startup")); | |
745 | m_perspectives_menu->Append(ID_FirstPerspective+1, _("All Panes")); | |
746 | ||
747 | wxMenu* help_menu = new wxMenu; | |
88fff2a7 FM |
748 | help_menu->Append(wxID_ABOUT); |
749 | ||
750 | mb->Append(file_menu, _("&File")); | |
751 | mb->Append(view_menu, _("&View")); | |
752 | mb->Append(m_perspectives_menu, _("&Perspectives")); | |
753 | mb->Append(options_menu, _("&Options")); | |
754 | mb->Append(notebook_menu, _("&Notebook")); | |
755 | mb->Append(help_menu, _("&Help")); | |
bfeed34c | 756 | |
50acee04 JS |
757 | SetMenuBar(mb); |
758 | ||
759 | CreateStatusBar(); | |
760 | GetStatusBar()->SetStatusText(_("Ready")); | |
761 | ||
762 | ||
763 | // min size for the frame itself isn't completely done. | |
a3a5df9d | 764 | // see the end up wxAuiManager::Update() for the test |
50acee04 JS |
765 | // code. For now, just hard code a frame minimum size |
766 | SetMinSize(wxSize(400,300)); | |
767 | ||
11986deb | 768 | |
b5d196c1 BW |
769 | |
770 | // prepare a few custom overflow elements for the toolbars' overflow buttons | |
16a6495d | 771 | |
b5d196c1 BW |
772 | wxAuiToolBarItemArray prepend_items; |
773 | wxAuiToolBarItemArray append_items; | |
774 | wxAuiToolBarItem item; | |
0766faa3 | 775 | item.SetKind(wxITEM_SEPARATOR); |
b5d196c1 | 776 | append_items.Add(item); |
0766faa3 BW |
777 | item.SetKind(wxITEM_NORMAL); |
778 | item.SetId(ID_CustomizeToolbar); | |
779 | item.SetLabel(_("Customize...")); | |
b5d196c1 BW |
780 | append_items.Add(item); |
781 | ||
782 | ||
783 | // create some toolbars | |
784 | wxAuiToolBar* tb1 = new wxAuiToolBar(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, | |
785 | wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_OVERFLOW); | |
50acee04 | 786 | tb1->SetToolBitmapSize(wxSize(48,48)); |
b5d196c1 | 787 | tb1->AddTool(ID_SampleItem+1, wxT("Test"), wxArtProvider::GetBitmap(wxART_ERROR)); |
50acee04 | 788 | tb1->AddSeparator(); |
b5d196c1 BW |
789 | tb1->AddTool(ID_SampleItem+2, wxT("Test"), wxArtProvider::GetBitmap(wxART_QUESTION)); |
790 | tb1->AddTool(ID_SampleItem+3, wxT("Test"), wxArtProvider::GetBitmap(wxART_INFORMATION)); | |
791 | tb1->AddTool(ID_SampleItem+4, wxT("Test"), wxArtProvider::GetBitmap(wxART_WARNING)); | |
792 | tb1->AddTool(ID_SampleItem+5, wxT("Test"), wxArtProvider::GetBitmap(wxART_MISSING_IMAGE)); | |
793 | tb1->SetCustomOverflowItems(prepend_items, append_items); | |
50acee04 JS |
794 | tb1->Realize(); |
795 | ||
796 | ||
b5d196c1 | 797 | wxAuiToolBar* tb2 = new wxAuiToolBar(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, |
e5dcae09 | 798 | wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_OVERFLOW | wxAUI_TB_HORIZONTAL); |
50acee04 JS |
799 | tb2->SetToolBitmapSize(wxSize(16,16)); |
800 | ||
801 | wxBitmap tb2_bmp1 = wxArtProvider::GetBitmap(wxART_QUESTION, wxART_OTHER, wxSize(16,16)); | |
b5d196c1 BW |
802 | tb2->AddTool(ID_SampleItem+6, wxT("Test"), tb2_bmp1); |
803 | tb2->AddTool(ID_SampleItem+7, wxT("Test"), tb2_bmp1); | |
804 | tb2->AddTool(ID_SampleItem+8, wxT("Test"), tb2_bmp1); | |
805 | tb2->AddTool(ID_SampleItem+9, wxT("Test"), tb2_bmp1); | |
50acee04 | 806 | tb2->AddSeparator(); |
b5d196c1 BW |
807 | tb2->AddTool(ID_SampleItem+10, wxT("Test"), tb2_bmp1); |
808 | tb2->AddTool(ID_SampleItem+11, wxT("Test"), tb2_bmp1); | |
50acee04 | 809 | tb2->AddSeparator(); |
b5d196c1 BW |
810 | tb2->AddTool(ID_SampleItem+12, wxT("Test"), tb2_bmp1); |
811 | tb2->AddTool(ID_SampleItem+13, wxT("Test"), tb2_bmp1); | |
812 | tb2->AddTool(ID_SampleItem+14, wxT("Test"), tb2_bmp1); | |
813 | tb2->AddTool(ID_SampleItem+15, wxT("Test"), tb2_bmp1); | |
814 | tb2->SetCustomOverflowItems(prepend_items, append_items); | |
50acee04 JS |
815 | tb2->Realize(); |
816 | ||
bfeed34c | 817 | |
b5d196c1 BW |
818 | wxAuiToolBar* tb3 = new wxAuiToolBar(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, |
819 | wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_OVERFLOW); | |
50acee04 JS |
820 | tb3->SetToolBitmapSize(wxSize(16,16)); |
821 | wxBitmap tb3_bmp1 = wxArtProvider::GetBitmap(wxART_FOLDER, wxART_OTHER, wxSize(16,16)); | |
d45d5bb2 BW |
822 | tb3->AddTool(ID_SampleItem+16, wxT("Check 1"), tb3_bmp1, wxT("Check 1"), wxITEM_CHECK); |
823 | tb3->AddTool(ID_SampleItem+17, wxT("Check 2"), tb3_bmp1, wxT("Check 2"), wxITEM_CHECK); | |
824 | tb3->AddTool(ID_SampleItem+18, wxT("Check 3"), tb3_bmp1, wxT("Check 3"), wxITEM_CHECK); | |
825 | tb3->AddTool(ID_SampleItem+19, wxT("Check 4"), tb3_bmp1, wxT("Check 4"), wxITEM_CHECK); | |
50acee04 | 826 | tb3->AddSeparator(); |
d45d5bb2 BW |
827 | tb3->AddTool(ID_SampleItem+20, wxT("Radio 1"), tb3_bmp1, wxT("Radio 1"), wxITEM_RADIO); |
828 | tb3->AddTool(ID_SampleItem+21, wxT("Radio 2"), tb3_bmp1, wxT("Radio 2"), wxITEM_RADIO); | |
829 | tb3->AddTool(ID_SampleItem+22, wxT("Radio 3"), tb3_bmp1, wxT("Radio 3"), wxITEM_RADIO); | |
830 | tb3->AddSeparator(); | |
831 | tb3->AddTool(ID_SampleItem+23, wxT("Radio 1 (Group 2)"), tb3_bmp1, wxT("Radio 1 (Group 2)"), wxITEM_RADIO); | |
832 | tb3->AddTool(ID_SampleItem+24, wxT("Radio 2 (Group 2)"), tb3_bmp1, wxT("Radio 2 (Group 2)"), wxITEM_RADIO); | |
833 | tb3->AddTool(ID_SampleItem+25, wxT("Radio 3 (Group 2)"), tb3_bmp1, wxT("Radio 3 (Group 2)"), wxITEM_RADIO); | |
b5d196c1 | 834 | tb3->SetCustomOverflowItems(prepend_items, append_items); |
50acee04 JS |
835 | tb3->Realize(); |
836 | ||
837 | ||
b5d196c1 | 838 | wxAuiToolBar* tb4 = new wxAuiToolBar(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, |
16a6495d | 839 | wxAUI_TB_DEFAULT_STYLE | |
b5d196c1 BW |
840 | wxAUI_TB_OVERFLOW | |
841 | wxAUI_TB_TEXT | | |
842 | wxAUI_TB_HORZ_TEXT); | |
50acee04 JS |
843 | tb4->SetToolBitmapSize(wxSize(16,16)); |
844 | wxBitmap tb4_bmp1 = wxArtProvider::GetBitmap(wxART_NORMAL_FILE, wxART_OTHER, wxSize(16,16)); | |
b5d196c1 BW |
845 | tb4->AddTool(ID_DropDownToolbarItem, wxT("Item 1"), tb4_bmp1); |
846 | tb4->AddTool(ID_SampleItem+23, wxT("Item 2"), tb4_bmp1); | |
847 | tb4->AddTool(ID_SampleItem+24, wxT("Item 3"), tb4_bmp1); | |
848 | tb4->AddTool(ID_SampleItem+25, wxT("Item 4"), tb4_bmp1); | |
50acee04 | 849 | tb4->AddSeparator(); |
b5d196c1 BW |
850 | tb4->AddTool(ID_SampleItem+26, wxT("Item 5"), tb4_bmp1); |
851 | tb4->AddTool(ID_SampleItem+27, wxT("Item 6"), tb4_bmp1); | |
852 | tb4->AddTool(ID_SampleItem+28, wxT("Item 7"), tb4_bmp1); | |
853 | tb4->AddTool(ID_SampleItem+29, wxT("Item 8"), tb4_bmp1); | |
854 | tb4->SetToolDropDown(ID_DropDownToolbarItem, true); | |
855 | tb4->SetCustomOverflowItems(prepend_items, append_items); | |
0772a898 VZ |
856 | wxChoice* choice = new wxChoice(tb4, ID_SampleItem+35); |
857 | choice->AppendString(wxT("One choice")); | |
858 | choice->AppendString(wxT("Another choice")); | |
859 | tb4->AddControl(choice); | |
50acee04 JS |
860 | tb4->Realize(); |
861 | ||
b5d196c1 BW |
862 | |
863 | wxAuiToolBar* tb5 = new wxAuiToolBar(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, | |
864 | wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_OVERFLOW | wxAUI_TB_VERTICAL); | |
50acee04 | 865 | tb5->SetToolBitmapSize(wxSize(48,48)); |
b5d196c1 | 866 | tb5->AddTool(ID_SampleItem+30, wxT("Test"), wxArtProvider::GetBitmap(wxART_ERROR)); |
50acee04 | 867 | tb5->AddSeparator(); |
b5d196c1 BW |
868 | tb5->AddTool(ID_SampleItem+31, wxT("Test"), wxArtProvider::GetBitmap(wxART_QUESTION)); |
869 | tb5->AddTool(ID_SampleItem+32, wxT("Test"), wxArtProvider::GetBitmap(wxART_INFORMATION)); | |
870 | tb5->AddTool(ID_SampleItem+33, wxT("Test"), wxArtProvider::GetBitmap(wxART_WARNING)); | |
871 | tb5->AddTool(ID_SampleItem+34, wxT("Test"), wxArtProvider::GetBitmap(wxART_MISSING_IMAGE)); | |
872 | tb5->SetCustomOverflowItems(prepend_items, append_items); | |
50acee04 JS |
873 | tb5->Realize(); |
874 | ||
50acee04 | 875 | // add a bunch of panes |
a3a5df9d | 876 | m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo(). |
50acee04 JS |
877 | Name(wxT("test1")).Caption(wxT("Pane Caption")). |
878 | Top()); | |
879 | ||
a3a5df9d | 880 | m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo(). |
50acee04 | 881 | Name(wxT("test2")).Caption(wxT("Client Size Reporter")). |
37106ab2 | 882 | Bottom().Position(1). |
50d5ad7d | 883 | CloseButton(true).MaximizeButton(true)); |
50acee04 | 884 | |
a3a5df9d | 885 | m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo(). |
50acee04 | 886 | Name(wxT("test3")).Caption(wxT("Client Size Reporter")). |
37106ab2 | 887 | Bottom(). |
50d5ad7d | 888 | CloseButton(true).MaximizeButton(true)); |
bfeed34c | 889 | |
a3a5df9d | 890 | m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo(). |
50acee04 JS |
891 | Name(wxT("test4")).Caption(wxT("Pane Caption")). |
892 | Left()); | |
bfeed34c | 893 | |
a3a5df9d | 894 | m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo(). |
31ec1d03 BW |
895 | Name(wxT("test5")).Caption(wxT("No Close Button")). |
896 | Right().CloseButton(false)); | |
bfeed34c | 897 | |
a3a5df9d | 898 | m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo(). |
50acee04 | 899 | Name(wxT("test6")).Caption(wxT("Client Size Reporter")). |
37106ab2 | 900 | Right().Row(1). |
50d5ad7d | 901 | CloseButton(true).MaximizeButton(true)); |
50acee04 | 902 | |
a3a5df9d | 903 | m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo(). |
50acee04 | 904 | Name(wxT("test7")).Caption(wxT("Client Size Reporter")). |
37106ab2 | 905 | Left().Layer(1). |
50d5ad7d | 906 | CloseButton(true).MaximizeButton(true)); |
bfeed34c | 907 | |
a3a5df9d | 908 | m_mgr.AddPane(CreateTreeCtrl(), wxAuiPaneInfo(). |
50acee04 | 909 | Name(wxT("test8")).Caption(wxT("Tree Pane")). |
37106ab2 BW |
910 | Left().Layer(1).Position(1). |
911 | CloseButton(true).MaximizeButton(true)); | |
50acee04 | 912 | |
a3a5df9d | 913 | m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo(). |
50acee04 JS |
914 | Name(wxT("test9")).Caption(wxT("Min Size 200x100")). |
915 | BestSize(wxSize(200,100)).MinSize(wxSize(200,100)). | |
37106ab2 BW |
916 | Bottom().Layer(1). |
917 | CloseButton(true).MaximizeButton(true)); | |
50acee04 | 918 | |
58754643 | 919 | wxWindow* wnd10 = CreateTextCtrl(wxT("This pane will prompt the user before hiding.")); |
a3a5df9d | 920 | m_mgr.AddPane(wnd10, wxAuiPaneInfo(). |
58754643 | 921 | Name(wxT("test10")).Caption(wxT("Text Pane with Hide Prompt")). |
50acee04 | 922 | Bottom().Layer(1).Position(1)); |
bfeed34c | 923 | |
a3a5df9d | 924 | m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo(). |
50acee04 JS |
925 | Name(wxT("test11")).Caption(wxT("Fixed Pane")). |
926 | Bottom().Layer(1).Position(2).Fixed()); | |
927 | ||
bfeed34c | 928 | |
a3a5df9d | 929 | m_mgr.AddPane(new SettingsPanel(this,this), wxAuiPaneInfo(). |
50acee04 JS |
930 | Name(wxT("settings")).Caption(wxT("Dock Manager Settings")). |
931 | Dockable(false).Float().Hide()); | |
932 | ||
933 | // create some center panes | |
934 | ||
a3a5df9d | 935 | m_mgr.AddPane(CreateGrid(), wxAuiPaneInfo().Name(wxT("grid_content")). |
50acee04 JS |
936 | CenterPane().Hide()); |
937 | ||
a3a5df9d | 938 | m_mgr.AddPane(CreateTreeCtrl(), wxAuiPaneInfo().Name(wxT("tree_content")). |
50acee04 | 939 | CenterPane().Hide()); |
bfeed34c | 940 | |
a3a5df9d | 941 | m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().Name(wxT("sizereport_content")). |
50acee04 JS |
942 | CenterPane().Hide()); |
943 | ||
a3a5df9d | 944 | m_mgr.AddPane(CreateTextCtrl(), wxAuiPaneInfo().Name(wxT("text_content")). |
50acee04 JS |
945 | CenterPane().Hide()); |
946 | ||
a3a5df9d | 947 | m_mgr.AddPane(CreateHTMLCtrl(), wxAuiPaneInfo().Name(wxT("html_content")). |
34886132 | 948 | CenterPane().Hide()); |
bfeed34c | 949 | |
a3a5df9d | 950 | m_mgr.AddPane(CreateNotebook(), wxAuiPaneInfo().Name(wxT("notebook_content")). |
2e5c35af | 951 | CenterPane().PaneBorder(false)); |
df00bdf7 | 952 | |
50acee04 | 953 | // add the toolbars to the manager |
a3a5df9d | 954 | m_mgr.AddPane(tb1, wxAuiPaneInfo(). |
50acee04 | 955 | Name(wxT("tb1")).Caption(wxT("Big Toolbar")). |
e5dcae09 | 956 | ToolbarPane().Top()); |
50acee04 | 957 | |
a3a5df9d | 958 | m_mgr.AddPane(tb2, wxAuiPaneInfo(). |
e5dcae09 VZ |
959 | Name(wxT("tb2")).Caption(wxT("Toolbar 2 (Horizontal)")). |
960 | ToolbarPane().Top().Row(1)); | |
bfeed34c | 961 | |
a3a5df9d | 962 | m_mgr.AddPane(tb3, wxAuiPaneInfo(). |
50acee04 | 963 | Name(wxT("tb3")).Caption(wxT("Toolbar 3")). |
e5dcae09 | 964 | ToolbarPane().Top().Row(1).Position(1)); |
bfeed34c | 965 | |
a3a5df9d | 966 | m_mgr.AddPane(tb4, wxAuiPaneInfo(). |
50acee04 | 967 | Name(wxT("tb4")).Caption(wxT("Sample Bookmark Toolbar")). |
e5dcae09 | 968 | ToolbarPane().Top().Row(2)); |
bfeed34c | 969 | |
a3a5df9d | 970 | m_mgr.AddPane(tb5, wxAuiPaneInfo(). |
2c26bdee | 971 | Name(wxT("tb5")).Caption(wxT("Sample Vertical Toolbar")). |
50acee04 | 972 | ToolbarPane().Left(). |
e5dcae09 | 973 | GripperTop()); |
bfeed34c WS |
974 | |
975 | m_mgr.AddPane(new wxButton(this, wxID_ANY, _("Test Button")), | |
a3a5df9d | 976 | wxAuiPaneInfo().Name(wxT("tb6")). |
50acee04 JS |
977 | ToolbarPane().Top().Row(2).Position(1). |
978 | LeftDockable(false).RightDockable(false)); | |
979 | ||
50acee04 | 980 | // make some default perspectives |
bfeed34c | 981 | |
50acee04 | 982 | wxString perspective_all = m_mgr.SavePerspective(); |
bfeed34c | 983 | |
50acee04 | 984 | int i, count; |
a3a5df9d | 985 | wxAuiPaneInfoArray& all_panes = m_mgr.GetAllPanes(); |
50acee04 JS |
986 | for (i = 0, count = all_panes.GetCount(); i < count; ++i) |
987 | if (!all_panes.Item(i).IsToolbar()) | |
988 | all_panes.Item(i).Hide(); | |
989 | m_mgr.GetPane(wxT("tb1")).Hide(); | |
60fa553c | 990 | m_mgr.GetPane(wxT("tb6")).Hide(); |
50acee04 JS |
991 | m_mgr.GetPane(wxT("test8")).Show().Left().Layer(0).Row(0).Position(0); |
992 | m_mgr.GetPane(wxT("test10")).Show().Bottom().Layer(0).Row(0).Position(0); | |
dbd2f790 | 993 | m_mgr.GetPane(wxT("notebook_content")).Show(); |
50acee04 | 994 | wxString perspective_default = m_mgr.SavePerspective(); |
bfeed34c | 995 | |
50acee04 JS |
996 | m_perspectives.Add(perspective_default); |
997 | m_perspectives.Add(perspective_all); | |
998 | ||
a3a5df9d | 999 | // "commit" all changes made to wxAuiManager |
50acee04 JS |
1000 | m_mgr.Update(); |
1001 | } | |
1002 | ||
1003 | MyFrame::~MyFrame() | |
1004 | { | |
1005 | m_mgr.UnInit(); | |
1006 | } | |
1007 | ||
a3a5df9d | 1008 | wxAuiDockArt* MyFrame::GetDockArt() |
50acee04 JS |
1009 | { |
1010 | return m_mgr.GetArtProvider(); | |
1011 | } | |
1012 | ||
1013 | void MyFrame::DoUpdate() | |
1014 | { | |
1015 | m_mgr.Update(); | |
1016 | } | |
1017 | ||
50acee04 JS |
1018 | void MyFrame::OnEraseBackground(wxEraseEvent& event) |
1019 | { | |
1020 | event.Skip(); | |
1021 | } | |
1022 | ||
1023 | void MyFrame::OnSize(wxSizeEvent& event) | |
1024 | { | |
1025 | event.Skip(); | |
1026 | } | |
1027 | ||
b5d196c1 | 1028 | void MyFrame::OnSettings(wxCommandEvent& WXUNUSED(evt)) |
50acee04 JS |
1029 | { |
1030 | // show the settings pane, and float it | |
a3a5df9d | 1031 | wxAuiPaneInfo& floating_pane = m_mgr.GetPane(wxT("settings")).Float().Show(); |
50acee04 JS |
1032 | |
1033 | if (floating_pane.floating_pos == wxDefaultPosition) | |
1034 | floating_pane.FloatingPosition(GetStartPosition()); | |
1035 | ||
1036 | m_mgr.Update(); | |
1037 | } | |
1038 | ||
b5d196c1 BW |
1039 | void MyFrame::OnCustomizeToolbar(wxCommandEvent& WXUNUSED(evt)) |
1040 | { | |
1041 | wxMessageBox(_("Customize Toolbar clicked")); | |
1042 | } | |
1043 | ||
50acee04 JS |
1044 | void MyFrame::OnGradient(wxCommandEvent& event) |
1045 | { | |
1046 | int gradient = 0; | |
1047 | ||
1048 | switch (event.GetId()) | |
1049 | { | |
1050 | case ID_NoGradient: gradient = wxAUI_GRADIENT_NONE; break; | |
1051 | case ID_VerticalGradient: gradient = wxAUI_GRADIENT_VERTICAL; break; | |
1052 | case ID_HorizontalGradient: gradient = wxAUI_GRADIENT_HORIZONTAL; break; | |
1053 | } | |
1054 | ||
254a3429 | 1055 | m_mgr.GetArtProvider()->SetMetric(wxAUI_DOCKART_GRADIENT_TYPE, gradient); |
50acee04 JS |
1056 | m_mgr.Update(); |
1057 | } | |
1058 | ||
e5dcae09 VZ |
1059 | void MyFrame::OnToolbarResizing(wxCommandEvent& WXUNUSED(evt)) |
1060 | { | |
1061 | wxAuiPaneInfoArray& all_panes = m_mgr.GetAllPanes(); | |
1062 | const size_t count = all_panes.GetCount(); | |
1063 | for (size_t i = 0; i < count; ++i) | |
1064 | { | |
1065 | wxAuiToolBar* toolbar = wxDynamicCast(all_panes[i].window, wxAuiToolBar); | |
1066 | if (toolbar) | |
1067 | { | |
1068 | all_panes[i].Resizable(!all_panes[i].IsResizable()); | |
1069 | } | |
1070 | } | |
1071 | ||
1072 | m_mgr.Update(); | |
1073 | } | |
1074 | ||
50acee04 JS |
1075 | void MyFrame::OnManagerFlag(wxCommandEvent& event) |
1076 | { | |
1077 | unsigned int flag = 0; | |
bfeed34c | 1078 | |
7a5b04a6 | 1079 | #if !defined(__WXMSW__) && !defined(__WXMAC__) && !defined(__WXGTK__) |
50acee04 JS |
1080 | if (event.GetId() == ID_TransparentDrag || |
1081 | event.GetId() == ID_TransparentHint || | |
cf6fec73 | 1082 | event.GetId() == ID_HintFade) |
50acee04 | 1083 | { |
7a5b04a6 | 1084 | wxMessageBox(wxT("This option is presently only available on wxGTK, wxMSW and wxMac")); |
50acee04 JS |
1085 | return; |
1086 | } | |
bfeed34c WS |
1087 | #endif |
1088 | ||
cf6fec73 BW |
1089 | int id = event.GetId(); |
1090 | ||
1091 | if (id == ID_TransparentHint || | |
1092 | id == ID_VenetianBlindsHint || | |
1093 | id == ID_RectangleHint || | |
1094 | id == ID_NoHint) | |
1095 | { | |
1096 | unsigned int flags = m_mgr.GetFlags(); | |
1097 | flags &= ~wxAUI_MGR_TRANSPARENT_HINT; | |
1098 | flags &= ~wxAUI_MGR_VENETIAN_BLINDS_HINT; | |
1099 | flags &= ~wxAUI_MGR_RECTANGLE_HINT; | |
1100 | m_mgr.SetFlags(flags); | |
1101 | } | |
1102 | ||
1103 | switch (id) | |
50acee04 JS |
1104 | { |
1105 | case ID_AllowFloating: flag = wxAUI_MGR_ALLOW_FLOATING; break; | |
1106 | case ID_TransparentDrag: flag = wxAUI_MGR_TRANSPARENT_DRAG; break; | |
cf6fec73 BW |
1107 | case ID_HintFade: flag = wxAUI_MGR_HINT_FADE; break; |
1108 | case ID_NoVenetianFade: flag = wxAUI_MGR_NO_VENETIAN_BLINDS_FADE; break; | |
50acee04 | 1109 | case ID_AllowActivePane: flag = wxAUI_MGR_ALLOW_ACTIVE_PANE; break; |
cf6fec73 BW |
1110 | case ID_TransparentHint: flag = wxAUI_MGR_TRANSPARENT_HINT; break; |
1111 | case ID_VenetianBlindsHint: flag = wxAUI_MGR_VENETIAN_BLINDS_HINT; break; | |
1112 | case ID_RectangleHint: flag = wxAUI_MGR_RECTANGLE_HINT; break; | |
68030cae | 1113 | case ID_LiveUpdate: flag = wxAUI_MGR_LIVE_RESIZE; break; |
cf6fec73 | 1114 | } |
b5d196c1 | 1115 | |
cf6fec73 BW |
1116 | if (flag) |
1117 | { | |
1118 | m_mgr.SetFlags(m_mgr.GetFlags() ^ flag); | |
50acee04 | 1119 | } |
b5d196c1 | 1120 | |
50acee04 JS |
1121 | m_mgr.Update(); |
1122 | } | |
1123 | ||
c50fa29f BW |
1124 | |
1125 | void MyFrame::OnNotebookFlag(wxCommandEvent& event) | |
1126 | { | |
1127 | int id = event.GetId(); | |
b5d196c1 | 1128 | |
931483d7 BW |
1129 | if (id == ID_NotebookNoCloseButton || |
1130 | id == ID_NotebookCloseButton || | |
c50fa29f BW |
1131 | id == ID_NotebookCloseButtonAll || |
1132 | id == ID_NotebookCloseButtonActive) | |
1133 | { | |
1134 | m_notebook_style &= ~(wxAUI_NB_CLOSE_BUTTON | | |
1135 | wxAUI_NB_CLOSE_ON_ACTIVE_TAB | | |
1136 | wxAUI_NB_CLOSE_ON_ALL_TABS); | |
b5d196c1 | 1137 | |
c50fa29f BW |
1138 | switch (id) |
1139 | { | |
931483d7 | 1140 | case ID_NotebookNoCloseButton: break; |
c50fa29f BW |
1141 | case ID_NotebookCloseButton: m_notebook_style |= wxAUI_NB_CLOSE_BUTTON; break; |
1142 | case ID_NotebookCloseButtonAll: m_notebook_style |= wxAUI_NB_CLOSE_ON_ALL_TABS; break; | |
1143 | case ID_NotebookCloseButtonActive: m_notebook_style |= wxAUI_NB_CLOSE_ON_ACTIVE_TAB; break; | |
1144 | } | |
51100f50 | 1145 | } |
b5d196c1 | 1146 | |
51100f50 BW |
1147 | if (id == ID_NotebookAllowTabMove) |
1148 | { | |
1149 | m_notebook_style ^= wxAUI_NB_TAB_MOVE; | |
5d3aeb0f BW |
1150 | } |
1151 | if (id == ID_NotebookAllowTabExternalMove) | |
1152 | { | |
1153 | m_notebook_style ^= wxAUI_NB_TAB_EXTERNAL_MOVE; | |
51100f50 | 1154 | } |
01372b8f | 1155 | else if (id == ID_NotebookAllowTabSplit) |
51100f50 BW |
1156 | { |
1157 | m_notebook_style ^= wxAUI_NB_TAB_SPLIT; | |
1158 | } | |
01372b8f BW |
1159 | else if (id == ID_NotebookWindowList) |
1160 | { | |
1161 | m_notebook_style ^= wxAUI_NB_WINDOWLIST_BUTTON; | |
1162 | } | |
1163 | else if (id == ID_NotebookScrollButtons) | |
1164 | { | |
1165 | m_notebook_style ^= wxAUI_NB_SCROLL_BUTTONS; | |
1166 | } | |
b0d17f7c BW |
1167 | else if (id == ID_NotebookTabFixedWidth) |
1168 | { | |
1169 | m_notebook_style ^= wxAUI_NB_TAB_FIXED_WIDTH; | |
1170 | } | |
1171 | ||
1172 | ||
c50fa29f BW |
1173 | size_t i, count; |
1174 | wxAuiPaneInfoArray& all_panes = m_mgr.GetAllPanes(); | |
1175 | for (i = 0, count = all_panes.GetCount(); i < count; ++i) | |
b5d196c1 | 1176 | { |
c50fa29f | 1177 | wxAuiPaneInfo& pane = all_panes.Item(i); |
c50fa29f BW |
1178 | if (pane.window->IsKindOf(CLASSINFO(wxAuiNotebook))) |
1179 | { | |
b0d17f7c | 1180 | wxAuiNotebook* nb = (wxAuiNotebook*)pane.window; |
b5d196c1 | 1181 | |
b0d17f7c BW |
1182 | if (id == ID_NotebookArtGloss) |
1183 | { | |
1184 | nb->SetArtProvider(new wxAuiDefaultTabArt); | |
1185 | m_notebook_theme = 0; | |
1186 | } | |
1187 | else if (id == ID_NotebookArtSimple) | |
1188 | { | |
1189 | nb->SetArtProvider(new wxAuiSimpleTabArt); | |
1190 | m_notebook_theme = 1; | |
1191 | } | |
b5d196c1 BW |
1192 | |
1193 | ||
b0d17f7c BW |
1194 | nb->SetWindowStyleFlag(m_notebook_style); |
1195 | nb->Refresh(); | |
c50fa29f BW |
1196 | } |
1197 | } | |
1198 | ||
1199 | ||
1200 | } | |
1201 | ||
1202 | ||
50acee04 JS |
1203 | void MyFrame::OnUpdateUI(wxUpdateUIEvent& event) |
1204 | { | |
1205 | unsigned int flags = m_mgr.GetFlags(); | |
bfeed34c | 1206 | |
50acee04 JS |
1207 | switch (event.GetId()) |
1208 | { | |
1209 | case ID_NoGradient: | |
254a3429 | 1210 | event.Check(m_mgr.GetArtProvider()->GetMetric(wxAUI_DOCKART_GRADIENT_TYPE) == wxAUI_GRADIENT_NONE); |
50acee04 JS |
1211 | break; |
1212 | case ID_VerticalGradient: | |
254a3429 | 1213 | event.Check(m_mgr.GetArtProvider()->GetMetric(wxAUI_DOCKART_GRADIENT_TYPE) == wxAUI_GRADIENT_VERTICAL); |
50acee04 JS |
1214 | break; |
1215 | case ID_HorizontalGradient: | |
254a3429 | 1216 | event.Check(m_mgr.GetArtProvider()->GetMetric(wxAUI_DOCKART_GRADIENT_TYPE) == wxAUI_GRADIENT_HORIZONTAL); |
50acee04 | 1217 | break; |
e5dcae09 VZ |
1218 | case ID_AllowToolbarResizing: |
1219 | { | |
1220 | wxAuiPaneInfoArray& all_panes = m_mgr.GetAllPanes(); | |
1221 | const size_t count = all_panes.GetCount(); | |
1222 | for (size_t i = 0; i < count; ++i) | |
1223 | { | |
1224 | wxAuiToolBar* toolbar = wxDynamicCast(all_panes[i].window, wxAuiToolBar); | |
1225 | if (toolbar) | |
1226 | { | |
1227 | event.Check(all_panes[i].IsResizable()); | |
1228 | break; | |
1229 | } | |
1230 | } | |
1231 | break; | |
1232 | } | |
50acee04 | 1233 | case ID_AllowFloating: |
87d658e5 | 1234 | event.Check((flags & wxAUI_MGR_ALLOW_FLOATING) != 0); |
50acee04 JS |
1235 | break; |
1236 | case ID_TransparentDrag: | |
87d658e5 | 1237 | event.Check((flags & wxAUI_MGR_TRANSPARENT_DRAG) != 0); |
50acee04 JS |
1238 | break; |
1239 | case ID_TransparentHint: | |
87d658e5 | 1240 | event.Check((flags & wxAUI_MGR_TRANSPARENT_HINT) != 0); |
50acee04 | 1241 | break; |
68030cae JS |
1242 | case ID_LiveUpdate: |
1243 | event.Check((flags & wxAUI_MGR_LIVE_RESIZE) != 0); | |
1244 | break; | |
cf6fec73 BW |
1245 | case ID_VenetianBlindsHint: |
1246 | event.Check((flags & wxAUI_MGR_VENETIAN_BLINDS_HINT) != 0); | |
1247 | break; | |
1248 | case ID_RectangleHint: | |
1249 | event.Check((flags & wxAUI_MGR_RECTANGLE_HINT) != 0); | |
50acee04 | 1250 | break; |
cf6fec73 BW |
1251 | case ID_NoHint: |
1252 | event.Check(((wxAUI_MGR_TRANSPARENT_HINT | | |
1253 | wxAUI_MGR_VENETIAN_BLINDS_HINT | | |
1254 | wxAUI_MGR_RECTANGLE_HINT) & flags) == 0); | |
b5d196c1 | 1255 | break; |
cf6fec73 BW |
1256 | case ID_HintFade: |
1257 | event.Check((flags & wxAUI_MGR_HINT_FADE) != 0); | |
70476471 | 1258 | break; |
cf6fec73 BW |
1259 | case ID_NoVenetianFade: |
1260 | event.Check((flags & wxAUI_MGR_NO_VENETIAN_BLINDS_FADE) != 0); | |
70476471 | 1261 | break; |
b5d196c1 | 1262 | |
931483d7 BW |
1263 | case ID_NotebookNoCloseButton: |
1264 | event.Check((m_notebook_style & (wxAUI_NB_CLOSE_BUTTON|wxAUI_NB_CLOSE_ON_ALL_TABS|wxAUI_NB_CLOSE_ON_ACTIVE_TAB)) != 0); | |
1265 | break; | |
c50fa29f BW |
1266 | case ID_NotebookCloseButton: |
1267 | event.Check((m_notebook_style & wxAUI_NB_CLOSE_BUTTON) != 0); | |
1268 | break; | |
1269 | case ID_NotebookCloseButtonAll: | |
1270 | event.Check((m_notebook_style & wxAUI_NB_CLOSE_ON_ALL_TABS) != 0); | |
1271 | break; | |
1272 | case ID_NotebookCloseButtonActive: | |
1273 | event.Check((m_notebook_style & wxAUI_NB_CLOSE_ON_ACTIVE_TAB) != 0); | |
1274 | break; | |
51100f50 BW |
1275 | case ID_NotebookAllowTabSplit: |
1276 | event.Check((m_notebook_style & wxAUI_NB_TAB_SPLIT) != 0); | |
1277 | break; | |
1278 | case ID_NotebookAllowTabMove: | |
1279 | event.Check((m_notebook_style & wxAUI_NB_TAB_MOVE) != 0); | |
1280 | break; | |
5d3aeb0f BW |
1281 | case ID_NotebookAllowTabExternalMove: |
1282 | event.Check((m_notebook_style & wxAUI_NB_TAB_EXTERNAL_MOVE) != 0); | |
1283 | break; | |
01372b8f BW |
1284 | case ID_NotebookScrollButtons: |
1285 | event.Check((m_notebook_style & wxAUI_NB_SCROLL_BUTTONS) != 0); | |
1286 | break; | |
1287 | case ID_NotebookWindowList: | |
1288 | event.Check((m_notebook_style & wxAUI_NB_WINDOWLIST_BUTTON) != 0); | |
1289 | break; | |
b0d17f7c BW |
1290 | case ID_NotebookTabFixedWidth: |
1291 | event.Check((m_notebook_style & wxAUI_NB_TAB_FIXED_WIDTH) != 0); | |
1292 | break; | |
1293 | case ID_NotebookArtGloss: | |
1294 | event.Check(m_notebook_style == 0); | |
1295 | break; | |
1296 | case ID_NotebookArtSimple: | |
1297 | event.Check(m_notebook_style == 1); | |
1298 | break; | |
1299 | ||
50acee04 JS |
1300 | } |
1301 | } | |
1302 | ||
a3a5df9d | 1303 | void MyFrame::OnPaneClose(wxAuiManagerEvent& evt) |
58754643 BW |
1304 | { |
1305 | if (evt.pane->name == wxT("test10")) | |
1306 | { | |
1307 | int res = wxMessageBox(wxT("Are you sure you want to close/hide this pane?"), | |
1308 | wxT("wxAUI"), | |
1309 | wxYES_NO, | |
1310 | this); | |
1311 | if (res != wxYES) | |
1312 | evt.Veto(); | |
1313 | } | |
1314 | } | |
1315 | ||
bfeed34c | 1316 | void MyFrame::OnCreatePerspective(wxCommandEvent& WXUNUSED(event)) |
50acee04 JS |
1317 | { |
1318 | wxTextEntryDialog dlg(this, wxT("Enter a name for the new perspective:"), | |
1319 | wxT("wxAUI Test")); | |
bfeed34c | 1320 | |
b143cf70 | 1321 | dlg.SetValue(wxString::Format(wxT("Perspective %u"), unsigned(m_perspectives.GetCount() + 1))); |
50acee04 JS |
1322 | if (dlg.ShowModal() != wxID_OK) |
1323 | return; | |
bfeed34c | 1324 | |
50acee04 JS |
1325 | if (m_perspectives.GetCount() == 0) |
1326 | { | |
1327 | m_perspectives_menu->AppendSeparator(); | |
1328 | } | |
bfeed34c | 1329 | |
50acee04 JS |
1330 | m_perspectives_menu->Append(ID_FirstPerspective + m_perspectives.GetCount(), dlg.GetValue()); |
1331 | m_perspectives.Add(m_mgr.SavePerspective()); | |
1332 | } | |
1333 | ||
5d3aeb0f | 1334 | void MyFrame::OnCopyPerspectiveCode(wxCommandEvent& WXUNUSED(evt)) |
50acee04 JS |
1335 | { |
1336 | wxString s = m_mgr.SavePerspective(); | |
bfeed34c | 1337 | |
b2e17848 | 1338 | #if wxUSE_CLIPBOARD |
50acee04 JS |
1339 | if (wxTheClipboard->Open()) |
1340 | { | |
1341 | wxTheClipboard->SetData(new wxTextDataObject(s)); | |
1342 | wxTheClipboard->Close(); | |
1343 | } | |
b2e17848 | 1344 | #endif |
50acee04 JS |
1345 | } |
1346 | ||
5d3aeb0f | 1347 | void MyFrame::OnRestorePerspective(wxCommandEvent& evt) |
50acee04 | 1348 | { |
5d3aeb0f | 1349 | m_mgr.LoadPerspective(m_perspectives.Item(evt.GetId() - ID_FirstPerspective)); |
50acee04 JS |
1350 | } |
1351 | ||
3fd8c988 | 1352 | void MyFrame::OnNotebookPageClose(wxAuiNotebookEvent& evt) |
b5d196c1 | 1353 | { |
3fd8c988 BW |
1354 | wxAuiNotebook* ctrl = (wxAuiNotebook*)evt.GetEventObject(); |
1355 | if (ctrl->GetPage(evt.GetSelection())->IsKindOf(CLASSINFO(wxHtmlWindow))) | |
1356 | { | |
1357 | int res = wxMessageBox(wxT("Are you sure you want to close/hide this notebook page?"), | |
1358 | wxT("wxAUI"), | |
1359 | wxYES_NO, | |
1360 | this); | |
1361 | if (res != wxYES) | |
1362 | evt.Veto(); | |
1363 | } | |
1364 | } | |
1365 | ||
917f228a VZ |
1366 | void MyFrame::OnNotebookPageClosed(wxAuiNotebookEvent& evt) |
1367 | { | |
1368 | wxAuiNotebook* ctrl = (wxAuiNotebook*)evt.GetEventObject(); | |
1369 | ||
1370 | // selection should always be a valid index | |
1371 | wxASSERT_MSG( ctrl->GetSelection() < (int)ctrl->GetPageCount(), | |
1372 | wxString::Format("Invalid selection %d, only %d pages left", | |
1373 | ctrl->GetSelection(), | |
1374 | (int)ctrl->GetPageCount()) ); | |
1375 | ||
1376 | evt.Skip(); | |
1377 | } | |
1378 | ||
5d3aeb0f | 1379 | void MyFrame::OnAllowNotebookDnD(wxAuiNotebookEvent& evt) |
b5d196c1 | 1380 | { |
5d3aeb0f BW |
1381 | // for the purpose of this test application, explicitly |
1382 | // allow all noteboko drag and drop events | |
1383 | evt.Allow(); | |
1384 | } | |
50acee04 JS |
1385 | |
1386 | wxPoint MyFrame::GetStartPosition() | |
1387 | { | |
1388 | static int x = 0; | |
1389 | x += 20; | |
1390 | wxPoint pt = ClientToScreen(wxPoint(0,0)); | |
1391 | return wxPoint(pt.x + x, pt.y + x); | |
1392 | } | |
1393 | ||
bfeed34c | 1394 | void MyFrame::OnCreateTree(wxCommandEvent& WXUNUSED(event)) |
50acee04 | 1395 | { |
a3a5df9d | 1396 | m_mgr.AddPane(CreateTreeCtrl(), wxAuiPaneInfo(). |
95c82627 | 1397 | Caption(wxT("Tree Control")). |
50acee04 JS |
1398 | Float().FloatingPosition(GetStartPosition()). |
1399 | FloatingSize(wxSize(150,300))); | |
1400 | m_mgr.Update(); | |
1401 | } | |
1402 | ||
bfeed34c | 1403 | void MyFrame::OnCreateGrid(wxCommandEvent& WXUNUSED(event)) |
50acee04 | 1404 | { |
a3a5df9d | 1405 | m_mgr.AddPane(CreateGrid(), wxAuiPaneInfo(). |
95c82627 | 1406 | Caption(wxT("Grid")). |
50acee04 JS |
1407 | Float().FloatingPosition(GetStartPosition()). |
1408 | FloatingSize(wxSize(300,200))); | |
1409 | m_mgr.Update(); | |
1410 | } | |
1411 | ||
bfeed34c | 1412 | void MyFrame::OnCreateHTML(wxCommandEvent& WXUNUSED(event)) |
50acee04 | 1413 | { |
a3a5df9d | 1414 | m_mgr.AddPane(CreateHTMLCtrl(), wxAuiPaneInfo(). |
95c82627 | 1415 | Caption(wxT("HTML Control")). |
50acee04 JS |
1416 | Float().FloatingPosition(GetStartPosition()). |
1417 | FloatingSize(wxSize(300,200))); | |
1418 | m_mgr.Update(); | |
1419 | } | |
1420 | ||
df00bdf7 RR |
1421 | void MyFrame::OnCreateNotebook(wxCommandEvent& WXUNUSED(event)) |
1422 | { | |
a3a5df9d | 1423 | m_mgr.AddPane(CreateNotebook(), wxAuiPaneInfo(). |
95c82627 | 1424 | Caption(wxT("Notebook")). |
df00bdf7 | 1425 | Float().FloatingPosition(GetStartPosition()). |
8bfde0a8 BW |
1426 | //FloatingSize(300,200). |
1427 | CloseButton(true).MaximizeButton(true)); | |
df00bdf7 RR |
1428 | m_mgr.Update(); |
1429 | } | |
1430 | ||
bfeed34c | 1431 | void MyFrame::OnCreateText(wxCommandEvent& WXUNUSED(event)) |
50acee04 | 1432 | { |
a3a5df9d | 1433 | m_mgr.AddPane(CreateTextCtrl(), wxAuiPaneInfo(). |
95c82627 | 1434 | Caption(wxT("Text Control")). |
50acee04 JS |
1435 | Float().FloatingPosition(GetStartPosition())); |
1436 | m_mgr.Update(); | |
1437 | } | |
1438 | ||
bfeed34c | 1439 | void MyFrame::OnCreateSizeReport(wxCommandEvent& WXUNUSED(event)) |
50acee04 | 1440 | { |
a3a5df9d | 1441 | m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo(). |
95c82627 | 1442 | Caption(wxT("Client Size Reporter")). |
37106ab2 | 1443 | Float().FloatingPosition(GetStartPosition()). |
50d5ad7d | 1444 | CloseButton(true).MaximizeButton(true)); |
50acee04 JS |
1445 | m_mgr.Update(); |
1446 | } | |
1447 | ||
b5d196c1 | 1448 | void MyFrame::OnChangeContentPane(wxCommandEvent& evt) |
50acee04 | 1449 | { |
b5d196c1 BW |
1450 | m_mgr.GetPane(wxT("grid_content")).Show(evt.GetId() == ID_GridContent); |
1451 | m_mgr.GetPane(wxT("text_content")).Show(evt.GetId() == ID_TextContent); | |
1452 | m_mgr.GetPane(wxT("tree_content")).Show(evt.GetId() == ID_TreeContent); | |
1453 | m_mgr.GetPane(wxT("sizereport_content")).Show(evt.GetId() == ID_SizeReportContent); | |
1454 | m_mgr.GetPane(wxT("html_content")).Show(evt.GetId() == ID_HTMLContent); | |
1455 | m_mgr.GetPane(wxT("notebook_content")).Show(evt.GetId() == ID_NotebookContent); | |
50acee04 JS |
1456 | m_mgr.Update(); |
1457 | } | |
1458 | ||
b5d196c1 BW |
1459 | void MyFrame::OnDropDownToolbarItem(wxAuiToolBarEvent& evt) |
1460 | { | |
1461 | if (evt.IsDropDownClicked()) | |
1462 | { | |
1463 | wxAuiToolBar* tb = static_cast<wxAuiToolBar*>(evt.GetEventObject()); | |
16a6495d | 1464 | |
b5d196c1 | 1465 | tb->SetToolSticky(evt.GetId(), true); |
16a6495d | 1466 | |
b5d196c1 BW |
1467 | // create the popup menu |
1468 | wxMenu menuPopup; | |
16a6495d | 1469 | |
b5d196c1 | 1470 | wxBitmap bmp = wxArtProvider::GetBitmap(wxART_QUESTION, wxART_OTHER, wxSize(16,16)); |
16a6495d | 1471 | |
b5d196c1 BW |
1472 | wxMenuItem* m1 = new wxMenuItem(&menuPopup, 10001, _("Drop Down Item 1")); |
1473 | m1->SetBitmap(bmp); | |
1474 | menuPopup.Append(m1); | |
16a6495d | 1475 | |
b5d196c1 BW |
1476 | wxMenuItem* m2 = new wxMenuItem(&menuPopup, 10002, _("Drop Down Item 2")); |
1477 | m2->SetBitmap(bmp); | |
1478 | menuPopup.Append(m2); | |
16a6495d | 1479 | |
b5d196c1 BW |
1480 | wxMenuItem* m3 = new wxMenuItem(&menuPopup, 10003, _("Drop Down Item 3")); |
1481 | m3->SetBitmap(bmp); | |
1482 | menuPopup.Append(m3); | |
16a6495d | 1483 | |
b5d196c1 BW |
1484 | wxMenuItem* m4 = new wxMenuItem(&menuPopup, 10004, _("Drop Down Item 4")); |
1485 | m4->SetBitmap(bmp); | |
1486 | menuPopup.Append(m4); | |
16a6495d | 1487 | |
b5d196c1 BW |
1488 | // line up our menu with the button |
1489 | wxRect rect = tb->GetToolRect(evt.GetId()); | |
1490 | wxPoint pt = tb->ClientToScreen(rect.GetBottomLeft()); | |
1491 | pt = ScreenToClient(pt); | |
16a6495d | 1492 | |
b5d196c1 BW |
1493 | |
1494 | PopupMenu(&menuPopup, pt); | |
1495 | ||
1496 | ||
1497 | // make sure the button is "un-stuck" | |
1498 | tb->SetToolSticky(evt.GetId(), false); | |
1499 | } | |
1500 | } | |
1501 | ||
1502 | ||
1503 | void MyFrame::OnTabAlignment(wxCommandEvent &evt) | |
1504 | { | |
f9199323 | 1505 | size_t i, count; |
b5d196c1 BW |
1506 | wxAuiPaneInfoArray& all_panes = m_mgr.GetAllPanes(); |
1507 | for (i = 0, count = all_panes.GetCount(); i < count; ++i) | |
1508 | { | |
1509 | wxAuiPaneInfo& pane = all_panes.Item(i); | |
1510 | if (pane.window->IsKindOf(CLASSINFO(wxAuiNotebook))) | |
1511 | { | |
1512 | wxAuiNotebook* nb = (wxAuiNotebook*)pane.window; | |
1513 | ||
f9199323 VZ |
1514 | long style = nb->GetWindowStyleFlag(); |
1515 | style &= ~(wxAUI_NB_TOP | wxAUI_NB_BOTTOM); | |
b5d196c1 | 1516 | if (evt.GetId() == ID_NotebookAlignTop) |
f9199323 VZ |
1517 | style |= wxAUI_NB_TOP; |
1518 | else if (evt.GetId() == ID_NotebookAlignBottom) | |
1519 | style |= wxAUI_NB_BOTTOM; | |
1520 | nb->SetWindowStyleFlag(style); | |
1521 | ||
b5d196c1 BW |
1522 | nb->Refresh(); |
1523 | } | |
1524 | } | |
1525 | } | |
1526 | ||
50acee04 JS |
1527 | void MyFrame::OnExit(wxCommandEvent& WXUNUSED(event)) |
1528 | { | |
1529 | Close(true); | |
1530 | } | |
1531 | ||
1532 | void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) | |
1533 | { | |
1534 | wxMessageBox(_("wxAUI Demo\nAn advanced window management library for wxWidgets\n(c) Copyright 2005-2006, Kirix Corporation"), _("About wxAUI Demo"), wxOK, this); | |
1535 | } | |
1536 | ||
58754643 | 1537 | wxTextCtrl* MyFrame::CreateTextCtrl(const wxString& ctrl_text) |
50acee04 | 1538 | { |
50acee04 JS |
1539 | static int n = 0; |
1540 | ||
58754643 BW |
1541 | wxString text; |
1542 | if (ctrl_text.Length() > 0) | |
1543 | text = ctrl_text; | |
87d658e5 | 1544 | else |
58754643 | 1545 | text.Printf(wxT("This is text box %d"), ++n); |
50acee04 | 1546 | |
bfeed34c | 1547 | return new wxTextCtrl(this,wxID_ANY, text, |
50acee04 JS |
1548 | wxPoint(0,0), wxSize(150,90), |
1549 | wxNO_BORDER | wxTE_MULTILINE); | |
1550 | } | |
1551 | ||
1552 | ||
1553 | wxGrid* MyFrame::CreateGrid() | |
1554 | { | |
bfeed34c | 1555 | wxGrid* grid = new wxGrid(this, wxID_ANY, |
50acee04 JS |
1556 | wxPoint(0,0), |
1557 | wxSize(150,250), | |
1558 | wxNO_BORDER | wxWANTS_CHARS); | |
1559 | grid->CreateGrid(50, 20); | |
1560 | return grid; | |
1561 | } | |
1562 | ||
1563 | wxTreeCtrl* MyFrame::CreateTreeCtrl() | |
1564 | { | |
bfeed34c | 1565 | wxTreeCtrl* tree = new wxTreeCtrl(this, wxID_ANY, |
50acee04 JS |
1566 | wxPoint(0,0), wxSize(160,250), |
1567 | wxTR_DEFAULT_STYLE | wxNO_BORDER); | |
b5d196c1 | 1568 | |
50acee04 JS |
1569 | wxImageList* imglist = new wxImageList(16, 16, true, 2); |
1570 | imglist->Add(wxArtProvider::GetBitmap(wxART_FOLDER, wxART_OTHER, wxSize(16,16))); | |
1571 | imglist->Add(wxArtProvider::GetBitmap(wxART_NORMAL_FILE, wxART_OTHER, wxSize(16,16))); | |
1572 | tree->AssignImageList(imglist); | |
1573 | ||
9c1d6ef4 BW |
1574 | wxTreeItemId root = tree->AddRoot(wxT("wxAUI Project"), 0); |
1575 | wxArrayTreeItemIds items; | |
1576 | ||
1577 | ||
1578 | ||
50acee04 JS |
1579 | items.Add(tree->AppendItem(root, wxT("Item 1"), 0)); |
1580 | items.Add(tree->AppendItem(root, wxT("Item 2"), 0)); | |
1581 | items.Add(tree->AppendItem(root, wxT("Item 3"), 0)); | |
1582 | items.Add(tree->AppendItem(root, wxT("Item 4"), 0)); | |
1583 | items.Add(tree->AppendItem(root, wxT("Item 5"), 0)); | |
1584 | ||
bfeed34c | 1585 | |
50acee04 JS |
1586 | int i, count; |
1587 | for (i = 0, count = items.Count(); i < count; ++i) | |
1588 | { | |
1589 | wxTreeItemId id = items.Item(i); | |
1590 | tree->AppendItem(id, wxT("Subitem 1"), 1); | |
1591 | tree->AppendItem(id, wxT("Subitem 2"), 1); | |
1592 | tree->AppendItem(id, wxT("Subitem 3"), 1); | |
1593 | tree->AppendItem(id, wxT("Subitem 4"), 1); | |
1594 | tree->AppendItem(id, wxT("Subitem 5"), 1); | |
1595 | } | |
1596 | ||
1597 | ||
1598 | tree->Expand(root); | |
1599 | ||
1600 | return tree; | |
1601 | } | |
1602 | ||
1603 | wxSizeReportCtrl* MyFrame::CreateSizeReportCtrl(int width, int height) | |
1604 | { | |
bfeed34c | 1605 | wxSizeReportCtrl* ctrl = new wxSizeReportCtrl(this, wxID_ANY, |
50acee04 JS |
1606 | wxDefaultPosition, |
1607 | wxSize(width, height), &m_mgr); | |
1608 | return ctrl; | |
1609 | } | |
1610 | ||
dbd2f790 | 1611 | wxHtmlWindow* MyFrame::CreateHTMLCtrl(wxWindow* parent) |
50acee04 | 1612 | { |
dbd2f790 BW |
1613 | if (!parent) |
1614 | parent = this; | |
b5d196c1 | 1615 | |
dbd2f790 | 1616 | wxHtmlWindow* ctrl = new wxHtmlWindow(parent, wxID_ANY, |
50acee04 JS |
1617 | wxDefaultPosition, |
1618 | wxSize(400,300)); | |
1619 | ctrl->SetPage(GetIntroText()); | |
1620 | return ctrl; | |
1621 | } | |
1622 | ||
a3a5df9d | 1623 | wxAuiNotebook* MyFrame::CreateNotebook() |
df00bdf7 | 1624 | { |
8bfde0a8 BW |
1625 | // create the notebook off-window to avoid flicker |
1626 | wxSize client_size = GetClientSize(); | |
b5d196c1 | 1627 | |
8bfde0a8 BW |
1628 | wxAuiNotebook* ctrl = new wxAuiNotebook(this, wxID_ANY, |
1629 | wxPoint(client_size.x, client_size.y), | |
1630 | wxSize(430,200), | |
1631 | m_notebook_style); | |
64178c36 | 1632 | ctrl->Freeze(); |
b5d196c1 | 1633 | |
2b9aac33 | 1634 | wxBitmap page_bmp = wxArtProvider::GetBitmap(wxART_NORMAL_FILE, wxART_OTHER, wxSize(16,16)); |
b5d196c1 | 1635 | |
2b9aac33 | 1636 | ctrl->AddPage(CreateHTMLCtrl(ctrl), wxT("Welcome to wxAUI") , false, page_bmp); |
b5d196c1 | 1637 | |
df00bdf7 | 1638 | wxPanel *panel = new wxPanel( ctrl, wxID_ANY ); |
b6d74808 | 1639 | wxFlexGridSizer *flex = new wxFlexGridSizer( 4, 2, 0, 0 ); |
038d59e9 VZ |
1640 | flex->AddGrowableRow( 0 ); |
1641 | flex->AddGrowableRow( 3 ); | |
1642 | flex->AddGrowableCol( 1 ); | |
df00bdf7 RR |
1643 | flex->Add( 5,5 ); flex->Add( 5,5 ); |
1644 | flex->Add( new wxStaticText( panel, -1, wxT("wxTextCtrl:") ), 0, wxALL|wxALIGN_CENTRE, 5 ); | |
b5d196c1 | 1645 | flex->Add( new wxTextCtrl( panel, -1, wxT(""), wxDefaultPosition, wxSize(100,-1)), |
df00bdf7 RR |
1646 | 1, wxALL|wxALIGN_CENTRE, 5 ); |
1647 | flex->Add( new wxStaticText( panel, -1, wxT("wxSpinCtrl:") ), 0, wxALL|wxALIGN_CENTRE, 5 ); | |
b5d196c1 | 1648 | flex->Add( new wxSpinCtrl( panel, -1, wxT("5"), wxDefaultPosition, wxSize(100,-1), |
df00bdf7 RR |
1649 | wxSP_ARROW_KEYS, 5, 50, 5 ), 0, wxALL|wxALIGN_CENTRE, 5 ); |
1650 | flex->Add( 5,5 ); flex->Add( 5,5 ); | |
1651 | panel->SetSizer( flex ); | |
2b9aac33 | 1652 | ctrl->AddPage( panel, wxT("wxPanel"), false, page_bmp ); |
b5d196c1 BW |
1653 | |
1654 | ||
df00bdf7 | 1655 | ctrl->AddPage( new wxTextCtrl( ctrl, wxID_ANY, wxT("Some text"), |
2b9aac33 | 1656 | wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , wxT("wxTextCtrl 1"), false, page_bmp ); |
b5d196c1 | 1657 | |
df00bdf7 | 1658 | ctrl->AddPage( new wxTextCtrl( ctrl, wxID_ANY, wxT("Some more text"), |
4953f8cf | 1659 | wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , wxT("wxTextCtrl 2") ); |
b5d196c1 | 1660 | |
4953f8cf BW |
1661 | ctrl->AddPage( new wxTextCtrl( ctrl, wxID_ANY, wxT("Some more text"), |
1662 | wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , wxT("wxTextCtrl 3") ); | |
b5d196c1 | 1663 | |
4953f8cf BW |
1664 | ctrl->AddPage( new wxTextCtrl( ctrl, wxID_ANY, wxT("Some more text"), |
1665 | wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , wxT("wxTextCtrl 4") ); | |
b5d196c1 | 1666 | |
4953f8cf BW |
1667 | ctrl->AddPage( new wxTextCtrl( ctrl, wxID_ANY, wxT("Some more text"), |
1668 | wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , wxT("wxTextCtrl 5") ); | |
b5d196c1 | 1669 | |
4953f8cf BW |
1670 | ctrl->AddPage( new wxTextCtrl( ctrl, wxID_ANY, wxT("Some more text"), |
1671 | wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , wxT("wxTextCtrl 6") ); | |
b5d196c1 | 1672 | |
4953f8cf | 1673 | ctrl->AddPage( new wxTextCtrl( ctrl, wxID_ANY, wxT("Some more text"), |
b0d17f7c | 1674 | wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , wxT("wxTextCtrl 7 (longer title)") ); |
b5d196c1 | 1675 | |
4953f8cf BW |
1676 | ctrl->AddPage( new wxTextCtrl( ctrl, wxID_ANY, wxT("Some more text"), |
1677 | wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , wxT("wxTextCtrl 8") ); | |
1678 | ||
64178c36 | 1679 | ctrl->Thaw(); |
df00bdf7 RR |
1680 | return ctrl; |
1681 | } | |
50acee04 JS |
1682 | |
1683 | wxString MyFrame::GetIntroText() | |
1684 | { | |
1685 | const char* text = | |
1686 | "<html><body>" | |
70476471 | 1687 | "<h3>Welcome to wxAUI</h3>" |
50acee04 JS |
1688 | "<br/><b>Overview</b><br/>" |
1689 | "<p>wxAUI is an Advanced User Interface library for the wxWidgets toolkit " | |
1690 | "that allows developers to create high-quality, cross-platform user " | |
1691 | "interfaces quickly and easily.</p>" | |
1692 | "<p><b>Features</b></p>" | |
70476471 | 1693 | "<p>With wxAUI, developers can create application frameworks with:</p>" |
50acee04 JS |
1694 | "<ul>" |
1695 | "<li>Native, dockable floating frames</li>" | |
1696 | "<li>Perspective saving and loading</li>" | |
1697 | "<li>Native toolbars incorporating real-time, "spring-loaded" dragging</li>" | |
1698 | "<li>Customizable floating/docking behavior</li>" | |
1699 | "<li>Completely customizable look-and-feel</li>" | |
1700 | "<li>Optional transparent window effects (while dragging or docking)</li>" | |
b809d2a4 BW |
1701 | "<li>Splittable notebook control</li>" |
1702 | "</ul>" | |
b5d196c1 BW |
1703 | "<p><b>What's new in 0.9.4?</b></p>" |
1704 | "<p>wxAUI 0.9.4, which is bundled with wxWidgets, adds the following features:" | |
1705 | "<ul>" | |
1706 | "<li>New wxAuiToolBar class, a toolbar control which integrates more " | |
1707 | "cleanly with wxAuiFrameManager.</li>" | |
1708 | "<li>Lots of bug fixes</li>" | |
1709 | "</ul>" | |
b809d2a4 BW |
1710 | "<p><b>What's new in 0.9.3?</b></p>" |
1711 | "<p>wxAUI 0.9.3, which is now bundled with wxWidgets, adds the following features:" | |
1712 | "<ul>" | |
1713 | "<li>New wxAuiNotebook class, a dynamic splittable notebook control</li>" | |
1714 | "<li>New wxAuiMDI* classes, a tab-based MDI and drop-in replacement for classic MDI</li>" | |
45980d81 | 1715 | "<li>Maximize/Restore buttons implemented</li>" |
b809d2a4 BW |
1716 | "<li>Better hinting with wxGTK</li>" |
1717 | "<li>Class rename. 'wxAui' is now the standard class prefix for all wxAUI classes</li>" | |
1718 | "<li>Lots of bug fixes</li>" | |
50acee04 JS |
1719 | "</ul>" |
1720 | "<p><b>What's new in 0.9.2?</b></p>" | |
1721 | "<p>The following features/fixes have been added since the last version of wxAUI:</p>" | |
1722 | "<ul>" | |
1723 | "<li>Support for wxMac</li>" | |
1724 | "<li>Updates for wxWidgets 2.6.3</li>" | |
1725 | "<li>Fix to pass more unused events through</li>" | |
1726 | "<li>Fix to allow floating windows to receive idle events</li>" | |
1727 | "<li>Fix for minimizing/maximizing problem with transparent hint pane</li>" | |
1728 | "<li>Fix to not paint empty hint rectangles</li>" | |
1729 | "<li>Fix for 64-bit compilation</li>" | |
1730 | "</ul>" | |
1731 | "<p><b>What changed in 0.9.1?</b></p>" | |
1732 | "<p>The following features/fixes were added in wxAUI 0.9.1:</p>" | |
1733 | "<ul>" | |
1734 | "<li>Support for MDI frames</li>" | |
1735 | "<li>Gradient captions option</li>" | |
1736 | "<li>Active/Inactive panes option</li>" | |
1737 | "<li>Fix for screen artifacts/paint problems</li>" | |
1738 | "<li>Fix for hiding/showing floated window problem</li>" | |
1739 | "<li>Fix for floating pane sizing problem</li>" | |
1740 | "<li>Fix for drop position problem when dragging around center pane margins</li>" | |
1741 | "<li>LF-only text file formatting for source code</li>" | |
1742 | "</ul>" | |
1743 | "<p>See README.txt for more information.</p>" | |
1744 | "</body></html>"; | |
1745 | ||
1746 | return wxString::FromAscii(text); | |
1747 | } |