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