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