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