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