]> git.saurik.com Git - wxWidgets.git/blame - include/wx/aui/framemanager.h
we have to export every virtual method in this template class for clang, next attempt...
[wxWidgets.git] / include / wx / aui / framemanager.h
CommitLineData
50acee04 1///////////////////////////////////////////////////////////////////////////////
be66f18e 2// Name: wx/aui/framemanager.h
50acee04
JS
3// Purpose: wxaui: wx advanced user interface - docking window manager
4// Author: Benjamin I. Williams
5// Modified by:
6// Created: 2005-05-17
be66f18e 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#ifndef _WX_FRAMEMANAGER_H_
13#define _WX_FRAMEMANAGER_H_
14
15// ----------------------------------------------------------------------------
16// headers
17// ----------------------------------------------------------------------------
18
19#include "wx/defs.h"
20
21#if wxUSE_AUI
22
08469b1f
JS
23#include "wx/dynarray.h"
24#include "wx/gdicmn.h"
25#include "wx/window.h"
26#include "wx/timer.h"
27#include "wx/sizer.h"
7748d3d5 28#include "wx/bitmap.h"
08469b1f 29
a3a5df9d 30enum wxAuiManagerDock
50acee04
JS
31{
32 wxAUI_DOCK_NONE = 0,
33 wxAUI_DOCK_TOP = 1,
34 wxAUI_DOCK_RIGHT = 2,
35 wxAUI_DOCK_BOTTOM = 3,
36 wxAUI_DOCK_LEFT = 4,
37 wxAUI_DOCK_CENTER = 5,
38 wxAUI_DOCK_CENTRE = wxAUI_DOCK_CENTER
39};
40
a3a5df9d 41enum wxAuiManagerOption
50acee04 42{
cf6fec73
BW
43 wxAUI_MGR_ALLOW_FLOATING = 1 << 0,
44 wxAUI_MGR_ALLOW_ACTIVE_PANE = 1 << 1,
45 wxAUI_MGR_TRANSPARENT_DRAG = 1 << 2,
46 wxAUI_MGR_TRANSPARENT_HINT = 1 << 3,
47 wxAUI_MGR_VENETIAN_BLINDS_HINT = 1 << 4,
48 wxAUI_MGR_RECTANGLE_HINT = 1 << 5,
49 wxAUI_MGR_HINT_FADE = 1 << 6,
50 wxAUI_MGR_NO_VENETIAN_BLINDS_FADE = 1 << 7,
68030cae 51 wxAUI_MGR_LIVE_RESIZE = 1 << 8,
50acee04
JS
52
53 wxAUI_MGR_DEFAULT = wxAUI_MGR_ALLOW_FLOATING |
54 wxAUI_MGR_TRANSPARENT_HINT |
cf6fec73
BW
55 wxAUI_MGR_HINT_FADE |
56 wxAUI_MGR_NO_VENETIAN_BLINDS_FADE
50acee04
JS
57};
58
cf6fec73 59
a3a5df9d 60enum wxAuiPaneDockArtSetting
50acee04 61{
254a3429
BW
62 wxAUI_DOCKART_SASH_SIZE = 0,
63 wxAUI_DOCKART_CAPTION_SIZE = 1,
64 wxAUI_DOCKART_GRIPPER_SIZE = 2,
65 wxAUI_DOCKART_PANE_BORDER_SIZE = 3,
66 wxAUI_DOCKART_PANE_BUTTON_SIZE = 4,
67 wxAUI_DOCKART_BACKGROUND_COLOUR = 5,
68 wxAUI_DOCKART_SASH_COLOUR = 6,
69 wxAUI_DOCKART_ACTIVE_CAPTION_COLOUR = 7,
70 wxAUI_DOCKART_ACTIVE_CAPTION_GRADIENT_COLOUR = 8,
71 wxAUI_DOCKART_INACTIVE_CAPTION_COLOUR = 9,
72 wxAUI_DOCKART_INACTIVE_CAPTION_GRADIENT_COLOUR = 10,
73 wxAUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR = 11,
74 wxAUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR = 12,
75 wxAUI_DOCKART_BORDER_COLOUR = 13,
76 wxAUI_DOCKART_GRIPPER_COLOUR = 14,
77 wxAUI_DOCKART_CAPTION_FONT = 15,
78 wxAUI_DOCKART_GRADIENT_TYPE = 16
50acee04
JS
79};
80
a3a5df9d 81enum wxAuiPaneDockArtGradients
50acee04
JS
82{
83 wxAUI_GRADIENT_NONE = 0,
84 wxAUI_GRADIENT_VERTICAL = 1,
85 wxAUI_GRADIENT_HORIZONTAL = 2
86};
87
a3a5df9d 88enum wxAuiPaneButtonState
50acee04 89{
4953f8cf
BW
90 wxAUI_BUTTON_STATE_NORMAL = 0,
91 wxAUI_BUTTON_STATE_HOVER = 1 << 1,
92 wxAUI_BUTTON_STATE_PRESSED = 1 << 2,
93 wxAUI_BUTTON_STATE_DISABLED = 1 << 3,
0a5bb138
BW
94 wxAUI_BUTTON_STATE_HIDDEN = 1 << 4,
95 wxAUI_BUTTON_STATE_CHECKED = 1 << 5
4953f8cf
BW
96};
97
98enum wxAuiButtonId
99{
100 wxAUI_BUTTON_CLOSE = 101,
37106ab2 101 wxAUI_BUTTON_MAXIMIZE_RESTORE = 102,
4953f8cf
BW
102 wxAUI_BUTTON_MINIMIZE = 103,
103 wxAUI_BUTTON_PIN = 104,
104 wxAUI_BUTTON_OPTIONS = 105,
01372b8f
BW
105 wxAUI_BUTTON_WINDOWLIST = 106,
106 wxAUI_BUTTON_LEFT = 107,
107 wxAUI_BUTTON_RIGHT = 108,
108 wxAUI_BUTTON_UP = 109,
109 wxAUI_BUTTON_DOWN = 110,
4953f8cf
BW
110 wxAUI_BUTTON_CUSTOM1 = 201,
111 wxAUI_BUTTON_CUSTOM2 = 202,
112 wxAUI_BUTTON_CUSTOM3 = 203
50acee04
JS
113};
114
a3a5df9d 115enum wxAuiPaneInsertLevel
50acee04
JS
116{
117 wxAUI_INSERT_PANE = 0,
118 wxAUI_INSERT_ROW = 1,
119 wxAUI_INSERT_DOCK = 2
120};
121
122
123
4953f8cf 124
50acee04 125// forwards and array declarations
a3a5df9d
BW
126class wxAuiDockUIPart;
127class wxAuiPaneButton;
128class wxAuiPaneInfo;
129class wxAuiDockInfo;
130class wxAuiDockArt;
131class wxAuiManagerEvent;
50acee04 132
06d4c4d6 133#ifndef SWIG
a3a5df9d
BW
134WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiDockInfo, wxAuiDockInfoArray, WXDLLIMPEXP_AUI);
135WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiDockUIPart, wxAuiDockUIPartArray, WXDLLIMPEXP_AUI);
136WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiPaneButton, wxAuiPaneButtonArray, WXDLLIMPEXP_AUI);
137WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiPaneInfo, wxAuiPaneInfoArray, WXDLLIMPEXP_AUI);
138WX_DEFINE_USER_EXPORTED_ARRAY_PTR(wxAuiPaneInfo*, wxAuiPaneInfoPtrArray, class WXDLLIMPEXP_AUI);
139WX_DEFINE_USER_EXPORTED_ARRAY_PTR(wxAuiDockInfo*, wxAuiDockInfoPtrArray, class WXDLLIMPEXP_AUI);
06d4c4d6 140#endif // SWIG
50acee04 141
a3a5df9d
BW
142extern WXDLLIMPEXP_AUI wxAuiDockInfo wxAuiNullDockInfo;
143extern WXDLLIMPEXP_AUI wxAuiPaneInfo wxAuiNullPaneInfo;
50acee04
JS
144
145
146
a3a5df9d 147class WXDLLIMPEXP_AUI wxAuiPaneInfo
50acee04
JS
148{
149public:
150
a3a5df9d 151 wxAuiPaneInfo()
50acee04
JS
152 {
153 window = NULL;
154 frame = NULL;
155 state = 0;
156 dock_direction = wxAUI_DOCK_LEFT;
157 dock_layer = 0;
158 dock_row = 0;
159 dock_pos = 0;
160 floating_pos = wxDefaultPosition;
161 floating_size = wxDefaultSize;
162 best_size = wxDefaultSize;
163 min_size = wxDefaultSize;
164 max_size = wxDefaultSize;
165 dock_proportion = 0;
be66f18e 166
50acee04
JS
167 DefaultPane();
168 }
169
a3a5df9d 170 ~wxAuiPaneInfo() {}
858a3a7a 171
06d4c4d6 172#ifndef SWIG
a3a5df9d 173 wxAuiPaneInfo(const wxAuiPaneInfo& c)
50acee04
JS
174 {
175 name = c.name;
176 caption = c.caption;
4254f672 177 icon = c.icon;
50acee04
JS
178 window = c.window;
179 frame = c.frame;
180 state = c.state;
181 dock_direction = c.dock_direction;
182 dock_layer = c.dock_layer;
183 dock_row = c.dock_row;
184 dock_pos = c.dock_pos;
185 best_size = c.best_size;
186 min_size = c.min_size;
187 max_size = c.max_size;
188 floating_pos = c.floating_pos;
189 floating_size = c.floating_size;
190 dock_proportion = c.dock_proportion;
191 buttons = c.buttons;
192 rect = c.rect;
193 }
194
a3a5df9d 195 wxAuiPaneInfo& operator=(const wxAuiPaneInfo& c)
50acee04
JS
196 {
197 name = c.name;
198 caption = c.caption;
199 window = c.window;
200 frame = c.frame;
201 state = c.state;
202 dock_direction = c.dock_direction;
203 dock_layer = c.dock_layer;
204 dock_row = c.dock_row;
205 dock_pos = c.dock_pos;
206 best_size = c.best_size;
207 min_size = c.min_size;
208 max_size = c.max_size;
209 floating_pos = c.floating_pos;
210 floating_size = c.floating_size;
211 dock_proportion = c.dock_proportion;
212 buttons = c.buttons;
213 rect = c.rect;
214 return *this;
215 }
06d4c4d6 216#endif // SWIG
75c8d68f
AB
217
218 // Write the safe parts of a newly loaded PaneInfo structure "source" into "this"
219 // used on loading perspectives etc.
a3a5df9d 220 void SafeSet(wxAuiPaneInfo source)
75c8d68f
AB
221 {
222 // note source is not passed by reference so we can overwrite, to keep the
223 // unsafe bits of "dest"
224 source.window = window;
225 source.frame = frame;
226 source.buttons = buttons;
e5dcae09
VZ
227 wxCHECK_RET(source.IsValid(),
228 "window settings and pane settings are incompatible");
75c8d68f
AB
229 // now assign
230 *this = source;
231 }
232
cedd7b22 233 bool IsOk() const { return window != NULL; }
50acee04
JS
234 bool IsFixed() const { return !HasFlag(optionResizable); }
235 bool IsResizable() const { return HasFlag(optionResizable); }
236 bool IsShown() const { return !HasFlag(optionHidden); }
237 bool IsFloating() const { return HasFlag(optionFloating); }
238 bool IsDocked() const { return !HasFlag(optionFloating); }
239 bool IsToolbar() const { return HasFlag(optionToolbar); }
240 bool IsTopDockable() const { return HasFlag(optionTopDockable); }
241 bool IsBottomDockable() const { return HasFlag(optionBottomDockable); }
242 bool IsLeftDockable() const { return HasFlag(optionLeftDockable); }
243 bool IsRightDockable() const { return HasFlag(optionRightDockable); }
ab84bafe
VZ
244 bool IsDockable() const
245 {
246 return HasFlag(optionTopDockable | optionBottomDockable |
247 optionLeftDockable | optionRightDockable);
248 }
50acee04
JS
249 bool IsFloatable() const { return HasFlag(optionFloatable); }
250 bool IsMovable() const { return HasFlag(optionMovable); }
fa96a36e 251 bool IsDestroyOnClose() const { return HasFlag(optionDestroyOnClose); }
37106ab2 252 bool IsMaximized() const { return HasFlag(optionMaximized); }
50acee04
JS
253 bool HasCaption() const { return HasFlag(optionCaption); }
254 bool HasGripper() const { return HasFlag(optionGripper); }
255 bool HasBorder() const { return HasFlag(optionPaneBorder); }
256 bool HasCloseButton() const { return HasFlag(buttonClose); }
257 bool HasMaximizeButton() const { return HasFlag(buttonMaximize); }
258 bool HasMinimizeButton() const { return HasFlag(buttonMinimize); }
259 bool HasPinButton() const { return HasFlag(buttonPin); }
260 bool HasGripperTop() const { return HasFlag(optionGripperTop); }
be66f18e 261
06d4c4d6 262#ifdef SWIG
a3a5df9d 263 %typemap(out) wxAuiPaneInfo& { $result = $self; Py_INCREF($result); }
06d4c4d6 264#endif
e5dcae09
VZ
265 wxAuiPaneInfo& Window(wxWindow* w)
266 {
267 wxAuiPaneInfo test(*this);
268 test.window = w;
269 wxCHECK_MSG(test.IsValid(), *this,
270 "window settings and pane settings are incompatible");
271 *this = test;
272 return *this;
273 }
a3a5df9d
BW
274 wxAuiPaneInfo& Name(const wxString& n) { name = n; return *this; }
275 wxAuiPaneInfo& Caption(const wxString& c) { caption = c; return *this; }
4254f672 276 wxAuiPaneInfo& Icon(const wxBitmap& b) { icon = b; return *this; }
a3a5df9d
BW
277 wxAuiPaneInfo& Left() { dock_direction = wxAUI_DOCK_LEFT; return *this; }
278 wxAuiPaneInfo& Right() { dock_direction = wxAUI_DOCK_RIGHT; return *this; }
279 wxAuiPaneInfo& Top() { dock_direction = wxAUI_DOCK_TOP; return *this; }
280 wxAuiPaneInfo& Bottom() { dock_direction = wxAUI_DOCK_BOTTOM; return *this; }
281 wxAuiPaneInfo& Center() { dock_direction = wxAUI_DOCK_CENTER; return *this; }
282 wxAuiPaneInfo& Centre() { dock_direction = wxAUI_DOCK_CENTRE; return *this; }
283 wxAuiPaneInfo& Direction(int direction) { dock_direction = direction; return *this; }
284 wxAuiPaneInfo& Layer(int layer) { dock_layer = layer; return *this; }
285 wxAuiPaneInfo& Row(int row) { dock_row = row; return *this; }
286 wxAuiPaneInfo& Position(int pos) { dock_pos = pos; return *this; }
287 wxAuiPaneInfo& BestSize(const wxSize& size) { best_size = size; return *this; }
288 wxAuiPaneInfo& MinSize(const wxSize& size) { min_size = size; return *this; }
289 wxAuiPaneInfo& MaxSize(const wxSize& size) { max_size = size; return *this; }
290 wxAuiPaneInfo& BestSize(int x, int y) { best_size.Set(x,y); return *this; }
291 wxAuiPaneInfo& MinSize(int x, int y) { min_size.Set(x,y); return *this; }
292 wxAuiPaneInfo& MaxSize(int x, int y) { max_size.Set(x,y); return *this; }
293 wxAuiPaneInfo& FloatingPosition(const wxPoint& pos) { floating_pos = pos; return *this; }
294 wxAuiPaneInfo& FloatingPosition(int x, int y) { floating_pos.x = x; floating_pos.y = y; return *this; }
295 wxAuiPaneInfo& FloatingSize(const wxSize& size) { floating_size = size; return *this; }
296 wxAuiPaneInfo& FloatingSize(int x, int y) { floating_size.Set(x,y); return *this; }
297 wxAuiPaneInfo& Fixed() { return SetFlag(optionResizable, false); }
298 wxAuiPaneInfo& Resizable(bool resizable = true) { return SetFlag(optionResizable, resizable); }
299 wxAuiPaneInfo& Dock() { return SetFlag(optionFloating, false); }
300 wxAuiPaneInfo& Float() { return SetFlag(optionFloating, true); }
301 wxAuiPaneInfo& Hide() { return SetFlag(optionHidden, true); }
302 wxAuiPaneInfo& Show(bool show = true) { return SetFlag(optionHidden, !show); }
303 wxAuiPaneInfo& CaptionVisible(bool visible = true) { return SetFlag(optionCaption, visible); }
304 wxAuiPaneInfo& Maximize() { return SetFlag(optionMaximized, true); }
305 wxAuiPaneInfo& Restore() { return SetFlag(optionMaximized, false); }
306 wxAuiPaneInfo& PaneBorder(bool visible = true) { return SetFlag(optionPaneBorder, visible); }
307 wxAuiPaneInfo& Gripper(bool visible = true) { return SetFlag(optionGripper, visible); }
308 wxAuiPaneInfo& GripperTop(bool attop = true) { return SetFlag(optionGripperTop, attop); }
309 wxAuiPaneInfo& CloseButton(bool visible = true) { return SetFlag(buttonClose, visible); }
310 wxAuiPaneInfo& MaximizeButton(bool visible = true) { return SetFlag(buttonMaximize, visible); }
311 wxAuiPaneInfo& MinimizeButton(bool visible = true) { return SetFlag(buttonMinimize, visible); }
312 wxAuiPaneInfo& PinButton(bool visible = true) { return SetFlag(buttonPin, visible); }
313 wxAuiPaneInfo& DestroyOnClose(bool b = true) { return SetFlag(optionDestroyOnClose, b); }
314 wxAuiPaneInfo& TopDockable(bool b = true) { return SetFlag(optionTopDockable, b); }
315 wxAuiPaneInfo& BottomDockable(bool b = true) { return SetFlag(optionBottomDockable, b); }
316 wxAuiPaneInfo& LeftDockable(bool b = true) { return SetFlag(optionLeftDockable, b); }
317 wxAuiPaneInfo& RightDockable(bool b = true) { return SetFlag(optionRightDockable, b); }
318 wxAuiPaneInfo& Floatable(bool b = true) { return SetFlag(optionFloatable, b); }
319 wxAuiPaneInfo& Movable(bool b = true) { return SetFlag(optionMovable, b); }
c89e16e4 320 wxAuiPaneInfo& DockFixed(bool b = true) { return SetFlag(optionDockFixed, b); }
a3a5df9d 321
a3a5df9d 322 wxAuiPaneInfo& Dockable(bool b = true)
50acee04
JS
323 {
324 return TopDockable(b).BottomDockable(b).LeftDockable(b).RightDockable(b);
325 }
326
a3a5df9d 327 wxAuiPaneInfo& DefaultPane()
50acee04 328 {
e5dcae09
VZ
329 wxAuiPaneInfo test(*this);
330 test.state |= optionTopDockable | optionBottomDockable |
50acee04
JS
331 optionLeftDockable | optionRightDockable |
332 optionFloatable | optionMovable | optionResizable |
333 optionCaption | optionPaneBorder | buttonClose;
e5dcae09
VZ
334 wxCHECK_MSG(test.IsValid(), *this,
335 "window settings and pane settings are incompatible");
336 *this = test;
50acee04
JS
337 return *this;
338 }
be66f18e 339
a3a5df9d
BW
340 wxAuiPaneInfo& CentrePane() { return CenterPane(); }
341 wxAuiPaneInfo& CenterPane()
50acee04
JS
342 {
343 state = 0;
344 return Center().PaneBorder().Resizable();
345 }
be66f18e 346
a3a5df9d 347 wxAuiPaneInfo& ToolbarPane()
50acee04
JS
348 {
349 DefaultPane();
350 state |= (optionToolbar | optionGripper);
351 state &= ~(optionResizable | optionCaption);
352 if (dock_layer == 0)
353 dock_layer = 10;
354 return *this;
355 }
356
e227438f 357 wxAuiPaneInfo& SetFlag(int flag, bool option_state)
50acee04 358 {
e5dcae09 359 wxAuiPaneInfo test(*this);
50acee04 360 if (option_state)
e5dcae09 361 test.state |= flag;
cedd7b22 362 else
e5dcae09
VZ
363 test.state &= ~flag;
364 wxCHECK_MSG(test.IsValid(), *this,
365 "window settings and pane settings are incompatible");
366 *this = test;
50acee04
JS
367 return *this;
368 }
be66f18e 369
e227438f 370 bool HasFlag(int flag) const
50acee04 371 {
cedd7b22 372 return (state & flag) != 0;
50acee04
JS
373 }
374
06d4c4d6 375#ifdef SWIG
a3a5df9d 376 %typemap(out) wxAuiPaneInfo& ;
06d4c4d6 377#endif
858a3a7a 378
50acee04
JS
379public:
380
9f41bf0e
RD
381 // NOTE: You can add and subtract flags from this list,
382 // but do not change the values of the flags, because
858a3a7a 383 // they are stored in a binary integer format in the
9f41bf0e
RD
384 // perspective string. If you really need to change the
385 // values around, you'll have to ensure backwards-compatibility
386 // in the perspective loading code.
a3a5df9d 387 enum wxAuiPaneState
50acee04
JS
388 {
389 optionFloating = 1 << 0,
390 optionHidden = 1 << 1,
391 optionLeftDockable = 1 << 2,
392 optionRightDockable = 1 << 3,
393 optionTopDockable = 1 << 4,
394 optionBottomDockable = 1 << 5,
395 optionFloatable = 1 << 6,
396 optionMovable = 1 << 7,
397 optionResizable = 1 << 8,
398 optionPaneBorder = 1 << 9,
399 optionCaption = 1 << 10,
400 optionGripper = 1 << 11,
401 optionDestroyOnClose = 1 << 12,
402 optionToolbar = 1 << 13,
403 optionActive = 1 << 14,
be66f18e 404 optionGripperTop = 1 << 15,
37106ab2 405 optionMaximized = 1 << 16,
c89e16e4 406 optionDockFixed = 1 << 17,
8d0634ab 407
1dc6ec2c
BW
408 buttonClose = 1 << 21,
409 buttonMaximize = 1 << 22,
410 buttonMinimize = 1 << 23,
411 buttonPin = 1 << 24,
858a3a7a 412
8d0634ab
BW
413 buttonCustom1 = 1 << 26,
414 buttonCustom2 = 1 << 27,
415 buttonCustom3 = 1 << 28,
858a3a7a 416
8d0634ab 417 savedHiddenState = 1 << 30, // used internally
50acee04
JS
418 actionPane = 1 << 31 // used internally
419 };
420
421public:
422 wxString name; // name of the pane
423 wxString caption; // caption displayed on the window
4254f672 424 wxBitmap icon; // icon of the pane, may be invalid
50acee04
JS
425
426 wxWindow* window; // window that is in this pane
50f3c41d 427 wxFrame* frame; // floating frame window that holds the pane
50acee04
JS
428 unsigned int state; // a combination of wxPaneState values
429
430 int dock_direction; // dock direction (top, bottom, left, right, center)
431 int dock_layer; // layer number (0 = innermost layer)
432 int dock_row; // row number on the docking bar (0 = first row)
433 int dock_pos; // position inside the row (0 = first position)
434
435 wxSize best_size; // size that the layout engine will prefer
436 wxSize min_size; // minimum size the pane window can tolerate
437 wxSize max_size; // maximum size the pane window can tolerate
438
439 wxPoint floating_pos; // position while floating
440 wxSize floating_size; // size while floating
441 int dock_proportion; // proportion while docked
442
a3a5df9d 443 wxAuiPaneButtonArray buttons; // buttons on the pane
50acee04 444
4254f672 445
50acee04 446 wxRect rect; // current rectangle (populated by wxAUI)
e5dcae09
VZ
447
448 bool IsValid() const;
50acee04
JS
449};
450
451
452
1afad0ac
RR
453class WXDLLIMPEXP_FWD_AUI wxAuiFloatingFrame;
454
a3a5df9d 455class WXDLLIMPEXP_AUI wxAuiManager : public wxEvtHandler
50acee04 456{
601398b9 457 friend class wxAuiFloatingFrame;
50acee04
JS
458
459public:
460
9a29fe70 461 wxAuiManager(wxWindow* managedWnd = NULL,
50acee04 462 unsigned int flags = wxAUI_MGR_DEFAULT);
a3a5df9d 463 virtual ~wxAuiManager();
50acee04 464 void UnInit();
be66f18e 465
50acee04
JS
466 void SetFlags(unsigned int flags);
467 unsigned int GetFlags() const;
be66f18e 468
9a29fe70 469 void SetManagedWindow(wxWindow* managedWnd);
461125ea 470 wxWindow* GetManagedWindow() const;
be66f18e 471
4dc79cfb
BW
472 static wxAuiManager* GetManager(wxWindow* window);
473
9a29fe70 474 void SetArtProvider(wxAuiDockArt* artProvider);
a3a5df9d 475 wxAuiDockArt* GetArtProvider() const;
50acee04 476
a3a5df9d
BW
477 wxAuiPaneInfo& GetPane(wxWindow* window);
478 wxAuiPaneInfo& GetPane(const wxString& name);
479 wxAuiPaneInfoArray& GetAllPanes();
50acee04
JS
480
481 bool AddPane(wxWindow* window,
9a29fe70 482 const wxAuiPaneInfo& paneInfo);
858a3a7a 483
0603bb28 484 bool AddPane(wxWindow* window,
9a29fe70
VZ
485 const wxAuiPaneInfo& paneInfo,
486 const wxPoint& dropPos);
be66f18e 487
50acee04
JS
488 bool AddPane(wxWindow* window,
489 int direction = wxLEFT,
490 const wxString& caption = wxEmptyString);
be66f18e 491
50acee04 492 bool InsertPane(wxWindow* window,
9a29fe70
VZ
493 const wxAuiPaneInfo& insertLocation,
494 int insertLevel = wxAUI_INSERT_PANE);
be66f18e 495
50acee04 496 bool DetachPane(wxWindow* window);
858a3a7a 497
a6b7a521 498 void Update();
50acee04 499
a3a5df9d 500 wxString SavePaneInfo(wxAuiPaneInfo& pane);
9a29fe70 501 void LoadPaneInfo(wxString panePart, wxAuiPaneInfo &pane);
50acee04 502 wxString SavePerspective();
a6b7a521 503 bool LoadPerspective(const wxString& perspective, bool update = true);
be66f18e 504
9a29fe70
VZ
505 void SetDockSizeConstraint(double widthPct, double heightPct);
506 void GetDockSizeConstraint(double* widthPct, double* heightPct) const;
858a3a7a 507
9a29fe70
VZ
508 void ClosePane(wxAuiPaneInfo& paneInfo);
509 void MaximizePane(wxAuiPaneInfo& paneInfo);
510 void RestorePane(wxAuiPaneInfo& paneInfo);
a6b7a521 511 void RestoreMaximizedPane();
50acee04 512
0603bb28 513public:
cf37c9a9 514
00c1c94c 515 virtual wxAuiFloatingFrame* CreateFloatingFrame(wxWindow* parent, const wxAuiPaneInfo& p);
858a3a7a 516 virtual bool CanDockPanel(const wxAuiPaneInfo & p);
0603bb28 517
cf37c9a9 518 void StartPaneDrag(
9a29fe70 519 wxWindow* paneWindow,
cf37c9a9
BW
520 const wxPoint& offset);
521
522 wxRect CalculateHintRect(
9a29fe70 523 wxWindow* paneWindow,
cf37c9a9
BW
524 const wxPoint& pt,
525 const wxPoint& offset);
858a3a7a 526
cf37c9a9 527 void DrawHintRect(
9a29fe70 528 wxWindow* paneWindow,
cf37c9a9
BW
529 const wxPoint& pt,
530 const wxPoint& offset);
858a3a7a 531
0603bb28
BW
532 virtual void ShowHint(const wxRect& rect);
533 virtual void HideHint();
534
d90dcdb7
BP
535 void OnHintActivate(wxActivateEvent& event);
536
461125ea
BW
537public:
538
539 // deprecated -- please use SetManagedWindow() and
540 // and GetManagedWindow() instead
858a3a7a 541
461125ea
BW
542 wxDEPRECATED( void SetFrame(wxFrame* frame) );
543 wxDEPRECATED( wxFrame* GetFrame() const );
858a3a7a 544
e4542fa6 545protected:
50acee04 546
cf6fec73 547 void UpdateHintWindowConfig();
858a3a7a 548
50acee04
JS
549 void DoFrameLayout();
550
551 void LayoutAddPane(wxSizer* container,
a3a5df9d
BW
552 wxAuiDockInfo& dock,
553 wxAuiPaneInfo& pane,
554 wxAuiDockUIPartArray& uiparts,
9a29fe70 555 bool spacerOnly);
50acee04
JS
556
557 void LayoutAddDock(wxSizer* container,
a3a5df9d 558 wxAuiDockInfo& dock,
9a29fe70
VZ
559 wxAuiDockUIPartArray& uiParts,
560 bool spacerOnly);
50acee04 561
a3a5df9d
BW
562 wxSizer* LayoutAll(wxAuiPaneInfoArray& panes,
563 wxAuiDockInfoArray& docks,
9a29fe70
VZ
564 wxAuiDockUIPartArray & uiParts,
565 bool spacerOnly = false);
50acee04 566
a3a5df9d 567 virtual bool ProcessDockResult(wxAuiPaneInfo& target,
9a29fe70 568 const wxAuiPaneInfo& newPos);
0d02dd54 569
a3a5df9d
BW
570 bool DoDrop(wxAuiDockInfoArray& docks,
571 wxAuiPaneInfoArray& panes,
572 wxAuiPaneInfo& drop,
50acee04 573 const wxPoint& pt,
9a29fe70 574 const wxPoint& actionOffset = wxPoint(0,0));
50acee04 575
a3a5df9d
BW
576 wxAuiDockUIPart* HitTest(int x, int y);
577 wxAuiDockUIPart* GetPanePart(wxWindow* pane);
578 int GetDockPixelOffset(wxAuiPaneInfo& test);
50acee04 579 void OnFloatingPaneMoveStart(wxWindow* window);
322c5ec4
RR
580 void OnFloatingPaneMoving(wxWindow* window, wxDirection dir );
581 void OnFloatingPaneMoved(wxWindow* window, wxDirection dir);
50acee04 582 void OnFloatingPaneActivated(wxWindow* window);
58754643 583 void OnFloatingPaneClosed(wxWindow* window, wxCloseEvent& evt);
76e1326a 584 void OnFloatingPaneResized(wxWindow* window, const wxRect& rect);
50acee04
JS
585 void Render(wxDC* dc);
586 void Repaint(wxDC* dc = NULL);
a3a5df9d 587 void ProcessMgrEvent(wxAuiManagerEvent& event);
9a29fe70 588 void UpdateButtonOnScreen(wxAuiDockUIPart* buttonUiPart,
50acee04 589 const wxMouseEvent& event);
a3a5df9d 590 void GetPanePositionsAndSizes(wxAuiDockInfo& dock,
50acee04
JS
591 wxArrayInt& positions,
592 wxArrayInt& sizes);
0603bb28 593
68030cae
JS
594 /// Ends a resize action, or for live update, resizes the sash
595 bool DoEndResizeAction(wxMouseEvent& event);
50acee04 596
673727f3
BW
597public:
598
599 // public events (which can be invoked externally)
a3a5df9d
BW
600 void OnRender(wxAuiManagerEvent& evt);
601 void OnPaneButton(wxAuiManagerEvent& evt);
673727f3 602
e4542fa6 603protected:
50acee04 604
673727f3
BW
605 // protected events
606 void OnPaint(wxPaintEvent& evt);
607 void OnEraseBackground(wxEraseEvent& evt);
608 void OnSize(wxSizeEvent& evt);
609 void OnSetCursor(wxSetCursorEvent& evt);
610 void OnLeftDown(wxMouseEvent& evt);
611 void OnLeftUp(wxMouseEvent& evt);
612 void OnMotion(wxMouseEvent& evt);
e2074948 613 void OnCaptureLost(wxMouseCaptureLostEvent& evt);
673727f3
BW
614 void OnLeaveWindow(wxMouseEvent& evt);
615 void OnChildFocus(wxChildFocusEvent& evt);
616 void OnHintFadeTimer(wxTimerEvent& evt);
4dc79cfb 617 void OnFindManager(wxAuiManagerEvent& evt);
50acee04 618
e4542fa6 619protected:
50acee04
JS
620
621 enum
622 {
623 actionNone = 0,
624 actionResize,
625 actionClickButton,
626 actionClickCaption,
627 actionDragToolbarPane,
628 actionDragFloatingPane
629 };
630
e4542fa6 631protected:
50acee04 632
a189504e 633 wxWindow* m_frame; // the window being managed
a3a5df9d 634 wxAuiDockArt* m_art; // dock art object which does all drawing
50acee04
JS
635 unsigned int m_flags; // manager flags wxAUI_MGR_*
636
a3a5df9d
BW
637 wxAuiPaneInfoArray m_panes; // array of panes structures
638 wxAuiDockInfoArray m_docks; // array of docks structures
9a29fe70 639 wxAuiDockUIPartArray m_uiParts; // array of UI parts (captions, buttons, etc)
50acee04
JS
640
641 int m_action; // current mouse action
9a29fe70
VZ
642 wxPoint m_actionStart; // position where the action click started
643 wxPoint m_actionOffset; // offset from upper left of the item clicked
644 wxAuiDockUIPart* m_actionPart; // ptr to the part the action happened to
645 wxWindow* m_actionWindow; // action frame or window (NULL if none)
646 wxRect m_actionHintRect; // hint rectangle for the action
647 wxRect m_lastRect;
648 wxAuiDockUIPart* m_hoverButton;// button uipart being hovered over
649 wxRect m_lastHint; // last hint rectangle
650 wxPoint m_lastMouseMove; // last mouse move position (see OnMotion)
68030cae 651 int m_currentDragItem;
a6b7a521 652 bool m_skipping;
9a29fe70 653 bool m_hasMaximized;
a6b7a521 654
9a29fe70
VZ
655 double m_dockConstraintX; // 0.0 .. 1.0; max pct of window width a dock can consume
656 double m_dockConstraintY; // 0.0 .. 1.0; max pct of window height a dock can consume
50acee04 657
9a29fe70
VZ
658 wxFrame* m_hintWnd; // transparent hint window, if supported by platform
659 wxTimer m_hintFadeTimer; // transparent fade timer
660 wxByte m_hintFadeAmt; // transparent fade amount
661 wxByte m_hintFadeMax; // maximum value of hint fade
858a3a7a 662
1dc6ec2c 663 void* m_reserved;
be66f18e 664
06d4c4d6 665#ifndef SWIG
50acee04 666 DECLARE_EVENT_TABLE()
4dc79cfb 667 DECLARE_CLASS(wxAuiManager)
06d4c4d6 668#endif // SWIG
50acee04
JS
669};
670
671
672
673// event declarations/classes
674
a3a5df9d 675class WXDLLIMPEXP_AUI wxAuiManagerEvent : public wxEvent
50acee04
JS
676{
677public:
a3a5df9d 678 wxAuiManagerEvent(wxEventType type=wxEVT_NULL) : wxEvent(0, type)
50acee04 679 {
4dc79cfb 680 manager = NULL;
50acee04
JS
681 pane = NULL;
682 button = 0;
58754643
BW
683 veto_flag = false;
684 canveto_flag = true;
673727f3 685 dc = NULL;
50acee04 686 }
06d4c4d6 687#ifndef SWIG
a3a5df9d 688 wxAuiManagerEvent(const wxAuiManagerEvent& c) : wxEvent(c)
50acee04 689 {
4dc79cfb 690 manager = c.manager;
50acee04
JS
691 pane = c.pane;
692 button = c.button;
58754643
BW
693 veto_flag = c.veto_flag;
694 canveto_flag = c.canveto_flag;
673727f3 695 dc = c.dc;
50acee04 696 }
06d4c4d6 697#endif
a3a5df9d 698 wxEvent *Clone() const { return new wxAuiManagerEvent(*this); }
50acee04 699
4dc79cfb 700 void SetManager(wxAuiManager* mgr) { manager = mgr; }
a3a5df9d 701 void SetPane(wxAuiPaneInfo* p) { pane = p; }
50acee04 702 void SetButton(int b) { button = b; }
673727f3 703 void SetDC(wxDC* pdc) { dc = pdc; }
858a3a7a 704
4dc79cfb
BW
705 wxAuiManager* GetManager() const { return manager; }
706 wxAuiPaneInfo* GetPane() const { return pane; }
707 int GetButton() const { return button; }
708 wxDC* GetDC() const { return dc; }
858a3a7a 709
58754643
BW
710 void Veto(bool veto = true) { veto_flag = veto; }
711 bool GetVeto() const { return veto_flag; }
712 void SetCanVeto(bool can_veto) { canveto_flag = can_veto; }
713 bool CanVeto() const { return canveto_flag && veto_flag; }
858a3a7a 714
50acee04 715public:
4dc79cfb 716 wxAuiManager* manager;
a3a5df9d 717 wxAuiPaneInfo* pane;
50acee04 718 int button;
58754643
BW
719 bool veto_flag;
720 bool canveto_flag;
673727f3 721 wxDC* dc;
af672b5a
RD
722
723#ifndef SWIG
724private:
a3a5df9d 725 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxAuiManagerEvent)
af672b5a 726#endif
50acee04
JS
727};
728
729
a3a5df9d 730class WXDLLIMPEXP_AUI wxAuiDockInfo
50acee04
JS
731{
732public:
a3a5df9d 733 wxAuiDockInfo()
50acee04
JS
734 {
735 dock_direction = 0;
736 dock_layer = 0;
737 dock_row = 0;
738 size = 0;
739 min_size = 0;
740 resizable = true;
741 fixed = false;
742 toolbar = false;
1dc6ec2c 743 reserved1 = false;
50acee04
JS
744 }
745
06d4c4d6 746#ifndef SWIG
a3a5df9d 747 wxAuiDockInfo(const wxAuiDockInfo& c)
50acee04
JS
748 {
749 dock_direction = c.dock_direction;
750 dock_layer = c.dock_layer;
751 dock_row = c.dock_row;
752 size = c.size;
753 min_size = c.min_size;
754 resizable = c.resizable;
755 fixed = c.fixed;
756 toolbar = c.toolbar;
757 panes = c.panes;
758 rect = c.rect;
1dc6ec2c 759 reserved1 = c.reserved1;
50acee04
JS
760 }
761
a3a5df9d 762 wxAuiDockInfo& operator=(const wxAuiDockInfo& c)
50acee04
JS
763 {
764 dock_direction = c.dock_direction;
765 dock_layer = c.dock_layer;
766 dock_row = c.dock_row;
767 size = c.size;
768 min_size = c.min_size;
769 resizable = c.resizable;
770 fixed = c.fixed;
771 toolbar = c.toolbar;
772 panes = c.panes;
773 rect = c.rect;
1dc6ec2c 774 reserved1 = c.reserved1;
50acee04
JS
775 return *this;
776 }
06d4c4d6 777#endif // SWIG
50acee04 778
cedd7b22
PC
779 bool IsOk() const { return dock_direction != 0; }
780 bool IsHorizontal() const { return dock_direction == wxAUI_DOCK_TOP ||
781 dock_direction == wxAUI_DOCK_BOTTOM; }
782 bool IsVertical() const { return dock_direction == wxAUI_DOCK_LEFT ||
50acee04 783 dock_direction == wxAUI_DOCK_RIGHT ||
cedd7b22 784 dock_direction == wxAUI_DOCK_CENTER; }
50acee04 785public:
a3a5df9d 786 wxAuiPaneInfoPtrArray panes; // array of panes
50acee04
JS
787 wxRect rect; // current rectangle
788 int dock_direction; // dock direction (top, bottom, left, right, center)
789 int dock_layer; // layer number (0 = innermost layer)
790 int dock_row; // row number on the docking bar (0 = first row)
791 int size; // size of the dock
792 int min_size; // minimum size of a dock (0 if there is no min)
793 bool resizable; // flag indicating whether the dock is resizable
794 bool toolbar; // flag indicating dock contains only toolbars
795 bool fixed; // flag indicating that the dock operates on
796 // absolute coordinates as opposed to proportional
1dc6ec2c 797 bool reserved1;
50acee04
JS
798};
799
800
a3a5df9d 801class WXDLLIMPEXP_AUI wxAuiDockUIPart
50acee04
JS
802{
803public:
804 enum
805 {
806 typeCaption,
807 typeGripper,
808 typeDock,
809 typeDockSizer,
810 typePane,
811 typePaneSizer,
812 typeBackground,
813 typePaneBorder,
55193d61 814 typePaneButton
50acee04
JS
815 };
816
817 int type; // ui part type (see enum above)
818 int orientation; // orientation (either wxHORIZONTAL or wxVERTICAL)
a3a5df9d
BW
819 wxAuiDockInfo* dock; // which dock the item is associated with
820 wxAuiPaneInfo* pane; // which pane the item is associated with
821 wxAuiPaneButton* button; // which pane button the item is associated with
50acee04
JS
822 wxSizer* cont_sizer; // the part's containing sizer
823 wxSizerItem* sizer_item; // the sizer item of the part
824 wxRect rect; // client coord rectangle of the part itself
825};
826
827
a3a5df9d 828class WXDLLIMPEXP_AUI wxAuiPaneButton
50acee04
JS
829{
830public:
831 int button_id; // id of the button (e.g. buttonClose)
832};
833
834
835
06d4c4d6 836#ifndef SWIG
c058cafa 837
9b11752c
VZ
838wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUI_PANE_BUTTON, wxAuiManagerEvent );
839wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUI_PANE_CLOSE, wxAuiManagerEvent );
840wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUI_PANE_MAXIMIZE, wxAuiManagerEvent );
841wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUI_PANE_RESTORE, wxAuiManagerEvent );
842wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUI_RENDER, wxAuiManagerEvent );
843wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUI_FIND_MANAGER, wxAuiManagerEvent );
50acee04 844
a3a5df9d 845typedef void (wxEvtHandler::*wxAuiManagerEventFunction)(wxAuiManagerEvent&);
50acee04 846
a3a5df9d 847#define wxAuiManagerEventHandler(func) \
3c778901 848 wxEVENT_HANDLER_CAST(wxAuiManagerEventFunction, func)
50acee04 849
bc07ab17
RD
850#define EVT_AUI_PANE_BUTTON(func) \
851 wx__DECLARE_EVT0(wxEVT_AUI_PANE_BUTTON, wxAuiManagerEventHandler(func))
852#define EVT_AUI_PANE_CLOSE(func) \
853 wx__DECLARE_EVT0(wxEVT_AUI_PANE_CLOSE, wxAuiManagerEventHandler(func))
854#define EVT_AUI_PANE_MAXIMIZE(func) \
855 wx__DECLARE_EVT0(wxEVT_AUI_PANE_MAXIMIZE, wxAuiManagerEventHandler(func))
856#define EVT_AUI_PANE_RESTORE(func) \
857 wx__DECLARE_EVT0(wxEVT_AUI_PANE_RESTORE, wxAuiManagerEventHandler(func))
673727f3 858#define EVT_AUI_RENDER(func) \
a3a5df9d 859 wx__DECLARE_EVT0(wxEVT_AUI_RENDER, wxAuiManagerEventHandler(func))
bc07ab17
RD
860#define EVT_AUI_FIND_MANAGER(func) \
861 wx__DECLARE_EVT0(wxEVT_AUI_FIND_MANAGER, wxAuiManagerEventHandler(func))
58754643 862
06d4c4d6
RD
863#else
864
bc07ab17
RD
865%constant wxEventType wxEVT_AUI_PANE_BUTTON;
866%constant wxEventType wxEVT_AUI_PANE_CLOSE;
867%constant wxEventType wxEVT_AUI_PANE_MAXIMIZE;
868%constant wxEventType wxEVT_AUI_PANE_RESTORE;
673727f3 869%constant wxEventType wxEVT_AUI_RENDER;
bc07ab17 870%constant wxEventType wxEVT_AUI_FIND_MANAGER;
06d4c4d6
RD
871
872%pythoncode {
bc07ab17
RD
873 EVT_AUI_PANE_BUTTON = wx.PyEventBinder( wxEVT_AUI_PANE_BUTTON )
874 EVT_AUI_PANE_CLOSE = wx.PyEventBinder( wxEVT_AUI_PANE_CLOSE )
875 EVT_AUI_PANE_MAXIMIZE = wx.PyEventBinder( wxEVT_AUI_PANE_MAXIMIZE )
876 EVT_AUI_PANE_RESTORE = wx.PyEventBinder( wxEVT_AUI_PANE_RESTORE )
673727f3 877 EVT_AUI_RENDER = wx.PyEventBinder( wxEVT_AUI_RENDER )
bc07ab17 878 EVT_AUI_FIND_MANAGER = wx.PyEventBinder( wxEVT_AUI_FIND_MANAGER )
06d4c4d6
RD
879}
880#endif // SWIG
50acee04
JS
881
882#endif // wxUSE_AUI
883#endif //_WX_FRAMEMANAGER_H_
884