]> git.saurik.com Git - wxWidgets.git/blame - include/wx/aui/framemanager.h
Document wxKill(wxSIGTERM) reliance on having an open window in wxMSW.
[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
fc5a6099
VZ
597 void SetActivePane(wxWindow* active_pane);
598
673727f3
BW
599public:
600
601 // public events (which can be invoked externally)
a3a5df9d
BW
602 void OnRender(wxAuiManagerEvent& evt);
603 void OnPaneButton(wxAuiManagerEvent& evt);
673727f3 604
e4542fa6 605protected:
50acee04 606
673727f3
BW
607 // protected events
608 void OnPaint(wxPaintEvent& evt);
609 void OnEraseBackground(wxEraseEvent& evt);
610 void OnSize(wxSizeEvent& evt);
611 void OnSetCursor(wxSetCursorEvent& evt);
612 void OnLeftDown(wxMouseEvent& evt);
613 void OnLeftUp(wxMouseEvent& evt);
614 void OnMotion(wxMouseEvent& evt);
e2074948 615 void OnCaptureLost(wxMouseCaptureLostEvent& evt);
673727f3
BW
616 void OnLeaveWindow(wxMouseEvent& evt);
617 void OnChildFocus(wxChildFocusEvent& evt);
618 void OnHintFadeTimer(wxTimerEvent& evt);
4dc79cfb 619 void OnFindManager(wxAuiManagerEvent& evt);
50acee04 620
e4542fa6 621protected:
50acee04
JS
622
623 enum
624 {
625 actionNone = 0,
626 actionResize,
627 actionClickButton,
628 actionClickCaption,
629 actionDragToolbarPane,
630 actionDragFloatingPane
631 };
632
e4542fa6 633protected:
50acee04 634
a189504e 635 wxWindow* m_frame; // the window being managed
a3a5df9d 636 wxAuiDockArt* m_art; // dock art object which does all drawing
50acee04
JS
637 unsigned int m_flags; // manager flags wxAUI_MGR_*
638
a3a5df9d
BW
639 wxAuiPaneInfoArray m_panes; // array of panes structures
640 wxAuiDockInfoArray m_docks; // array of docks structures
9a29fe70 641 wxAuiDockUIPartArray m_uiParts; // array of UI parts (captions, buttons, etc)
50acee04
JS
642
643 int m_action; // current mouse action
9a29fe70
VZ
644 wxPoint m_actionStart; // position where the action click started
645 wxPoint m_actionOffset; // offset from upper left of the item clicked
646 wxAuiDockUIPart* m_actionPart; // ptr to the part the action happened to
647 wxWindow* m_actionWindow; // action frame or window (NULL if none)
648 wxRect m_actionHintRect; // hint rectangle for the action
649 wxRect m_lastRect;
650 wxAuiDockUIPart* m_hoverButton;// button uipart being hovered over
651 wxRect m_lastHint; // last hint rectangle
652 wxPoint m_lastMouseMove; // last mouse move position (see OnMotion)
68030cae 653 int m_currentDragItem;
a6b7a521 654 bool m_skipping;
9a29fe70 655 bool m_hasMaximized;
a6b7a521 656
9a29fe70
VZ
657 double m_dockConstraintX; // 0.0 .. 1.0; max pct of window width a dock can consume
658 double m_dockConstraintY; // 0.0 .. 1.0; max pct of window height a dock can consume
50acee04 659
9a29fe70
VZ
660 wxFrame* m_hintWnd; // transparent hint window, if supported by platform
661 wxTimer m_hintFadeTimer; // transparent fade timer
662 wxByte m_hintFadeAmt; // transparent fade amount
663 wxByte m_hintFadeMax; // maximum value of hint fade
858a3a7a 664
1dc6ec2c 665 void* m_reserved;
be66f18e 666
06d4c4d6 667#ifndef SWIG
50acee04 668 DECLARE_EVENT_TABLE()
4dc79cfb 669 DECLARE_CLASS(wxAuiManager)
06d4c4d6 670#endif // SWIG
50acee04
JS
671};
672
673
674
675// event declarations/classes
676
a3a5df9d 677class WXDLLIMPEXP_AUI wxAuiManagerEvent : public wxEvent
50acee04
JS
678{
679public:
a3a5df9d 680 wxAuiManagerEvent(wxEventType type=wxEVT_NULL) : wxEvent(0, type)
50acee04 681 {
4dc79cfb 682 manager = NULL;
50acee04
JS
683 pane = NULL;
684 button = 0;
58754643
BW
685 veto_flag = false;
686 canveto_flag = true;
673727f3 687 dc = NULL;
50acee04 688 }
06d4c4d6 689#ifndef SWIG
a3a5df9d 690 wxAuiManagerEvent(const wxAuiManagerEvent& c) : wxEvent(c)
50acee04 691 {
4dc79cfb 692 manager = c.manager;
50acee04
JS
693 pane = c.pane;
694 button = c.button;
58754643
BW
695 veto_flag = c.veto_flag;
696 canveto_flag = c.canveto_flag;
673727f3 697 dc = c.dc;
50acee04 698 }
06d4c4d6 699#endif
a3a5df9d 700 wxEvent *Clone() const { return new wxAuiManagerEvent(*this); }
50acee04 701
4dc79cfb 702 void SetManager(wxAuiManager* mgr) { manager = mgr; }
a3a5df9d 703 void SetPane(wxAuiPaneInfo* p) { pane = p; }
50acee04 704 void SetButton(int b) { button = b; }
673727f3 705 void SetDC(wxDC* pdc) { dc = pdc; }
858a3a7a 706
4dc79cfb
BW
707 wxAuiManager* GetManager() const { return manager; }
708 wxAuiPaneInfo* GetPane() const { return pane; }
709 int GetButton() const { return button; }
710 wxDC* GetDC() const { return dc; }
858a3a7a 711
58754643
BW
712 void Veto(bool veto = true) { veto_flag = veto; }
713 bool GetVeto() const { return veto_flag; }
714 void SetCanVeto(bool can_veto) { canveto_flag = can_veto; }
715 bool CanVeto() const { return canveto_flag && veto_flag; }
858a3a7a 716
50acee04 717public:
4dc79cfb 718 wxAuiManager* manager;
a3a5df9d 719 wxAuiPaneInfo* pane;
50acee04 720 int button;
58754643
BW
721 bool veto_flag;
722 bool canveto_flag;
673727f3 723 wxDC* dc;
af672b5a
RD
724
725#ifndef SWIG
726private:
a3a5df9d 727 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxAuiManagerEvent)
af672b5a 728#endif
50acee04
JS
729};
730
731
a3a5df9d 732class WXDLLIMPEXP_AUI wxAuiDockInfo
50acee04
JS
733{
734public:
a3a5df9d 735 wxAuiDockInfo()
50acee04
JS
736 {
737 dock_direction = 0;
738 dock_layer = 0;
739 dock_row = 0;
740 size = 0;
741 min_size = 0;
742 resizable = true;
743 fixed = false;
744 toolbar = false;
1dc6ec2c 745 reserved1 = false;
50acee04
JS
746 }
747
06d4c4d6 748#ifndef SWIG
a3a5df9d 749 wxAuiDockInfo(const wxAuiDockInfo& c)
50acee04
JS
750 {
751 dock_direction = c.dock_direction;
752 dock_layer = c.dock_layer;
753 dock_row = c.dock_row;
754 size = c.size;
755 min_size = c.min_size;
756 resizable = c.resizable;
757 fixed = c.fixed;
758 toolbar = c.toolbar;
759 panes = c.panes;
760 rect = c.rect;
1dc6ec2c 761 reserved1 = c.reserved1;
50acee04
JS
762 }
763
a3a5df9d 764 wxAuiDockInfo& operator=(const wxAuiDockInfo& c)
50acee04
JS
765 {
766 dock_direction = c.dock_direction;
767 dock_layer = c.dock_layer;
768 dock_row = c.dock_row;
769 size = c.size;
770 min_size = c.min_size;
771 resizable = c.resizable;
772 fixed = c.fixed;
773 toolbar = c.toolbar;
774 panes = c.panes;
775 rect = c.rect;
1dc6ec2c 776 reserved1 = c.reserved1;
50acee04
JS
777 return *this;
778 }
06d4c4d6 779#endif // SWIG
50acee04 780
cedd7b22
PC
781 bool IsOk() const { return dock_direction != 0; }
782 bool IsHorizontal() const { return dock_direction == wxAUI_DOCK_TOP ||
783 dock_direction == wxAUI_DOCK_BOTTOM; }
784 bool IsVertical() const { return dock_direction == wxAUI_DOCK_LEFT ||
50acee04 785 dock_direction == wxAUI_DOCK_RIGHT ||
cedd7b22 786 dock_direction == wxAUI_DOCK_CENTER; }
50acee04 787public:
a3a5df9d 788 wxAuiPaneInfoPtrArray panes; // array of panes
50acee04
JS
789 wxRect rect; // current rectangle
790 int dock_direction; // dock direction (top, bottom, left, right, center)
791 int dock_layer; // layer number (0 = innermost layer)
792 int dock_row; // row number on the docking bar (0 = first row)
793 int size; // size of the dock
794 int min_size; // minimum size of a dock (0 if there is no min)
795 bool resizable; // flag indicating whether the dock is resizable
796 bool toolbar; // flag indicating dock contains only toolbars
797 bool fixed; // flag indicating that the dock operates on
798 // absolute coordinates as opposed to proportional
1dc6ec2c 799 bool reserved1;
50acee04
JS
800};
801
802
a3a5df9d 803class WXDLLIMPEXP_AUI wxAuiDockUIPart
50acee04
JS
804{
805public:
806 enum
807 {
808 typeCaption,
809 typeGripper,
810 typeDock,
811 typeDockSizer,
812 typePane,
813 typePaneSizer,
814 typeBackground,
815 typePaneBorder,
55193d61 816 typePaneButton
50acee04
JS
817 };
818
819 int type; // ui part type (see enum above)
820 int orientation; // orientation (either wxHORIZONTAL or wxVERTICAL)
a3a5df9d
BW
821 wxAuiDockInfo* dock; // which dock the item is associated with
822 wxAuiPaneInfo* pane; // which pane the item is associated with
823 wxAuiPaneButton* button; // which pane button the item is associated with
50acee04
JS
824 wxSizer* cont_sizer; // the part's containing sizer
825 wxSizerItem* sizer_item; // the sizer item of the part
826 wxRect rect; // client coord rectangle of the part itself
827};
828
829
a3a5df9d 830class WXDLLIMPEXP_AUI wxAuiPaneButton
50acee04
JS
831{
832public:
833 int button_id; // id of the button (e.g. buttonClose)
834};
835
836
837
06d4c4d6 838#ifndef SWIG
c058cafa 839
9b11752c
VZ
840wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUI_PANE_BUTTON, wxAuiManagerEvent );
841wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUI_PANE_CLOSE, wxAuiManagerEvent );
842wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUI_PANE_MAXIMIZE, wxAuiManagerEvent );
843wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUI_PANE_RESTORE, wxAuiManagerEvent );
3a1ec1d5 844wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUI_PANE_ACTIVATED, wxAuiManagerEvent );
9b11752c
VZ
845wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUI_RENDER, wxAuiManagerEvent );
846wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUI_FIND_MANAGER, wxAuiManagerEvent );
50acee04 847
a3a5df9d 848typedef void (wxEvtHandler::*wxAuiManagerEventFunction)(wxAuiManagerEvent&);
50acee04 849
a3a5df9d 850#define wxAuiManagerEventHandler(func) \
3c778901 851 wxEVENT_HANDLER_CAST(wxAuiManagerEventFunction, func)
50acee04 852
bc07ab17
RD
853#define EVT_AUI_PANE_BUTTON(func) \
854 wx__DECLARE_EVT0(wxEVT_AUI_PANE_BUTTON, wxAuiManagerEventHandler(func))
855#define EVT_AUI_PANE_CLOSE(func) \
856 wx__DECLARE_EVT0(wxEVT_AUI_PANE_CLOSE, wxAuiManagerEventHandler(func))
857#define EVT_AUI_PANE_MAXIMIZE(func) \
858 wx__DECLARE_EVT0(wxEVT_AUI_PANE_MAXIMIZE, wxAuiManagerEventHandler(func))
859#define EVT_AUI_PANE_RESTORE(func) \
860 wx__DECLARE_EVT0(wxEVT_AUI_PANE_RESTORE, wxAuiManagerEventHandler(func))
3a1ec1d5
VZ
861#define EVT_AUI_PANE_ACTIVATED(func) \
862 wx__DECLARE_EVT0(wxEVT_AUI_PANE_ACTIVATED, wxAuiManagerEventHandler(func))
673727f3 863#define EVT_AUI_RENDER(func) \
a3a5df9d 864 wx__DECLARE_EVT0(wxEVT_AUI_RENDER, wxAuiManagerEventHandler(func))
bc07ab17
RD
865#define EVT_AUI_FIND_MANAGER(func) \
866 wx__DECLARE_EVT0(wxEVT_AUI_FIND_MANAGER, wxAuiManagerEventHandler(func))
58754643 867
06d4c4d6
RD
868#else
869
bc07ab17
RD
870%constant wxEventType wxEVT_AUI_PANE_BUTTON;
871%constant wxEventType wxEVT_AUI_PANE_CLOSE;
872%constant wxEventType wxEVT_AUI_PANE_MAXIMIZE;
873%constant wxEventType wxEVT_AUI_PANE_RESTORE;
3a1ec1d5 874%constant wxEventType wxEVT_AUI_PANE_ACTIVATED;
673727f3 875%constant wxEventType wxEVT_AUI_RENDER;
bc07ab17 876%constant wxEventType wxEVT_AUI_FIND_MANAGER;
06d4c4d6
RD
877
878%pythoncode {
bc07ab17
RD
879 EVT_AUI_PANE_BUTTON = wx.PyEventBinder( wxEVT_AUI_PANE_BUTTON )
880 EVT_AUI_PANE_CLOSE = wx.PyEventBinder( wxEVT_AUI_PANE_CLOSE )
881 EVT_AUI_PANE_MAXIMIZE = wx.PyEventBinder( wxEVT_AUI_PANE_MAXIMIZE )
882 EVT_AUI_PANE_RESTORE = wx.PyEventBinder( wxEVT_AUI_PANE_RESTORE )
3a1ec1d5 883 EVT_AUI_PANE_ACTIVATED = wx.PyEventBinder( wxEVT_AUI_PANE_ACTIVATED )
673727f3 884 EVT_AUI_RENDER = wx.PyEventBinder( wxEVT_AUI_RENDER )
bc07ab17 885 EVT_AUI_FIND_MANAGER = wx.PyEventBinder( wxEVT_AUI_FIND_MANAGER )
06d4c4d6
RD
886}
887#endif // SWIG
50acee04
JS
888
889#endif // wxUSE_AUI
890#endif //_WX_FRAMEMANAGER_H_
891