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