]> git.saurik.com Git - wxWidgets.git/blame - samples/aui/auidemo.cpp
disable dialup manager for MGL, it doesn't link as there is no DOS implementation...
[wxWidgets.git] / samples / aui / auidemo.cpp
CommitLineData
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
43class MyApp : public wxApp
44{
45public:
46 bool OnInit();
47};
48
004f4002
VZ
49DECLARE_APP(MyApp)
50IMPLEMENT_APP(MyApp)
50acee04
JS
51
52
53class wxSizeReportCtrl;
54
55// -- frame --
56
57class 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,
87 ID_Settings,
931483d7 88 ID_NotebookNoCloseButton,
c50fa29f
BW
89 ID_NotebookCloseButton,
90 ID_NotebookCloseButtonAll,
91 ID_NotebookCloseButtonActive,
51100f50
BW
92 ID_NotebookAllowTabMove,
93 ID_NotebookAllowTabSplit,
01372b8f
BW
94 ID_NotebookWindowList,
95 ID_NotebookScrollButtons,
50acee04
JS
96 ID_FirstPerspective = ID_CreatePerspective+1000
97 };
98
99public:
100 MyFrame(wxWindow* parent,
101 wxWindowID id,
102 const wxString& title,
103 const wxPoint& pos = wxDefaultPosition,
104 const wxSize& size = wxDefaultSize,
105 long style = wxDEFAULT_FRAME_STYLE | wxSUNKEN_BORDER);
106
107 ~MyFrame();
108
a3a5df9d 109 wxAuiDockArt* GetDockArt();
50acee04
JS
110 void DoUpdate();
111
112private:
58754643 113 wxTextCtrl* CreateTextCtrl(const wxString& text = wxEmptyString);
50acee04
JS
114 wxGrid* CreateGrid();
115 wxTreeCtrl* CreateTreeCtrl();
116 wxSizeReportCtrl* CreateSizeReportCtrl(int width = 80, int height = 80);
117 wxPoint GetStartPosition();
dbd2f790 118 wxHtmlWindow* CreateHTMLCtrl(wxWindow* parent = NULL);
a3a5df9d 119 wxAuiNotebook* CreateNotebook();
50acee04
JS
120
121 wxString GetIntroText();
122
123private:
124
58754643
BW
125 void OnEraseBackground(wxEraseEvent& evt);
126 void OnSize(wxSizeEvent& evt);
127
128 void OnCreateTree(wxCommandEvent& evt);
129 void OnCreateGrid(wxCommandEvent& evt);
130 void OnCreateHTML(wxCommandEvent& evt);
df00bdf7 131 void OnCreateNotebook(wxCommandEvent& evt);
58754643
BW
132 void OnCreateText(wxCommandEvent& evt);
133 void OnCreateSizeReport(wxCommandEvent& evt);
134 void OnChangeContentPane(wxCommandEvent& evt);
135 void OnCreatePerspective(wxCommandEvent& evt);
136 void OnCopyPerspectiveCode(wxCommandEvent& evt);
137 void OnRestorePerspective(wxCommandEvent& evt);
138 void OnSettings(wxCommandEvent& evt);
139 void OnExit(wxCommandEvent& evt);
140 void OnAbout(wxCommandEvent& evt);
141
142 void OnGradient(wxCommandEvent& evt);
143 void OnManagerFlag(wxCommandEvent& evt);
c50fa29f 144 void OnNotebookFlag(wxCommandEvent& evt);
58754643
BW
145 void OnUpdateUI(wxUpdateUIEvent& evt);
146
a3a5df9d 147 void OnPaneClose(wxAuiManagerEvent& evt);
58754643 148
50acee04
JS
149private:
150
a3a5df9d 151 wxAuiManager m_mgr;
50acee04
JS
152 wxArrayString m_perspectives;
153 wxMenu* m_perspectives_menu;
c50fa29f 154 long m_notebook_style;
bfeed34c 155
6dcf9888 156 DECLARE_EVENT_TABLE()
50acee04
JS
157};
158
159
50acee04
JS
160// -- wxSizeReportCtrl --
161// (a utility control that always reports it's client size)
162
163class wxSizeReportCtrl : public wxControl
164{
165public:
166
bfeed34c 167 wxSizeReportCtrl(wxWindow* parent, wxWindowID id = wxID_ANY,
50acee04
JS
168 const wxPoint& pos = wxDefaultPosition,
169 const wxSize& size = wxDefaultSize,
a3a5df9d 170 wxAuiManager* mgr = NULL)
50acee04
JS
171 : wxControl(parent, id, pos, size, wxNO_BORDER)
172 {
173 m_mgr = mgr;
174 }
175
176private:
177
bfeed34c 178 void OnPaint(wxPaintEvent& WXUNUSED(evt))
50acee04
JS
179 {
180 wxPaintDC dc(this);
181 wxSize size = GetClientSize();
182 wxString s;
183 int h, w, height;
184
185 s.Printf(wxT("Size: %d x %d"), size.x, size.y);
186
187 dc.SetFont(*wxNORMAL_FONT);
188 dc.GetTextExtent(s, &w, &height);
189 height += 3;
190 dc.SetBrush(*wxWHITE_BRUSH);
191 dc.SetPen(*wxWHITE_PEN);
192 dc.DrawRectangle(0, 0, size.x, size.y);
193 dc.SetPen(*wxLIGHT_GREY_PEN);
194 dc.DrawLine(0, 0, size.x, size.y);
195 dc.DrawLine(0, size.y, size.x, 0);
196 dc.DrawText(s, (size.x-w)/2, ((size.y-(height*5))/2));
bfeed34c 197
50acee04
JS
198 if (m_mgr)
199 {
a3a5df9d 200 wxAuiPaneInfo pi = m_mgr->GetPane(this);
bfeed34c 201
50acee04
JS
202 s.Printf(wxT("Layer: %d"), pi.dock_layer);
203 dc.GetTextExtent(s, &w, &h);
204 dc.DrawText(s, (size.x-w)/2, ((size.y-(height*5))/2)+(height*1));
bfeed34c 205
50acee04
JS
206 s.Printf(wxT("Dock: %d Row: %d"), pi.dock_direction, pi.dock_row);
207 dc.GetTextExtent(s, &w, &h);
208 dc.DrawText(s, (size.x-w)/2, ((size.y-(height*5))/2)+(height*2));
bfeed34c 209
50acee04
JS
210 s.Printf(wxT("Position: %d"), pi.dock_pos);
211 dc.GetTextExtent(s, &w, &h);
212 dc.DrawText(s, (size.x-w)/2, ((size.y-(height*5))/2)+(height*3));
bfeed34c 213
50acee04
JS
214 s.Printf(wxT("Proportion: %d"), pi.dock_proportion);
215 dc.GetTextExtent(s, &w, &h);
216 dc.DrawText(s, (size.x-w)/2, ((size.y-(height*5))/2)+(height*4));
217 }
218 }
219
bfeed34c 220 void OnEraseBackground(wxEraseEvent& WXUNUSED(evt))
50acee04
JS
221 {
222 // intentionally empty
223 }
224
bfeed34c 225 void OnSize(wxSizeEvent& WXUNUSED(evt))
50acee04
JS
226 {
227 Refresh();
228 }
229private:
230
a3a5df9d 231 wxAuiManager* m_mgr;
bfeed34c 232
6dcf9888 233 DECLARE_EVENT_TABLE()
50acee04
JS
234};
235
236BEGIN_EVENT_TABLE(wxSizeReportCtrl, wxControl)
237 EVT_PAINT(wxSizeReportCtrl::OnPaint)
238 EVT_SIZE(wxSizeReportCtrl::OnSize)
239 EVT_ERASE_BACKGROUND(wxSizeReportCtrl::OnEraseBackground)
240END_EVENT_TABLE()
241
242
50acee04
JS
243class SettingsPanel : public wxPanel
244{
245 enum
246 {
247 ID_PaneBorderSize = wxID_HIGHEST+1,
248 ID_SashSize,
249 ID_CaptionSize,
250 ID_BackgroundColor,
251 ID_SashColor,
252 ID_InactiveCaptionColor,
253 ID_InactiveCaptionGradientColor,
254 ID_InactiveCaptionTextColor,
255 ID_ActiveCaptionColor,
256 ID_ActiveCaptionGradientColor,
257 ID_ActiveCaptionTextColor,
258 ID_BorderColor,
259 ID_GripperColor
260 };
261
262public:
263
264 SettingsPanel(wxWindow* parent, MyFrame* frame)
bfeed34c 265 : wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize)
50acee04
JS
266 {
267 //wxBoxSizer* vert = new wxBoxSizer(wxVERTICAL);
268
269 //vert->Add(1, 1, 1, wxEXPAND);
270
271 wxBoxSizer* s1 = new wxBoxSizer(wxHORIZONTAL);
272 m_border_size = new wxSpinCtrl(this, ID_PaneBorderSize, wxEmptyString, wxDefaultPosition, wxSize(50,20));
273 s1->Add(1, 1, 1, wxEXPAND);
bfeed34c 274 s1->Add(new wxStaticText(this, wxID_ANY, wxT("Pane Border Size:")));
50acee04
JS
275 s1->Add(m_border_size);
276 s1->Add(1, 1, 1, wxEXPAND);
277 s1->SetItemMinSize((size_t)1, 180, 20);
278 //vert->Add(s1, 0, wxEXPAND | wxLEFT | wxBOTTOM, 5);
279
280 wxBoxSizer* s2 = new wxBoxSizer(wxHORIZONTAL);
281 m_sash_size = new wxSpinCtrl(this, ID_SashSize, wxEmptyString, wxDefaultPosition, wxSize(50,20));
282 s2->Add(1, 1, 1, wxEXPAND);
bfeed34c 283 s2->Add(new wxStaticText(this, wxID_ANY, wxT("Sash Size:")));
50acee04
JS
284 s2->Add(m_sash_size);
285 s2->Add(1, 1, 1, wxEXPAND);
286 s2->SetItemMinSize((size_t)1, 180, 20);
287 //vert->Add(s2, 0, wxEXPAND | wxLEFT | wxBOTTOM, 5);
288
289 wxBoxSizer* s3 = new wxBoxSizer(wxHORIZONTAL);
290 m_caption_size = new wxSpinCtrl(this, ID_CaptionSize, wxEmptyString, wxDefaultPosition, wxSize(50,20));
291 s3->Add(1, 1, 1, wxEXPAND);
bfeed34c 292 s3->Add(new wxStaticText(this, wxID_ANY, wxT("Caption Size:")));
50acee04
JS
293 s3->Add(m_caption_size);
294 s3->Add(1, 1, 1, wxEXPAND);
295 s3->SetItemMinSize((size_t)1, 180, 20);
296 //vert->Add(s3, 0, wxEXPAND | wxLEFT | wxBOTTOM, 5);
297
298 //vert->Add(1, 1, 1, wxEXPAND);
299
300
301 wxBitmap b = CreateColorBitmap(*wxBLACK);
302
303 wxBoxSizer* s4 = new wxBoxSizer(wxHORIZONTAL);
304 m_background_color = new wxBitmapButton(this, ID_BackgroundColor, b, wxDefaultPosition, wxSize(50,25));
305 s4->Add(1, 1, 1, wxEXPAND);
bfeed34c 306 s4->Add(new wxStaticText(this, wxID_ANY, wxT("Background Color:")));
50acee04
JS
307 s4->Add(m_background_color);
308 s4->Add(1, 1, 1, wxEXPAND);
309 s4->SetItemMinSize((size_t)1, 180, 20);
310
311 wxBoxSizer* s5 = new wxBoxSizer(wxHORIZONTAL);
312 m_sash_color = new wxBitmapButton(this, ID_SashColor, b, wxDefaultPosition, wxSize(50,25));
313 s5->Add(1, 1, 1, wxEXPAND);
bfeed34c 314 s5->Add(new wxStaticText(this, wxID_ANY, wxT("Sash Color:")));
50acee04
JS
315 s5->Add(m_sash_color);
316 s5->Add(1, 1, 1, wxEXPAND);
317 s5->SetItemMinSize((size_t)1, 180, 20);
318
319 wxBoxSizer* s6 = new wxBoxSizer(wxHORIZONTAL);
320 m_inactive_caption_color = new wxBitmapButton(this, ID_InactiveCaptionColor, b, wxDefaultPosition, wxSize(50,25));
321 s6->Add(1, 1, 1, wxEXPAND);
bfeed34c 322 s6->Add(new wxStaticText(this, wxID_ANY, wxT("Normal Caption:")));
50acee04
JS
323 s6->Add(m_inactive_caption_color);
324 s6->Add(1, 1, 1, wxEXPAND);
325 s6->SetItemMinSize((size_t)1, 180, 20);
326
327 wxBoxSizer* s7 = new wxBoxSizer(wxHORIZONTAL);
328 m_inactive_caption_gradient_color = new wxBitmapButton(this, ID_InactiveCaptionGradientColor, b, wxDefaultPosition, wxSize(50,25));
329 s7->Add(1, 1, 1, wxEXPAND);
bfeed34c 330 s7->Add(new wxStaticText(this, wxID_ANY, wxT("Normal Caption Gradient:")));
50acee04
JS
331 s7->Add(m_inactive_caption_gradient_color);
332 s7->Add(1, 1, 1, wxEXPAND);
333 s7->SetItemMinSize((size_t)1, 180, 20);
334
335 wxBoxSizer* s8 = new wxBoxSizer(wxHORIZONTAL);
336 m_inactive_caption_text_color = new wxBitmapButton(this, ID_InactiveCaptionTextColor, b, wxDefaultPosition, wxSize(50,25));
337 s8->Add(1, 1, 1, wxEXPAND);
bfeed34c 338 s8->Add(new wxStaticText(this, wxID_ANY, wxT("Normal Caption Text:")));
50acee04
JS
339 s8->Add(m_inactive_caption_text_color);
340 s8->Add(1, 1, 1, wxEXPAND);
341 s8->SetItemMinSize((size_t)1, 180, 20);
342
343 wxBoxSizer* s9 = new wxBoxSizer(wxHORIZONTAL);
344 m_active_caption_color = new wxBitmapButton(this, ID_ActiveCaptionColor, b, wxDefaultPosition, wxSize(50,25));
345 s9->Add(1, 1, 1, wxEXPAND);
bfeed34c 346 s9->Add(new wxStaticText(this, wxID_ANY, wxT("Active Caption:")));
50acee04
JS
347 s9->Add(m_active_caption_color);
348 s9->Add(1, 1, 1, wxEXPAND);
349 s9->SetItemMinSize((size_t)1, 180, 20);
350
351 wxBoxSizer* s10 = new wxBoxSizer(wxHORIZONTAL);
352 m_active_caption_gradient_color = new wxBitmapButton(this, ID_ActiveCaptionGradientColor, b, wxDefaultPosition, wxSize(50,25));
353 s10->Add(1, 1, 1, wxEXPAND);
bfeed34c 354 s10->Add(new wxStaticText(this, wxID_ANY, wxT("Active Caption Gradient:")));
50acee04
JS
355 s10->Add(m_active_caption_gradient_color);
356 s10->Add(1, 1, 1, wxEXPAND);
357 s10->SetItemMinSize((size_t)1, 180, 20);
358
359 wxBoxSizer* s11 = new wxBoxSizer(wxHORIZONTAL);
360 m_active_caption_text_color = new wxBitmapButton(this, ID_ActiveCaptionTextColor, b, wxDefaultPosition, wxSize(50,25));
361 s11->Add(1, 1, 1, wxEXPAND);
bfeed34c 362 s11->Add(new wxStaticText(this, wxID_ANY, wxT("Active Caption Text:")));
50acee04
JS
363 s11->Add(m_active_caption_text_color);
364 s11->Add(1, 1, 1, wxEXPAND);
365 s11->SetItemMinSize((size_t)1, 180, 20);
366
367 wxBoxSizer* s12 = new wxBoxSizer(wxHORIZONTAL);
368 m_border_color = new wxBitmapButton(this, ID_BorderColor, b, wxDefaultPosition, wxSize(50,25));
369 s12->Add(1, 1, 1, wxEXPAND);
bfeed34c 370 s12->Add(new wxStaticText(this, wxID_ANY, wxT("Border Color:")));
50acee04
JS
371 s12->Add(m_border_color);
372 s12->Add(1, 1, 1, wxEXPAND);
373 s12->SetItemMinSize((size_t)1, 180, 20);
374
375 wxBoxSizer* s13 = new wxBoxSizer(wxHORIZONTAL);
376 m_gripper_color = new wxBitmapButton(this, ID_GripperColor, b, wxDefaultPosition, wxSize(50,25));
377 s13->Add(1, 1, 1, wxEXPAND);
bfeed34c 378 s13->Add(new wxStaticText(this, wxID_ANY, wxT("Gripper Color:")));
50acee04
JS
379 s13->Add(m_gripper_color);
380 s13->Add(1, 1, 1, wxEXPAND);
381 s13->SetItemMinSize((size_t)1, 180, 20);
bfeed34c 382
50acee04
JS
383 wxGridSizer* grid_sizer = new wxGridSizer(2);
384 grid_sizer->SetHGap(5);
385 grid_sizer->Add(s1); grid_sizer->Add(s4);
386 grid_sizer->Add(s2); grid_sizer->Add(s5);
387 grid_sizer->Add(s3); grid_sizer->Add(s13);
388 grid_sizer->Add(1,1); grid_sizer->Add(s12);
389 grid_sizer->Add(s6); grid_sizer->Add(s9);
390 grid_sizer->Add(s7); grid_sizer->Add(s10);
391 grid_sizer->Add(s8); grid_sizer->Add(s11);
bfeed34c 392
50acee04
JS
393 wxBoxSizer* cont_sizer = new wxBoxSizer(wxVERTICAL);
394 cont_sizer->Add(grid_sizer, 1, wxEXPAND | wxALL, 5);
395 SetSizer(cont_sizer);
396 GetSizer()->SetSizeHints(this);
397
398 m_frame = frame;
399 m_border_size->SetValue(frame->GetDockArt()->GetMetric(wxAUI_ART_PANE_BORDER_SIZE));
400 m_sash_size->SetValue(frame->GetDockArt()->GetMetric(wxAUI_ART_SASH_SIZE));
401 m_caption_size->SetValue(frame->GetDockArt()->GetMetric(wxAUI_ART_CAPTION_SIZE));
bfeed34c 402
50acee04
JS
403 UpdateColors();
404 }
405
406private:
407
408 wxBitmap CreateColorBitmap(const wxColour& c)
409 {
410 wxImage image;
411 image.Create(25,14);
412 for (int x = 0; x < 25; ++x)
413 for (int y = 0; y < 14; ++y)
414 {
415 wxColour pixcol = c;
416 if (x == 0 || x == 24 || y == 0 || y == 13)
417 pixcol = *wxBLACK;
418 image.SetRGB(x, y, pixcol.Red(), pixcol.Green(), pixcol.Blue());
419 }
420 return wxBitmap(image);
421 }
bfeed34c 422
50acee04
JS
423 void UpdateColors()
424 {
425 wxColour bk = m_frame->GetDockArt()->GetColor(wxAUI_ART_BACKGROUND_COLOUR);
426 m_background_color->SetBitmapLabel(CreateColorBitmap(bk));
bfeed34c 427
50acee04
JS
428 wxColour cap = m_frame->GetDockArt()->GetColor(wxAUI_ART_INACTIVE_CAPTION_COLOUR);
429 m_inactive_caption_color->SetBitmapLabel(CreateColorBitmap(cap));
bfeed34c 430
50acee04
JS
431 wxColour capgrad = m_frame->GetDockArt()->GetColor(wxAUI_ART_INACTIVE_CAPTION_GRADIENT_COLOUR);
432 m_inactive_caption_gradient_color->SetBitmapLabel(CreateColorBitmap(capgrad));
bfeed34c 433
50acee04
JS
434 wxColour captxt = m_frame->GetDockArt()->GetColor(wxAUI_ART_INACTIVE_CAPTION_TEXT_COLOUR);
435 m_inactive_caption_text_color->SetBitmapLabel(CreateColorBitmap(captxt));
bfeed34c 436
50acee04
JS
437 wxColour acap = m_frame->GetDockArt()->GetColor(wxAUI_ART_ACTIVE_CAPTION_COLOUR);
438 m_active_caption_color->SetBitmapLabel(CreateColorBitmap(acap));
bfeed34c 439
50acee04
JS
440 wxColour acapgrad = m_frame->GetDockArt()->GetColor(wxAUI_ART_ACTIVE_CAPTION_GRADIENT_COLOUR);
441 m_active_caption_gradient_color->SetBitmapLabel(CreateColorBitmap(acapgrad));
bfeed34c 442
50acee04
JS
443 wxColour acaptxt = m_frame->GetDockArt()->GetColor(wxAUI_ART_ACTIVE_CAPTION_TEXT_COLOUR);
444 m_active_caption_text_color->SetBitmapLabel(CreateColorBitmap(acaptxt));
445
446 wxColour sash = m_frame->GetDockArt()->GetColor(wxAUI_ART_SASH_COLOUR);
447 m_sash_color->SetBitmapLabel(CreateColorBitmap(sash));
bfeed34c 448
50acee04
JS
449 wxColour border = m_frame->GetDockArt()->GetColor(wxAUI_ART_BORDER_COLOUR);
450 m_border_color->SetBitmapLabel(CreateColorBitmap(border));
bfeed34c 451
50acee04
JS
452 wxColour gripper = m_frame->GetDockArt()->GetColor(wxAUI_ART_GRIPPER_COLOUR);
453 m_gripper_color->SetBitmapLabel(CreateColorBitmap(gripper));
454 }
bfeed34c 455
50acee04
JS
456 void OnPaneBorderSize(wxSpinEvent& event)
457 {
458 m_frame->GetDockArt()->SetMetric(wxAUI_ART_PANE_BORDER_SIZE,
459 event.GetPosition());
460 m_frame->DoUpdate();
461 }
462
463 void OnSashSize(wxSpinEvent& event)
464 {
465 m_frame->GetDockArt()->SetMetric(wxAUI_ART_SASH_SIZE,
466 event.GetPosition());
467 m_frame->DoUpdate();
468 }
469
470 void OnCaptionSize(wxSpinEvent& event)
471 {
472 m_frame->GetDockArt()->SetMetric(wxAUI_ART_CAPTION_SIZE,
473 event.GetPosition());
474 m_frame->DoUpdate();
475 }
476
477 void OnSetColor(wxCommandEvent& event)
478 {
479 wxColourDialog dlg(m_frame);
480 dlg.SetTitle(_("Color Picker"));
481 if (dlg.ShowModal() != wxID_OK)
482 return;
bfeed34c 483
50acee04
JS
484 int var = 0;
485 switch (event.GetId())
486 {
487 case ID_BackgroundColor: var = wxAUI_ART_BACKGROUND_COLOUR; break;
488 case ID_SashColor: var = wxAUI_ART_SASH_COLOUR; break;
489 case ID_InactiveCaptionColor: var = wxAUI_ART_INACTIVE_CAPTION_COLOUR; break;
490 case ID_InactiveCaptionGradientColor: var = wxAUI_ART_INACTIVE_CAPTION_GRADIENT_COLOUR; break;
491 case ID_InactiveCaptionTextColor: var = wxAUI_ART_INACTIVE_CAPTION_TEXT_COLOUR; break;
492 case ID_ActiveCaptionColor: var = wxAUI_ART_ACTIVE_CAPTION_COLOUR; break;
493 case ID_ActiveCaptionGradientColor: var = wxAUI_ART_ACTIVE_CAPTION_GRADIENT_COLOUR; break;
494 case ID_ActiveCaptionTextColor: var = wxAUI_ART_ACTIVE_CAPTION_TEXT_COLOUR; break;
495 case ID_BorderColor: var = wxAUI_ART_BORDER_COLOUR; break;
496 case ID_GripperColor: var = wxAUI_ART_GRIPPER_COLOUR; break;
497 default: return;
498 }
bfeed34c 499
50acee04
JS
500 m_frame->GetDockArt()->SetColor(var, dlg.GetColourData().GetColour());
501 m_frame->DoUpdate();
502 UpdateColors();
503 }
bfeed34c 504
50acee04
JS
505private:
506
507 MyFrame* m_frame;
508 wxSpinCtrl* m_border_size;
509 wxSpinCtrl* m_sash_size;
510 wxSpinCtrl* m_caption_size;
511 wxBitmapButton* m_inactive_caption_text_color;
512 wxBitmapButton* m_inactive_caption_gradient_color;
513 wxBitmapButton* m_inactive_caption_color;
514 wxBitmapButton* m_active_caption_text_color;
515 wxBitmapButton* m_active_caption_gradient_color;
516 wxBitmapButton* m_active_caption_color;
517 wxBitmapButton* m_sash_color;
518 wxBitmapButton* m_background_color;
519 wxBitmapButton* m_border_color;
520 wxBitmapButton* m_gripper_color;
bfeed34c 521
50acee04
JS
522 DECLARE_EVENT_TABLE()
523};
524
525BEGIN_EVENT_TABLE(SettingsPanel, wxPanel)
526 EVT_SPINCTRL(ID_PaneBorderSize, SettingsPanel::OnPaneBorderSize)
527 EVT_SPINCTRL(ID_SashSize, SettingsPanel::OnSashSize)
528 EVT_SPINCTRL(ID_CaptionSize, SettingsPanel::OnCaptionSize)
529 EVT_BUTTON(ID_BackgroundColor, SettingsPanel::OnSetColor)
530 EVT_BUTTON(ID_SashColor, SettingsPanel::OnSetColor)
531 EVT_BUTTON(ID_InactiveCaptionColor, SettingsPanel::OnSetColor)
532 EVT_BUTTON(ID_InactiveCaptionGradientColor, SettingsPanel::OnSetColor)
533 EVT_BUTTON(ID_InactiveCaptionTextColor, SettingsPanel::OnSetColor)
534 EVT_BUTTON(ID_ActiveCaptionColor, SettingsPanel::OnSetColor)
535 EVT_BUTTON(ID_ActiveCaptionGradientColor, SettingsPanel::OnSetColor)
536 EVT_BUTTON(ID_ActiveCaptionTextColor, SettingsPanel::OnSetColor)
537 EVT_BUTTON(ID_BorderColor, SettingsPanel::OnSetColor)
bfeed34c 538 EVT_BUTTON(ID_GripperColor, SettingsPanel::OnSetColor)
50acee04
JS
539END_EVENT_TABLE()
540
541
50acee04
JS
542bool MyApp::OnInit()
543{
544 wxFrame* frame = new MyFrame(NULL,
545 wxID_ANY,
70476471 546 wxT("wxAUI Sample Application"),
50acee04
JS
547 wxDefaultPosition,
548 wxSize(800, 600));
549 SetTopWindow(frame);
550 frame->Show();
551
552 return true;
553}
554
50acee04
JS
555BEGIN_EVENT_TABLE(MyFrame, wxFrame)
556 EVT_ERASE_BACKGROUND(MyFrame::OnEraseBackground)
557 EVT_SIZE(MyFrame::OnSize)
558 EVT_MENU(MyFrame::ID_CreateTree, MyFrame::OnCreateTree)
559 EVT_MENU(MyFrame::ID_CreateGrid, MyFrame::OnCreateGrid)
560 EVT_MENU(MyFrame::ID_CreateText, MyFrame::OnCreateText)
561 EVT_MENU(MyFrame::ID_CreateHTML, MyFrame::OnCreateHTML)
562 EVT_MENU(MyFrame::ID_CreateSizeReport, MyFrame::OnCreateSizeReport)
8bfde0a8 563 EVT_MENU(MyFrame::ID_CreateNotebook, MyFrame::OnCreateNotebook)
50acee04
JS
564 EVT_MENU(MyFrame::ID_CreatePerspective, MyFrame::OnCreatePerspective)
565 EVT_MENU(MyFrame::ID_CopyPerspectiveCode, MyFrame::OnCopyPerspectiveCode)
566 EVT_MENU(ID_AllowFloating, MyFrame::OnManagerFlag)
567 EVT_MENU(ID_TransparentHint, MyFrame::OnManagerFlag)
cf6fec73
BW
568 EVT_MENU(ID_VenetianBlindsHint, MyFrame::OnManagerFlag)
569 EVT_MENU(ID_RectangleHint, MyFrame::OnManagerFlag)
570 EVT_MENU(ID_NoHint, MyFrame::OnManagerFlag)
571 EVT_MENU(ID_HintFade, MyFrame::OnManagerFlag)
572 EVT_MENU(ID_NoVenetianFade, MyFrame::OnManagerFlag)
50acee04
JS
573 EVT_MENU(ID_TransparentDrag, MyFrame::OnManagerFlag)
574 EVT_MENU(ID_AllowActivePane, MyFrame::OnManagerFlag)
931483d7 575 EVT_MENU(ID_NotebookNoCloseButton, MyFrame::OnNotebookFlag)
c50fa29f
BW
576 EVT_MENU(ID_NotebookCloseButton, MyFrame::OnNotebookFlag)
577 EVT_MENU(ID_NotebookCloseButtonAll, MyFrame::OnNotebookFlag)
578 EVT_MENU(ID_NotebookCloseButtonActive, MyFrame::OnNotebookFlag)
51100f50
BW
579 EVT_MENU(ID_NotebookAllowTabMove, MyFrame::OnNotebookFlag)
580 EVT_MENU(ID_NotebookAllowTabSplit, MyFrame::OnNotebookFlag)
01372b8f
BW
581 EVT_MENU(ID_NotebookScrollButtons, MyFrame::OnNotebookFlag)
582 EVT_MENU(ID_NotebookWindowList, MyFrame::OnNotebookFlag)
50acee04
JS
583 EVT_MENU(ID_NoGradient, MyFrame::OnGradient)
584 EVT_MENU(ID_VerticalGradient, MyFrame::OnGradient)
585 EVT_MENU(ID_HorizontalGradient, MyFrame::OnGradient)
586 EVT_MENU(ID_Settings, MyFrame::OnSettings)
587 EVT_MENU(ID_GridContent, MyFrame::OnChangeContentPane)
588 EVT_MENU(ID_TreeContent, MyFrame::OnChangeContentPane)
589 EVT_MENU(ID_TextContent, MyFrame::OnChangeContentPane)
590 EVT_MENU(ID_SizeReportContent, MyFrame::OnChangeContentPane)
591 EVT_MENU(ID_HTMLContent, MyFrame::OnChangeContentPane)
df00bdf7 592 EVT_MENU(ID_NotebookContent, MyFrame::OnChangeContentPane)
50acee04
JS
593 EVT_MENU(wxID_EXIT, MyFrame::OnExit)
594 EVT_MENU(wxID_ABOUT, MyFrame::OnAbout)
931483d7 595 EVT_UPDATE_UI(ID_NotebookNoCloseButton, MyFrame::OnUpdateUI)
c50fa29f
BW
596 EVT_UPDATE_UI(ID_NotebookCloseButton, MyFrame::OnUpdateUI)
597 EVT_UPDATE_UI(ID_NotebookCloseButtonAll, MyFrame::OnUpdateUI)
598 EVT_UPDATE_UI(ID_NotebookCloseButtonActive, MyFrame::OnUpdateUI)
51100f50
BW
599 EVT_UPDATE_UI(ID_NotebookAllowTabMove, MyFrame::OnUpdateUI)
600 EVT_UPDATE_UI(ID_NotebookAllowTabSplit, MyFrame::OnUpdateUI)
01372b8f
BW
601 EVT_UPDATE_UI(ID_NotebookScrollButtons, MyFrame::OnUpdateUI)
602 EVT_UPDATE_UI(ID_NotebookWindowList, MyFrame::OnUpdateUI)
50acee04
JS
603 EVT_UPDATE_UI(ID_AllowFloating, MyFrame::OnUpdateUI)
604 EVT_UPDATE_UI(ID_TransparentHint, MyFrame::OnUpdateUI)
cf6fec73
BW
605 EVT_UPDATE_UI(ID_VenetianBlindsHint, MyFrame::OnUpdateUI)
606 EVT_UPDATE_UI(ID_RectangleHint, MyFrame::OnUpdateUI)
607 EVT_UPDATE_UI(ID_NoHint, MyFrame::OnUpdateUI)
608 EVT_UPDATE_UI(ID_HintFade, MyFrame::OnUpdateUI)
609 EVT_UPDATE_UI(ID_NoVenetianFade, MyFrame::OnUpdateUI)
50acee04
JS
610 EVT_UPDATE_UI(ID_TransparentDrag, MyFrame::OnUpdateUI)
611 EVT_UPDATE_UI(ID_NoGradient, MyFrame::OnUpdateUI)
612 EVT_UPDATE_UI(ID_VerticalGradient, MyFrame::OnUpdateUI)
613 EVT_UPDATE_UI(ID_HorizontalGradient, MyFrame::OnUpdateUI)
614 EVT_MENU_RANGE(MyFrame::ID_FirstPerspective, MyFrame::ID_FirstPerspective+1000,
615 MyFrame::OnRestorePerspective)
58754643 616 EVT_AUI_PANECLOSE(MyFrame::OnPaneClose)
50acee04
JS
617END_EVENT_TABLE()
618
619
50acee04
JS
620MyFrame::MyFrame(wxWindow* parent,
621 wxWindowID id,
622 const wxString& title,
623 const wxPoint& pos,
624 const wxSize& size,
625 long style)
626 : wxFrame(parent, id, title, pos, size, style)
627{
a3a5df9d 628 // tell wxAuiManager to manage this frame
461125ea 629 m_mgr.SetManagedWindow(this);
bfeed34c 630
50acee04
JS
631 // set frame icon
632 SetIcon(wxIcon(sample_xpm));
633
c50fa29f
BW
634 // set up default notebook style
635 m_notebook_style = wxAUI_NB_DEFAULT_STYLE | wxNO_BORDER;
636
50acee04
JS
637 // create menu
638 wxMenuBar* mb = new wxMenuBar;
639
640 wxMenu* file_menu = new wxMenu;
641 file_menu->Append(wxID_EXIT, _("Exit"));
642
643 wxMenu* view_menu = new wxMenu;
644 view_menu->Append(ID_CreateText, _("Create Text Control"));
645 view_menu->Append(ID_CreateHTML, _("Create HTML Control"));
646 view_menu->Append(ID_CreateTree, _("Create Tree"));
647 view_menu->Append(ID_CreateGrid, _("Create Grid"));
8bfde0a8 648 view_menu->Append(ID_CreateNotebook, _("Create Notebook"));
50acee04
JS
649 view_menu->Append(ID_CreateSizeReport, _("Create Size Reporter"));
650 view_menu->AppendSeparator();
651 view_menu->Append(ID_GridContent, _("Use a Grid for the Content Pane"));
652 view_menu->Append(ID_TextContent, _("Use a Text Control for the Content Pane"));
653 view_menu->Append(ID_HTMLContent, _("Use an HTML Control for the Content Pane"));
654 view_menu->Append(ID_TreeContent, _("Use a Tree Control for the Content Pane"));
df00bdf7 655 view_menu->Append(ID_NotebookContent, _("Use a AUI wxMultiNotebook control for the Content Pane"));
bfeed34c
WS
656 view_menu->Append(ID_SizeReportContent, _("Use a Size Reporter for the Content Pane"));
657
50acee04 658 wxMenu* options_menu = new wxMenu;
cf6fec73
BW
659 options_menu->AppendRadioItem(ID_TransparentHint, _("Transparent Hint"));
660 options_menu->AppendRadioItem(ID_VenetianBlindsHint, _("Venetian Blinds Hint"));
661 options_menu->AppendRadioItem(ID_RectangleHint, _("Rectangle Hint"));
662 options_menu->AppendRadioItem(ID_NoHint, _("No Hint"));
663 options_menu->AppendSeparator();
664 options_menu->AppendCheckItem(ID_HintFade, _("Hint Fade-in"));
50acee04 665 options_menu->AppendCheckItem(ID_AllowFloating, _("Allow Floating"));
cf6fec73 666 options_menu->AppendCheckItem(ID_NoVenetianFade, _("Disable Venetian Blinds Hint Fade-in"));
50acee04
JS
667 options_menu->AppendCheckItem(ID_TransparentDrag, _("Transparent Drag"));
668 options_menu->AppendCheckItem(ID_AllowActivePane, _("Allow Active Pane"));
669 options_menu->AppendSeparator();
670 options_menu->AppendRadioItem(ID_NoGradient, _("No Caption Gradient"));
671 options_menu->AppendRadioItem(ID_VerticalGradient, _("Vertical Caption Gradient"));
672 options_menu->AppendRadioItem(ID_HorizontalGradient, _("Horizontal Caption Gradient"));
673 options_menu->AppendSeparator();
674 options_menu->Append(ID_Settings, _("Settings Pane"));
bfeed34c 675
c50fa29f 676 wxMenu* notebook_menu = new wxMenu;
931483d7 677 notebook_menu->AppendRadioItem(ID_NotebookNoCloseButton, _("No Close Button"));
c50fa29f
BW
678 notebook_menu->AppendRadioItem(ID_NotebookCloseButton, _("Close Button at Right"));
679 notebook_menu->AppendRadioItem(ID_NotebookCloseButtonAll, _("Close Button on All Tabs"));
680 notebook_menu->AppendRadioItem(ID_NotebookCloseButtonActive, _("Close Button on Active Tab"));
51100f50
BW
681 notebook_menu->AppendSeparator();
682 notebook_menu->AppendCheckItem(ID_NotebookAllowTabMove, _("Allow Tab Move"));
683 notebook_menu->AppendCheckItem(ID_NotebookAllowTabSplit, _("Allow Notebook Split"));
01372b8f
BW
684 notebook_menu->AppendCheckItem(ID_NotebookScrollButtons, _("Scroll Buttons Visible"));
685 notebook_menu->AppendCheckItem(ID_NotebookWindowList, _("Window List Button Visible"));
c50fa29f 686
50acee04
JS
687 m_perspectives_menu = new wxMenu;
688 m_perspectives_menu->Append(ID_CreatePerspective, _("Create Perspective"));
689 m_perspectives_menu->Append(ID_CopyPerspectiveCode, _("Copy Perspective Data To Clipboard"));
690 m_perspectives_menu->AppendSeparator();
691 m_perspectives_menu->Append(ID_FirstPerspective+0, _("Default Startup"));
692 m_perspectives_menu->Append(ID_FirstPerspective+1, _("All Panes"));
693
694 wxMenu* help_menu = new wxMenu;
695 help_menu->Append(wxID_ABOUT, _("About..."));
bfeed34c 696
50acee04
JS
697 mb->Append(file_menu, _("File"));
698 mb->Append(view_menu, _("View"));
699 mb->Append(m_perspectives_menu, _("Perspectives"));
700 mb->Append(options_menu, _("Options"));
c50fa29f 701 mb->Append(notebook_menu, _("Notebook"));
50acee04 702 mb->Append(help_menu, _("Help"));
bfeed34c 703
50acee04
JS
704 SetMenuBar(mb);
705
706 CreateStatusBar();
707 GetStatusBar()->SetStatusText(_("Ready"));
708
709
710 // min size for the frame itself isn't completely done.
a3a5df9d 711 // see the end up wxAuiManager::Update() for the test
50acee04
JS
712 // code. For now, just hard code a frame minimum size
713 SetMinSize(wxSize(400,300));
714
715 // create some toolbars
bfeed34c 716 wxToolBar* tb1 = new wxToolBar(this, wxID_ANY, wxDefaultPosition, wxDefaultSize,
50acee04
JS
717 wxTB_FLAT | wxTB_NODIVIDER);
718 tb1->SetToolBitmapSize(wxSize(48,48));
719 tb1->AddTool(101, wxT("Test"), wxArtProvider::GetBitmap(wxART_ERROR));
720 tb1->AddSeparator();
721 tb1->AddTool(102, wxT("Test"), wxArtProvider::GetBitmap(wxART_QUESTION));
722 tb1->AddTool(103, wxT("Test"), wxArtProvider::GetBitmap(wxART_INFORMATION));
723 tb1->AddTool(103, wxT("Test"), wxArtProvider::GetBitmap(wxART_WARNING));
724 tb1->AddTool(103, wxT("Test"), wxArtProvider::GetBitmap(wxART_MISSING_IMAGE));
725 tb1->Realize();
726
727
bfeed34c 728 wxToolBar* tb2 = new wxToolBar(this, wxID_ANY, wxDefaultPosition, wxDefaultSize,
50acee04
JS
729 wxTB_FLAT | wxTB_NODIVIDER);
730 tb2->SetToolBitmapSize(wxSize(16,16));
731
732 wxBitmap tb2_bmp1 = wxArtProvider::GetBitmap(wxART_QUESTION, wxART_OTHER, wxSize(16,16));
733 tb2->AddTool(101, wxT("Test"), tb2_bmp1);
734 tb2->AddTool(101, wxT("Test"), tb2_bmp1);
735 tb2->AddTool(101, wxT("Test"), tb2_bmp1);
736 tb2->AddTool(101, wxT("Test"), tb2_bmp1);
737 tb2->AddSeparator();
738 tb2->AddTool(101, wxT("Test"), tb2_bmp1);
739 tb2->AddTool(101, wxT("Test"), tb2_bmp1);
740 tb2->AddSeparator();
741 tb2->AddTool(101, wxT("Test"), tb2_bmp1);
742 tb2->AddTool(101, wxT("Test"), tb2_bmp1);
743 tb2->AddTool(101, wxT("Test"), tb2_bmp1);
744 tb2->AddTool(101, wxT("Test"), tb2_bmp1);
745 tb2->Realize();
746
bfeed34c
WS
747
748 wxToolBar* tb3 = new wxToolBar(this, wxID_ANY, wxDefaultPosition, wxDefaultSize,
50acee04
JS
749 wxTB_FLAT | wxTB_NODIVIDER);
750 tb3->SetToolBitmapSize(wxSize(16,16));
751 wxBitmap tb3_bmp1 = wxArtProvider::GetBitmap(wxART_FOLDER, wxART_OTHER, wxSize(16,16));
752 tb3->AddTool(101, wxT("Test"), tb3_bmp1);
753 tb3->AddTool(101, wxT("Test"), tb3_bmp1);
754 tb3->AddTool(101, wxT("Test"), tb3_bmp1);
755 tb3->AddTool(101, wxT("Test"), tb3_bmp1);
756 tb3->AddSeparator();
757 tb3->AddTool(101, wxT("Test"), tb3_bmp1);
758 tb3->AddTool(101, wxT("Test"), tb3_bmp1);
759 tb3->Realize();
760
761
bfeed34c 762 wxToolBar* tb4 = new wxToolBar(this, wxID_ANY, wxDefaultPosition, wxDefaultSize,
50acee04
JS
763 wxTB_FLAT | wxTB_NODIVIDER | wxTB_HORZ_TEXT);
764 tb4->SetToolBitmapSize(wxSize(16,16));
765 wxBitmap tb4_bmp1 = wxArtProvider::GetBitmap(wxART_NORMAL_FILE, wxART_OTHER, wxSize(16,16));
766 tb4->AddTool(101, wxT("Item 1"), tb4_bmp1);
767 tb4->AddTool(101, wxT("Item 2"), tb4_bmp1);
768 tb4->AddTool(101, wxT("Item 3"), tb4_bmp1);
769 tb4->AddTool(101, wxT("Item 4"), tb4_bmp1);
770 tb4->AddSeparator();
771 tb4->AddTool(101, wxT("Item 5"), tb4_bmp1);
772 tb4->AddTool(101, wxT("Item 6"), tb4_bmp1);
773 tb4->AddTool(101, wxT("Item 7"), tb4_bmp1);
774 tb4->AddTool(101, wxT("Item 8"), tb4_bmp1);
775 tb4->Realize();
776
777 // create some toolbars
bfeed34c 778 wxToolBar* tb5 = new wxToolBar(this, wxID_ANY, wxDefaultPosition, wxDefaultSize,
50acee04
JS
779 wxTB_FLAT | wxTB_NODIVIDER | wxTB_VERTICAL);
780 tb5->SetToolBitmapSize(wxSize(48,48));
781 tb5->AddTool(101, wxT("Test"), wxArtProvider::GetBitmap(wxART_ERROR));
782 tb5->AddSeparator();
783 tb5->AddTool(102, wxT("Test"), wxArtProvider::GetBitmap(wxART_QUESTION));
784 tb5->AddTool(103, wxT("Test"), wxArtProvider::GetBitmap(wxART_INFORMATION));
785 tb5->AddTool(103, wxT("Test"), wxArtProvider::GetBitmap(wxART_WARNING));
786 tb5->AddTool(103, wxT("Test"), wxArtProvider::GetBitmap(wxART_MISSING_IMAGE));
787 tb5->Realize();
788
50acee04 789 // add a bunch of panes
a3a5df9d 790 m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().
50acee04
JS
791 Name(wxT("test1")).Caption(wxT("Pane Caption")).
792 Top());
793
a3a5df9d 794 m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().
50acee04 795 Name(wxT("test2")).Caption(wxT("Client Size Reporter")).
37106ab2
BW
796 Bottom().Position(1).
797 PinButton(true).CloseButton(true).MaximizeButton(true));
50acee04 798
a3a5df9d 799 m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().
50acee04 800 Name(wxT("test3")).Caption(wxT("Client Size Reporter")).
37106ab2
BW
801 Bottom().
802 PinButton(true).CloseButton(true).MaximizeButton(true));
bfeed34c 803
a3a5df9d 804 m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().
50acee04
JS
805 Name(wxT("test4")).Caption(wxT("Pane Caption")).
806 Left());
bfeed34c 807
a3a5df9d 808 m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().
31ec1d03
BW
809 Name(wxT("test5")).Caption(wxT("No Close Button")).
810 Right().CloseButton(false));
bfeed34c 811
a3a5df9d 812 m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().
50acee04 813 Name(wxT("test6")).Caption(wxT("Client Size Reporter")).
37106ab2
BW
814 Right().Row(1).
815 PinButton(true).CloseButton(true).MaximizeButton(true));
50acee04 816
a3a5df9d 817 m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().
50acee04 818 Name(wxT("test7")).Caption(wxT("Client Size Reporter")).
37106ab2
BW
819 Left().Layer(1).
820 PinButton(true).CloseButton(true).MaximizeButton(true));
bfeed34c 821
a3a5df9d 822 m_mgr.AddPane(CreateTreeCtrl(), wxAuiPaneInfo().
50acee04 823 Name(wxT("test8")).Caption(wxT("Tree Pane")).
37106ab2
BW
824 Left().Layer(1).Position(1).
825 CloseButton(true).MaximizeButton(true));
50acee04 826
a3a5df9d 827 m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().
50acee04
JS
828 Name(wxT("test9")).Caption(wxT("Min Size 200x100")).
829 BestSize(wxSize(200,100)).MinSize(wxSize(200,100)).
37106ab2
BW
830 Bottom().Layer(1).
831 CloseButton(true).MaximizeButton(true));
50acee04 832
58754643 833 wxWindow* wnd10 = CreateTextCtrl(wxT("This pane will prompt the user before hiding."));
a3a5df9d 834 m_mgr.AddPane(wnd10, wxAuiPaneInfo().
58754643 835 Name(wxT("test10")).Caption(wxT("Text Pane with Hide Prompt")).
50acee04 836 Bottom().Layer(1).Position(1));
bfeed34c 837
a3a5df9d 838 m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().
50acee04
JS
839 Name(wxT("test11")).Caption(wxT("Fixed Pane")).
840 Bottom().Layer(1).Position(2).Fixed());
841
bfeed34c 842
a3a5df9d 843 m_mgr.AddPane(new SettingsPanel(this,this), wxAuiPaneInfo().
50acee04
JS
844 Name(wxT("settings")).Caption(wxT("Dock Manager Settings")).
845 Dockable(false).Float().Hide());
846
847 // create some center panes
848
a3a5df9d 849 m_mgr.AddPane(CreateGrid(), wxAuiPaneInfo().Name(wxT("grid_content")).
50acee04
JS
850 CenterPane().Hide());
851
a3a5df9d 852 m_mgr.AddPane(CreateTreeCtrl(), wxAuiPaneInfo().Name(wxT("tree_content")).
50acee04 853 CenterPane().Hide());
bfeed34c 854
a3a5df9d 855 m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().Name(wxT("sizereport_content")).
50acee04
JS
856 CenterPane().Hide());
857
a3a5df9d 858 m_mgr.AddPane(CreateTextCtrl(), wxAuiPaneInfo().Name(wxT("text_content")).
50acee04
JS
859 CenterPane().Hide());
860
a3a5df9d 861 m_mgr.AddPane(CreateHTMLCtrl(), wxAuiPaneInfo().Name(wxT("html_content")).
50acee04 862 CenterPane());
bfeed34c 863
a3a5df9d 864 m_mgr.AddPane(CreateNotebook(), wxAuiPaneInfo().Name(wxT("notebook_content")).
2e5c35af 865 CenterPane().PaneBorder(false));
df00bdf7 866
50acee04 867 // add the toolbars to the manager
a3a5df9d 868 m_mgr.AddPane(tb1, wxAuiPaneInfo().
50acee04
JS
869 Name(wxT("tb1")).Caption(wxT("Big Toolbar")).
870 ToolbarPane().Top().
871 LeftDockable(false).RightDockable(false));
872
a3a5df9d 873 m_mgr.AddPane(tb2, wxAuiPaneInfo().
50acee04
JS
874 Name(wxT("tb2")).Caption(wxT("Toolbar 2")).
875 ToolbarPane().Top().Row(1).
876 LeftDockable(false).RightDockable(false));
bfeed34c 877
a3a5df9d 878 m_mgr.AddPane(tb3, wxAuiPaneInfo().
50acee04
JS
879 Name(wxT("tb3")).Caption(wxT("Toolbar 3")).
880 ToolbarPane().Top().Row(1).Position(1).
881 LeftDockable(false).RightDockable(false));
bfeed34c 882
a3a5df9d 883 m_mgr.AddPane(tb4, wxAuiPaneInfo().
50acee04
JS
884 Name(wxT("tb4")).Caption(wxT("Sample Bookmark Toolbar")).
885 ToolbarPane().Top().Row(2).
886 LeftDockable(false).RightDockable(false));
bfeed34c 887
a3a5df9d 888 m_mgr.AddPane(tb5, wxAuiPaneInfo().
2c26bdee 889 Name(wxT("tb5")).Caption(wxT("Sample Vertical Toolbar")).
50acee04
JS
890 ToolbarPane().Left().
891 GripperTop().
892 TopDockable(false).BottomDockable(false));
bfeed34c
WS
893
894 m_mgr.AddPane(new wxButton(this, wxID_ANY, _("Test Button")),
a3a5df9d 895 wxAuiPaneInfo().Name(wxT("tb6")).
50acee04
JS
896 ToolbarPane().Top().Row(2).Position(1).
897 LeftDockable(false).RightDockable(false));
898
50acee04 899 // make some default perspectives
bfeed34c 900
50acee04 901 wxString perspective_all = m_mgr.SavePerspective();
bfeed34c 902
50acee04 903 int i, count;
a3a5df9d 904 wxAuiPaneInfoArray& all_panes = m_mgr.GetAllPanes();
50acee04
JS
905 for (i = 0, count = all_panes.GetCount(); i < count; ++i)
906 if (!all_panes.Item(i).IsToolbar())
907 all_panes.Item(i).Hide();
908 m_mgr.GetPane(wxT("tb1")).Hide();
60fa553c 909 m_mgr.GetPane(wxT("tb6")).Hide();
50acee04
JS
910 m_mgr.GetPane(wxT("test8")).Show().Left().Layer(0).Row(0).Position(0);
911 m_mgr.GetPane(wxT("test10")).Show().Bottom().Layer(0).Row(0).Position(0);
dbd2f790 912 m_mgr.GetPane(wxT("notebook_content")).Show();
50acee04 913 wxString perspective_default = m_mgr.SavePerspective();
bfeed34c 914
50acee04
JS
915 m_perspectives.Add(perspective_default);
916 m_perspectives.Add(perspective_all);
917
a3a5df9d 918 // "commit" all changes made to wxAuiManager
50acee04
JS
919 m_mgr.Update();
920}
921
922MyFrame::~MyFrame()
923{
924 m_mgr.UnInit();
925}
926
a3a5df9d 927wxAuiDockArt* MyFrame::GetDockArt()
50acee04
JS
928{
929 return m_mgr.GetArtProvider();
930}
931
932void MyFrame::DoUpdate()
933{
934 m_mgr.Update();
935}
936
50acee04
JS
937void MyFrame::OnEraseBackground(wxEraseEvent& event)
938{
939 event.Skip();
940}
941
942void MyFrame::OnSize(wxSizeEvent& event)
943{
944 event.Skip();
945}
946
bfeed34c 947void MyFrame::OnSettings(wxCommandEvent& WXUNUSED(event))
50acee04
JS
948{
949 // show the settings pane, and float it
a3a5df9d 950 wxAuiPaneInfo& floating_pane = m_mgr.GetPane(wxT("settings")).Float().Show();
50acee04
JS
951
952 if (floating_pane.floating_pos == wxDefaultPosition)
953 floating_pane.FloatingPosition(GetStartPosition());
954
955 m_mgr.Update();
956}
957
50acee04
JS
958void MyFrame::OnGradient(wxCommandEvent& event)
959{
960 int gradient = 0;
961
962 switch (event.GetId())
963 {
964 case ID_NoGradient: gradient = wxAUI_GRADIENT_NONE; break;
965 case ID_VerticalGradient: gradient = wxAUI_GRADIENT_VERTICAL; break;
966 case ID_HorizontalGradient: gradient = wxAUI_GRADIENT_HORIZONTAL; break;
967 }
968
969 m_mgr.GetArtProvider()->SetMetric(wxAUI_ART_GRADIENT_TYPE, gradient);
970 m_mgr.Update();
971}
972
973void MyFrame::OnManagerFlag(wxCommandEvent& event)
974{
975 unsigned int flag = 0;
bfeed34c 976
7a5b04a6 977#if !defined(__WXMSW__) && !defined(__WXMAC__) && !defined(__WXGTK__)
50acee04
JS
978 if (event.GetId() == ID_TransparentDrag ||
979 event.GetId() == ID_TransparentHint ||
cf6fec73 980 event.GetId() == ID_HintFade)
50acee04 981 {
7a5b04a6 982 wxMessageBox(wxT("This option is presently only available on wxGTK, wxMSW and wxMac"));
50acee04
JS
983 return;
984 }
bfeed34c
WS
985#endif
986
cf6fec73
BW
987 int id = event.GetId();
988
989 if (id == ID_TransparentHint ||
990 id == ID_VenetianBlindsHint ||
991 id == ID_RectangleHint ||
992 id == ID_NoHint)
993 {
994 unsigned int flags = m_mgr.GetFlags();
995 flags &= ~wxAUI_MGR_TRANSPARENT_HINT;
996 flags &= ~wxAUI_MGR_VENETIAN_BLINDS_HINT;
997 flags &= ~wxAUI_MGR_RECTANGLE_HINT;
998 m_mgr.SetFlags(flags);
999 }
1000
1001 switch (id)
50acee04
JS
1002 {
1003 case ID_AllowFloating: flag = wxAUI_MGR_ALLOW_FLOATING; break;
1004 case ID_TransparentDrag: flag = wxAUI_MGR_TRANSPARENT_DRAG; break;
cf6fec73
BW
1005 case ID_HintFade: flag = wxAUI_MGR_HINT_FADE; break;
1006 case ID_NoVenetianFade: flag = wxAUI_MGR_NO_VENETIAN_BLINDS_FADE; break;
50acee04 1007 case ID_AllowActivePane: flag = wxAUI_MGR_ALLOW_ACTIVE_PANE; break;
cf6fec73
BW
1008 case ID_TransparentHint: flag = wxAUI_MGR_TRANSPARENT_HINT; break;
1009 case ID_VenetianBlindsHint: flag = wxAUI_MGR_VENETIAN_BLINDS_HINT; break;
1010 case ID_RectangleHint: flag = wxAUI_MGR_RECTANGLE_HINT; break;
1011 }
1012
1013 if (flag)
1014 {
1015 m_mgr.SetFlags(m_mgr.GetFlags() ^ flag);
50acee04 1016 }
cf6fec73 1017
50acee04
JS
1018 m_mgr.Update();
1019}
1020
c50fa29f
BW
1021
1022void MyFrame::OnNotebookFlag(wxCommandEvent& event)
1023{
1024 int id = event.GetId();
1025
931483d7
BW
1026 if (id == ID_NotebookNoCloseButton ||
1027 id == ID_NotebookCloseButton ||
c50fa29f
BW
1028 id == ID_NotebookCloseButtonAll ||
1029 id == ID_NotebookCloseButtonActive)
1030 {
1031 m_notebook_style &= ~(wxAUI_NB_CLOSE_BUTTON |
1032 wxAUI_NB_CLOSE_ON_ACTIVE_TAB |
1033 wxAUI_NB_CLOSE_ON_ALL_TABS);
1034
1035 switch (id)
1036 {
931483d7 1037 case ID_NotebookNoCloseButton: break;
c50fa29f
BW
1038 case ID_NotebookCloseButton: m_notebook_style |= wxAUI_NB_CLOSE_BUTTON; break;
1039 case ID_NotebookCloseButtonAll: m_notebook_style |= wxAUI_NB_CLOSE_ON_ALL_TABS; break;
1040 case ID_NotebookCloseButtonActive: m_notebook_style |= wxAUI_NB_CLOSE_ON_ACTIVE_TAB; break;
1041 }
51100f50
BW
1042 }
1043
1044 if (id == ID_NotebookAllowTabMove)
1045 {
1046 m_notebook_style ^= wxAUI_NB_TAB_MOVE;
1047 }
01372b8f 1048 else if (id == ID_NotebookAllowTabSplit)
51100f50
BW
1049 {
1050 m_notebook_style ^= wxAUI_NB_TAB_SPLIT;
1051 }
01372b8f
BW
1052 else if (id == ID_NotebookWindowList)
1053 {
1054 m_notebook_style ^= wxAUI_NB_WINDOWLIST_BUTTON;
1055 }
1056 else if (id == ID_NotebookScrollButtons)
1057 {
1058 m_notebook_style ^= wxAUI_NB_SCROLL_BUTTONS;
1059 }
c50fa29f 1060
c50fa29f
BW
1061
1062
1063 size_t i, count;
1064 wxAuiPaneInfoArray& all_panes = m_mgr.GetAllPanes();
1065 for (i = 0, count = all_panes.GetCount(); i < count; ++i)
1066 {
1067 wxAuiPaneInfo& pane = all_panes.Item(i);
1068
1069 if (pane.window->IsKindOf(CLASSINFO(wxAuiNotebook)))
1070 {
1071 pane.window->SetWindowStyleFlag(m_notebook_style);
1072 pane.window->Refresh();
1073 }
1074 }
1075
1076
1077}
1078
1079
50acee04
JS
1080void MyFrame::OnUpdateUI(wxUpdateUIEvent& event)
1081{
1082 unsigned int flags = m_mgr.GetFlags();
bfeed34c 1083
50acee04
JS
1084 switch (event.GetId())
1085 {
1086 case ID_NoGradient:
87d658e5 1087 event.Check(m_mgr.GetArtProvider()->GetMetric(wxAUI_ART_GRADIENT_TYPE) == wxAUI_GRADIENT_NONE);
50acee04
JS
1088 break;
1089 case ID_VerticalGradient:
87d658e5 1090 event.Check(m_mgr.GetArtProvider()->GetMetric(wxAUI_ART_GRADIENT_TYPE) == wxAUI_GRADIENT_VERTICAL);
50acee04
JS
1091 break;
1092 case ID_HorizontalGradient:
87d658e5 1093 event.Check(m_mgr.GetArtProvider()->GetMetric(wxAUI_ART_GRADIENT_TYPE) == wxAUI_GRADIENT_HORIZONTAL);
50acee04
JS
1094 break;
1095 case ID_AllowFloating:
87d658e5 1096 event.Check((flags & wxAUI_MGR_ALLOW_FLOATING) != 0);
50acee04
JS
1097 break;
1098 case ID_TransparentDrag:
87d658e5 1099 event.Check((flags & wxAUI_MGR_TRANSPARENT_DRAG) != 0);
50acee04
JS
1100 break;
1101 case ID_TransparentHint:
87d658e5 1102 event.Check((flags & wxAUI_MGR_TRANSPARENT_HINT) != 0);
50acee04 1103 break;
cf6fec73
BW
1104 case ID_VenetianBlindsHint:
1105 event.Check((flags & wxAUI_MGR_VENETIAN_BLINDS_HINT) != 0);
1106 break;
1107 case ID_RectangleHint:
1108 event.Check((flags & wxAUI_MGR_RECTANGLE_HINT) != 0);
50acee04 1109 break;
cf6fec73
BW
1110 case ID_NoHint:
1111 event.Check(((wxAUI_MGR_TRANSPARENT_HINT |
1112 wxAUI_MGR_VENETIAN_BLINDS_HINT |
1113 wxAUI_MGR_RECTANGLE_HINT) & flags) == 0);
1114 break;
1115 case ID_HintFade:
1116 event.Check((flags & wxAUI_MGR_HINT_FADE) != 0);
70476471 1117 break;
cf6fec73
BW
1118 case ID_NoVenetianFade:
1119 event.Check((flags & wxAUI_MGR_NO_VENETIAN_BLINDS_FADE) != 0);
70476471 1120 break;
c50fa29f 1121
931483d7
BW
1122 case ID_NotebookNoCloseButton:
1123 event.Check((m_notebook_style & (wxAUI_NB_CLOSE_BUTTON|wxAUI_NB_CLOSE_ON_ALL_TABS|wxAUI_NB_CLOSE_ON_ACTIVE_TAB)) != 0);
1124 break;
c50fa29f
BW
1125 case ID_NotebookCloseButton:
1126 event.Check((m_notebook_style & wxAUI_NB_CLOSE_BUTTON) != 0);
1127 break;
1128 case ID_NotebookCloseButtonAll:
1129 event.Check((m_notebook_style & wxAUI_NB_CLOSE_ON_ALL_TABS) != 0);
1130 break;
1131 case ID_NotebookCloseButtonActive:
1132 event.Check((m_notebook_style & wxAUI_NB_CLOSE_ON_ACTIVE_TAB) != 0);
1133 break;
51100f50
BW
1134 case ID_NotebookAllowTabSplit:
1135 event.Check((m_notebook_style & wxAUI_NB_TAB_SPLIT) != 0);
1136 break;
1137 case ID_NotebookAllowTabMove:
1138 event.Check((m_notebook_style & wxAUI_NB_TAB_MOVE) != 0);
1139 break;
01372b8f
BW
1140 case ID_NotebookScrollButtons:
1141 event.Check((m_notebook_style & wxAUI_NB_SCROLL_BUTTONS) != 0);
1142 break;
1143 case ID_NotebookWindowList:
1144 event.Check((m_notebook_style & wxAUI_NB_WINDOWLIST_BUTTON) != 0);
1145 break;
50acee04
JS
1146 }
1147}
1148
a3a5df9d 1149void MyFrame::OnPaneClose(wxAuiManagerEvent& evt)
58754643
BW
1150{
1151 if (evt.pane->name == wxT("test10"))
1152 {
1153 int res = wxMessageBox(wxT("Are you sure you want to close/hide this pane?"),
1154 wxT("wxAUI"),
1155 wxYES_NO,
1156 this);
1157 if (res != wxYES)
1158 evt.Veto();
1159 }
1160}
1161
bfeed34c 1162void MyFrame::OnCreatePerspective(wxCommandEvent& WXUNUSED(event))
50acee04
JS
1163{
1164 wxTextEntryDialog dlg(this, wxT("Enter a name for the new perspective:"),
1165 wxT("wxAUI Test"));
bfeed34c 1166
b143cf70 1167 dlg.SetValue(wxString::Format(wxT("Perspective %u"), unsigned(m_perspectives.GetCount() + 1)));
50acee04
JS
1168 if (dlg.ShowModal() != wxID_OK)
1169 return;
bfeed34c 1170
50acee04
JS
1171 if (m_perspectives.GetCount() == 0)
1172 {
1173 m_perspectives_menu->AppendSeparator();
1174 }
bfeed34c 1175
50acee04
JS
1176 m_perspectives_menu->Append(ID_FirstPerspective + m_perspectives.GetCount(), dlg.GetValue());
1177 m_perspectives.Add(m_mgr.SavePerspective());
1178}
1179
bfeed34c 1180void MyFrame::OnCopyPerspectiveCode(wxCommandEvent& WXUNUSED(event))
50acee04
JS
1181{
1182 wxString s = m_mgr.SavePerspective();
bfeed34c 1183
b2e17848 1184#if wxUSE_CLIPBOARD
50acee04
JS
1185 if (wxTheClipboard->Open())
1186 {
1187 wxTheClipboard->SetData(new wxTextDataObject(s));
1188 wxTheClipboard->Close();
1189 }
b2e17848 1190#endif
50acee04
JS
1191}
1192
1193void MyFrame::OnRestorePerspective(wxCommandEvent& event)
1194{
1195 m_mgr.LoadPerspective(m_perspectives.Item(event.GetId() - ID_FirstPerspective));
1196}
1197
1198
1199wxPoint MyFrame::GetStartPosition()
1200{
1201 static int x = 0;
1202 x += 20;
1203 wxPoint pt = ClientToScreen(wxPoint(0,0));
1204 return wxPoint(pt.x + x, pt.y + x);
1205}
1206
bfeed34c 1207void MyFrame::OnCreateTree(wxCommandEvent& WXUNUSED(event))
50acee04 1208{
a3a5df9d 1209 m_mgr.AddPane(CreateTreeCtrl(), wxAuiPaneInfo().
50acee04
JS
1210 Name(wxT("Test")).Caption(wxT("Tree Control")).
1211 Float().FloatingPosition(GetStartPosition()).
1212 FloatingSize(wxSize(150,300)));
1213 m_mgr.Update();
1214}
1215
bfeed34c 1216void MyFrame::OnCreateGrid(wxCommandEvent& WXUNUSED(event))
50acee04 1217{
a3a5df9d 1218 m_mgr.AddPane(CreateGrid(), wxAuiPaneInfo().
50acee04
JS
1219 Name(wxT("Test")).Caption(wxT("Grid")).
1220 Float().FloatingPosition(GetStartPosition()).
1221 FloatingSize(wxSize(300,200)));
1222 m_mgr.Update();
1223}
1224
bfeed34c 1225void MyFrame::OnCreateHTML(wxCommandEvent& WXUNUSED(event))
50acee04 1226{
a3a5df9d 1227 m_mgr.AddPane(CreateHTMLCtrl(), wxAuiPaneInfo().
87d658e5 1228 Name(wxT("Test")).Caption(wxT("HTML Control")).
50acee04
JS
1229 Float().FloatingPosition(GetStartPosition()).
1230 FloatingSize(wxSize(300,200)));
1231 m_mgr.Update();
1232}
1233
df00bdf7
RR
1234void MyFrame::OnCreateNotebook(wxCommandEvent& WXUNUSED(event))
1235{
a3a5df9d 1236 m_mgr.AddPane(CreateNotebook(), wxAuiPaneInfo().
df00bdf7
RR
1237 Name(wxT("Test")).Caption(wxT("Notebook")).
1238 Float().FloatingPosition(GetStartPosition()).
8bfde0a8
BW
1239 //FloatingSize(300,200).
1240 CloseButton(true).MaximizeButton(true));
df00bdf7
RR
1241 m_mgr.Update();
1242}
1243
bfeed34c 1244void MyFrame::OnCreateText(wxCommandEvent& WXUNUSED(event))
50acee04 1245{
a3a5df9d 1246 m_mgr.AddPane(CreateTextCtrl(), wxAuiPaneInfo().
50acee04
JS
1247 Name(wxT("Test")).Caption(wxT("Text Control")).
1248 Float().FloatingPosition(GetStartPosition()));
1249 m_mgr.Update();
1250}
1251
bfeed34c 1252void MyFrame::OnCreateSizeReport(wxCommandEvent& WXUNUSED(event))
50acee04 1253{
a3a5df9d 1254 m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().
50acee04 1255 Name(wxT("Test")).Caption(wxT("Client Size Reporter")).
37106ab2
BW
1256 Float().FloatingPosition(GetStartPosition()).
1257 PinButton(true).CloseButton(true).MaximizeButton(true));
50acee04
JS
1258 m_mgr.Update();
1259}
1260
1261void MyFrame::OnChangeContentPane(wxCommandEvent& event)
1262{
87d658e5
PC
1263 m_mgr.GetPane(wxT("grid_content")).Show(event.GetId() == ID_GridContent);
1264 m_mgr.GetPane(wxT("text_content")).Show(event.GetId() == ID_TextContent);
1265 m_mgr.GetPane(wxT("tree_content")).Show(event.GetId() == ID_TreeContent);
1266 m_mgr.GetPane(wxT("sizereport_content")).Show(event.GetId() == ID_SizeReportContent);
1267 m_mgr.GetPane(wxT("html_content")).Show(event.GetId() == ID_HTMLContent);
1268 m_mgr.GetPane(wxT("notebook_content")).Show(event.GetId() == ID_NotebookContent);
50acee04
JS
1269 m_mgr.Update();
1270}
1271
1272void MyFrame::OnExit(wxCommandEvent& WXUNUSED(event))
1273{
1274 Close(true);
1275}
1276
1277void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
1278{
1279 wxMessageBox(_("wxAUI Demo\nAn advanced window management library for wxWidgets\n(c) Copyright 2005-2006, Kirix Corporation"), _("About wxAUI Demo"), wxOK, this);
1280}
1281
58754643 1282wxTextCtrl* MyFrame::CreateTextCtrl(const wxString& ctrl_text)
50acee04 1283{
50acee04
JS
1284 static int n = 0;
1285
58754643
BW
1286 wxString text;
1287 if (ctrl_text.Length() > 0)
1288 text = ctrl_text;
87d658e5 1289 else
58754643 1290 text.Printf(wxT("This is text box %d"), ++n);
50acee04 1291
bfeed34c 1292 return new wxTextCtrl(this,wxID_ANY, text,
50acee04
JS
1293 wxPoint(0,0), wxSize(150,90),
1294 wxNO_BORDER | wxTE_MULTILINE);
1295}
1296
1297
1298wxGrid* MyFrame::CreateGrid()
1299{
bfeed34c 1300 wxGrid* grid = new wxGrid(this, wxID_ANY,
50acee04
JS
1301 wxPoint(0,0),
1302 wxSize(150,250),
1303 wxNO_BORDER | wxWANTS_CHARS);
1304 grid->CreateGrid(50, 20);
1305 return grid;
1306}
1307
1308wxTreeCtrl* MyFrame::CreateTreeCtrl()
1309{
bfeed34c 1310 wxTreeCtrl* tree = new wxTreeCtrl(this, wxID_ANY,
50acee04
JS
1311 wxPoint(0,0), wxSize(160,250),
1312 wxTR_DEFAULT_STYLE | wxNO_BORDER);
bfeed34c 1313
50acee04
JS
1314 wxTreeItemId root = tree->AddRoot(wxT("wxAUI Project"));
1315 wxArrayTreeItemIds items;
1316
1317
1318 wxImageList* imglist = new wxImageList(16, 16, true, 2);
1319 imglist->Add(wxArtProvider::GetBitmap(wxART_FOLDER, wxART_OTHER, wxSize(16,16)));
1320 imglist->Add(wxArtProvider::GetBitmap(wxART_NORMAL_FILE, wxART_OTHER, wxSize(16,16)));
1321 tree->AssignImageList(imglist);
1322
1323 items.Add(tree->AppendItem(root, wxT("Item 1"), 0));
1324 items.Add(tree->AppendItem(root, wxT("Item 2"), 0));
1325 items.Add(tree->AppendItem(root, wxT("Item 3"), 0));
1326 items.Add(tree->AppendItem(root, wxT("Item 4"), 0));
1327 items.Add(tree->AppendItem(root, wxT("Item 5"), 0));
1328
bfeed34c 1329
50acee04
JS
1330 int i, count;
1331 for (i = 0, count = items.Count(); i < count; ++i)
1332 {
1333 wxTreeItemId id = items.Item(i);
1334 tree->AppendItem(id, wxT("Subitem 1"), 1);
1335 tree->AppendItem(id, wxT("Subitem 2"), 1);
1336 tree->AppendItem(id, wxT("Subitem 3"), 1);
1337 tree->AppendItem(id, wxT("Subitem 4"), 1);
1338 tree->AppendItem(id, wxT("Subitem 5"), 1);
1339 }
1340
1341
1342 tree->Expand(root);
1343
1344 return tree;
1345}
1346
1347wxSizeReportCtrl* MyFrame::CreateSizeReportCtrl(int width, int height)
1348{
bfeed34c 1349 wxSizeReportCtrl* ctrl = new wxSizeReportCtrl(this, wxID_ANY,
50acee04
JS
1350 wxDefaultPosition,
1351 wxSize(width, height), &m_mgr);
1352 return ctrl;
1353}
1354
dbd2f790 1355wxHtmlWindow* MyFrame::CreateHTMLCtrl(wxWindow* parent)
50acee04 1356{
dbd2f790
BW
1357 if (!parent)
1358 parent = this;
1359
1360 wxHtmlWindow* ctrl = new wxHtmlWindow(parent, wxID_ANY,
50acee04
JS
1361 wxDefaultPosition,
1362 wxSize(400,300));
1363 ctrl->SetPage(GetIntroText());
1364 return ctrl;
1365}
1366
a3a5df9d 1367wxAuiNotebook* MyFrame::CreateNotebook()
df00bdf7 1368{
8bfde0a8
BW
1369 // create the notebook off-window to avoid flicker
1370 wxSize client_size = GetClientSize();
1371
1372 wxAuiNotebook* ctrl = new wxAuiNotebook(this, wxID_ANY,
1373 wxPoint(client_size.x, client_size.y),
1374 wxSize(430,200),
1375 m_notebook_style);
df00bdf7 1376
dbd2f790
BW
1377 ctrl->AddPage(CreateHTMLCtrl(ctrl), wxT("Welcome"));
1378
df00bdf7
RR
1379 wxPanel *panel = new wxPanel( ctrl, wxID_ANY );
1380 wxFlexGridSizer *flex = new wxFlexGridSizer( 2 );
1381 flex->AddGrowableRow( 0 );
1382 flex->AddGrowableRow( 3 );
1383 flex->AddGrowableCol( 1 );
1384 flex->Add( 5,5 ); flex->Add( 5,5 );
1385 flex->Add( new wxStaticText( panel, -1, wxT("wxTextCtrl:") ), 0, wxALL|wxALIGN_CENTRE, 5 );
2e5c35af 1386 flex->Add( new wxTextCtrl( panel, -1, wxT(""), wxDefaultPosition, wxSize(100,-1)),
df00bdf7
RR
1387 1, wxALL|wxALIGN_CENTRE, 5 );
1388 flex->Add( new wxStaticText( panel, -1, wxT("wxSpinCtrl:") ), 0, wxALL|wxALIGN_CENTRE, 5 );
1389 flex->Add( new wxSpinCtrl( panel, -1, wxT("5"), wxDefaultPosition, wxSize(100,-1),
1390 wxSP_ARROW_KEYS, 5, 50, 5 ), 0, wxALL|wxALIGN_CENTRE, 5 );
1391 flex->Add( 5,5 ); flex->Add( 5,5 );
1392 panel->SetSizer( flex );
1393 ctrl->AddPage( panel, wxT("wxPanel") );
1394
1395 ctrl->AddPage( new wxTextCtrl( ctrl, wxID_ANY, wxT("Some text"),
4953f8cf 1396 wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , wxT("wxTextCtrl 1") );
df00bdf7
RR
1397
1398 ctrl->AddPage( new wxTextCtrl( ctrl, wxID_ANY, wxT("Some more text"),
4953f8cf
BW
1399 wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , wxT("wxTextCtrl 2") );
1400
1401 ctrl->AddPage( new wxTextCtrl( ctrl, wxID_ANY, wxT("Some more text"),
1402 wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , wxT("wxTextCtrl 3") );
1403
1404 ctrl->AddPage( new wxTextCtrl( ctrl, wxID_ANY, wxT("Some more text"),
1405 wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , wxT("wxTextCtrl 4") );
1406
1407 ctrl->AddPage( new wxTextCtrl( ctrl, wxID_ANY, wxT("Some more text"),
1408 wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , wxT("wxTextCtrl 5") );
df00bdf7 1409
4953f8cf
BW
1410 ctrl->AddPage( new wxTextCtrl( ctrl, wxID_ANY, wxT("Some more text"),
1411 wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , wxT("wxTextCtrl 6") );
1412
1413 ctrl->AddPage( new wxTextCtrl( ctrl, wxID_ANY, wxT("Some more text"),
1414 wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , wxT("wxTextCtrl 7") );
1415
1416 ctrl->AddPage( new wxTextCtrl( ctrl, wxID_ANY, wxT("Some more text"),
1417 wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , wxT("wxTextCtrl 8") );
1418
df00bdf7
RR
1419 return ctrl;
1420}
50acee04
JS
1421
1422wxString MyFrame::GetIntroText()
1423{
1424 const char* text =
1425 "<html><body>"
70476471 1426 "<h3>Welcome to wxAUI</h3>"
50acee04
JS
1427 "<br/><b>Overview</b><br/>"
1428 "<p>wxAUI is an Advanced User Interface library for the wxWidgets toolkit "
1429 "that allows developers to create high-quality, cross-platform user "
1430 "interfaces quickly and easily.</p>"
1431 "<p><b>Features</b></p>"
70476471 1432 "<p>With wxAUI, developers can create application frameworks with:</p>"
50acee04
JS
1433 "<ul>"
1434 "<li>Native, dockable floating frames</li>"
1435 "<li>Perspective saving and loading</li>"
1436 "<li>Native toolbars incorporating real-time, &quot;spring-loaded&quot; dragging</li>"
1437 "<li>Customizable floating/docking behavior</li>"
1438 "<li>Completely customizable look-and-feel</li>"
1439 "<li>Optional transparent window effects (while dragging or docking)</li>"
1440 "</ul>"
1441 "<p><b>What's new in 0.9.2?</b></p>"
1442 "<p>The following features/fixes have been added since the last version of wxAUI:</p>"
1443 "<ul>"
1444 "<li>Support for wxMac</li>"
1445 "<li>Updates for wxWidgets 2.6.3</li>"
1446 "<li>Fix to pass more unused events through</li>"
1447 "<li>Fix to allow floating windows to receive idle events</li>"
1448 "<li>Fix for minimizing/maximizing problem with transparent hint pane</li>"
1449 "<li>Fix to not paint empty hint rectangles</li>"
1450 "<li>Fix for 64-bit compilation</li>"
1451 "</ul>"
1452 "<p><b>What changed in 0.9.1?</b></p>"
1453 "<p>The following features/fixes were added in wxAUI 0.9.1:</p>"
1454 "<ul>"
1455 "<li>Support for MDI frames</li>"
1456 "<li>Gradient captions option</li>"
1457 "<li>Active/Inactive panes option</li>"
1458 "<li>Fix for screen artifacts/paint problems</li>"
1459 "<li>Fix for hiding/showing floated window problem</li>"
1460 "<li>Fix for floating pane sizing problem</li>"
1461 "<li>Fix for drop position problem when dragging around center pane margins</li>"
1462 "<li>LF-only text file formatting for source code</li>"
1463 "</ul>"
1464 "<p>See README.txt for more information.</p>"
1465 "</body></html>";
1466
1467 return wxString::FromAscii(text);
1468}