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