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