]> git.saurik.com Git - wxWidgets.git/blame - include/wx/aui/framemanager.h
Fix another line somehow missing from the wxGraphicsBitmap forward port.
[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,
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;
176 window = c.window;
177 frame = c.frame;
178 state = c.state;
179 dock_direction = c.dock_direction;
180 dock_layer = c.dock_layer;
181 dock_row = c.dock_row;
182 dock_pos = c.dock_pos;
183 best_size = c.best_size;
184 min_size = c.min_size;
185 max_size = c.max_size;
186 floating_pos = c.floating_pos;
187 floating_size = c.floating_size;
188 dock_proportion = c.dock_proportion;
189 buttons = c.buttons;
190 rect = c.rect;
191 }
192
a3a5df9d 193 wxAuiPaneInfo& operator=(const wxAuiPaneInfo& c)
50acee04
JS
194 {
195 name = c.name;
196 caption = c.caption;
197 window = c.window;
198 frame = c.frame;
199 state = c.state;
200 dock_direction = c.dock_direction;
201 dock_layer = c.dock_layer;
202 dock_row = c.dock_row;
203 dock_pos = c.dock_pos;
204 best_size = c.best_size;
205 min_size = c.min_size;
206 max_size = c.max_size;
207 floating_pos = c.floating_pos;
208 floating_size = c.floating_size;
209 dock_proportion = c.dock_proportion;
210 buttons = c.buttons;
211 rect = c.rect;
212 return *this;
213 }
06d4c4d6 214#endif // SWIG
75c8d68f
AB
215
216 // Write the safe parts of a newly loaded PaneInfo structure "source" into "this"
217 // used on loading perspectives etc.
a3a5df9d 218 void SafeSet(wxAuiPaneInfo source)
75c8d68f
AB
219 {
220 // note source is not passed by reference so we can overwrite, to keep the
221 // unsafe bits of "dest"
222 source.window = window;
223 source.frame = frame;
224 source.buttons = buttons;
225 // now assign
226 *this = source;
227 }
228
cedd7b22 229 bool IsOk() const { return window != NULL; }
50acee04
JS
230 bool IsFixed() const { return !HasFlag(optionResizable); }
231 bool IsResizable() const { return HasFlag(optionResizable); }
232 bool IsShown() const { return !HasFlag(optionHidden); }
233 bool IsFloating() const { return HasFlag(optionFloating); }
234 bool IsDocked() const { return !HasFlag(optionFloating); }
235 bool IsToolbar() const { return HasFlag(optionToolbar); }
236 bool IsTopDockable() const { return HasFlag(optionTopDockable); }
237 bool IsBottomDockable() const { return HasFlag(optionBottomDockable); }
238 bool IsLeftDockable() const { return HasFlag(optionLeftDockable); }
239 bool IsRightDockable() const { return HasFlag(optionRightDockable); }
240 bool IsFloatable() const { return HasFlag(optionFloatable); }
241 bool IsMovable() const { return HasFlag(optionMovable); }
fa96a36e 242 bool IsDestroyOnClose() const { return HasFlag(optionDestroyOnClose); }
37106ab2 243 bool IsMaximized() const { return HasFlag(optionMaximized); }
50acee04
JS
244 bool HasCaption() const { return HasFlag(optionCaption); }
245 bool HasGripper() const { return HasFlag(optionGripper); }
246 bool HasBorder() const { return HasFlag(optionPaneBorder); }
247 bool HasCloseButton() const { return HasFlag(buttonClose); }
248 bool HasMaximizeButton() const { return HasFlag(buttonMaximize); }
249 bool HasMinimizeButton() const { return HasFlag(buttonMinimize); }
250 bool HasPinButton() const { return HasFlag(buttonPin); }
251 bool HasGripperTop() const { return HasFlag(optionGripperTop); }
be66f18e 252
06d4c4d6 253#ifdef SWIG
a3a5df9d 254 %typemap(out) wxAuiPaneInfo& { $result = $self; Py_INCREF($result); }
06d4c4d6 255#endif
a3a5df9d
BW
256 wxAuiPaneInfo& Window(wxWindow* w) { window = w; return *this; }
257 wxAuiPaneInfo& Name(const wxString& n) { name = n; return *this; }
258 wxAuiPaneInfo& Caption(const wxString& c) { caption = c; return *this; }
259 wxAuiPaneInfo& Left() { dock_direction = wxAUI_DOCK_LEFT; return *this; }
260 wxAuiPaneInfo& Right() { dock_direction = wxAUI_DOCK_RIGHT; return *this; }
261 wxAuiPaneInfo& Top() { dock_direction = wxAUI_DOCK_TOP; return *this; }
262 wxAuiPaneInfo& Bottom() { dock_direction = wxAUI_DOCK_BOTTOM; return *this; }
263 wxAuiPaneInfo& Center() { dock_direction = wxAUI_DOCK_CENTER; return *this; }
264 wxAuiPaneInfo& Centre() { dock_direction = wxAUI_DOCK_CENTRE; return *this; }
265 wxAuiPaneInfo& Direction(int direction) { dock_direction = direction; return *this; }
266 wxAuiPaneInfo& Layer(int layer) { dock_layer = layer; return *this; }
267 wxAuiPaneInfo& Row(int row) { dock_row = row; return *this; }
268 wxAuiPaneInfo& Position(int pos) { dock_pos = pos; return *this; }
269 wxAuiPaneInfo& BestSize(const wxSize& size) { best_size = size; return *this; }
270 wxAuiPaneInfo& MinSize(const wxSize& size) { min_size = size; return *this; }
271 wxAuiPaneInfo& MaxSize(const wxSize& size) { max_size = size; return *this; }
272 wxAuiPaneInfo& BestSize(int x, int y) { best_size.Set(x,y); return *this; }
273 wxAuiPaneInfo& MinSize(int x, int y) { min_size.Set(x,y); return *this; }
274 wxAuiPaneInfo& MaxSize(int x, int y) { max_size.Set(x,y); return *this; }
275 wxAuiPaneInfo& FloatingPosition(const wxPoint& pos) { floating_pos = pos; return *this; }
276 wxAuiPaneInfo& FloatingPosition(int x, int y) { floating_pos.x = x; floating_pos.y = y; return *this; }
277 wxAuiPaneInfo& FloatingSize(const wxSize& size) { floating_size = size; return *this; }
278 wxAuiPaneInfo& FloatingSize(int x, int y) { floating_size.Set(x,y); return *this; }
279 wxAuiPaneInfo& Fixed() { return SetFlag(optionResizable, false); }
280 wxAuiPaneInfo& Resizable(bool resizable = true) { return SetFlag(optionResizable, resizable); }
281 wxAuiPaneInfo& Dock() { return SetFlag(optionFloating, false); }
282 wxAuiPaneInfo& Float() { return SetFlag(optionFloating, true); }
283 wxAuiPaneInfo& Hide() { return SetFlag(optionHidden, true); }
284 wxAuiPaneInfo& Show(bool show = true) { return SetFlag(optionHidden, !show); }
285 wxAuiPaneInfo& CaptionVisible(bool visible = true) { return SetFlag(optionCaption, visible); }
286 wxAuiPaneInfo& Maximize() { return SetFlag(optionMaximized, true); }
287 wxAuiPaneInfo& Restore() { return SetFlag(optionMaximized, false); }
288 wxAuiPaneInfo& PaneBorder(bool visible = true) { return SetFlag(optionPaneBorder, visible); }
289 wxAuiPaneInfo& Gripper(bool visible = true) { return SetFlag(optionGripper, visible); }
290 wxAuiPaneInfo& GripperTop(bool attop = true) { return SetFlag(optionGripperTop, attop); }
291 wxAuiPaneInfo& CloseButton(bool visible = true) { return SetFlag(buttonClose, visible); }
292 wxAuiPaneInfo& MaximizeButton(bool visible = true) { return SetFlag(buttonMaximize, visible); }
293 wxAuiPaneInfo& MinimizeButton(bool visible = true) { return SetFlag(buttonMinimize, visible); }
294 wxAuiPaneInfo& PinButton(bool visible = true) { return SetFlag(buttonPin, visible); }
295 wxAuiPaneInfo& DestroyOnClose(bool b = true) { return SetFlag(optionDestroyOnClose, b); }
296 wxAuiPaneInfo& TopDockable(bool b = true) { return SetFlag(optionTopDockable, b); }
297 wxAuiPaneInfo& BottomDockable(bool b = true) { return SetFlag(optionBottomDockable, b); }
298 wxAuiPaneInfo& LeftDockable(bool b = true) { return SetFlag(optionLeftDockable, b); }
299 wxAuiPaneInfo& RightDockable(bool b = true) { return SetFlag(optionRightDockable, b); }
300 wxAuiPaneInfo& Floatable(bool b = true) { return SetFlag(optionFloatable, b); }
301 wxAuiPaneInfo& Movable(bool b = true) { return SetFlag(optionMovable, b); }
c89e16e4 302 wxAuiPaneInfo& DockFixed(bool b = true) { return SetFlag(optionDockFixed, b); }
a3a5df9d 303
a3a5df9d 304 wxAuiPaneInfo& Dockable(bool b = true)
50acee04
JS
305 {
306 return TopDockable(b).BottomDockable(b).LeftDockable(b).RightDockable(b);
307 }
308
a3a5df9d 309 wxAuiPaneInfo& DefaultPane()
50acee04
JS
310 {
311 state |= optionTopDockable | optionBottomDockable |
312 optionLeftDockable | optionRightDockable |
313 optionFloatable | optionMovable | optionResizable |
314 optionCaption | optionPaneBorder | buttonClose;
315 return *this;
316 }
be66f18e 317
a3a5df9d
BW
318 wxAuiPaneInfo& CentrePane() { return CenterPane(); }
319 wxAuiPaneInfo& CenterPane()
50acee04
JS
320 {
321 state = 0;
322 return Center().PaneBorder().Resizable();
323 }
be66f18e 324
a3a5df9d 325 wxAuiPaneInfo& ToolbarPane()
50acee04
JS
326 {
327 DefaultPane();
328 state |= (optionToolbar | optionGripper);
329 state &= ~(optionResizable | optionCaption);
330 if (dock_layer == 0)
331 dock_layer = 10;
332 return *this;
333 }
334
e227438f 335 wxAuiPaneInfo& SetFlag(int flag, bool option_state)
50acee04
JS
336 {
337 if (option_state)
338 state |= flag;
cedd7b22 339 else
50acee04
JS
340 state &= ~flag;
341 return *this;
342 }
be66f18e 343
e227438f 344 bool HasFlag(int flag) const
50acee04 345 {
cedd7b22 346 return (state & flag) != 0;
50acee04
JS
347 }
348
06d4c4d6 349#ifdef SWIG
a3a5df9d 350 %typemap(out) wxAuiPaneInfo& ;
06d4c4d6 351#endif
858a3a7a 352
50acee04
JS
353public:
354
9f41bf0e
RD
355 // NOTE: You can add and subtract flags from this list,
356 // but do not change the values of the flags, because
858a3a7a 357 // they are stored in a binary integer format in the
9f41bf0e
RD
358 // perspective string. If you really need to change the
359 // values around, you'll have to ensure backwards-compatibility
360 // in the perspective loading code.
a3a5df9d 361 enum wxAuiPaneState
50acee04
JS
362 {
363 optionFloating = 1 << 0,
364 optionHidden = 1 << 1,
365 optionLeftDockable = 1 << 2,
366 optionRightDockable = 1 << 3,
367 optionTopDockable = 1 << 4,
368 optionBottomDockable = 1 << 5,
369 optionFloatable = 1 << 6,
370 optionMovable = 1 << 7,
371 optionResizable = 1 << 8,
372 optionPaneBorder = 1 << 9,
373 optionCaption = 1 << 10,
374 optionGripper = 1 << 11,
375 optionDestroyOnClose = 1 << 12,
376 optionToolbar = 1 << 13,
377 optionActive = 1 << 14,
be66f18e 378 optionGripperTop = 1 << 15,
37106ab2 379 optionMaximized = 1 << 16,
c89e16e4 380 optionDockFixed = 1 << 17,
8d0634ab 381
1dc6ec2c
BW
382 buttonClose = 1 << 21,
383 buttonMaximize = 1 << 22,
384 buttonMinimize = 1 << 23,
385 buttonPin = 1 << 24,
858a3a7a 386
8d0634ab
BW
387 buttonCustom1 = 1 << 26,
388 buttonCustom2 = 1 << 27,
389 buttonCustom3 = 1 << 28,
858a3a7a 390
8d0634ab 391 savedHiddenState = 1 << 30, // used internally
50acee04
JS
392 actionPane = 1 << 31 // used internally
393 };
394
395public:
396 wxString name; // name of the pane
397 wxString caption; // caption displayed on the window
398
399 wxWindow* window; // window that is in this pane
50f3c41d 400 wxFrame* frame; // floating frame window that holds the pane
50acee04
JS
401 unsigned int state; // a combination of wxPaneState values
402
403 int dock_direction; // dock direction (top, bottom, left, right, center)
404 int dock_layer; // layer number (0 = innermost layer)
405 int dock_row; // row number on the docking bar (0 = first row)
406 int dock_pos; // position inside the row (0 = first position)
407
408 wxSize best_size; // size that the layout engine will prefer
409 wxSize min_size; // minimum size the pane window can tolerate
410 wxSize max_size; // maximum size the pane window can tolerate
411
412 wxPoint floating_pos; // position while floating
413 wxSize floating_size; // size while floating
414 int dock_proportion; // proportion while docked
415
a3a5df9d 416 wxAuiPaneButtonArray buttons; // buttons on the pane
50acee04
JS
417
418 wxRect rect; // current rectangle (populated by wxAUI)
419};
420
421
422
1afad0ac
RR
423class WXDLLIMPEXP_FWD_AUI wxAuiFloatingFrame;
424
a3a5df9d 425class WXDLLIMPEXP_AUI wxAuiManager : public wxEvtHandler
50acee04 426{
601398b9 427 friend class wxAuiFloatingFrame;
50acee04
JS
428
429public:
430
a3a5df9d 431 wxAuiManager(wxWindow* managed_wnd = NULL,
50acee04 432 unsigned int flags = wxAUI_MGR_DEFAULT);
a3a5df9d 433 virtual ~wxAuiManager();
50acee04 434 void UnInit();
be66f18e 435
50acee04
JS
436 void SetFlags(unsigned int flags);
437 unsigned int GetFlags() const;
be66f18e 438
461125ea
BW
439 void SetManagedWindow(wxWindow* managed_wnd);
440 wxWindow* GetManagedWindow() const;
be66f18e 441
4dc79cfb
BW
442 static wxAuiManager* GetManager(wxWindow* window);
443
a3a5df9d
BW
444 void SetArtProvider(wxAuiDockArt* art_provider);
445 wxAuiDockArt* GetArtProvider() const;
50acee04 446
a3a5df9d
BW
447 wxAuiPaneInfo& GetPane(wxWindow* window);
448 wxAuiPaneInfo& GetPane(const wxString& name);
449 wxAuiPaneInfoArray& GetAllPanes();
50acee04
JS
450
451 bool AddPane(wxWindow* window,
a3a5df9d 452 const wxAuiPaneInfo& pane_info);
858a3a7a 453
0603bb28 454 bool AddPane(wxWindow* window,
a3a5df9d 455 const wxAuiPaneInfo& pane_info,
0603bb28 456 const wxPoint& drop_pos);
be66f18e 457
50acee04
JS
458 bool AddPane(wxWindow* window,
459 int direction = wxLEFT,
460 const wxString& caption = wxEmptyString);
be66f18e 461
50acee04 462 bool InsertPane(wxWindow* window,
a3a5df9d 463 const wxAuiPaneInfo& insert_location,
50acee04 464 int insert_level = wxAUI_INSERT_PANE);
be66f18e 465
50acee04 466 bool DetachPane(wxWindow* window);
858a3a7a 467
a6b7a521 468 void Update();
50acee04 469
a3a5df9d
BW
470 wxString SavePaneInfo(wxAuiPaneInfo& pane);
471 void LoadPaneInfo(wxString pane_part, wxAuiPaneInfo &pane);
50acee04 472 wxString SavePerspective();
a6b7a521 473 bool LoadPerspective(const wxString& perspective, bool update = true);
be66f18e 474
a6b7a521
VZ
475 void SetDockSizeConstraint(double width_pct, double height_pct);
476 void GetDockSizeConstraint(double* width_pct, double* height_pct) const;
858a3a7a 477
a6b7a521
VZ
478 void ClosePane(wxAuiPaneInfo& pane_info);
479 void MaximizePane(wxAuiPaneInfo& pane_info);
480 void RestorePane(wxAuiPaneInfo& pane_info);
481 void RestoreMaximizedPane();
50acee04 482
0603bb28 483public:
cf37c9a9 484
00c1c94c 485 virtual wxAuiFloatingFrame* CreateFloatingFrame(wxWindow* parent, const wxAuiPaneInfo& p);
858a3a7a 486 virtual bool CanDockPanel(const wxAuiPaneInfo & p);
0603bb28 487
cf37c9a9
BW
488 void StartPaneDrag(
489 wxWindow* pane_window,
490 const wxPoint& offset);
491
492 wxRect CalculateHintRect(
493 wxWindow* pane_window,
494 const wxPoint& pt,
495 const wxPoint& offset);
858a3a7a 496
cf37c9a9
BW
497 void DrawHintRect(
498 wxWindow* pane_window,
499 const wxPoint& pt,
500 const wxPoint& offset);
858a3a7a 501
0603bb28
BW
502 virtual void ShowHint(const wxRect& rect);
503 virtual void HideHint();
504
d90dcdb7
BP
505 void OnHintActivate(wxActivateEvent& event);
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
68030cae
JS
564 /// Ends a resize action, or for live update, resizes the sash
565 bool DoEndResizeAction(wxMouseEvent& event);
50acee04 566
673727f3
BW
567public:
568
569 // public events (which can be invoked externally)
a3a5df9d
BW
570 void OnRender(wxAuiManagerEvent& evt);
571 void OnPaneButton(wxAuiManagerEvent& evt);
673727f3 572
e4542fa6 573protected:
50acee04 574
673727f3
BW
575 // protected events
576 void OnPaint(wxPaintEvent& evt);
577 void OnEraseBackground(wxEraseEvent& evt);
578 void OnSize(wxSizeEvent& evt);
579 void OnSetCursor(wxSetCursorEvent& evt);
580 void OnLeftDown(wxMouseEvent& evt);
581 void OnLeftUp(wxMouseEvent& evt);
582 void OnMotion(wxMouseEvent& evt);
e2074948 583 void OnCaptureLost(wxMouseCaptureLostEvent& evt);
673727f3
BW
584 void OnLeaveWindow(wxMouseEvent& evt);
585 void OnChildFocus(wxChildFocusEvent& evt);
586 void OnHintFadeTimer(wxTimerEvent& evt);
4dc79cfb 587 void OnFindManager(wxAuiManagerEvent& evt);
50acee04 588
e4542fa6 589protected:
50acee04
JS
590
591 enum
592 {
593 actionNone = 0,
594 actionResize,
595 actionClickButton,
596 actionClickCaption,
597 actionDragToolbarPane,
598 actionDragFloatingPane
599 };
600
e4542fa6 601protected:
50acee04 602
a189504e 603 wxWindow* m_frame; // the window being managed
a3a5df9d 604 wxAuiDockArt* m_art; // dock art object which does all drawing
50acee04
JS
605 unsigned int m_flags; // manager flags wxAUI_MGR_*
606
a3a5df9d
BW
607 wxAuiPaneInfoArray m_panes; // array of panes structures
608 wxAuiDockInfoArray m_docks; // array of docks structures
609 wxAuiDockUIPartArray m_uiparts; // array of UI parts (captions, buttons, etc)
50acee04
JS
610
611 int m_action; // current mouse action
612 wxPoint m_action_start; // position where the action click started
613 wxPoint m_action_offset; // offset from upper left of the item clicked
a3a5df9d 614 wxAuiDockUIPart* m_action_part; // ptr to the part the action happened to
50acee04
JS
615 wxWindow* m_action_window; // action frame or window (NULL if none)
616 wxRect m_action_hintrect; // hint rectangle for the action
c3008402 617 wxRect m_last_rect;
a3a5df9d 618 wxAuiDockUIPart* m_hover_button;// button uipart being hovered over
50acee04
JS
619 wxRect m_last_hint; // last hint rectangle
620 wxPoint m_last_mouse_move; // last mouse move position (see OnMotion)
68030cae 621 int m_currentDragItem;
a6b7a521
VZ
622 bool m_skipping;
623 bool m_has_maximized;
624
625 double m_dock_constraint_x; // 0.0 .. 1.0; max pct of window width a dock can consume
626 double m_dock_constraint_y; // 0.0 .. 1.0; max pct of window height a dock can consume
50acee04 627
50f3c41d
RD
628 wxFrame* m_hint_wnd; // transparent hint window, if supported by platform
629 wxTimer m_hint_fadetimer; // transparent fade timer
db847131 630 wxByte m_hint_fadeamt; // transparent fade amount
7a5b04a6 631 wxByte m_hint_fademax; // maximum value of hint fade
858a3a7a 632
1dc6ec2c 633 void* m_reserved;
be66f18e 634
06d4c4d6 635#ifndef SWIG
50acee04 636 DECLARE_EVENT_TABLE()
4dc79cfb 637 DECLARE_CLASS(wxAuiManager)
06d4c4d6 638#endif // SWIG
50acee04
JS
639};
640
641
642
643// event declarations/classes
644
a3a5df9d 645class WXDLLIMPEXP_AUI wxAuiManagerEvent : public wxEvent
50acee04
JS
646{
647public:
a3a5df9d 648 wxAuiManagerEvent(wxEventType type=wxEVT_NULL) : wxEvent(0, type)
50acee04 649 {
4dc79cfb 650 manager = NULL;
50acee04
JS
651 pane = NULL;
652 button = 0;
58754643
BW
653 veto_flag = false;
654 canveto_flag = true;
673727f3 655 dc = NULL;
50acee04 656 }
06d4c4d6 657#ifndef SWIG
a3a5df9d 658 wxAuiManagerEvent(const wxAuiManagerEvent& c) : wxEvent(c)
50acee04 659 {
4dc79cfb 660 manager = c.manager;
50acee04
JS
661 pane = c.pane;
662 button = c.button;
58754643
BW
663 veto_flag = c.veto_flag;
664 canveto_flag = c.canveto_flag;
673727f3 665 dc = c.dc;
50acee04 666 }
06d4c4d6 667#endif
a3a5df9d 668 wxEvent *Clone() const { return new wxAuiManagerEvent(*this); }
50acee04 669
4dc79cfb 670 void SetManager(wxAuiManager* mgr) { manager = mgr; }
a3a5df9d 671 void SetPane(wxAuiPaneInfo* p) { pane = p; }
50acee04 672 void SetButton(int b) { button = b; }
673727f3 673 void SetDC(wxDC* pdc) { dc = pdc; }
858a3a7a 674
4dc79cfb
BW
675 wxAuiManager* GetManager() const { return manager; }
676 wxAuiPaneInfo* GetPane() const { return pane; }
677 int GetButton() const { return button; }
678 wxDC* GetDC() const { return dc; }
858a3a7a 679
58754643
BW
680 void Veto(bool veto = true) { veto_flag = veto; }
681 bool GetVeto() const { return veto_flag; }
682 void SetCanVeto(bool can_veto) { canveto_flag = can_veto; }
683 bool CanVeto() const { return canveto_flag && veto_flag; }
858a3a7a 684
50acee04 685public:
4dc79cfb 686 wxAuiManager* manager;
a3a5df9d 687 wxAuiPaneInfo* pane;
50acee04 688 int button;
58754643
BW
689 bool veto_flag;
690 bool canveto_flag;
673727f3 691 wxDC* dc;
af672b5a
RD
692
693#ifndef SWIG
694private:
a3a5df9d 695 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxAuiManagerEvent)
af672b5a 696#endif
50acee04
JS
697};
698
699
a3a5df9d 700class WXDLLIMPEXP_AUI wxAuiDockInfo
50acee04
JS
701{
702public:
a3a5df9d 703 wxAuiDockInfo()
50acee04
JS
704 {
705 dock_direction = 0;
706 dock_layer = 0;
707 dock_row = 0;
708 size = 0;
709 min_size = 0;
710 resizable = true;
711 fixed = false;
712 toolbar = false;
1dc6ec2c 713 reserved1 = false;
50acee04
JS
714 }
715
06d4c4d6 716#ifndef SWIG
a3a5df9d 717 wxAuiDockInfo(const wxAuiDockInfo& c)
50acee04
JS
718 {
719 dock_direction = c.dock_direction;
720 dock_layer = c.dock_layer;
721 dock_row = c.dock_row;
722 size = c.size;
723 min_size = c.min_size;
724 resizable = c.resizable;
725 fixed = c.fixed;
726 toolbar = c.toolbar;
727 panes = c.panes;
728 rect = c.rect;
1dc6ec2c 729 reserved1 = c.reserved1;
50acee04
JS
730 }
731
a3a5df9d 732 wxAuiDockInfo& operator=(const wxAuiDockInfo& c)
50acee04
JS
733 {
734 dock_direction = c.dock_direction;
735 dock_layer = c.dock_layer;
736 dock_row = c.dock_row;
737 size = c.size;
738 min_size = c.min_size;
739 resizable = c.resizable;
740 fixed = c.fixed;
741 toolbar = c.toolbar;
742 panes = c.panes;
743 rect = c.rect;
1dc6ec2c 744 reserved1 = c.reserved1;
50acee04
JS
745 return *this;
746 }
06d4c4d6 747#endif // SWIG
50acee04 748
cedd7b22
PC
749 bool IsOk() const { return dock_direction != 0; }
750 bool IsHorizontal() const { return dock_direction == wxAUI_DOCK_TOP ||
751 dock_direction == wxAUI_DOCK_BOTTOM; }
752 bool IsVertical() const { return dock_direction == wxAUI_DOCK_LEFT ||
50acee04 753 dock_direction == wxAUI_DOCK_RIGHT ||
cedd7b22 754 dock_direction == wxAUI_DOCK_CENTER; }
50acee04 755public:
a3a5df9d 756 wxAuiPaneInfoPtrArray panes; // array of panes
50acee04
JS
757 wxRect rect; // current rectangle
758 int dock_direction; // dock direction (top, bottom, left, right, center)
759 int dock_layer; // layer number (0 = innermost layer)
760 int dock_row; // row number on the docking bar (0 = first row)
761 int size; // size of the dock
762 int min_size; // minimum size of a dock (0 if there is no min)
763 bool resizable; // flag indicating whether the dock is resizable
764 bool toolbar; // flag indicating dock contains only toolbars
765 bool fixed; // flag indicating that the dock operates on
766 // absolute coordinates as opposed to proportional
1dc6ec2c 767 bool reserved1;
50acee04
JS
768};
769
770
a3a5df9d 771class WXDLLIMPEXP_AUI wxAuiDockUIPart
50acee04
JS
772{
773public:
774 enum
775 {
776 typeCaption,
777 typeGripper,
778 typeDock,
779 typeDockSizer,
780 typePane,
781 typePaneSizer,
782 typeBackground,
783 typePaneBorder,
55193d61 784 typePaneButton
50acee04
JS
785 };
786
787 int type; // ui part type (see enum above)
788 int orientation; // orientation (either wxHORIZONTAL or wxVERTICAL)
a3a5df9d
BW
789 wxAuiDockInfo* dock; // which dock the item is associated with
790 wxAuiPaneInfo* pane; // which pane the item is associated with
791 wxAuiPaneButton* button; // which pane button the item is associated with
50acee04
JS
792 wxSizer* cont_sizer; // the part's containing sizer
793 wxSizerItem* sizer_item; // the sizer item of the part
794 wxRect rect; // client coord rectangle of the part itself
795};
796
797
a3a5df9d 798class WXDLLIMPEXP_AUI wxAuiPaneButton
50acee04
JS
799{
800public:
801 int button_id; // id of the button (e.g. buttonClose)
802};
803
804
805
06d4c4d6 806#ifndef SWIG
c058cafa 807
9b11752c
VZ
808wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUI_PANE_BUTTON, wxAuiManagerEvent );
809wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUI_PANE_CLOSE, wxAuiManagerEvent );
810wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUI_PANE_MAXIMIZE, wxAuiManagerEvent );
811wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUI_PANE_RESTORE, wxAuiManagerEvent );
812wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUI_RENDER, wxAuiManagerEvent );
813wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUI_FIND_MANAGER, wxAuiManagerEvent );
50acee04 814
a3a5df9d 815typedef void (wxEvtHandler::*wxAuiManagerEventFunction)(wxAuiManagerEvent&);
50acee04 816
a3a5df9d 817#define wxAuiManagerEventHandler(func) \
3c778901 818 wxEVENT_HANDLER_CAST(wxAuiManagerEventFunction, func)
50acee04 819
bc07ab17
RD
820#define EVT_AUI_PANE_BUTTON(func) \
821 wx__DECLARE_EVT0(wxEVT_AUI_PANE_BUTTON, wxAuiManagerEventHandler(func))
822#define EVT_AUI_PANE_CLOSE(func) \
823 wx__DECLARE_EVT0(wxEVT_AUI_PANE_CLOSE, wxAuiManagerEventHandler(func))
824#define EVT_AUI_PANE_MAXIMIZE(func) \
825 wx__DECLARE_EVT0(wxEVT_AUI_PANE_MAXIMIZE, wxAuiManagerEventHandler(func))
826#define EVT_AUI_PANE_RESTORE(func) \
827 wx__DECLARE_EVT0(wxEVT_AUI_PANE_RESTORE, wxAuiManagerEventHandler(func))
673727f3 828#define EVT_AUI_RENDER(func) \
a3a5df9d 829 wx__DECLARE_EVT0(wxEVT_AUI_RENDER, wxAuiManagerEventHandler(func))
bc07ab17
RD
830#define EVT_AUI_FIND_MANAGER(func) \
831 wx__DECLARE_EVT0(wxEVT_AUI_FIND_MANAGER, wxAuiManagerEventHandler(func))
58754643 832
06d4c4d6
RD
833#else
834
bc07ab17
RD
835%constant wxEventType wxEVT_AUI_PANE_BUTTON;
836%constant wxEventType wxEVT_AUI_PANE_CLOSE;
837%constant wxEventType wxEVT_AUI_PANE_MAXIMIZE;
838%constant wxEventType wxEVT_AUI_PANE_RESTORE;
673727f3 839%constant wxEventType wxEVT_AUI_RENDER;
bc07ab17 840%constant wxEventType wxEVT_AUI_FIND_MANAGER;
06d4c4d6
RD
841
842%pythoncode {
bc07ab17
RD
843 EVT_AUI_PANE_BUTTON = wx.PyEventBinder( wxEVT_AUI_PANE_BUTTON )
844 EVT_AUI_PANE_CLOSE = wx.PyEventBinder( wxEVT_AUI_PANE_CLOSE )
845 EVT_AUI_PANE_MAXIMIZE = wx.PyEventBinder( wxEVT_AUI_PANE_MAXIMIZE )
846 EVT_AUI_PANE_RESTORE = wx.PyEventBinder( wxEVT_AUI_PANE_RESTORE )
673727f3 847 EVT_AUI_RENDER = wx.PyEventBinder( wxEVT_AUI_RENDER )
bc07ab17 848 EVT_AUI_FIND_MANAGER = wx.PyEventBinder( wxEVT_AUI_FIND_MANAGER )
06d4c4d6
RD
849}
850#endif // SWIG
50acee04
JS
851
852#endif // wxUSE_AUI
853#endif //_WX_FRAMEMANAGER_H_
854