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"
30 #include "wx/aui/aui.h"
31 #include "../sample.xpm"
35 class MyApp
: public wxApp
45 class wxSizeReportCtrl
;
49 class MyFrame
: public wxFrame
53 ID_CreateTree
= wxID_HIGHEST
+1,
64 ID_CopyPerspectiveCode
,
68 ID_TransparentHintFade
,
72 ID_HorizontalGradient
,
74 ID_FirstPerspective
= ID_CreatePerspective
+1000
78 MyFrame(wxWindow
* parent
,
80 const wxString
& title
,
81 const wxPoint
& pos
= wxDefaultPosition
,
82 const wxSize
& size
= wxDefaultSize
,
83 long style
= wxDEFAULT_FRAME_STYLE
| wxSUNKEN_BORDER
);
87 wxDockArt
* GetDockArt();
91 wxTextCtrl
* CreateTextCtrl();
93 wxTreeCtrl
* CreateTreeCtrl();
94 wxSizeReportCtrl
* CreateSizeReportCtrl(int width
= 80, int height
= 80);
95 wxPoint
GetStartPosition();
96 wxHtmlWindow
* CreateHTMLCtrl();
98 wxString
GetIntroText();
102 void OnEraseBackground(wxEraseEvent
& event
);
103 void OnSize(wxSizeEvent
& event
);
105 void OnCreateTree(wxCommandEvent
& event
);
106 void OnCreateGrid(wxCommandEvent
& event
);
107 void OnCreateHTML(wxCommandEvent
& event
);
108 void OnCreateText(wxCommandEvent
& event
);
109 void OnCreateSizeReport(wxCommandEvent
& event
);
110 void OnChangeContentPane(wxCommandEvent
& event
);
111 void OnCreatePerspective(wxCommandEvent
& event
);
112 void OnCopyPerspectiveCode(wxCommandEvent
& event
);
113 void OnRestorePerspective(wxCommandEvent
& event
);
114 void OnSettings(wxCommandEvent
& event
);
115 void OnExit(wxCommandEvent
& event
);
116 void OnAbout(wxCommandEvent
& event
);
118 void OnGradient(wxCommandEvent
& event
);
119 void OnManagerFlag(wxCommandEvent
& event
);
120 void OnUpdateUI(wxUpdateUIEvent
& event
);
124 wxFrameManager m_mgr
;
125 wxArrayString m_perspectives
;
126 wxMenu
* m_perspectives_menu
;
128 DECLARE_EVENT_TABLE();
133 // -- wxSizeReportCtrl --
134 // (a utility control that always reports it's client size)
136 class wxSizeReportCtrl
: public wxControl
140 wxSizeReportCtrl(wxWindow
* parent
, wxWindowID id
= wxID_ANY
,
141 const wxPoint
& pos
= wxDefaultPosition
,
142 const wxSize
& size
= wxDefaultSize
,
143 wxFrameManager
* mgr
= NULL
)
144 : wxControl(parent
, id
, pos
, size
, wxNO_BORDER
)
151 void OnPaint(wxPaintEvent
& WXUNUSED(evt
))
154 wxSize size
= GetClientSize();
158 s
.Printf(wxT("Size: %d x %d"), size
.x
, size
.y
);
160 dc
.SetFont(*wxNORMAL_FONT
);
161 dc
.GetTextExtent(s
, &w
, &height
);
163 dc
.SetBrush(*wxWHITE_BRUSH
);
164 dc
.SetPen(*wxWHITE_PEN
);
165 dc
.DrawRectangle(0, 0, size
.x
, size
.y
);
166 dc
.SetPen(*wxLIGHT_GREY_PEN
);
167 dc
.DrawLine(0, 0, size
.x
, size
.y
);
168 dc
.DrawLine(0, size
.y
, size
.x
, 0);
169 dc
.DrawText(s
, (size
.x
-w
)/2, ((size
.y
-(height
*5))/2));
173 wxPaneInfo pi
= m_mgr
->GetPane(this);
175 s
.Printf(wxT("Layer: %d"), pi
.dock_layer
);
176 dc
.GetTextExtent(s
, &w
, &h
);
177 dc
.DrawText(s
, (size
.x
-w
)/2, ((size
.y
-(height
*5))/2)+(height
*1));
179 s
.Printf(wxT("Dock: %d Row: %d"), pi
.dock_direction
, pi
.dock_row
);
180 dc
.GetTextExtent(s
, &w
, &h
);
181 dc
.DrawText(s
, (size
.x
-w
)/2, ((size
.y
-(height
*5))/2)+(height
*2));
183 s
.Printf(wxT("Position: %d"), pi
.dock_pos
);
184 dc
.GetTextExtent(s
, &w
, &h
);
185 dc
.DrawText(s
, (size
.x
-w
)/2, ((size
.y
-(height
*5))/2)+(height
*3));
187 s
.Printf(wxT("Proportion: %d"), pi
.dock_proportion
);
188 dc
.GetTextExtent(s
, &w
, &h
);
189 dc
.DrawText(s
, (size
.x
-w
)/2, ((size
.y
-(height
*5))/2)+(height
*4));
193 void OnEraseBackground(wxEraseEvent
& WXUNUSED(evt
))
195 // intentionally empty
198 void OnSize(wxSizeEvent
& WXUNUSED(evt
))
204 wxFrameManager
* m_mgr
;
206 DECLARE_EVENT_TABLE();
209 BEGIN_EVENT_TABLE(wxSizeReportCtrl
, wxControl
)
210 EVT_PAINT(wxSizeReportCtrl::OnPaint
)
211 EVT_SIZE(wxSizeReportCtrl::OnSize
)
212 EVT_ERASE_BACKGROUND(wxSizeReportCtrl::OnEraseBackground
)
220 class SettingsPanel
: public wxPanel
224 ID_PaneBorderSize
= wxID_HIGHEST
+1,
229 ID_InactiveCaptionColor
,
230 ID_InactiveCaptionGradientColor
,
231 ID_InactiveCaptionTextColor
,
232 ID_ActiveCaptionColor
,
233 ID_ActiveCaptionGradientColor
,
234 ID_ActiveCaptionTextColor
,
241 SettingsPanel(wxWindow
* parent
, MyFrame
* frame
)
242 : wxPanel(parent
, wxID_ANY
, wxDefaultPosition
, wxDefaultSize
)
244 //wxBoxSizer* vert = new wxBoxSizer(wxVERTICAL);
246 //vert->Add(1, 1, 1, wxEXPAND);
248 wxBoxSizer
* s1
= new wxBoxSizer(wxHORIZONTAL
);
249 m_border_size
= new wxSpinCtrl(this, ID_PaneBorderSize
, wxEmptyString
, wxDefaultPosition
, wxSize(50,20));
250 s1
->Add(1, 1, 1, wxEXPAND
);
251 s1
->Add(new wxStaticText(this, wxID_ANY
, wxT("Pane Border Size:")));
252 s1
->Add(m_border_size
);
253 s1
->Add(1, 1, 1, wxEXPAND
);
254 s1
->SetItemMinSize((size_t)1, 180, 20);
255 //vert->Add(s1, 0, wxEXPAND | wxLEFT | wxBOTTOM, 5);
257 wxBoxSizer
* s2
= new wxBoxSizer(wxHORIZONTAL
);
258 m_sash_size
= new wxSpinCtrl(this, ID_SashSize
, wxEmptyString
, wxDefaultPosition
, wxSize(50,20));
259 s2
->Add(1, 1, 1, wxEXPAND
);
260 s2
->Add(new wxStaticText(this, wxID_ANY
, wxT("Sash Size:")));
261 s2
->Add(m_sash_size
);
262 s2
->Add(1, 1, 1, wxEXPAND
);
263 s2
->SetItemMinSize((size_t)1, 180, 20);
264 //vert->Add(s2, 0, wxEXPAND | wxLEFT | wxBOTTOM, 5);
266 wxBoxSizer
* s3
= new wxBoxSizer(wxHORIZONTAL
);
267 m_caption_size
= new wxSpinCtrl(this, ID_CaptionSize
, wxEmptyString
, wxDefaultPosition
, wxSize(50,20));
268 s3
->Add(1, 1, 1, wxEXPAND
);
269 s3
->Add(new wxStaticText(this, wxID_ANY
, wxT("Caption Size:")));
270 s3
->Add(m_caption_size
);
271 s3
->Add(1, 1, 1, wxEXPAND
);
272 s3
->SetItemMinSize((size_t)1, 180, 20);
273 //vert->Add(s3, 0, wxEXPAND | wxLEFT | wxBOTTOM, 5);
275 //vert->Add(1, 1, 1, wxEXPAND);
278 wxBitmap b
= CreateColorBitmap(*wxBLACK
);
280 wxBoxSizer
* s4
= new wxBoxSizer(wxHORIZONTAL
);
281 m_background_color
= new wxBitmapButton(this, ID_BackgroundColor
, b
, wxDefaultPosition
, wxSize(50,25));
282 s4
->Add(1, 1, 1, wxEXPAND
);
283 s4
->Add(new wxStaticText(this, wxID_ANY
, wxT("Background Color:")));
284 s4
->Add(m_background_color
);
285 s4
->Add(1, 1, 1, wxEXPAND
);
286 s4
->SetItemMinSize((size_t)1, 180, 20);
288 wxBoxSizer
* s5
= new wxBoxSizer(wxHORIZONTAL
);
289 m_sash_color
= new wxBitmapButton(this, ID_SashColor
, b
, wxDefaultPosition
, wxSize(50,25));
290 s5
->Add(1, 1, 1, wxEXPAND
);
291 s5
->Add(new wxStaticText(this, wxID_ANY
, wxT("Sash Color:")));
292 s5
->Add(m_sash_color
);
293 s5
->Add(1, 1, 1, wxEXPAND
);
294 s5
->SetItemMinSize((size_t)1, 180, 20);
296 wxBoxSizer
* s6
= new wxBoxSizer(wxHORIZONTAL
);
297 m_inactive_caption_color
= new wxBitmapButton(this, ID_InactiveCaptionColor
, b
, wxDefaultPosition
, wxSize(50,25));
298 s6
->Add(1, 1, 1, wxEXPAND
);
299 s6
->Add(new wxStaticText(this, wxID_ANY
, wxT("Normal Caption:")));
300 s6
->Add(m_inactive_caption_color
);
301 s6
->Add(1, 1, 1, wxEXPAND
);
302 s6
->SetItemMinSize((size_t)1, 180, 20);
304 wxBoxSizer
* s7
= new wxBoxSizer(wxHORIZONTAL
);
305 m_inactive_caption_gradient_color
= new wxBitmapButton(this, ID_InactiveCaptionGradientColor
, b
, wxDefaultPosition
, wxSize(50,25));
306 s7
->Add(1, 1, 1, wxEXPAND
);
307 s7
->Add(new wxStaticText(this, wxID_ANY
, wxT("Normal Caption Gradient:")));
308 s7
->Add(m_inactive_caption_gradient_color
);
309 s7
->Add(1, 1, 1, wxEXPAND
);
310 s7
->SetItemMinSize((size_t)1, 180, 20);
312 wxBoxSizer
* s8
= new wxBoxSizer(wxHORIZONTAL
);
313 m_inactive_caption_text_color
= new wxBitmapButton(this, ID_InactiveCaptionTextColor
, b
, wxDefaultPosition
, wxSize(50,25));
314 s8
->Add(1, 1, 1, wxEXPAND
);
315 s8
->Add(new wxStaticText(this, wxID_ANY
, wxT("Normal Caption Text:")));
316 s8
->Add(m_inactive_caption_text_color
);
317 s8
->Add(1, 1, 1, wxEXPAND
);
318 s8
->SetItemMinSize((size_t)1, 180, 20);
320 wxBoxSizer
* s9
= new wxBoxSizer(wxHORIZONTAL
);
321 m_active_caption_color
= new wxBitmapButton(this, ID_ActiveCaptionColor
, b
, wxDefaultPosition
, wxSize(50,25));
322 s9
->Add(1, 1, 1, wxEXPAND
);
323 s9
->Add(new wxStaticText(this, wxID_ANY
, wxT("Active Caption:")));
324 s9
->Add(m_active_caption_color
);
325 s9
->Add(1, 1, 1, wxEXPAND
);
326 s9
->SetItemMinSize((size_t)1, 180, 20);
328 wxBoxSizer
* s10
= new wxBoxSizer(wxHORIZONTAL
);
329 m_active_caption_gradient_color
= new wxBitmapButton(this, ID_ActiveCaptionGradientColor
, b
, wxDefaultPosition
, wxSize(50,25));
330 s10
->Add(1, 1, 1, wxEXPAND
);
331 s10
->Add(new wxStaticText(this, wxID_ANY
, wxT("Active Caption Gradient:")));
332 s10
->Add(m_active_caption_gradient_color
);
333 s10
->Add(1, 1, 1, wxEXPAND
);
334 s10
->SetItemMinSize((size_t)1, 180, 20);
336 wxBoxSizer
* s11
= new wxBoxSizer(wxHORIZONTAL
);
337 m_active_caption_text_color
= new wxBitmapButton(this, ID_ActiveCaptionTextColor
, b
, wxDefaultPosition
, wxSize(50,25));
338 s11
->Add(1, 1, 1, wxEXPAND
);
339 s11
->Add(new wxStaticText(this, wxID_ANY
, wxT("Active Caption Text:")));
340 s11
->Add(m_active_caption_text_color
);
341 s11
->Add(1, 1, 1, wxEXPAND
);
342 s11
->SetItemMinSize((size_t)1, 180, 20);
344 wxBoxSizer
* s12
= new wxBoxSizer(wxHORIZONTAL
);
345 m_border_color
= new wxBitmapButton(this, ID_BorderColor
, b
, wxDefaultPosition
, wxSize(50,25));
346 s12
->Add(1, 1, 1, wxEXPAND
);
347 s12
->Add(new wxStaticText(this, wxID_ANY
, wxT("Border Color:")));
348 s12
->Add(m_border_color
);
349 s12
->Add(1, 1, 1, wxEXPAND
);
350 s12
->SetItemMinSize((size_t)1, 180, 20);
352 wxBoxSizer
* s13
= new wxBoxSizer(wxHORIZONTAL
);
353 m_gripper_color
= new wxBitmapButton(this, ID_GripperColor
, b
, wxDefaultPosition
, wxSize(50,25));
354 s13
->Add(1, 1, 1, wxEXPAND
);
355 s13
->Add(new wxStaticText(this, wxID_ANY
, wxT("Gripper Color:")));
356 s13
->Add(m_gripper_color
);
357 s13
->Add(1, 1, 1, wxEXPAND
);
358 s13
->SetItemMinSize((size_t)1, 180, 20);
360 wxGridSizer
* grid_sizer
= new wxGridSizer(2);
361 grid_sizer
->SetHGap(5);
362 grid_sizer
->Add(s1
); grid_sizer
->Add(s4
);
363 grid_sizer
->Add(s2
); grid_sizer
->Add(s5
);
364 grid_sizer
->Add(s3
); grid_sizer
->Add(s13
);
365 grid_sizer
->Add(1,1); grid_sizer
->Add(s12
);
366 grid_sizer
->Add(s6
); grid_sizer
->Add(s9
);
367 grid_sizer
->Add(s7
); grid_sizer
->Add(s10
);
368 grid_sizer
->Add(s8
); grid_sizer
->Add(s11
);
370 wxBoxSizer
* cont_sizer
= new wxBoxSizer(wxVERTICAL
);
371 cont_sizer
->Add(grid_sizer
, 1, wxEXPAND
| wxALL
, 5);
372 SetSizer(cont_sizer
);
373 GetSizer()->SetSizeHints(this);
376 m_border_size
->SetValue(frame
->GetDockArt()->GetMetric(wxAUI_ART_PANE_BORDER_SIZE
));
377 m_sash_size
->SetValue(frame
->GetDockArt()->GetMetric(wxAUI_ART_SASH_SIZE
));
378 m_caption_size
->SetValue(frame
->GetDockArt()->GetMetric(wxAUI_ART_CAPTION_SIZE
));
385 wxBitmap
CreateColorBitmap(const wxColour
& c
)
389 for (int x
= 0; x
< 25; ++x
)
390 for (int y
= 0; y
< 14; ++y
)
393 if (x
== 0 || x
== 24 || y
== 0 || y
== 13)
395 image
.SetRGB(x
, y
, pixcol
.Red(), pixcol
.Green(), pixcol
.Blue());
397 return wxBitmap(image
);
402 wxColour bk
= m_frame
->GetDockArt()->GetColor(wxAUI_ART_BACKGROUND_COLOUR
);
403 m_background_color
->SetBitmapLabel(CreateColorBitmap(bk
));
405 wxColour cap
= m_frame
->GetDockArt()->GetColor(wxAUI_ART_INACTIVE_CAPTION_COLOUR
);
406 m_inactive_caption_color
->SetBitmapLabel(CreateColorBitmap(cap
));
408 wxColour capgrad
= m_frame
->GetDockArt()->GetColor(wxAUI_ART_INACTIVE_CAPTION_GRADIENT_COLOUR
);
409 m_inactive_caption_gradient_color
->SetBitmapLabel(CreateColorBitmap(capgrad
));
411 wxColour captxt
= m_frame
->GetDockArt()->GetColor(wxAUI_ART_INACTIVE_CAPTION_TEXT_COLOUR
);
412 m_inactive_caption_text_color
->SetBitmapLabel(CreateColorBitmap(captxt
));
414 wxColour acap
= m_frame
->GetDockArt()->GetColor(wxAUI_ART_ACTIVE_CAPTION_COLOUR
);
415 m_active_caption_color
->SetBitmapLabel(CreateColorBitmap(acap
));
417 wxColour acapgrad
= m_frame
->GetDockArt()->GetColor(wxAUI_ART_ACTIVE_CAPTION_GRADIENT_COLOUR
);
418 m_active_caption_gradient_color
->SetBitmapLabel(CreateColorBitmap(acapgrad
));
420 wxColour acaptxt
= m_frame
->GetDockArt()->GetColor(wxAUI_ART_ACTIVE_CAPTION_TEXT_COLOUR
);
421 m_active_caption_text_color
->SetBitmapLabel(CreateColorBitmap(acaptxt
));
423 wxColour sash
= m_frame
->GetDockArt()->GetColor(wxAUI_ART_SASH_COLOUR
);
424 m_sash_color
->SetBitmapLabel(CreateColorBitmap(sash
));
426 wxColour border
= m_frame
->GetDockArt()->GetColor(wxAUI_ART_BORDER_COLOUR
);
427 m_border_color
->SetBitmapLabel(CreateColorBitmap(border
));
429 wxColour gripper
= m_frame
->GetDockArt()->GetColor(wxAUI_ART_GRIPPER_COLOUR
);
430 m_gripper_color
->SetBitmapLabel(CreateColorBitmap(gripper
));
433 void OnPaneBorderSize(wxSpinEvent
& event
)
435 m_frame
->GetDockArt()->SetMetric(wxAUI_ART_PANE_BORDER_SIZE
,
436 event
.GetPosition());
440 void OnSashSize(wxSpinEvent
& event
)
442 m_frame
->GetDockArt()->SetMetric(wxAUI_ART_SASH_SIZE
,
443 event
.GetPosition());
447 void OnCaptionSize(wxSpinEvent
& event
)
449 m_frame
->GetDockArt()->SetMetric(wxAUI_ART_CAPTION_SIZE
,
450 event
.GetPosition());
454 void OnSetColor(wxCommandEvent
& event
)
456 wxColourDialog
dlg(m_frame
);
457 dlg
.SetTitle(_("Color Picker"));
458 if (dlg
.ShowModal() != wxID_OK
)
462 switch (event
.GetId())
464 case ID_BackgroundColor
: var
= wxAUI_ART_BACKGROUND_COLOUR
; break;
465 case ID_SashColor
: var
= wxAUI_ART_SASH_COLOUR
; break;
466 case ID_InactiveCaptionColor
: var
= wxAUI_ART_INACTIVE_CAPTION_COLOUR
; break;
467 case ID_InactiveCaptionGradientColor
: var
= wxAUI_ART_INACTIVE_CAPTION_GRADIENT_COLOUR
; break;
468 case ID_InactiveCaptionTextColor
: var
= wxAUI_ART_INACTIVE_CAPTION_TEXT_COLOUR
; break;
469 case ID_ActiveCaptionColor
: var
= wxAUI_ART_ACTIVE_CAPTION_COLOUR
; break;
470 case ID_ActiveCaptionGradientColor
: var
= wxAUI_ART_ACTIVE_CAPTION_GRADIENT_COLOUR
; break;
471 case ID_ActiveCaptionTextColor
: var
= wxAUI_ART_ACTIVE_CAPTION_TEXT_COLOUR
; break;
472 case ID_BorderColor
: var
= wxAUI_ART_BORDER_COLOUR
; break;
473 case ID_GripperColor
: var
= wxAUI_ART_GRIPPER_COLOUR
; break;
477 m_frame
->GetDockArt()->SetColor(var
, dlg
.GetColourData().GetColour());
485 wxSpinCtrl
* m_border_size
;
486 wxSpinCtrl
* m_sash_size
;
487 wxSpinCtrl
* m_caption_size
;
488 wxBitmapButton
* m_inactive_caption_text_color
;
489 wxBitmapButton
* m_inactive_caption_gradient_color
;
490 wxBitmapButton
* m_inactive_caption_color
;
491 wxBitmapButton
* m_active_caption_text_color
;
492 wxBitmapButton
* m_active_caption_gradient_color
;
493 wxBitmapButton
* m_active_caption_color
;
494 wxBitmapButton
* m_sash_color
;
495 wxBitmapButton
* m_background_color
;
496 wxBitmapButton
* m_border_color
;
497 wxBitmapButton
* m_gripper_color
;
499 DECLARE_EVENT_TABLE()
502 BEGIN_EVENT_TABLE(SettingsPanel
, wxPanel
)
503 EVT_SPINCTRL(ID_PaneBorderSize
, SettingsPanel::OnPaneBorderSize
)
504 EVT_SPINCTRL(ID_SashSize
, SettingsPanel::OnSashSize
)
505 EVT_SPINCTRL(ID_CaptionSize
, SettingsPanel::OnCaptionSize
)
506 EVT_BUTTON(ID_BackgroundColor
, SettingsPanel::OnSetColor
)
507 EVT_BUTTON(ID_SashColor
, SettingsPanel::OnSetColor
)
508 EVT_BUTTON(ID_InactiveCaptionColor
, SettingsPanel::OnSetColor
)
509 EVT_BUTTON(ID_InactiveCaptionGradientColor
, SettingsPanel::OnSetColor
)
510 EVT_BUTTON(ID_InactiveCaptionTextColor
, SettingsPanel::OnSetColor
)
511 EVT_BUTTON(ID_ActiveCaptionColor
, SettingsPanel::OnSetColor
)
512 EVT_BUTTON(ID_ActiveCaptionGradientColor
, SettingsPanel::OnSetColor
)
513 EVT_BUTTON(ID_ActiveCaptionTextColor
, SettingsPanel::OnSetColor
)
514 EVT_BUTTON(ID_BorderColor
, SettingsPanel::OnSetColor
)
515 EVT_BUTTON(ID_GripperColor
, SettingsPanel::OnSetColor
)
526 wxFrame
* frame
= new MyFrame(NULL
,
528 wxT("wxAUI 0.9.2 Test Application"),
539 BEGIN_EVENT_TABLE(MyFrame
, wxFrame
)
540 EVT_ERASE_BACKGROUND(MyFrame::OnEraseBackground
)
541 EVT_SIZE(MyFrame::OnSize
)
542 EVT_MENU(MyFrame::ID_CreateTree
, MyFrame::OnCreateTree
)
543 EVT_MENU(MyFrame::ID_CreateGrid
, MyFrame::OnCreateGrid
)
544 EVT_MENU(MyFrame::ID_CreateText
, MyFrame::OnCreateText
)
545 EVT_MENU(MyFrame::ID_CreateHTML
, MyFrame::OnCreateHTML
)
546 EVT_MENU(MyFrame::ID_CreateSizeReport
, MyFrame::OnCreateSizeReport
)
547 EVT_MENU(MyFrame::ID_CreatePerspective
, MyFrame::OnCreatePerspective
)
548 EVT_MENU(MyFrame::ID_CopyPerspectiveCode
, MyFrame::OnCopyPerspectiveCode
)
549 EVT_MENU(ID_AllowFloating
, MyFrame::OnManagerFlag
)
550 EVT_MENU(ID_TransparentHint
, MyFrame::OnManagerFlag
)
551 EVT_MENU(ID_TransparentHintFade
, MyFrame::OnManagerFlag
)
552 EVT_MENU(ID_TransparentDrag
, MyFrame::OnManagerFlag
)
553 EVT_MENU(ID_AllowActivePane
, MyFrame::OnManagerFlag
)
554 EVT_MENU(ID_NoGradient
, MyFrame::OnGradient
)
555 EVT_MENU(ID_VerticalGradient
, MyFrame::OnGradient
)
556 EVT_MENU(ID_HorizontalGradient
, MyFrame::OnGradient
)
557 EVT_MENU(ID_Settings
, MyFrame::OnSettings
)
558 EVT_MENU(ID_GridContent
, MyFrame::OnChangeContentPane
)
559 EVT_MENU(ID_TreeContent
, MyFrame::OnChangeContentPane
)
560 EVT_MENU(ID_TextContent
, MyFrame::OnChangeContentPane
)
561 EVT_MENU(ID_SizeReportContent
, MyFrame::OnChangeContentPane
)
562 EVT_MENU(ID_HTMLContent
, MyFrame::OnChangeContentPane
)
563 EVT_MENU(wxID_EXIT
, MyFrame::OnExit
)
564 EVT_MENU(wxID_ABOUT
, MyFrame::OnAbout
)
565 EVT_UPDATE_UI(ID_AllowFloating
, MyFrame::OnUpdateUI
)
566 EVT_UPDATE_UI(ID_TransparentHint
, MyFrame::OnUpdateUI
)
567 EVT_UPDATE_UI(ID_TransparentHintFade
, MyFrame::OnUpdateUI
)
568 EVT_UPDATE_UI(ID_TransparentDrag
, MyFrame::OnUpdateUI
)
569 EVT_UPDATE_UI(ID_NoGradient
, MyFrame::OnUpdateUI
)
570 EVT_UPDATE_UI(ID_VerticalGradient
, MyFrame::OnUpdateUI
)
571 EVT_UPDATE_UI(ID_HorizontalGradient
, MyFrame::OnUpdateUI
)
572 EVT_MENU_RANGE(MyFrame::ID_FirstPerspective
, MyFrame::ID_FirstPerspective
+1000,
573 MyFrame::OnRestorePerspective
)
578 MyFrame::MyFrame(wxWindow
* parent
,
580 const wxString
& title
,
584 : wxFrame(parent
, id
, title
, pos
, size
, style
)
586 // tell wxFrameManager to manage this frame
587 m_mgr
.SetFrame(this);
590 SetIcon(wxIcon(sample_xpm
));
593 wxMenuBar
* mb
= new wxMenuBar
;
595 wxMenu
* file_menu
= new wxMenu
;
596 file_menu
->Append(wxID_EXIT
, _("Exit"));
598 wxMenu
* view_menu
= new wxMenu
;
599 view_menu
->Append(ID_CreateText
, _("Create Text Control"));
600 view_menu
->Append(ID_CreateHTML
, _("Create HTML Control"));
601 view_menu
->Append(ID_CreateTree
, _("Create Tree"));
602 view_menu
->Append(ID_CreateGrid
, _("Create Grid"));
603 view_menu
->Append(ID_CreateSizeReport
, _("Create Size Reporter"));
604 view_menu
->AppendSeparator();
605 view_menu
->Append(ID_GridContent
, _("Use a Grid for the Content Pane"));
606 view_menu
->Append(ID_TextContent
, _("Use a Text Control for the Content Pane"));
607 view_menu
->Append(ID_HTMLContent
, _("Use an HTML Control for the Content Pane"));
608 view_menu
->Append(ID_TreeContent
, _("Use a Tree Control for the Content Pane"));
609 view_menu
->Append(ID_SizeReportContent
, _("Use a Size Reporter for the Content Pane"));
611 wxMenu
* options_menu
= new wxMenu
;
612 options_menu
->AppendCheckItem(ID_AllowFloating
, _("Allow Floating"));
613 options_menu
->AppendCheckItem(ID_TransparentHint
, _("Transparent Hint"));
614 options_menu
->AppendCheckItem(ID_TransparentHintFade
, _("Transparent Hint Fade-in"));
615 options_menu
->AppendCheckItem(ID_TransparentDrag
, _("Transparent Drag"));
616 options_menu
->AppendCheckItem(ID_AllowActivePane
, _("Allow Active Pane"));
617 options_menu
->AppendSeparator();
618 options_menu
->AppendRadioItem(ID_NoGradient
, _("No Caption Gradient"));
619 options_menu
->AppendRadioItem(ID_VerticalGradient
, _("Vertical Caption Gradient"));
620 options_menu
->AppendRadioItem(ID_HorizontalGradient
, _("Horizontal Caption Gradient"));
621 options_menu
->AppendSeparator();
622 options_menu
->Append(ID_Settings
, _("Settings Pane"));
624 m_perspectives_menu
= new wxMenu
;
625 m_perspectives_menu
->Append(ID_CreatePerspective
, _("Create Perspective"));
626 m_perspectives_menu
->Append(ID_CopyPerspectiveCode
, _("Copy Perspective Data To Clipboard"));
627 m_perspectives_menu
->AppendSeparator();
628 m_perspectives_menu
->Append(ID_FirstPerspective
+0, _("Default Startup"));
629 m_perspectives_menu
->Append(ID_FirstPerspective
+1, _("All Panes"));
631 wxMenu
* help_menu
= new wxMenu
;
632 help_menu
->Append(wxID_ABOUT
, _("About..."));
634 mb
->Append(file_menu
, _("File"));
635 mb
->Append(view_menu
, _("View"));
636 mb
->Append(m_perspectives_menu
, _("Perspectives"));
637 mb
->Append(options_menu
, _("Options"));
638 mb
->Append(help_menu
, _("Help"));
643 GetStatusBar()->SetStatusText(_("Ready"));
646 // min size for the frame itself isn't completely done.
647 // see the end up wxFrameManager::Update() for the test
648 // code. For now, just hard code a frame minimum size
649 SetMinSize(wxSize(400,300));
651 // create some toolbars
652 wxToolBar
* tb1
= new wxToolBar(this, wxID_ANY
, wxDefaultPosition
, wxDefaultSize
,
653 wxTB_FLAT
| wxTB_NODIVIDER
);
654 tb1
->SetToolBitmapSize(wxSize(48,48));
655 tb1
->AddTool(101, wxT("Test"), wxArtProvider::GetBitmap(wxART_ERROR
));
657 tb1
->AddTool(102, wxT("Test"), wxArtProvider::GetBitmap(wxART_QUESTION
));
658 tb1
->AddTool(103, wxT("Test"), wxArtProvider::GetBitmap(wxART_INFORMATION
));
659 tb1
->AddTool(103, wxT("Test"), wxArtProvider::GetBitmap(wxART_WARNING
));
660 tb1
->AddTool(103, wxT("Test"), wxArtProvider::GetBitmap(wxART_MISSING_IMAGE
));
665 wxToolBar
* tb2
= new wxToolBar(this, wxID_ANY
, wxDefaultPosition
, wxDefaultSize
,
666 wxTB_FLAT
| wxTB_NODIVIDER
);
667 tb2
->SetToolBitmapSize(wxSize(16,16));
669 wxBitmap tb2_bmp1
= wxArtProvider::GetBitmap(wxART_QUESTION
, wxART_OTHER
, wxSize(16,16));
670 tb2
->AddTool(101, wxT("Test"), tb2_bmp1
);
671 tb2
->AddTool(101, wxT("Test"), tb2_bmp1
);
672 tb2
->AddTool(101, wxT("Test"), tb2_bmp1
);
673 tb2
->AddTool(101, wxT("Test"), tb2_bmp1
);
675 tb2
->AddTool(101, wxT("Test"), tb2_bmp1
);
676 tb2
->AddTool(101, wxT("Test"), tb2_bmp1
);
678 tb2
->AddTool(101, wxT("Test"), tb2_bmp1
);
679 tb2
->AddTool(101, wxT("Test"), tb2_bmp1
);
680 tb2
->AddTool(101, wxT("Test"), tb2_bmp1
);
681 tb2
->AddTool(101, wxT("Test"), tb2_bmp1
);
685 wxToolBar
* tb3
= new wxToolBar(this, wxID_ANY
, wxDefaultPosition
, wxDefaultSize
,
686 wxTB_FLAT
| wxTB_NODIVIDER
);
687 tb3
->SetToolBitmapSize(wxSize(16,16));
688 wxBitmap tb3_bmp1
= wxArtProvider::GetBitmap(wxART_FOLDER
, wxART_OTHER
, wxSize(16,16));
689 tb3
->AddTool(101, wxT("Test"), tb3_bmp1
);
690 tb3
->AddTool(101, wxT("Test"), tb3_bmp1
);
691 tb3
->AddTool(101, wxT("Test"), tb3_bmp1
);
692 tb3
->AddTool(101, wxT("Test"), tb3_bmp1
);
694 tb3
->AddTool(101, wxT("Test"), tb3_bmp1
);
695 tb3
->AddTool(101, wxT("Test"), tb3_bmp1
);
700 wxToolBar
* tb4
= new wxToolBar(this, wxID_ANY
, wxDefaultPosition
, wxDefaultSize
,
701 wxTB_FLAT
| wxTB_NODIVIDER
| wxTB_HORZ_TEXT
);
702 tb4
->SetToolBitmapSize(wxSize(16,16));
703 wxBitmap tb4_bmp1
= wxArtProvider::GetBitmap(wxART_NORMAL_FILE
, wxART_OTHER
, wxSize(16,16));
704 tb4
->AddTool(101, wxT("Item 1"), tb4_bmp1
);
705 tb4
->AddTool(101, wxT("Item 2"), tb4_bmp1
);
706 tb4
->AddTool(101, wxT("Item 3"), tb4_bmp1
);
707 tb4
->AddTool(101, wxT("Item 4"), tb4_bmp1
);
709 tb4
->AddTool(101, wxT("Item 5"), tb4_bmp1
);
710 tb4
->AddTool(101, wxT("Item 6"), tb4_bmp1
);
711 tb4
->AddTool(101, wxT("Item 7"), tb4_bmp1
);
712 tb4
->AddTool(101, wxT("Item 8"), tb4_bmp1
);
715 // create some toolbars
716 wxToolBar
* tb5
= new wxToolBar(this, wxID_ANY
, wxDefaultPosition
, wxDefaultSize
,
717 wxTB_FLAT
| wxTB_NODIVIDER
| wxTB_VERTICAL
);
718 tb5
->SetToolBitmapSize(wxSize(48,48));
719 tb5
->AddTool(101, wxT("Test"), wxArtProvider::GetBitmap(wxART_ERROR
));
721 tb5
->AddTool(102, wxT("Test"), wxArtProvider::GetBitmap(wxART_QUESTION
));
722 tb5
->AddTool(103, wxT("Test"), wxArtProvider::GetBitmap(wxART_INFORMATION
));
723 tb5
->AddTool(103, wxT("Test"), wxArtProvider::GetBitmap(wxART_WARNING
));
724 tb5
->AddTool(103, wxT("Test"), wxArtProvider::GetBitmap(wxART_MISSING_IMAGE
));
728 // add a bunch of panes
729 m_mgr
.AddPane(CreateSizeReportCtrl(), wxPaneInfo().
730 Name(wxT("test1")).Caption(wxT("Pane Caption")).
733 m_mgr
.AddPane(CreateSizeReportCtrl(), wxPaneInfo().
734 Name(wxT("test2")).Caption(wxT("Client Size Reporter")).
735 Bottom().Position(1));
737 m_mgr
.AddPane(CreateSizeReportCtrl(), wxPaneInfo().
738 Name(wxT("test3")).Caption(wxT("Client Size Reporter")).
741 m_mgr
.AddPane(CreateSizeReportCtrl(), wxPaneInfo().
742 Name(wxT("test4")).Caption(wxT("Pane Caption")).
745 m_mgr
.AddPane(CreateSizeReportCtrl(), wxPaneInfo().
746 Name(wxT("test5")).Caption(wxT("Pane Caption")).
749 m_mgr
.AddPane(CreateSizeReportCtrl(), wxPaneInfo().
750 Name(wxT("test6")).Caption(wxT("Client Size Reporter")).
753 m_mgr
.AddPane(CreateSizeReportCtrl(), wxPaneInfo().
754 Name(wxT("test7")).Caption(wxT("Client Size Reporter")).
757 m_mgr
.AddPane(CreateTreeCtrl(), wxPaneInfo().
758 Name(wxT("test8")).Caption(wxT("Tree Pane")).
759 Left().Layer(1).Position(1));
761 m_mgr
.AddPane(CreateSizeReportCtrl(), wxPaneInfo().
762 Name(wxT("test9")).Caption(wxT("Min Size 200x100")).
763 BestSize(wxSize(200,100)).MinSize(wxSize(200,100)).
766 m_mgr
.AddPane(CreateTextCtrl(), wxPaneInfo().
767 Name(wxT("test10")).Caption(wxT("Text Pane")).
768 Bottom().Layer(1).Position(1));
770 m_mgr
.AddPane(CreateSizeReportCtrl(), wxPaneInfo().
771 Name(wxT("test11")).Caption(wxT("Fixed Pane")).
772 Bottom().Layer(1).Position(2).Fixed());
775 m_mgr
.AddPane(new SettingsPanel(this,this), wxPaneInfo().
776 Name(wxT("settings")).Caption(wxT("Dock Manager Settings")).
777 Dockable(false).Float().Hide());
779 // create some center panes
781 m_mgr
.AddPane(CreateGrid(), wxPaneInfo().Name(wxT("grid_content")).
782 CenterPane().Hide());
784 m_mgr
.AddPane(CreateTreeCtrl(), wxPaneInfo().Name(wxT("tree_content")).
785 CenterPane().Hide());
787 m_mgr
.AddPane(CreateSizeReportCtrl(), wxPaneInfo().Name(wxT("sizereport_content")).
788 CenterPane().Hide());
790 m_mgr
.AddPane(CreateTextCtrl(), wxPaneInfo().Name(wxT("text_content")).
791 CenterPane().Hide());
793 m_mgr
.AddPane(CreateHTMLCtrl(), wxPaneInfo().Name(wxT("html_content")).
796 // add the toolbars to the manager
798 m_mgr
.AddPane(tb1
, wxPaneInfo().
799 Name(wxT("tb1")).Caption(wxT("Big Toolbar")).
801 LeftDockable(false).RightDockable(false));
803 m_mgr
.AddPane(tb2
, wxPaneInfo().
804 Name(wxT("tb2")).Caption(wxT("Toolbar 2")).
805 ToolbarPane().Top().Row(1).
806 LeftDockable(false).RightDockable(false));
808 m_mgr
.AddPane(tb3
, wxPaneInfo().
809 Name(wxT("tb3")).Caption(wxT("Toolbar 3")).
810 ToolbarPane().Top().Row(1).Position(1).
811 LeftDockable(false).RightDockable(false));
813 m_mgr
.AddPane(tb4
, wxPaneInfo().
814 Name(wxT("tb4")).Caption(wxT("Sample Bookmark Toolbar")).
815 ToolbarPane().Top().Row(2).
816 LeftDockable(false).RightDockable(false));
818 m_mgr
.AddPane(tb5
, wxPaneInfo().
819 Name(wxT("tb4")).Caption(wxT("Sample Vertical Toolbar")).
820 ToolbarPane().Left().
822 TopDockable(false).BottomDockable(false));
824 m_mgr
.AddPane(new wxButton(this, wxID_ANY
, _("Test Button")),
825 wxPaneInfo().Name(wxT("tb5")).
826 ToolbarPane().Top().Row(2).Position(1).
827 LeftDockable(false).RightDockable(false));
831 // make some default perspectives
833 wxString perspective_all
= m_mgr
.SavePerspective();
836 wxPaneInfoArray
& all_panes
= m_mgr
.GetAllPanes();
837 for (i
= 0, count
= all_panes
.GetCount(); i
< count
; ++i
)
838 if (!all_panes
.Item(i
).IsToolbar())
839 all_panes
.Item(i
).Hide();
840 m_mgr
.GetPane(wxT("tb1")).Hide();
841 m_mgr
.GetPane(wxT("tb5")).Hide();
842 m_mgr
.GetPane(wxT("test8")).Show().Left().Layer(0).Row(0).Position(0);
843 m_mgr
.GetPane(wxT("test10")).Show().Bottom().Layer(0).Row(0).Position(0);
844 m_mgr
.GetPane(wxT("html_content")).Show();
845 wxString perspective_default
= m_mgr
.SavePerspective();
847 m_perspectives
.Add(perspective_default
);
848 m_perspectives
.Add(perspective_all
);
850 // "commit" all changes made to wxFrameManager
859 wxDockArt
* MyFrame::GetDockArt()
861 return m_mgr
.GetArtProvider();
864 void MyFrame::DoUpdate()
870 void MyFrame::OnEraseBackground(wxEraseEvent
& event
)
875 void MyFrame::OnSize(wxSizeEvent
& event
)
880 void MyFrame::OnSettings(wxCommandEvent
& WXUNUSED(event
))
882 // show the settings pane, and float it
883 wxPaneInfo
& floating_pane
= m_mgr
.GetPane(wxT("settings")).Float().Show();
885 if (floating_pane
.floating_pos
== wxDefaultPosition
)
886 floating_pane
.FloatingPosition(GetStartPosition());
892 void MyFrame::OnGradient(wxCommandEvent
& event
)
896 switch (event
.GetId())
898 case ID_NoGradient
: gradient
= wxAUI_GRADIENT_NONE
; break;
899 case ID_VerticalGradient
: gradient
= wxAUI_GRADIENT_VERTICAL
; break;
900 case ID_HorizontalGradient
: gradient
= wxAUI_GRADIENT_HORIZONTAL
; break;
903 m_mgr
.GetArtProvider()->SetMetric(wxAUI_ART_GRADIENT_TYPE
, gradient
);
907 void MyFrame::OnManagerFlag(wxCommandEvent
& event
)
909 unsigned int flag
= 0;
912 if (event
.GetId() == ID_TransparentDrag
||
913 event
.GetId() == ID_TransparentHint
||
914 event
.GetId() == ID_TransparentHintFade
)
916 wxMessageBox(wxT("This option is presently only available on wxMSW"));
921 switch (event
.GetId())
923 case ID_AllowFloating
: flag
= wxAUI_MGR_ALLOW_FLOATING
; break;
924 case ID_TransparentDrag
: flag
= wxAUI_MGR_TRANSPARENT_DRAG
; break;
925 case ID_TransparentHint
: flag
= wxAUI_MGR_TRANSPARENT_HINT
; break;
926 case ID_TransparentHintFade
: flag
= wxAUI_MGR_TRANSPARENT_HINT_FADE
; break;
927 case ID_AllowActivePane
: flag
= wxAUI_MGR_ALLOW_ACTIVE_PANE
; break;
929 m_mgr
.SetFlags(m_mgr
.GetFlags() ^ flag
);
933 void MyFrame::OnUpdateUI(wxUpdateUIEvent
& event
)
935 unsigned int flags
= m_mgr
.GetFlags();
937 switch (event
.GetId())
940 event
.Check(m_mgr
.GetArtProvider()->GetMetric(wxAUI_ART_GRADIENT_TYPE
) == wxAUI_GRADIENT_NONE
? true : false);
942 case ID_VerticalGradient
:
943 event
.Check(m_mgr
.GetArtProvider()->GetMetric(wxAUI_ART_GRADIENT_TYPE
) == wxAUI_GRADIENT_VERTICAL
? true : false);
945 case ID_HorizontalGradient
:
946 event
.Check(m_mgr
.GetArtProvider()->GetMetric(wxAUI_ART_GRADIENT_TYPE
) == wxAUI_GRADIENT_HORIZONTAL
? true : false);
948 case ID_AllowFloating
:
949 event
.Check(flags
& wxAUI_MGR_ALLOW_FLOATING
? true : false);
951 case ID_TransparentDrag
:
952 event
.Check(flags
& wxAUI_MGR_TRANSPARENT_DRAG
? true : false);
954 case ID_TransparentHint
:
955 event
.Check(flags
& wxAUI_MGR_TRANSPARENT_HINT
? true : false);
957 case ID_TransparentHintFade
:
958 event
.Check(flags
& wxAUI_MGR_TRANSPARENT_HINT_FADE
? true : false);
963 void MyFrame::OnCreatePerspective(wxCommandEvent
& WXUNUSED(event
))
965 wxTextEntryDialog
dlg(this, wxT("Enter a name for the new perspective:"),
968 dlg
.SetValue(wxString::Format(wxT("Perspective %d"), m_perspectives
.GetCount()+1));
969 if (dlg
.ShowModal() != wxID_OK
)
972 if (m_perspectives
.GetCount() == 0)
974 m_perspectives_menu
->AppendSeparator();
977 m_perspectives_menu
->Append(ID_FirstPerspective
+ m_perspectives
.GetCount(), dlg
.GetValue());
978 m_perspectives
.Add(m_mgr
.SavePerspective());
981 void MyFrame::OnCopyPerspectiveCode(wxCommandEvent
& WXUNUSED(event
))
983 wxString s
= m_mgr
.SavePerspective();
986 if (wxTheClipboard
->Open())
988 wxTheClipboard
->SetData(new wxTextDataObject(s
));
989 wxTheClipboard
->Close();
994 void MyFrame::OnRestorePerspective(wxCommandEvent
& event
)
996 m_mgr
.LoadPerspective(m_perspectives
.Item(event
.GetId() - ID_FirstPerspective
));
1000 wxPoint
MyFrame::GetStartPosition()
1004 wxPoint pt
= ClientToScreen(wxPoint(0,0));
1005 return wxPoint(pt
.x
+ x
, pt
.y
+ x
);
1008 void MyFrame::OnCreateTree(wxCommandEvent
& WXUNUSED(event
))
1010 m_mgr
.AddPane(CreateTreeCtrl(), wxPaneInfo().
1011 Name(wxT("Test")).Caption(wxT("Tree Control")).
1012 Float().FloatingPosition(GetStartPosition()).
1013 FloatingSize(wxSize(150,300)));
1017 void MyFrame::OnCreateGrid(wxCommandEvent
& WXUNUSED(event
))
1019 m_mgr
.AddPane(CreateGrid(), wxPaneInfo().
1020 Name(wxT("Test")).Caption(wxT("Grid")).
1021 Float().FloatingPosition(GetStartPosition()).
1022 FloatingSize(wxSize(300,200)));
1026 void MyFrame::OnCreateHTML(wxCommandEvent
& WXUNUSED(event
))
1028 m_mgr
.AddPane(CreateHTMLCtrl(), wxPaneInfo().
1029 Name(wxT("Test")).Caption(wxT("Grid")).
1030 Float().FloatingPosition(GetStartPosition()).
1031 FloatingSize(wxSize(300,200)));
1035 void MyFrame::OnCreateText(wxCommandEvent
& WXUNUSED(event
))
1037 m_mgr
.AddPane(CreateTextCtrl(), wxPaneInfo().
1038 Name(wxT("Test")).Caption(wxT("Text Control")).
1039 Float().FloatingPosition(GetStartPosition()));
1043 void MyFrame::OnCreateSizeReport(wxCommandEvent
& WXUNUSED(event
))
1045 m_mgr
.AddPane(CreateSizeReportCtrl(), wxPaneInfo().
1046 Name(wxT("Test")).Caption(wxT("Client Size Reporter")).
1047 Float().FloatingPosition(GetStartPosition()));
1051 void MyFrame::OnChangeContentPane(wxCommandEvent
& event
)
1053 m_mgr
.GetPane(wxT("grid_content")).Show(event
.GetId() == ID_GridContent
? true:false);
1054 m_mgr
.GetPane(wxT("text_content")).Show(event
.GetId() == ID_TextContent
? true:false);
1055 m_mgr
.GetPane(wxT("tree_content")).Show(event
.GetId() == ID_TreeContent
? true:false);
1056 m_mgr
.GetPane(wxT("sizereport_content")).Show(event
.GetId() == ID_SizeReportContent
? true:false);
1057 m_mgr
.GetPane(wxT("html_content")).Show(event
.GetId() == ID_HTMLContent
? true:false);
1061 void MyFrame::OnExit(wxCommandEvent
& WXUNUSED(event
))
1066 void MyFrame::OnAbout(wxCommandEvent
& WXUNUSED(event
))
1068 wxMessageBox(_("wxAUI Demo\nAn advanced window management library for wxWidgets\n(c) Copyright 2005-2006, Kirix Corporation"), _("About wxAUI Demo"), wxOK
, this);
1071 wxTextCtrl
* MyFrame::CreateTextCtrl()
1076 text
.Printf(wxT("This is text box %d"), ++n
);
1078 return new wxTextCtrl(this,wxID_ANY
, text
,
1079 wxPoint(0,0), wxSize(150,90),
1080 wxNO_BORDER
| wxTE_MULTILINE
);
1084 wxGrid
* MyFrame::CreateGrid()
1086 wxGrid
* grid
= new wxGrid(this, wxID_ANY
,
1089 wxNO_BORDER
| wxWANTS_CHARS
);
1090 grid
->CreateGrid(50, 20);
1094 wxTreeCtrl
* MyFrame::CreateTreeCtrl()
1096 wxTreeCtrl
* tree
= new wxTreeCtrl(this, wxID_ANY
,
1097 wxPoint(0,0), wxSize(160,250),
1098 wxTR_DEFAULT_STYLE
| wxNO_BORDER
);
1100 wxTreeItemId root
= tree
->AddRoot(wxT("wxAUI Project"));
1101 wxArrayTreeItemIds items
;
1104 wxImageList
* imglist
= new wxImageList(16, 16, true, 2);
1105 imglist
->Add(wxArtProvider::GetBitmap(wxART_FOLDER
, wxART_OTHER
, wxSize(16,16)));
1106 imglist
->Add(wxArtProvider::GetBitmap(wxART_NORMAL_FILE
, wxART_OTHER
, wxSize(16,16)));
1107 tree
->AssignImageList(imglist
);
1109 items
.Add(tree
->AppendItem(root
, wxT("Item 1"), 0));
1110 items
.Add(tree
->AppendItem(root
, wxT("Item 2"), 0));
1111 items
.Add(tree
->AppendItem(root
, wxT("Item 3"), 0));
1112 items
.Add(tree
->AppendItem(root
, wxT("Item 4"), 0));
1113 items
.Add(tree
->AppendItem(root
, wxT("Item 5"), 0));
1117 for (i
= 0, count
= items
.Count(); i
< count
; ++i
)
1119 wxTreeItemId id
= items
.Item(i
);
1120 tree
->AppendItem(id
, wxT("Subitem 1"), 1);
1121 tree
->AppendItem(id
, wxT("Subitem 2"), 1);
1122 tree
->AppendItem(id
, wxT("Subitem 3"), 1);
1123 tree
->AppendItem(id
, wxT("Subitem 4"), 1);
1124 tree
->AppendItem(id
, wxT("Subitem 5"), 1);
1133 wxSizeReportCtrl
* MyFrame::CreateSizeReportCtrl(int width
, int height
)
1135 wxSizeReportCtrl
* ctrl
= new wxSizeReportCtrl(this, wxID_ANY
,
1137 wxSize(width
, height
), &m_mgr
);
1141 wxHtmlWindow
* MyFrame::CreateHTMLCtrl()
1143 wxHtmlWindow
* ctrl
= new wxHtmlWindow(this, wxID_ANY
,
1146 ctrl
->SetPage(GetIntroText());
1151 wxString
MyFrame::GetIntroText()
1155 "<h3>Welcome to wxAUI 0.9.2</h3>"
1156 "<br/><b>Overview</b><br/>"
1157 "<p>wxAUI is an Advanced User Interface library for the wxWidgets toolkit "
1158 "that allows developers to create high-quality, cross-platform user "
1159 "interfaces quickly and easily.</p>"
1160 "<p><b>Features</b></p>"
1161 "<p>With wxAUI version 0.9.2, developers can create application frameworks with:</p>"
1163 "<li>Native, dockable floating frames</li>"
1164 "<li>Perspective saving and loading</li>"
1165 "<li>Native toolbars incorporating real-time, "spring-loaded" dragging</li>"
1166 "<li>Customizable floating/docking behavior</li>"
1167 "<li>Completely customizable look-and-feel</li>"
1168 "<li>Optional transparent window effects (while dragging or docking)</li>"
1170 "<p><b>What's new in 0.9.2?</b></p>"
1171 "<p>The following features/fixes have been added since the last version of wxAUI:</p>"
1173 "<li>Support for wxMac</li>"
1174 "<li>Updates for wxWidgets 2.6.3</li>"
1175 "<li>Fix to pass more unused events through</li>"
1176 "<li>Fix to allow floating windows to receive idle events</li>"
1177 "<li>Fix for minimizing/maximizing problem with transparent hint pane</li>"
1178 "<li>Fix to not paint empty hint rectangles</li>"
1179 "<li>Fix for 64-bit compilation</li>"
1181 "<p><b>What changed in 0.9.1?</b></p>"
1182 "<p>The following features/fixes were added in wxAUI 0.9.1:</p>"
1184 "<li>Support for MDI frames</li>"
1185 "<li>Gradient captions option</li>"
1186 "<li>Active/Inactive panes option</li>"
1187 "<li>Fix for screen artifacts/paint problems</li>"
1188 "<li>Fix for hiding/showing floated window problem</li>"
1189 "<li>Fix for floating pane sizing problem</li>"
1190 "<li>Fix for drop position problem when dragging around center pane margins</li>"
1191 "<li>LF-only text file formatting for source code</li>"
1193 "<p>See README.txt for more information.</p>"
1196 return wxString::FromAscii(text
);