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