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