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