1 ///////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxaui: wx advanced user interface - sample/test program
4 // Author: Benjamin I. Williams
8 // Copyright: (C) Copyright 2005, Kirix Corporation, All Rights Reserved.
9 // Licence: wxWindows Library Licence, Version 3.1
10 ///////////////////////////////////////////////////////////////////////////////
12 // For compilers that support precompilation, includes "wx/wx.h".
13 #include "wx/wxprec.h"
21 #include "wx/treectrl.h"
22 #include "wx/spinctrl.h"
23 #include "wx/artprov.h"
24 #include "wx/clipbrd.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"
33 #include "wx/toolbar.h"
34 #include "wx/statusbr.h"
35 #include "wx/msgdlg.h"
36 #include "wx/textdlg.h"
38 #include "wx/aui/aui.h"
39 #include "../sample.xpm"
43 class MyApp
: public wxApp
53 class wxSizeReportCtrl
;
57 class MyFrame
: public wxFrame
61 ID_CreateTree
= wxID_HIGHEST
+1,
74 ID_CopyPerspectiveCode
,
78 ID_VenetianBlindsHint
,
86 ID_HorizontalGradient
,
90 ID_DropDownToolbarItem
,
91 ID_NotebookNoCloseButton
,
92 ID_NotebookCloseButton
,
93 ID_NotebookCloseButtonAll
,
94 ID_NotebookCloseButtonActive
,
95 ID_NotebookAllowTabMove
,
96 ID_NotebookAllowTabExternalMove
,
97 ID_NotebookAllowTabSplit
,
98 ID_NotebookWindowList
,
99 ID_NotebookScrollButtons
,
100 ID_NotebookTabFixedWidth
,
102 ID_NotebookArtSimple
,
104 ID_NotebookAlignBottom
,
108 ID_FirstPerspective
= ID_CreatePerspective
+1000
112 MyFrame(wxWindow
* parent
,
114 const wxString
& title
,
115 const wxPoint
& pos
= wxDefaultPosition
,
116 const wxSize
& size
= wxDefaultSize
,
117 long style
= wxDEFAULT_FRAME_STYLE
| wxSUNKEN_BORDER
);
121 wxAuiDockArt
* GetDockArt();
125 wxTextCtrl
* CreateTextCtrl(const wxString
& text
= wxEmptyString
);
126 wxGrid
* CreateGrid();
127 wxTreeCtrl
* CreateTreeCtrl();
128 wxSizeReportCtrl
* CreateSizeReportCtrl(int width
= 80, int height
= 80);
129 wxPoint
GetStartPosition();
130 wxHtmlWindow
* CreateHTMLCtrl(wxWindow
* parent
= NULL
);
131 wxAuiNotebook
* CreateNotebook();
133 wxString
GetIntroText();
137 void OnEraseBackground(wxEraseEvent
& evt
);
138 void OnSize(wxSizeEvent
& evt
);
140 void OnCreateTree(wxCommandEvent
& evt
);
141 void OnCreateGrid(wxCommandEvent
& evt
);
142 void OnCreateHTML(wxCommandEvent
& evt
);
143 void OnCreateNotebook(wxCommandEvent
& evt
);
144 void OnCreateText(wxCommandEvent
& evt
);
145 void OnCreateSizeReport(wxCommandEvent
& evt
);
146 void OnChangeContentPane(wxCommandEvent
& evt
);
147 void OnDropDownToolbarItem(wxAuiToolBarEvent
& evt
);
148 void OnCreatePerspective(wxCommandEvent
& evt
);
149 void OnCopyPerspectiveCode(wxCommandEvent
& evt
);
150 void OnRestorePerspective(wxCommandEvent
& evt
);
151 void OnSettings(wxCommandEvent
& evt
);
152 void OnCustomizeToolbar(wxCommandEvent
& evt
);
153 void OnAllowNotebookDnD(wxAuiNotebookEvent
& evt
);
154 void OnNotebookPageClose(wxAuiNotebookEvent
& evt
);
155 void OnNotebookPageClosed(wxAuiNotebookEvent
& evt
);
156 void OnExit(wxCommandEvent
& evt
);
157 void OnAbout(wxCommandEvent
& evt
);
158 void OnTabAlignment(wxCommandEvent
&evt
);
160 void OnGradient(wxCommandEvent
& evt
);
161 void OnManagerFlag(wxCommandEvent
& evt
);
162 void OnNotebookFlag(wxCommandEvent
& evt
);
163 void OnUpdateUI(wxUpdateUIEvent
& evt
);
165 void OnPaneClose(wxAuiManagerEvent
& evt
);
170 wxArrayString m_perspectives
;
171 wxMenu
* m_perspectives_menu
;
172 long m_notebook_style
;
173 long m_notebook_theme
;
175 DECLARE_EVENT_TABLE()
179 // -- wxSizeReportCtrl --
180 // (a utility control that always reports it's client size)
182 class wxSizeReportCtrl
: public wxControl
186 wxSizeReportCtrl(wxWindow
* parent
, wxWindowID id
= wxID_ANY
,
187 const wxPoint
& pos
= wxDefaultPosition
,
188 const wxSize
& size
= wxDefaultSize
,
189 wxAuiManager
* mgr
= NULL
)
190 : wxControl(parent
, id
, pos
, size
, wxNO_BORDER
)
197 void OnPaint(wxPaintEvent
& WXUNUSED(evt
))
200 wxSize size
= GetClientSize();
204 s
.Printf(wxT("Size: %d x %d"), size
.x
, size
.y
);
206 dc
.SetFont(*wxNORMAL_FONT
);
207 dc
.GetTextExtent(s
, &w
, &height
);
209 dc
.SetBrush(*wxWHITE_BRUSH
);
210 dc
.SetPen(*wxWHITE_PEN
);
211 dc
.DrawRectangle(0, 0, size
.x
, size
.y
);
212 dc
.SetPen(*wxLIGHT_GREY_PEN
);
213 dc
.DrawLine(0, 0, size
.x
, size
.y
);
214 dc
.DrawLine(0, size
.y
, size
.x
, 0);
215 dc
.DrawText(s
, (size
.x
-w
)/2, ((size
.y
-(height
*5))/2));
219 wxAuiPaneInfo pi
= m_mgr
->GetPane(this);
221 s
.Printf(wxT("Layer: %d"), pi
.dock_layer
);
222 dc
.GetTextExtent(s
, &w
, &h
);
223 dc
.DrawText(s
, (size
.x
-w
)/2, ((size
.y
-(height
*5))/2)+(height
*1));
225 s
.Printf(wxT("Dock: %d Row: %d"), pi
.dock_direction
, pi
.dock_row
);
226 dc
.GetTextExtent(s
, &w
, &h
);
227 dc
.DrawText(s
, (size
.x
-w
)/2, ((size
.y
-(height
*5))/2)+(height
*2));
229 s
.Printf(wxT("Position: %d"), pi
.dock_pos
);
230 dc
.GetTextExtent(s
, &w
, &h
);
231 dc
.DrawText(s
, (size
.x
-w
)/2, ((size
.y
-(height
*5))/2)+(height
*3));
233 s
.Printf(wxT("Proportion: %d"), pi
.dock_proportion
);
234 dc
.GetTextExtent(s
, &w
, &h
);
235 dc
.DrawText(s
, (size
.x
-w
)/2, ((size
.y
-(height
*5))/2)+(height
*4));
239 void OnEraseBackground(wxEraseEvent
& WXUNUSED(evt
))
241 // intentionally empty
244 void OnSize(wxSizeEvent
& WXUNUSED(evt
))
252 DECLARE_EVENT_TABLE()
255 BEGIN_EVENT_TABLE(wxSizeReportCtrl
, wxControl
)
256 EVT_PAINT(wxSizeReportCtrl::OnPaint
)
257 EVT_SIZE(wxSizeReportCtrl::OnSize
)
258 EVT_ERASE_BACKGROUND(wxSizeReportCtrl::OnEraseBackground
)
262 class SettingsPanel
: public wxPanel
266 ID_PaneBorderSize
= wxID_HIGHEST
+1,
271 ID_InactiveCaptionColor
,
272 ID_InactiveCaptionGradientColor
,
273 ID_InactiveCaptionTextColor
,
274 ID_ActiveCaptionColor
,
275 ID_ActiveCaptionGradientColor
,
276 ID_ActiveCaptionTextColor
,
283 SettingsPanel(wxWindow
* parent
, MyFrame
* frame
)
284 : wxPanel(parent
, wxID_ANY
, wxDefaultPosition
, wxDefaultSize
),
287 //wxBoxSizer* vert = new wxBoxSizer(wxVERTICAL);
289 //vert->Add(1, 1, 1, wxEXPAND);
291 wxBoxSizer
* s1
= new wxBoxSizer(wxHORIZONTAL
);
292 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
));
293 s1
->Add(1, 1, 1, wxEXPAND
);
294 s1
->Add(new wxStaticText(this, wxID_ANY
, wxT("Pane Border Size:")));
295 s1
->Add(m_border_size
);
296 s1
->Add(1, 1, 1, wxEXPAND
);
297 s1
->SetItemMinSize((size_t)1, 180, 20);
298 //vert->Add(s1, 0, wxEXPAND | wxLEFT | wxBOTTOM, 5);
300 wxBoxSizer
* s2
= new wxBoxSizer(wxHORIZONTAL
);
301 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
));
302 s2
->Add(1, 1, 1, wxEXPAND
);
303 s2
->Add(new wxStaticText(this, wxID_ANY
, wxT("Sash Size:")));
304 s2
->Add(m_sash_size
);
305 s2
->Add(1, 1, 1, wxEXPAND
);
306 s2
->SetItemMinSize((size_t)1, 180, 20);
307 //vert->Add(s2, 0, wxEXPAND | wxLEFT | wxBOTTOM, 5);
309 wxBoxSizer
* s3
= new wxBoxSizer(wxHORIZONTAL
);
310 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
));
311 s3
->Add(1, 1, 1, wxEXPAND
);
312 s3
->Add(new wxStaticText(this, wxID_ANY
, wxT("Caption Size:")));
313 s3
->Add(m_caption_size
);
314 s3
->Add(1, 1, 1, wxEXPAND
);
315 s3
->SetItemMinSize((size_t)1, 180, 20);
316 //vert->Add(s3, 0, wxEXPAND | wxLEFT | wxBOTTOM, 5);
318 //vert->Add(1, 1, 1, wxEXPAND);
321 wxBitmap b
= CreateColorBitmap(*wxBLACK
);
323 wxBoxSizer
* s4
= new wxBoxSizer(wxHORIZONTAL
);
324 m_background_color
= new wxBitmapButton(this, ID_BackgroundColor
, b
, wxDefaultPosition
, wxSize(50,25));
325 s4
->Add(1, 1, 1, wxEXPAND
);
326 s4
->Add(new wxStaticText(this, wxID_ANY
, wxT("Background Color:")));
327 s4
->Add(m_background_color
);
328 s4
->Add(1, 1, 1, wxEXPAND
);
329 s4
->SetItemMinSize((size_t)1, 180, 20);
331 wxBoxSizer
* s5
= new wxBoxSizer(wxHORIZONTAL
);
332 m_sash_color
= new wxBitmapButton(this, ID_SashColor
, b
, wxDefaultPosition
, wxSize(50,25));
333 s5
->Add(1, 1, 1, wxEXPAND
);
334 s5
->Add(new wxStaticText(this, wxID_ANY
, wxT("Sash Color:")));
335 s5
->Add(m_sash_color
);
336 s5
->Add(1, 1, 1, wxEXPAND
);
337 s5
->SetItemMinSize((size_t)1, 180, 20);
339 wxBoxSizer
* s6
= new wxBoxSizer(wxHORIZONTAL
);
340 m_inactive_caption_color
= new wxBitmapButton(this, ID_InactiveCaptionColor
, b
, wxDefaultPosition
, wxSize(50,25));
341 s6
->Add(1, 1, 1, wxEXPAND
);
342 s6
->Add(new wxStaticText(this, wxID_ANY
, wxT("Normal Caption:")));
343 s6
->Add(m_inactive_caption_color
);
344 s6
->Add(1, 1, 1, wxEXPAND
);
345 s6
->SetItemMinSize((size_t)1, 180, 20);
347 wxBoxSizer
* s7
= new wxBoxSizer(wxHORIZONTAL
);
348 m_inactive_caption_gradient_color
= new wxBitmapButton(this, ID_InactiveCaptionGradientColor
, b
, wxDefaultPosition
, wxSize(50,25));
349 s7
->Add(1, 1, 1, wxEXPAND
);
350 s7
->Add(new wxStaticText(this, wxID_ANY
, wxT("Normal Caption Gradient:")));
351 s7
->Add(m_inactive_caption_gradient_color
);
352 s7
->Add(1, 1, 1, wxEXPAND
);
353 s7
->SetItemMinSize((size_t)1, 180, 20);
355 wxBoxSizer
* s8
= new wxBoxSizer(wxHORIZONTAL
);
356 m_inactive_caption_text_color
= new wxBitmapButton(this, ID_InactiveCaptionTextColor
, b
, wxDefaultPosition
, wxSize(50,25));
357 s8
->Add(1, 1, 1, wxEXPAND
);
358 s8
->Add(new wxStaticText(this, wxID_ANY
, wxT("Normal Caption Text:")));
359 s8
->Add(m_inactive_caption_text_color
);
360 s8
->Add(1, 1, 1, wxEXPAND
);
361 s8
->SetItemMinSize((size_t)1, 180, 20);
363 wxBoxSizer
* s9
= new wxBoxSizer(wxHORIZONTAL
);
364 m_active_caption_color
= new wxBitmapButton(this, ID_ActiveCaptionColor
, b
, wxDefaultPosition
, wxSize(50,25));
365 s9
->Add(1, 1, 1, wxEXPAND
);
366 s9
->Add(new wxStaticText(this, wxID_ANY
, wxT("Active Caption:")));
367 s9
->Add(m_active_caption_color
);
368 s9
->Add(1, 1, 1, wxEXPAND
);
369 s9
->SetItemMinSize((size_t)1, 180, 20);
371 wxBoxSizer
* s10
= new wxBoxSizer(wxHORIZONTAL
);
372 m_active_caption_gradient_color
= new wxBitmapButton(this, ID_ActiveCaptionGradientColor
, b
, wxDefaultPosition
, wxSize(50,25));
373 s10
->Add(1, 1, 1, wxEXPAND
);
374 s10
->Add(new wxStaticText(this, wxID_ANY
, wxT("Active Caption Gradient:")));
375 s10
->Add(m_active_caption_gradient_color
);
376 s10
->Add(1, 1, 1, wxEXPAND
);
377 s10
->SetItemMinSize((size_t)1, 180, 20);
379 wxBoxSizer
* s11
= new wxBoxSizer(wxHORIZONTAL
);
380 m_active_caption_text_color
= new wxBitmapButton(this, ID_ActiveCaptionTextColor
, b
, wxDefaultPosition
, wxSize(50,25));
381 s11
->Add(1, 1, 1, wxEXPAND
);
382 s11
->Add(new wxStaticText(this, wxID_ANY
, wxT("Active Caption Text:")));
383 s11
->Add(m_active_caption_text_color
);
384 s11
->Add(1, 1, 1, wxEXPAND
);
385 s11
->SetItemMinSize((size_t)1, 180, 20);
387 wxBoxSizer
* s12
= new wxBoxSizer(wxHORIZONTAL
);
388 m_border_color
= new wxBitmapButton(this, ID_BorderColor
, b
, wxDefaultPosition
, wxSize(50,25));
389 s12
->Add(1, 1, 1, wxEXPAND
);
390 s12
->Add(new wxStaticText(this, wxID_ANY
, wxT("Border Color:")));
391 s12
->Add(m_border_color
);
392 s12
->Add(1, 1, 1, wxEXPAND
);
393 s12
->SetItemMinSize((size_t)1, 180, 20);
395 wxBoxSizer
* s13
= new wxBoxSizer(wxHORIZONTAL
);
396 m_gripper_color
= new wxBitmapButton(this, ID_GripperColor
, b
, wxDefaultPosition
, wxSize(50,25));
397 s13
->Add(1, 1, 1, wxEXPAND
);
398 s13
->Add(new wxStaticText(this, wxID_ANY
, wxT("Gripper Color:")));
399 s13
->Add(m_gripper_color
);
400 s13
->Add(1, 1, 1, wxEXPAND
);
401 s13
->SetItemMinSize((size_t)1, 180, 20);
403 wxGridSizer
* grid_sizer
= new wxGridSizer(2);
404 grid_sizer
->SetHGap(5);
405 grid_sizer
->Add(s1
); grid_sizer
->Add(s4
);
406 grid_sizer
->Add(s2
); grid_sizer
->Add(s5
);
407 grid_sizer
->Add(s3
); grid_sizer
->Add(s13
);
408 grid_sizer
->Add(1,1); grid_sizer
->Add(s12
);
409 grid_sizer
->Add(s6
); grid_sizer
->Add(s9
);
410 grid_sizer
->Add(s7
); grid_sizer
->Add(s10
);
411 grid_sizer
->Add(s8
); grid_sizer
->Add(s11
);
413 wxBoxSizer
* cont_sizer
= new wxBoxSizer(wxVERTICAL
);
414 cont_sizer
->Add(grid_sizer
, 1, wxEXPAND
| wxALL
, 5);
415 SetSizer(cont_sizer
);
416 GetSizer()->SetSizeHints(this);
418 m_border_size
->SetValue(frame
->GetDockArt()->GetMetric(wxAUI_DOCKART_PANE_BORDER_SIZE
));
419 m_sash_size
->SetValue(frame
->GetDockArt()->GetMetric(wxAUI_DOCKART_SASH_SIZE
));
420 m_caption_size
->SetValue(frame
->GetDockArt()->GetMetric(wxAUI_DOCKART_CAPTION_SIZE
));
427 wxBitmap
CreateColorBitmap(const wxColour
& c
)
431 for (int x
= 0; x
< 25; ++x
)
432 for (int y
= 0; y
< 14; ++y
)
435 if (x
== 0 || x
== 24 || y
== 0 || y
== 13)
437 image
.SetRGB(x
, y
, pixcol
.Red(), pixcol
.Green(), pixcol
.Blue());
439 return wxBitmap(image
);
444 wxColour bk
= m_frame
->GetDockArt()->GetColor(wxAUI_DOCKART_BACKGROUND_COLOUR
);
445 m_background_color
->SetBitmapLabel(CreateColorBitmap(bk
));
447 wxColour cap
= m_frame
->GetDockArt()->GetColor(wxAUI_DOCKART_INACTIVE_CAPTION_COLOUR
);
448 m_inactive_caption_color
->SetBitmapLabel(CreateColorBitmap(cap
));
450 wxColour capgrad
= m_frame
->GetDockArt()->GetColor(wxAUI_DOCKART_INACTIVE_CAPTION_GRADIENT_COLOUR
);
451 m_inactive_caption_gradient_color
->SetBitmapLabel(CreateColorBitmap(capgrad
));
453 wxColour captxt
= m_frame
->GetDockArt()->GetColor(wxAUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR
);
454 m_inactive_caption_text_color
->SetBitmapLabel(CreateColorBitmap(captxt
));
456 wxColour acap
= m_frame
->GetDockArt()->GetColor(wxAUI_DOCKART_ACTIVE_CAPTION_COLOUR
);
457 m_active_caption_color
->SetBitmapLabel(CreateColorBitmap(acap
));
459 wxColour acapgrad
= m_frame
->GetDockArt()->GetColor(wxAUI_DOCKART_ACTIVE_CAPTION_GRADIENT_COLOUR
);
460 m_active_caption_gradient_color
->SetBitmapLabel(CreateColorBitmap(acapgrad
));
462 wxColour acaptxt
= m_frame
->GetDockArt()->GetColor(wxAUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR
);
463 m_active_caption_text_color
->SetBitmapLabel(CreateColorBitmap(acaptxt
));
465 wxColour sash
= m_frame
->GetDockArt()->GetColor(wxAUI_DOCKART_SASH_COLOUR
);
466 m_sash_color
->SetBitmapLabel(CreateColorBitmap(sash
));
468 wxColour border
= m_frame
->GetDockArt()->GetColor(wxAUI_DOCKART_BORDER_COLOUR
);
469 m_border_color
->SetBitmapLabel(CreateColorBitmap(border
));
471 wxColour gripper
= m_frame
->GetDockArt()->GetColor(wxAUI_DOCKART_GRIPPER_COLOUR
);
472 m_gripper_color
->SetBitmapLabel(CreateColorBitmap(gripper
));
475 void OnPaneBorderSize(wxSpinEvent
& event
)
477 m_frame
->GetDockArt()->SetMetric(wxAUI_DOCKART_PANE_BORDER_SIZE
,
478 event
.GetPosition());
482 void OnSashSize(wxSpinEvent
& event
)
484 m_frame
->GetDockArt()->SetMetric(wxAUI_DOCKART_SASH_SIZE
,
485 event
.GetPosition());
489 void OnCaptionSize(wxSpinEvent
& event
)
491 m_frame
->GetDockArt()->SetMetric(wxAUI_DOCKART_CAPTION_SIZE
,
492 event
.GetPosition());
496 void OnSetColor(wxCommandEvent
& event
)
498 wxColourDialog
dlg(m_frame
);
499 dlg
.SetTitle(_("Color Picker"));
500 if (dlg
.ShowModal() != wxID_OK
)
504 switch (event
.GetId())
506 case ID_BackgroundColor
: var
= wxAUI_DOCKART_BACKGROUND_COLOUR
; break;
507 case ID_SashColor
: var
= wxAUI_DOCKART_SASH_COLOUR
; break;
508 case ID_InactiveCaptionColor
: var
= wxAUI_DOCKART_INACTIVE_CAPTION_COLOUR
; break;
509 case ID_InactiveCaptionGradientColor
: var
= wxAUI_DOCKART_INACTIVE_CAPTION_GRADIENT_COLOUR
; break;
510 case ID_InactiveCaptionTextColor
: var
= wxAUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR
; break;
511 case ID_ActiveCaptionColor
: var
= wxAUI_DOCKART_ACTIVE_CAPTION_COLOUR
; break;
512 case ID_ActiveCaptionGradientColor
: var
= wxAUI_DOCKART_ACTIVE_CAPTION_GRADIENT_COLOUR
; break;
513 case ID_ActiveCaptionTextColor
: var
= wxAUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR
; break;
514 case ID_BorderColor
: var
= wxAUI_DOCKART_BORDER_COLOUR
; break;
515 case ID_GripperColor
: var
= wxAUI_DOCKART_GRIPPER_COLOUR
; break;
519 m_frame
->GetDockArt()->SetColor(var
, dlg
.GetColourData().GetColour());
527 wxSpinCtrl
* m_border_size
;
528 wxSpinCtrl
* m_sash_size
;
529 wxSpinCtrl
* m_caption_size
;
530 wxBitmapButton
* m_inactive_caption_text_color
;
531 wxBitmapButton
* m_inactive_caption_gradient_color
;
532 wxBitmapButton
* m_inactive_caption_color
;
533 wxBitmapButton
* m_active_caption_text_color
;
534 wxBitmapButton
* m_active_caption_gradient_color
;
535 wxBitmapButton
* m_active_caption_color
;
536 wxBitmapButton
* m_sash_color
;
537 wxBitmapButton
* m_background_color
;
538 wxBitmapButton
* m_border_color
;
539 wxBitmapButton
* m_gripper_color
;
541 DECLARE_EVENT_TABLE()
544 BEGIN_EVENT_TABLE(SettingsPanel
, wxPanel
)
545 EVT_SPINCTRL(ID_PaneBorderSize
, SettingsPanel::OnPaneBorderSize
)
546 EVT_SPINCTRL(ID_SashSize
, SettingsPanel::OnSashSize
)
547 EVT_SPINCTRL(ID_CaptionSize
, SettingsPanel::OnCaptionSize
)
548 EVT_BUTTON(ID_BackgroundColor
, SettingsPanel::OnSetColor
)
549 EVT_BUTTON(ID_SashColor
, SettingsPanel::OnSetColor
)
550 EVT_BUTTON(ID_InactiveCaptionColor
, SettingsPanel::OnSetColor
)
551 EVT_BUTTON(ID_InactiveCaptionGradientColor
, SettingsPanel::OnSetColor
)
552 EVT_BUTTON(ID_InactiveCaptionTextColor
, SettingsPanel::OnSetColor
)
553 EVT_BUTTON(ID_ActiveCaptionColor
, SettingsPanel::OnSetColor
)
554 EVT_BUTTON(ID_ActiveCaptionGradientColor
, SettingsPanel::OnSetColor
)
555 EVT_BUTTON(ID_ActiveCaptionTextColor
, SettingsPanel::OnSetColor
)
556 EVT_BUTTON(ID_BorderColor
, SettingsPanel::OnSetColor
)
557 EVT_BUTTON(ID_GripperColor
, SettingsPanel::OnSetColor
)
563 if ( !wxApp::OnInit() )
566 wxFrame
* frame
= new MyFrame(NULL
,
568 wxT("wxAUI Sample Application"),
577 BEGIN_EVENT_TABLE(MyFrame
, wxFrame
)
578 EVT_ERASE_BACKGROUND(MyFrame::OnEraseBackground
)
579 EVT_SIZE(MyFrame::OnSize
)
580 EVT_MENU(MyFrame::ID_CreateTree
, MyFrame::OnCreateTree
)
581 EVT_MENU(MyFrame::ID_CreateGrid
, MyFrame::OnCreateGrid
)
582 EVT_MENU(MyFrame::ID_CreateText
, MyFrame::OnCreateText
)
583 EVT_MENU(MyFrame::ID_CreateHTML
, MyFrame::OnCreateHTML
)
584 EVT_MENU(MyFrame::ID_CreateSizeReport
, MyFrame::OnCreateSizeReport
)
585 EVT_MENU(MyFrame::ID_CreateNotebook
, MyFrame::OnCreateNotebook
)
586 EVT_MENU(MyFrame::ID_CreatePerspective
, MyFrame::OnCreatePerspective
)
587 EVT_MENU(MyFrame::ID_CopyPerspectiveCode
, MyFrame::OnCopyPerspectiveCode
)
588 EVT_MENU(ID_AllowFloating
, MyFrame::OnManagerFlag
)
589 EVT_MENU(ID_TransparentHint
, MyFrame::OnManagerFlag
)
590 EVT_MENU(ID_VenetianBlindsHint
, MyFrame::OnManagerFlag
)
591 EVT_MENU(ID_RectangleHint
, MyFrame::OnManagerFlag
)
592 EVT_MENU(ID_NoHint
, MyFrame::OnManagerFlag
)
593 EVT_MENU(ID_HintFade
, MyFrame::OnManagerFlag
)
594 EVT_MENU(ID_NoVenetianFade
, MyFrame::OnManagerFlag
)
595 EVT_MENU(ID_TransparentDrag
, MyFrame::OnManagerFlag
)
596 EVT_MENU(ID_LiveUpdate
, MyFrame::OnManagerFlag
)
597 EVT_MENU(ID_AllowActivePane
, MyFrame::OnManagerFlag
)
598 EVT_MENU(ID_NotebookTabFixedWidth
, MyFrame::OnNotebookFlag
)
599 EVT_MENU(ID_NotebookNoCloseButton
, MyFrame::OnNotebookFlag
)
600 EVT_MENU(ID_NotebookCloseButton
, MyFrame::OnNotebookFlag
)
601 EVT_MENU(ID_NotebookCloseButtonAll
, MyFrame::OnNotebookFlag
)
602 EVT_MENU(ID_NotebookCloseButtonActive
, MyFrame::OnNotebookFlag
)
603 EVT_MENU(ID_NotebookAllowTabMove
, MyFrame::OnNotebookFlag
)
604 EVT_MENU(ID_NotebookAllowTabExternalMove
, MyFrame::OnNotebookFlag
)
605 EVT_MENU(ID_NotebookAllowTabSplit
, MyFrame::OnNotebookFlag
)
606 EVT_MENU(ID_NotebookScrollButtons
, MyFrame::OnNotebookFlag
)
607 EVT_MENU(ID_NotebookWindowList
, MyFrame::OnNotebookFlag
)
608 EVT_MENU(ID_NotebookArtGloss
, MyFrame::OnNotebookFlag
)
609 EVT_MENU(ID_NotebookArtSimple
, MyFrame::OnNotebookFlag
)
610 EVT_MENU(ID_NotebookAlignTop
, MyFrame::OnTabAlignment
)
611 EVT_MENU(ID_NotebookAlignBottom
, MyFrame::OnTabAlignment
)
612 EVT_MENU(ID_NoGradient
, MyFrame::OnGradient
)
613 EVT_MENU(ID_VerticalGradient
, MyFrame::OnGradient
)
614 EVT_MENU(ID_HorizontalGradient
, MyFrame::OnGradient
)
615 EVT_MENU(ID_Settings
, MyFrame::OnSettings
)
616 EVT_MENU(ID_CustomizeToolbar
, MyFrame::OnCustomizeToolbar
)
617 EVT_MENU(ID_GridContent
, MyFrame::OnChangeContentPane
)
618 EVT_MENU(ID_TreeContent
, MyFrame::OnChangeContentPane
)
619 EVT_MENU(ID_TextContent
, MyFrame::OnChangeContentPane
)
620 EVT_MENU(ID_SizeReportContent
, MyFrame::OnChangeContentPane
)
621 EVT_MENU(ID_HTMLContent
, MyFrame::OnChangeContentPane
)
622 EVT_MENU(ID_NotebookContent
, MyFrame::OnChangeContentPane
)
623 EVT_MENU(wxID_EXIT
, MyFrame::OnExit
)
624 EVT_MENU(wxID_ABOUT
, MyFrame::OnAbout
)
625 EVT_UPDATE_UI(ID_NotebookTabFixedWidth
, MyFrame::OnUpdateUI
)
626 EVT_UPDATE_UI(ID_NotebookNoCloseButton
, MyFrame::OnUpdateUI
)
627 EVT_UPDATE_UI(ID_NotebookCloseButton
, MyFrame::OnUpdateUI
)
628 EVT_UPDATE_UI(ID_NotebookCloseButtonAll
, MyFrame::OnUpdateUI
)
629 EVT_UPDATE_UI(ID_NotebookCloseButtonActive
, MyFrame::OnUpdateUI
)
630 EVT_UPDATE_UI(ID_NotebookAllowTabMove
, MyFrame::OnUpdateUI
)
631 EVT_UPDATE_UI(ID_NotebookAllowTabExternalMove
, MyFrame::OnUpdateUI
)
632 EVT_UPDATE_UI(ID_NotebookAllowTabSplit
, MyFrame::OnUpdateUI
)
633 EVT_UPDATE_UI(ID_NotebookScrollButtons
, MyFrame::OnUpdateUI
)
634 EVT_UPDATE_UI(ID_NotebookWindowList
, MyFrame::OnUpdateUI
)
635 EVT_UPDATE_UI(ID_AllowFloating
, MyFrame::OnUpdateUI
)
636 EVT_UPDATE_UI(ID_TransparentHint
, MyFrame::OnUpdateUI
)
637 EVT_UPDATE_UI(ID_VenetianBlindsHint
, MyFrame::OnUpdateUI
)
638 EVT_UPDATE_UI(ID_RectangleHint
, MyFrame::OnUpdateUI
)
639 EVT_UPDATE_UI(ID_NoHint
, MyFrame::OnUpdateUI
)
640 EVT_UPDATE_UI(ID_HintFade
, MyFrame::OnUpdateUI
)
641 EVT_UPDATE_UI(ID_NoVenetianFade
, MyFrame::OnUpdateUI
)
642 EVT_UPDATE_UI(ID_TransparentDrag
, MyFrame::OnUpdateUI
)
643 EVT_UPDATE_UI(ID_LiveUpdate
, MyFrame::OnUpdateUI
)
644 EVT_UPDATE_UI(ID_NoGradient
, MyFrame::OnUpdateUI
)
645 EVT_UPDATE_UI(ID_VerticalGradient
, MyFrame::OnUpdateUI
)
646 EVT_UPDATE_UI(ID_HorizontalGradient
, MyFrame::OnUpdateUI
)
647 EVT_MENU_RANGE(MyFrame::ID_FirstPerspective
, MyFrame::ID_FirstPerspective
+1000,
648 MyFrame::OnRestorePerspective
)
649 EVT_AUITOOLBAR_TOOL_DROPDOWN(ID_DropDownToolbarItem
, MyFrame::OnDropDownToolbarItem
)
650 EVT_AUI_PANE_CLOSE(MyFrame::OnPaneClose
)
651 EVT_AUINOTEBOOK_ALLOW_DND(wxID_ANY
, MyFrame::OnAllowNotebookDnD
)
652 EVT_AUINOTEBOOK_PAGE_CLOSE(wxID_ANY
, MyFrame::OnNotebookPageClose
)
653 EVT_AUINOTEBOOK_PAGE_CLOSED(wxID_ANY
, MyFrame::OnNotebookPageClosed
)
657 MyFrame::MyFrame(wxWindow
* parent
,
659 const wxString
& title
,
663 : wxFrame(parent
, id
, title
, pos
, size
, style
)
665 // tell wxAuiManager to manage this frame
666 m_mgr
.SetManagedWindow(this);
669 SetIcon(wxIcon(sample_xpm
));
671 // set up default notebook style
672 m_notebook_style
= wxAUI_NB_DEFAULT_STYLE
| wxAUI_NB_TAB_EXTERNAL_MOVE
| wxNO_BORDER
;
673 m_notebook_theme
= 0;
676 wxMenuBar
* mb
= new wxMenuBar
;
678 wxMenu
* file_menu
= new wxMenu
;
679 file_menu
->Append(wxID_EXIT
);
681 wxMenu
* view_menu
= new wxMenu
;
682 view_menu
->Append(ID_CreateText
, _("Create Text Control"));
683 view_menu
->Append(ID_CreateHTML
, _("Create HTML Control"));
684 view_menu
->Append(ID_CreateTree
, _("Create Tree"));
685 view_menu
->Append(ID_CreateGrid
, _("Create Grid"));
686 view_menu
->Append(ID_CreateNotebook
, _("Create Notebook"));
687 view_menu
->Append(ID_CreateSizeReport
, _("Create Size Reporter"));
688 view_menu
->AppendSeparator();
689 view_menu
->Append(ID_GridContent
, _("Use a Grid for the Content Pane"));
690 view_menu
->Append(ID_TextContent
, _("Use a Text Control for the Content Pane"));
691 view_menu
->Append(ID_HTMLContent
, _("Use an HTML Control for the Content Pane"));
692 view_menu
->Append(ID_TreeContent
, _("Use a Tree Control for the Content Pane"));
693 view_menu
->Append(ID_NotebookContent
, _("Use a wxAuiNotebook control for the Content Pane"));
694 view_menu
->Append(ID_SizeReportContent
, _("Use a Size Reporter for the Content Pane"));
696 wxMenu
* options_menu
= new wxMenu
;
697 options_menu
->AppendRadioItem(ID_TransparentHint
, _("Transparent Hint"));
698 options_menu
->AppendRadioItem(ID_VenetianBlindsHint
, _("Venetian Blinds Hint"));
699 options_menu
->AppendRadioItem(ID_RectangleHint
, _("Rectangle Hint"));
700 options_menu
->AppendRadioItem(ID_NoHint
, _("No Hint"));
701 options_menu
->AppendSeparator();
702 options_menu
->AppendCheckItem(ID_HintFade
, _("Hint Fade-in"));
703 options_menu
->AppendCheckItem(ID_AllowFloating
, _("Allow Floating"));
704 options_menu
->AppendCheckItem(ID_NoVenetianFade
, _("Disable Venetian Blinds Hint Fade-in"));
705 options_menu
->AppendCheckItem(ID_TransparentDrag
, _("Transparent Drag"));
706 options_menu
->AppendCheckItem(ID_AllowActivePane
, _("Allow Active Pane"));
707 options_menu
->AppendCheckItem(ID_LiveUpdate
, _("Live Resize Update"));
708 options_menu
->AppendSeparator();
709 options_menu
->AppendRadioItem(ID_NoGradient
, _("No Caption Gradient"));
710 options_menu
->AppendRadioItem(ID_VerticalGradient
, _("Vertical Caption Gradient"));
711 options_menu
->AppendRadioItem(ID_HorizontalGradient
, _("Horizontal Caption Gradient"));
712 options_menu
->AppendSeparator();
713 options_menu
->Append(ID_Settings
, _("Settings Pane"));
715 wxMenu
* notebook_menu
= new wxMenu
;
716 notebook_menu
->AppendRadioItem(ID_NotebookArtGloss
, _("Glossy Theme (Default)"));
717 notebook_menu
->AppendRadioItem(ID_NotebookArtSimple
, _("Simple Theme"));
718 notebook_menu
->AppendSeparator();
719 notebook_menu
->AppendRadioItem(ID_NotebookNoCloseButton
, _("No Close Button"));
720 notebook_menu
->AppendRadioItem(ID_NotebookCloseButton
, _("Close Button at Right"));
721 notebook_menu
->AppendRadioItem(ID_NotebookCloseButtonAll
, _("Close Button on All Tabs"));
722 notebook_menu
->AppendRadioItem(ID_NotebookCloseButtonActive
, _("Close Button on Active Tab"));
723 notebook_menu
->AppendSeparator();
724 notebook_menu
->AppendRadioItem(ID_NotebookAlignTop
, _("Tab Top Alignment"));
725 notebook_menu
->AppendRadioItem(ID_NotebookAlignBottom
, _("Tab Bottom Alignment"));
726 notebook_menu
->AppendSeparator();
727 notebook_menu
->AppendCheckItem(ID_NotebookAllowTabMove
, _("Allow Tab Move"));
728 notebook_menu
->AppendCheckItem(ID_NotebookAllowTabExternalMove
, _("Allow External Tab Move"));
729 notebook_menu
->AppendCheckItem(ID_NotebookAllowTabSplit
, _("Allow Notebook Split"));
730 notebook_menu
->AppendCheckItem(ID_NotebookScrollButtons
, _("Scroll Buttons Visible"));
731 notebook_menu
->AppendCheckItem(ID_NotebookWindowList
, _("Window List Button Visible"));
732 notebook_menu
->AppendCheckItem(ID_NotebookTabFixedWidth
, _("Fixed-width Tabs"));
734 m_perspectives_menu
= new wxMenu
;
735 m_perspectives_menu
->Append(ID_CreatePerspective
, _("Create Perspective"));
736 m_perspectives_menu
->Append(ID_CopyPerspectiveCode
, _("Copy Perspective Data To Clipboard"));
737 m_perspectives_menu
->AppendSeparator();
738 m_perspectives_menu
->Append(ID_FirstPerspective
+0, _("Default Startup"));
739 m_perspectives_menu
->Append(ID_FirstPerspective
+1, _("All Panes"));
741 wxMenu
* help_menu
= new wxMenu
;
742 help_menu
->Append(wxID_ABOUT
);
744 mb
->Append(file_menu
, _("&File"));
745 mb
->Append(view_menu
, _("&View"));
746 mb
->Append(m_perspectives_menu
, _("&Perspectives"));
747 mb
->Append(options_menu
, _("&Options"));
748 mb
->Append(notebook_menu
, _("&Notebook"));
749 mb
->Append(help_menu
, _("&Help"));
754 GetStatusBar()->SetStatusText(_("Ready"));
757 // min size for the frame itself isn't completely done.
758 // see the end up wxAuiManager::Update() for the test
759 // code. For now, just hard code a frame minimum size
760 SetMinSize(wxSize(400,300));
764 // prepare a few custom overflow elements for the toolbars' overflow buttons
766 wxAuiToolBarItemArray prepend_items
;
767 wxAuiToolBarItemArray append_items
;
768 wxAuiToolBarItem item
;
769 item
.SetKind(wxITEM_SEPARATOR
);
770 append_items
.Add(item
);
771 item
.SetKind(wxITEM_NORMAL
);
772 item
.SetId(ID_CustomizeToolbar
);
773 item
.SetLabel(_("Customize..."));
774 append_items
.Add(item
);
777 // create some toolbars
778 wxAuiToolBar
* tb1
= new wxAuiToolBar(this, wxID_ANY
, wxDefaultPosition
, wxDefaultSize
,
779 wxAUI_TB_DEFAULT_STYLE
| wxAUI_TB_OVERFLOW
);
780 tb1
->SetToolBitmapSize(wxSize(48,48));
781 tb1
->AddTool(ID_SampleItem
+1, wxT("Test"), wxArtProvider::GetBitmap(wxART_ERROR
));
783 tb1
->AddTool(ID_SampleItem
+2, wxT("Test"), wxArtProvider::GetBitmap(wxART_QUESTION
));
784 tb1
->AddTool(ID_SampleItem
+3, wxT("Test"), wxArtProvider::GetBitmap(wxART_INFORMATION
));
785 tb1
->AddTool(ID_SampleItem
+4, wxT("Test"), wxArtProvider::GetBitmap(wxART_WARNING
));
786 tb1
->AddTool(ID_SampleItem
+5, wxT("Test"), wxArtProvider::GetBitmap(wxART_MISSING_IMAGE
));
787 tb1
->SetCustomOverflowItems(prepend_items
, append_items
);
791 wxAuiToolBar
* tb2
= new wxAuiToolBar(this, wxID_ANY
, wxDefaultPosition
, wxDefaultSize
,
792 wxAUI_TB_DEFAULT_STYLE
| wxAUI_TB_OVERFLOW
);
793 tb2
->SetToolBitmapSize(wxSize(16,16));
795 wxBitmap tb2_bmp1
= wxArtProvider::GetBitmap(wxART_QUESTION
, wxART_OTHER
, wxSize(16,16));
796 tb2
->AddTool(ID_SampleItem
+6, wxT("Test"), tb2_bmp1
);
797 tb2
->AddTool(ID_SampleItem
+7, wxT("Test"), tb2_bmp1
);
798 tb2
->AddTool(ID_SampleItem
+8, wxT("Test"), tb2_bmp1
);
799 tb2
->AddTool(ID_SampleItem
+9, wxT("Test"), tb2_bmp1
);
801 tb2
->AddTool(ID_SampleItem
+10, wxT("Test"), tb2_bmp1
);
802 tb2
->AddTool(ID_SampleItem
+11, wxT("Test"), tb2_bmp1
);
804 tb2
->AddTool(ID_SampleItem
+12, wxT("Test"), tb2_bmp1
);
805 tb2
->AddTool(ID_SampleItem
+13, wxT("Test"), tb2_bmp1
);
806 tb2
->AddTool(ID_SampleItem
+14, wxT("Test"), tb2_bmp1
);
807 tb2
->AddTool(ID_SampleItem
+15, wxT("Test"), tb2_bmp1
);
808 tb2
->SetCustomOverflowItems(prepend_items
, append_items
);
812 wxAuiToolBar
* tb3
= new wxAuiToolBar(this, wxID_ANY
, wxDefaultPosition
, wxDefaultSize
,
813 wxAUI_TB_DEFAULT_STYLE
| wxAUI_TB_OVERFLOW
);
814 tb3
->SetToolBitmapSize(wxSize(16,16));
815 wxBitmap tb3_bmp1
= wxArtProvider::GetBitmap(wxART_FOLDER
, wxART_OTHER
, wxSize(16,16));
816 tb3
->AddTool(ID_SampleItem
+16, wxT("Check 1"), tb3_bmp1
, wxT("Check 1"), wxITEM_CHECK
);
817 tb3
->AddTool(ID_SampleItem
+17, wxT("Check 2"), tb3_bmp1
, wxT("Check 2"), wxITEM_CHECK
);
818 tb3
->AddTool(ID_SampleItem
+18, wxT("Check 3"), tb3_bmp1
, wxT("Check 3"), wxITEM_CHECK
);
819 tb3
->AddTool(ID_SampleItem
+19, wxT("Check 4"), tb3_bmp1
, wxT("Check 4"), wxITEM_CHECK
);
821 tb3
->AddTool(ID_SampleItem
+20, wxT("Radio 1"), tb3_bmp1
, wxT("Radio 1"), wxITEM_RADIO
);
822 tb3
->AddTool(ID_SampleItem
+21, wxT("Radio 2"), tb3_bmp1
, wxT("Radio 2"), wxITEM_RADIO
);
823 tb3
->AddTool(ID_SampleItem
+22, wxT("Radio 3"), tb3_bmp1
, wxT("Radio 3"), wxITEM_RADIO
);
825 tb3
->AddTool(ID_SampleItem
+23, wxT("Radio 1 (Group 2)"), tb3_bmp1
, wxT("Radio 1 (Group 2)"), wxITEM_RADIO
);
826 tb3
->AddTool(ID_SampleItem
+24, wxT("Radio 2 (Group 2)"), tb3_bmp1
, wxT("Radio 2 (Group 2)"), wxITEM_RADIO
);
827 tb3
->AddTool(ID_SampleItem
+25, wxT("Radio 3 (Group 2)"), tb3_bmp1
, wxT("Radio 3 (Group 2)"), wxITEM_RADIO
);
828 tb3
->SetCustomOverflowItems(prepend_items
, append_items
);
832 wxAuiToolBar
* tb4
= new wxAuiToolBar(this, wxID_ANY
, wxDefaultPosition
, wxDefaultSize
,
833 wxAUI_TB_DEFAULT_STYLE
|
837 tb4
->SetToolBitmapSize(wxSize(16,16));
838 wxBitmap tb4_bmp1
= wxArtProvider::GetBitmap(wxART_NORMAL_FILE
, wxART_OTHER
, wxSize(16,16));
839 tb4
->AddTool(ID_DropDownToolbarItem
, wxT("Item 1"), tb4_bmp1
);
840 tb4
->AddTool(ID_SampleItem
+23, wxT("Item 2"), tb4_bmp1
);
841 tb4
->AddTool(ID_SampleItem
+24, wxT("Item 3"), tb4_bmp1
);
842 tb4
->AddTool(ID_SampleItem
+25, wxT("Item 4"), tb4_bmp1
);
844 tb4
->AddTool(ID_SampleItem
+26, wxT("Item 5"), tb4_bmp1
);
845 tb4
->AddTool(ID_SampleItem
+27, wxT("Item 6"), tb4_bmp1
);
846 tb4
->AddTool(ID_SampleItem
+28, wxT("Item 7"), tb4_bmp1
);
847 tb4
->AddTool(ID_SampleItem
+29, wxT("Item 8"), tb4_bmp1
);
848 tb4
->SetToolDropDown(ID_DropDownToolbarItem
, true);
849 tb4
->SetCustomOverflowItems(prepend_items
, append_items
);
853 wxAuiToolBar
* tb5
= new wxAuiToolBar(this, wxID_ANY
, wxDefaultPosition
, wxDefaultSize
,
854 wxAUI_TB_DEFAULT_STYLE
| wxAUI_TB_OVERFLOW
| wxAUI_TB_VERTICAL
);
855 tb5
->SetToolBitmapSize(wxSize(48,48));
856 tb5
->AddTool(ID_SampleItem
+30, wxT("Test"), wxArtProvider::GetBitmap(wxART_ERROR
));
858 tb5
->AddTool(ID_SampleItem
+31, wxT("Test"), wxArtProvider::GetBitmap(wxART_QUESTION
));
859 tb5
->AddTool(ID_SampleItem
+32, wxT("Test"), wxArtProvider::GetBitmap(wxART_INFORMATION
));
860 tb5
->AddTool(ID_SampleItem
+33, wxT("Test"), wxArtProvider::GetBitmap(wxART_WARNING
));
861 tb5
->AddTool(ID_SampleItem
+34, wxT("Test"), wxArtProvider::GetBitmap(wxART_MISSING_IMAGE
));
862 tb5
->SetCustomOverflowItems(prepend_items
, append_items
);
865 // add a bunch of panes
866 m_mgr
.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().
867 Name(wxT("test1")).Caption(wxT("Pane Caption")).
870 m_mgr
.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().
871 Name(wxT("test2")).Caption(wxT("Client Size Reporter")).
872 Bottom().Position(1).
873 CloseButton(true).MaximizeButton(true));
875 m_mgr
.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().
876 Name(wxT("test3")).Caption(wxT("Client Size Reporter")).
878 CloseButton(true).MaximizeButton(true));
880 m_mgr
.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().
881 Name(wxT("test4")).Caption(wxT("Pane Caption")).
884 m_mgr
.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().
885 Name(wxT("test5")).Caption(wxT("No Close Button")).
886 Right().CloseButton(false));
888 m_mgr
.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().
889 Name(wxT("test6")).Caption(wxT("Client Size Reporter")).
891 CloseButton(true).MaximizeButton(true));
893 m_mgr
.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().
894 Name(wxT("test7")).Caption(wxT("Client Size Reporter")).
896 CloseButton(true).MaximizeButton(true));
898 m_mgr
.AddPane(CreateTreeCtrl(), wxAuiPaneInfo().
899 Name(wxT("test8")).Caption(wxT("Tree Pane")).
900 Left().Layer(1).Position(1).
901 CloseButton(true).MaximizeButton(true));
903 m_mgr
.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().
904 Name(wxT("test9")).Caption(wxT("Min Size 200x100")).
905 BestSize(wxSize(200,100)).MinSize(wxSize(200,100)).
907 CloseButton(true).MaximizeButton(true));
909 wxWindow
* wnd10
= CreateTextCtrl(wxT("This pane will prompt the user before hiding."));
910 m_mgr
.AddPane(wnd10
, wxAuiPaneInfo().
911 Name(wxT("test10")).Caption(wxT("Text Pane with Hide Prompt")).
912 Bottom().Layer(1).Position(1));
914 m_mgr
.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().
915 Name(wxT("test11")).Caption(wxT("Fixed Pane")).
916 Bottom().Layer(1).Position(2).Fixed());
919 m_mgr
.AddPane(new SettingsPanel(this,this), wxAuiPaneInfo().
920 Name(wxT("settings")).Caption(wxT("Dock Manager Settings")).
921 Dockable(false).Float().Hide());
923 // create some center panes
925 m_mgr
.AddPane(CreateGrid(), wxAuiPaneInfo().Name(wxT("grid_content")).
926 CenterPane().Hide());
928 m_mgr
.AddPane(CreateTreeCtrl(), wxAuiPaneInfo().Name(wxT("tree_content")).
929 CenterPane().Hide());
931 m_mgr
.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().Name(wxT("sizereport_content")).
932 CenterPane().Hide());
934 m_mgr
.AddPane(CreateTextCtrl(), wxAuiPaneInfo().Name(wxT("text_content")).
935 CenterPane().Hide());
937 m_mgr
.AddPane(CreateHTMLCtrl(), wxAuiPaneInfo().Name(wxT("html_content")).
938 CenterPane().Hide());
940 m_mgr
.AddPane(CreateNotebook(), wxAuiPaneInfo().Name(wxT("notebook_content")).
941 CenterPane().PaneBorder(false));
943 // add the toolbars to the manager
944 m_mgr
.AddPane(tb1
, wxAuiPaneInfo().
945 Name(wxT("tb1")).Caption(wxT("Big Toolbar")).
947 LeftDockable(false).RightDockable(false));
949 m_mgr
.AddPane(tb2
, wxAuiPaneInfo().
950 Name(wxT("tb2")).Caption(wxT("Toolbar 2")).
951 ToolbarPane().Top().Row(1).
952 LeftDockable(false).RightDockable(false));
954 m_mgr
.AddPane(tb3
, wxAuiPaneInfo().
955 Name(wxT("tb3")).Caption(wxT("Toolbar 3")).
956 ToolbarPane().Top().Row(1).Position(1).
957 LeftDockable(false).RightDockable(false));
959 m_mgr
.AddPane(tb4
, wxAuiPaneInfo().
960 Name(wxT("tb4")).Caption(wxT("Sample Bookmark Toolbar")).
961 ToolbarPane().Top().Row(2).
962 LeftDockable(false).RightDockable(false));
964 m_mgr
.AddPane(tb5
, wxAuiPaneInfo().
965 Name(wxT("tb5")).Caption(wxT("Sample Vertical Toolbar")).
966 ToolbarPane().Left().
968 TopDockable(false).BottomDockable(false));
970 m_mgr
.AddPane(new wxButton(this, wxID_ANY
, _("Test Button")),
971 wxAuiPaneInfo().Name(wxT("tb6")).
972 ToolbarPane().Top().Row(2).Position(1).
973 LeftDockable(false).RightDockable(false));
975 // make some default perspectives
977 wxString perspective_all
= m_mgr
.SavePerspective();
980 wxAuiPaneInfoArray
& all_panes
= m_mgr
.GetAllPanes();
981 for (i
= 0, count
= all_panes
.GetCount(); i
< count
; ++i
)
982 if (!all_panes
.Item(i
).IsToolbar())
983 all_panes
.Item(i
).Hide();
984 m_mgr
.GetPane(wxT("tb1")).Hide();
985 m_mgr
.GetPane(wxT("tb6")).Hide();
986 m_mgr
.GetPane(wxT("test8")).Show().Left().Layer(0).Row(0).Position(0);
987 m_mgr
.GetPane(wxT("test10")).Show().Bottom().Layer(0).Row(0).Position(0);
988 m_mgr
.GetPane(wxT("notebook_content")).Show();
989 wxString perspective_default
= m_mgr
.SavePerspective();
991 m_perspectives
.Add(perspective_default
);
992 m_perspectives
.Add(perspective_all
);
994 // "commit" all changes made to wxAuiManager
1003 wxAuiDockArt
* MyFrame::GetDockArt()
1005 return m_mgr
.GetArtProvider();
1008 void MyFrame::DoUpdate()
1013 void MyFrame::OnEraseBackground(wxEraseEvent
& event
)
1018 void MyFrame::OnSize(wxSizeEvent
& event
)
1023 void MyFrame::OnSettings(wxCommandEvent
& WXUNUSED(evt
))
1025 // show the settings pane, and float it
1026 wxAuiPaneInfo
& floating_pane
= m_mgr
.GetPane(wxT("settings")).Float().Show();
1028 if (floating_pane
.floating_pos
== wxDefaultPosition
)
1029 floating_pane
.FloatingPosition(GetStartPosition());
1034 void MyFrame::OnCustomizeToolbar(wxCommandEvent
& WXUNUSED(evt
))
1036 wxMessageBox(_("Customize Toolbar clicked"));
1039 void MyFrame::OnGradient(wxCommandEvent
& event
)
1043 switch (event
.GetId())
1045 case ID_NoGradient
: gradient
= wxAUI_GRADIENT_NONE
; break;
1046 case ID_VerticalGradient
: gradient
= wxAUI_GRADIENT_VERTICAL
; break;
1047 case ID_HorizontalGradient
: gradient
= wxAUI_GRADIENT_HORIZONTAL
; break;
1050 m_mgr
.GetArtProvider()->SetMetric(wxAUI_DOCKART_GRADIENT_TYPE
, gradient
);
1054 void MyFrame::OnManagerFlag(wxCommandEvent
& event
)
1056 unsigned int flag
= 0;
1058 #if !defined(__WXMSW__) && !defined(__WXMAC__) && !defined(__WXGTK__)
1059 if (event
.GetId() == ID_TransparentDrag
||
1060 event
.GetId() == ID_TransparentHint
||
1061 event
.GetId() == ID_HintFade
)
1063 wxMessageBox(wxT("This option is presently only available on wxGTK, wxMSW and wxMac"));
1068 int id
= event
.GetId();
1070 if (id
== ID_TransparentHint
||
1071 id
== ID_VenetianBlindsHint
||
1072 id
== ID_RectangleHint
||
1075 unsigned int flags
= m_mgr
.GetFlags();
1076 flags
&= ~wxAUI_MGR_TRANSPARENT_HINT
;
1077 flags
&= ~wxAUI_MGR_VENETIAN_BLINDS_HINT
;
1078 flags
&= ~wxAUI_MGR_RECTANGLE_HINT
;
1079 m_mgr
.SetFlags(flags
);
1084 case ID_AllowFloating
: flag
= wxAUI_MGR_ALLOW_FLOATING
; break;
1085 case ID_TransparentDrag
: flag
= wxAUI_MGR_TRANSPARENT_DRAG
; break;
1086 case ID_HintFade
: flag
= wxAUI_MGR_HINT_FADE
; break;
1087 case ID_NoVenetianFade
: flag
= wxAUI_MGR_NO_VENETIAN_BLINDS_FADE
; break;
1088 case ID_AllowActivePane
: flag
= wxAUI_MGR_ALLOW_ACTIVE_PANE
; break;
1089 case ID_TransparentHint
: flag
= wxAUI_MGR_TRANSPARENT_HINT
; break;
1090 case ID_VenetianBlindsHint
: flag
= wxAUI_MGR_VENETIAN_BLINDS_HINT
; break;
1091 case ID_RectangleHint
: flag
= wxAUI_MGR_RECTANGLE_HINT
; break;
1092 case ID_LiveUpdate
: flag
= wxAUI_MGR_LIVE_RESIZE
; break;
1097 m_mgr
.SetFlags(m_mgr
.GetFlags() ^ flag
);
1104 void MyFrame::OnNotebookFlag(wxCommandEvent
& event
)
1106 int id
= event
.GetId();
1108 if (id
== ID_NotebookNoCloseButton
||
1109 id
== ID_NotebookCloseButton
||
1110 id
== ID_NotebookCloseButtonAll
||
1111 id
== ID_NotebookCloseButtonActive
)
1113 m_notebook_style
&= ~(wxAUI_NB_CLOSE_BUTTON
|
1114 wxAUI_NB_CLOSE_ON_ACTIVE_TAB
|
1115 wxAUI_NB_CLOSE_ON_ALL_TABS
);
1119 case ID_NotebookNoCloseButton
: break;
1120 case ID_NotebookCloseButton
: m_notebook_style
|= wxAUI_NB_CLOSE_BUTTON
; break;
1121 case ID_NotebookCloseButtonAll
: m_notebook_style
|= wxAUI_NB_CLOSE_ON_ALL_TABS
; break;
1122 case ID_NotebookCloseButtonActive
: m_notebook_style
|= wxAUI_NB_CLOSE_ON_ACTIVE_TAB
; break;
1126 if (id
== ID_NotebookAllowTabMove
)
1128 m_notebook_style
^= wxAUI_NB_TAB_MOVE
;
1130 if (id
== ID_NotebookAllowTabExternalMove
)
1132 m_notebook_style
^= wxAUI_NB_TAB_EXTERNAL_MOVE
;
1134 else if (id
== ID_NotebookAllowTabSplit
)
1136 m_notebook_style
^= wxAUI_NB_TAB_SPLIT
;
1138 else if (id
== ID_NotebookWindowList
)
1140 m_notebook_style
^= wxAUI_NB_WINDOWLIST_BUTTON
;
1142 else if (id
== ID_NotebookScrollButtons
)
1144 m_notebook_style
^= wxAUI_NB_SCROLL_BUTTONS
;
1146 else if (id
== ID_NotebookTabFixedWidth
)
1148 m_notebook_style
^= wxAUI_NB_TAB_FIXED_WIDTH
;
1153 wxAuiPaneInfoArray
& all_panes
= m_mgr
.GetAllPanes();
1154 for (i
= 0, count
= all_panes
.GetCount(); i
< count
; ++i
)
1156 wxAuiPaneInfo
& pane
= all_panes
.Item(i
);
1157 if (pane
.window
->IsKindOf(CLASSINFO(wxAuiNotebook
)))
1159 wxAuiNotebook
* nb
= (wxAuiNotebook
*)pane
.window
;
1161 if (id
== ID_NotebookArtGloss
)
1163 nb
->SetArtProvider(new wxAuiDefaultTabArt
);
1164 m_notebook_theme
= 0;
1166 else if (id
== ID_NotebookArtSimple
)
1168 nb
->SetArtProvider(new wxAuiSimpleTabArt
);
1169 m_notebook_theme
= 1;
1173 nb
->SetWindowStyleFlag(m_notebook_style
);
1182 void MyFrame::OnUpdateUI(wxUpdateUIEvent
& event
)
1184 unsigned int flags
= m_mgr
.GetFlags();
1186 switch (event
.GetId())
1189 event
.Check(m_mgr
.GetArtProvider()->GetMetric(wxAUI_DOCKART_GRADIENT_TYPE
) == wxAUI_GRADIENT_NONE
);
1191 case ID_VerticalGradient
:
1192 event
.Check(m_mgr
.GetArtProvider()->GetMetric(wxAUI_DOCKART_GRADIENT_TYPE
) == wxAUI_GRADIENT_VERTICAL
);
1194 case ID_HorizontalGradient
:
1195 event
.Check(m_mgr
.GetArtProvider()->GetMetric(wxAUI_DOCKART_GRADIENT_TYPE
) == wxAUI_GRADIENT_HORIZONTAL
);
1197 case ID_AllowFloating
:
1198 event
.Check((flags
& wxAUI_MGR_ALLOW_FLOATING
) != 0);
1200 case ID_TransparentDrag
:
1201 event
.Check((flags
& wxAUI_MGR_TRANSPARENT_DRAG
) != 0);
1203 case ID_TransparentHint
:
1204 event
.Check((flags
& wxAUI_MGR_TRANSPARENT_HINT
) != 0);
1207 event
.Check((flags
& wxAUI_MGR_LIVE_RESIZE
) != 0);
1209 case ID_VenetianBlindsHint
:
1210 event
.Check((flags
& wxAUI_MGR_VENETIAN_BLINDS_HINT
) != 0);
1212 case ID_RectangleHint
:
1213 event
.Check((flags
& wxAUI_MGR_RECTANGLE_HINT
) != 0);
1216 event
.Check(((wxAUI_MGR_TRANSPARENT_HINT
|
1217 wxAUI_MGR_VENETIAN_BLINDS_HINT
|
1218 wxAUI_MGR_RECTANGLE_HINT
) & flags
) == 0);
1221 event
.Check((flags
& wxAUI_MGR_HINT_FADE
) != 0);
1223 case ID_NoVenetianFade
:
1224 event
.Check((flags
& wxAUI_MGR_NO_VENETIAN_BLINDS_FADE
) != 0);
1227 case ID_NotebookNoCloseButton
:
1228 event
.Check((m_notebook_style
& (wxAUI_NB_CLOSE_BUTTON
|wxAUI_NB_CLOSE_ON_ALL_TABS
|wxAUI_NB_CLOSE_ON_ACTIVE_TAB
)) != 0);
1230 case ID_NotebookCloseButton
:
1231 event
.Check((m_notebook_style
& wxAUI_NB_CLOSE_BUTTON
) != 0);
1233 case ID_NotebookCloseButtonAll
:
1234 event
.Check((m_notebook_style
& wxAUI_NB_CLOSE_ON_ALL_TABS
) != 0);
1236 case ID_NotebookCloseButtonActive
:
1237 event
.Check((m_notebook_style
& wxAUI_NB_CLOSE_ON_ACTIVE_TAB
) != 0);
1239 case ID_NotebookAllowTabSplit
:
1240 event
.Check((m_notebook_style
& wxAUI_NB_TAB_SPLIT
) != 0);
1242 case ID_NotebookAllowTabMove
:
1243 event
.Check((m_notebook_style
& wxAUI_NB_TAB_MOVE
) != 0);
1245 case ID_NotebookAllowTabExternalMove
:
1246 event
.Check((m_notebook_style
& wxAUI_NB_TAB_EXTERNAL_MOVE
) != 0);
1248 case ID_NotebookScrollButtons
:
1249 event
.Check((m_notebook_style
& wxAUI_NB_SCROLL_BUTTONS
) != 0);
1251 case ID_NotebookWindowList
:
1252 event
.Check((m_notebook_style
& wxAUI_NB_WINDOWLIST_BUTTON
) != 0);
1254 case ID_NotebookTabFixedWidth
:
1255 event
.Check((m_notebook_style
& wxAUI_NB_TAB_FIXED_WIDTH
) != 0);
1257 case ID_NotebookArtGloss
:
1258 event
.Check(m_notebook_style
== 0);
1260 case ID_NotebookArtSimple
:
1261 event
.Check(m_notebook_style
== 1);
1267 void MyFrame::OnPaneClose(wxAuiManagerEvent
& evt
)
1269 if (evt
.pane
->name
== wxT("test10"))
1271 int res
= wxMessageBox(wxT("Are you sure you want to close/hide this pane?"),
1280 void MyFrame::OnCreatePerspective(wxCommandEvent
& WXUNUSED(event
))
1282 wxTextEntryDialog
dlg(this, wxT("Enter a name for the new perspective:"),
1285 dlg
.SetValue(wxString::Format(wxT("Perspective %u"), unsigned(m_perspectives
.GetCount() + 1)));
1286 if (dlg
.ShowModal() != wxID_OK
)
1289 if (m_perspectives
.GetCount() == 0)
1291 m_perspectives_menu
->AppendSeparator();
1294 m_perspectives_menu
->Append(ID_FirstPerspective
+ m_perspectives
.GetCount(), dlg
.GetValue());
1295 m_perspectives
.Add(m_mgr
.SavePerspective());
1298 void MyFrame::OnCopyPerspectiveCode(wxCommandEvent
& WXUNUSED(evt
))
1300 wxString s
= m_mgr
.SavePerspective();
1303 if (wxTheClipboard
->Open())
1305 wxTheClipboard
->SetData(new wxTextDataObject(s
));
1306 wxTheClipboard
->Close();
1311 void MyFrame::OnRestorePerspective(wxCommandEvent
& evt
)
1313 m_mgr
.LoadPerspective(m_perspectives
.Item(evt
.GetId() - ID_FirstPerspective
));
1316 void MyFrame::OnNotebookPageClose(wxAuiNotebookEvent
& evt
)
1318 wxAuiNotebook
* ctrl
= (wxAuiNotebook
*)evt
.GetEventObject();
1319 if (ctrl
->GetPage(evt
.GetSelection())->IsKindOf(CLASSINFO(wxHtmlWindow
)))
1321 int res
= wxMessageBox(wxT("Are you sure you want to close/hide this notebook page?"),
1330 void MyFrame::OnNotebookPageClosed(wxAuiNotebookEvent
& evt
)
1332 wxAuiNotebook
* ctrl
= (wxAuiNotebook
*)evt
.GetEventObject();
1334 // selection should always be a valid index
1335 wxASSERT_MSG( ctrl
->GetSelection() < (int)ctrl
->GetPageCount(),
1336 wxString::Format("Invalid selection %d, only %d pages left",
1337 ctrl
->GetSelection(),
1338 (int)ctrl
->GetPageCount()) );
1343 void MyFrame::OnAllowNotebookDnD(wxAuiNotebookEvent
& evt
)
1345 // for the purpose of this test application, explicitly
1346 // allow all noteboko drag and drop events
1350 wxPoint
MyFrame::GetStartPosition()
1354 wxPoint pt
= ClientToScreen(wxPoint(0,0));
1355 return wxPoint(pt
.x
+ x
, pt
.y
+ x
);
1358 void MyFrame::OnCreateTree(wxCommandEvent
& WXUNUSED(event
))
1360 m_mgr
.AddPane(CreateTreeCtrl(), wxAuiPaneInfo().
1361 Caption(wxT("Tree Control")).
1362 Float().FloatingPosition(GetStartPosition()).
1363 FloatingSize(wxSize(150,300)));
1367 void MyFrame::OnCreateGrid(wxCommandEvent
& WXUNUSED(event
))
1369 m_mgr
.AddPane(CreateGrid(), wxAuiPaneInfo().
1370 Caption(wxT("Grid")).
1371 Float().FloatingPosition(GetStartPosition()).
1372 FloatingSize(wxSize(300,200)));
1376 void MyFrame::OnCreateHTML(wxCommandEvent
& WXUNUSED(event
))
1378 m_mgr
.AddPane(CreateHTMLCtrl(), wxAuiPaneInfo().
1379 Caption(wxT("HTML Control")).
1380 Float().FloatingPosition(GetStartPosition()).
1381 FloatingSize(wxSize(300,200)));
1385 void MyFrame::OnCreateNotebook(wxCommandEvent
& WXUNUSED(event
))
1387 m_mgr
.AddPane(CreateNotebook(), wxAuiPaneInfo().
1388 Caption(wxT("Notebook")).
1389 Float().FloatingPosition(GetStartPosition()).
1390 //FloatingSize(300,200).
1391 CloseButton(true).MaximizeButton(true));
1395 void MyFrame::OnCreateText(wxCommandEvent
& WXUNUSED(event
))
1397 m_mgr
.AddPane(CreateTextCtrl(), wxAuiPaneInfo().
1398 Caption(wxT("Text Control")).
1399 Float().FloatingPosition(GetStartPosition()));
1403 void MyFrame::OnCreateSizeReport(wxCommandEvent
& WXUNUSED(event
))
1405 m_mgr
.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().
1406 Caption(wxT("Client Size Reporter")).
1407 Float().FloatingPosition(GetStartPosition()).
1408 CloseButton(true).MaximizeButton(true));
1412 void MyFrame::OnChangeContentPane(wxCommandEvent
& evt
)
1414 m_mgr
.GetPane(wxT("grid_content")).Show(evt
.GetId() == ID_GridContent
);
1415 m_mgr
.GetPane(wxT("text_content")).Show(evt
.GetId() == ID_TextContent
);
1416 m_mgr
.GetPane(wxT("tree_content")).Show(evt
.GetId() == ID_TreeContent
);
1417 m_mgr
.GetPane(wxT("sizereport_content")).Show(evt
.GetId() == ID_SizeReportContent
);
1418 m_mgr
.GetPane(wxT("html_content")).Show(evt
.GetId() == ID_HTMLContent
);
1419 m_mgr
.GetPane(wxT("notebook_content")).Show(evt
.GetId() == ID_NotebookContent
);
1423 void MyFrame::OnDropDownToolbarItem(wxAuiToolBarEvent
& evt
)
1425 if (evt
.IsDropDownClicked())
1427 wxAuiToolBar
* tb
= static_cast<wxAuiToolBar
*>(evt
.GetEventObject());
1429 tb
->SetToolSticky(evt
.GetId(), true);
1431 // create the popup menu
1434 wxBitmap bmp
= wxArtProvider::GetBitmap(wxART_QUESTION
, wxART_OTHER
, wxSize(16,16));
1436 wxMenuItem
* m1
= new wxMenuItem(&menuPopup
, 10001, _("Drop Down Item 1"));
1438 menuPopup
.Append(m1
);
1440 wxMenuItem
* m2
= new wxMenuItem(&menuPopup
, 10002, _("Drop Down Item 2"));
1442 menuPopup
.Append(m2
);
1444 wxMenuItem
* m3
= new wxMenuItem(&menuPopup
, 10003, _("Drop Down Item 3"));
1446 menuPopup
.Append(m3
);
1448 wxMenuItem
* m4
= new wxMenuItem(&menuPopup
, 10004, _("Drop Down Item 4"));
1450 menuPopup
.Append(m4
);
1452 // line up our menu with the button
1453 wxRect rect
= tb
->GetToolRect(evt
.GetId());
1454 wxPoint pt
= tb
->ClientToScreen(rect
.GetBottomLeft());
1455 pt
= ScreenToClient(pt
);
1458 PopupMenu(&menuPopup
, pt
);
1461 // make sure the button is "un-stuck"
1462 tb
->SetToolSticky(evt
.GetId(), false);
1467 void MyFrame::OnTabAlignment(wxCommandEvent
&evt
)
1470 wxAuiPaneInfoArray
& all_panes
= m_mgr
.GetAllPanes();
1471 for (i
= 0, count
= all_panes
.GetCount(); i
< count
; ++i
)
1473 wxAuiPaneInfo
& pane
= all_panes
.Item(i
);
1474 if (pane
.window
->IsKindOf(CLASSINFO(wxAuiNotebook
)))
1476 wxAuiNotebook
* nb
= (wxAuiNotebook
*)pane
.window
;
1478 long style
= nb
->GetWindowStyleFlag();
1479 style
&= ~(wxAUI_NB_TOP
| wxAUI_NB_BOTTOM
);
1480 if (evt
.GetId() == ID_NotebookAlignTop
)
1481 style
|= wxAUI_NB_TOP
;
1482 else if (evt
.GetId() == ID_NotebookAlignBottom
)
1483 style
|= wxAUI_NB_BOTTOM
;
1484 nb
->SetWindowStyleFlag(style
);
1491 void MyFrame::OnExit(wxCommandEvent
& WXUNUSED(event
))
1496 void MyFrame::OnAbout(wxCommandEvent
& WXUNUSED(event
))
1498 wxMessageBox(_("wxAUI Demo\nAn advanced window management library for wxWidgets\n(c) Copyright 2005-2006, Kirix Corporation"), _("About wxAUI Demo"), wxOK
, this);
1501 wxTextCtrl
* MyFrame::CreateTextCtrl(const wxString
& ctrl_text
)
1506 if (ctrl_text
.Length() > 0)
1509 text
.Printf(wxT("This is text box %d"), ++n
);
1511 return new wxTextCtrl(this,wxID_ANY
, text
,
1512 wxPoint(0,0), wxSize(150,90),
1513 wxNO_BORDER
| wxTE_MULTILINE
);
1517 wxGrid
* MyFrame::CreateGrid()
1519 wxGrid
* grid
= new wxGrid(this, wxID_ANY
,
1522 wxNO_BORDER
| wxWANTS_CHARS
);
1523 grid
->CreateGrid(50, 20);
1527 wxTreeCtrl
* MyFrame::CreateTreeCtrl()
1529 wxTreeCtrl
* tree
= new wxTreeCtrl(this, wxID_ANY
,
1530 wxPoint(0,0), wxSize(160,250),
1531 wxTR_DEFAULT_STYLE
| wxNO_BORDER
);
1533 wxImageList
* imglist
= new wxImageList(16, 16, true, 2);
1534 imglist
->Add(wxArtProvider::GetBitmap(wxART_FOLDER
, wxART_OTHER
, wxSize(16,16)));
1535 imglist
->Add(wxArtProvider::GetBitmap(wxART_NORMAL_FILE
, wxART_OTHER
, wxSize(16,16)));
1536 tree
->AssignImageList(imglist
);
1538 wxTreeItemId root
= tree
->AddRoot(wxT("wxAUI Project"), 0);
1539 wxArrayTreeItemIds items
;
1543 items
.Add(tree
->AppendItem(root
, wxT("Item 1"), 0));
1544 items
.Add(tree
->AppendItem(root
, wxT("Item 2"), 0));
1545 items
.Add(tree
->AppendItem(root
, wxT("Item 3"), 0));
1546 items
.Add(tree
->AppendItem(root
, wxT("Item 4"), 0));
1547 items
.Add(tree
->AppendItem(root
, wxT("Item 5"), 0));
1551 for (i
= 0, count
= items
.Count(); i
< count
; ++i
)
1553 wxTreeItemId id
= items
.Item(i
);
1554 tree
->AppendItem(id
, wxT("Subitem 1"), 1);
1555 tree
->AppendItem(id
, wxT("Subitem 2"), 1);
1556 tree
->AppendItem(id
, wxT("Subitem 3"), 1);
1557 tree
->AppendItem(id
, wxT("Subitem 4"), 1);
1558 tree
->AppendItem(id
, wxT("Subitem 5"), 1);
1567 wxSizeReportCtrl
* MyFrame::CreateSizeReportCtrl(int width
, int height
)
1569 wxSizeReportCtrl
* ctrl
= new wxSizeReportCtrl(this, wxID_ANY
,
1571 wxSize(width
, height
), &m_mgr
);
1575 wxHtmlWindow
* MyFrame::CreateHTMLCtrl(wxWindow
* parent
)
1580 wxHtmlWindow
* ctrl
= new wxHtmlWindow(parent
, wxID_ANY
,
1583 ctrl
->SetPage(GetIntroText());
1587 wxAuiNotebook
* MyFrame::CreateNotebook()
1589 // create the notebook off-window to avoid flicker
1590 wxSize client_size
= GetClientSize();
1592 wxAuiNotebook
* ctrl
= new wxAuiNotebook(this, wxID_ANY
,
1593 wxPoint(client_size
.x
, client_size
.y
),
1598 wxBitmap page_bmp
= wxArtProvider::GetBitmap(wxART_NORMAL_FILE
, wxART_OTHER
, wxSize(16,16));
1600 ctrl
->AddPage(CreateHTMLCtrl(ctrl
), wxT("Welcome to wxAUI") , false, page_bmp
);
1602 wxPanel
*panel
= new wxPanel( ctrl
, wxID_ANY
);
1603 wxFlexGridSizer
*flex
= new wxFlexGridSizer( 4, 2, 0, 0 );
1604 flex
->AddGrowableRow( 0 );
1605 flex
->AddGrowableRow( 3 );
1606 flex
->AddGrowableCol( 1 );
1607 flex
->Add( 5,5 ); flex
->Add( 5,5 );
1608 flex
->Add( new wxStaticText( panel
, -1, wxT("wxTextCtrl:") ), 0, wxALL
|wxALIGN_CENTRE
, 5 );
1609 flex
->Add( new wxTextCtrl( panel
, -1, wxT(""), wxDefaultPosition
, wxSize(100,-1)),
1610 1, wxALL
|wxALIGN_CENTRE
, 5 );
1611 flex
->Add( new wxStaticText( panel
, -1, wxT("wxSpinCtrl:") ), 0, wxALL
|wxALIGN_CENTRE
, 5 );
1612 flex
->Add( new wxSpinCtrl( panel
, -1, wxT("5"), wxDefaultPosition
, wxSize(100,-1),
1613 wxSP_ARROW_KEYS
, 5, 50, 5 ), 0, wxALL
|wxALIGN_CENTRE
, 5 );
1614 flex
->Add( 5,5 ); flex
->Add( 5,5 );
1615 panel
->SetSizer( flex
);
1616 ctrl
->AddPage( panel
, wxT("wxPanel"), false, page_bmp
);
1619 ctrl
->AddPage( new wxTextCtrl( ctrl
, wxID_ANY
, wxT("Some text"),
1620 wxDefaultPosition
, wxDefaultSize
, wxTE_MULTILINE
|wxNO_BORDER
) , wxT("wxTextCtrl 1"), false, page_bmp
);
1622 ctrl
->AddPage( new wxTextCtrl( ctrl
, wxID_ANY
, wxT("Some more text"),
1623 wxDefaultPosition
, wxDefaultSize
, wxTE_MULTILINE
|wxNO_BORDER
) , wxT("wxTextCtrl 2") );
1625 ctrl
->AddPage( new wxTextCtrl( ctrl
, wxID_ANY
, wxT("Some more text"),
1626 wxDefaultPosition
, wxDefaultSize
, wxTE_MULTILINE
|wxNO_BORDER
) , wxT("wxTextCtrl 3") );
1628 ctrl
->AddPage( new wxTextCtrl( ctrl
, wxID_ANY
, wxT("Some more text"),
1629 wxDefaultPosition
, wxDefaultSize
, wxTE_MULTILINE
|wxNO_BORDER
) , wxT("wxTextCtrl 4") );
1631 ctrl
->AddPage( new wxTextCtrl( ctrl
, wxID_ANY
, wxT("Some more text"),
1632 wxDefaultPosition
, wxDefaultSize
, wxTE_MULTILINE
|wxNO_BORDER
) , wxT("wxTextCtrl 5") );
1634 ctrl
->AddPage( new wxTextCtrl( ctrl
, wxID_ANY
, wxT("Some more text"),
1635 wxDefaultPosition
, wxDefaultSize
, wxTE_MULTILINE
|wxNO_BORDER
) , wxT("wxTextCtrl 6") );
1637 ctrl
->AddPage( new wxTextCtrl( ctrl
, wxID_ANY
, wxT("Some more text"),
1638 wxDefaultPosition
, wxDefaultSize
, wxTE_MULTILINE
|wxNO_BORDER
) , wxT("wxTextCtrl 7 (longer title)") );
1640 ctrl
->AddPage( new wxTextCtrl( ctrl
, wxID_ANY
, wxT("Some more text"),
1641 wxDefaultPosition
, wxDefaultSize
, wxTE_MULTILINE
|wxNO_BORDER
) , wxT("wxTextCtrl 8") );
1647 wxString
MyFrame::GetIntroText()
1651 "<h3>Welcome to wxAUI</h3>"
1652 "<br/><b>Overview</b><br/>"
1653 "<p>wxAUI is an Advanced User Interface library for the wxWidgets toolkit "
1654 "that allows developers to create high-quality, cross-platform user "
1655 "interfaces quickly and easily.</p>"
1656 "<p><b>Features</b></p>"
1657 "<p>With wxAUI, developers can create application frameworks with:</p>"
1659 "<li>Native, dockable floating frames</li>"
1660 "<li>Perspective saving and loading</li>"
1661 "<li>Native toolbars incorporating real-time, "spring-loaded" dragging</li>"
1662 "<li>Customizable floating/docking behavior</li>"
1663 "<li>Completely customizable look-and-feel</li>"
1664 "<li>Optional transparent window effects (while dragging or docking)</li>"
1665 "<li>Splittable notebook control</li>"
1667 "<p><b>What's new in 0.9.4?</b></p>"
1668 "<p>wxAUI 0.9.4, which is bundled with wxWidgets, adds the following features:"
1670 "<li>New wxAuiToolBar class, a toolbar control which integrates more "
1671 "cleanly with wxAuiFrameManager.</li>"
1672 "<li>Lots of bug fixes</li>"
1674 "<p><b>What's new in 0.9.3?</b></p>"
1675 "<p>wxAUI 0.9.3, which is now bundled with wxWidgets, adds the following features:"
1677 "<li>New wxAuiNotebook class, a dynamic splittable notebook control</li>"
1678 "<li>New wxAuiMDI* classes, a tab-based MDI and drop-in replacement for classic MDI</li>"
1679 "<li>Maximize/Restore buttons implemented</li>"
1680 "<li>Better hinting with wxGTK</li>"
1681 "<li>Class rename. 'wxAui' is now the standard class prefix for all wxAUI classes</li>"
1682 "<li>Lots of bug fixes</li>"
1684 "<p><b>What's new in 0.9.2?</b></p>"
1685 "<p>The following features/fixes have been added since the last version of wxAUI:</p>"
1687 "<li>Support for wxMac</li>"
1688 "<li>Updates for wxWidgets 2.6.3</li>"
1689 "<li>Fix to pass more unused events through</li>"
1690 "<li>Fix to allow floating windows to receive idle events</li>"
1691 "<li>Fix for minimizing/maximizing problem with transparent hint pane</li>"
1692 "<li>Fix to not paint empty hint rectangles</li>"
1693 "<li>Fix for 64-bit compilation</li>"
1695 "<p><b>What changed in 0.9.1?</b></p>"
1696 "<p>The following features/fixes were added in wxAUI 0.9.1:</p>"
1698 "<li>Support for MDI frames</li>"
1699 "<li>Gradient captions option</li>"
1700 "<li>Active/Inactive panes option</li>"
1701 "<li>Fix for screen artifacts/paint problems</li>"
1702 "<li>Fix for hiding/showing floated window problem</li>"
1703 "<li>Fix for floating pane sizing problem</li>"
1704 "<li>Fix for drop position problem when dragging around center pane margins</li>"
1705 "<li>LF-only text file formatting for source code</li>"
1707 "<p>See README.txt for more information.</p>"
1710 return wxString::FromAscii(text
);