]> git.saurik.com Git - wxWidgets.git/blob - include/wx/aui/framemanager.h
Added a wxRichTextCtrl-specific caret implementation in case of need
[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 WXDLLIMPEXP_FWD_AUI wxAuiFloatingFrame;
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(wxAuiFloatingFrame*, wxAuiFloatingFramePtrArray, class WXDLLIMPEXP_AUI);
138 WX_DEFINE_USER_EXPORTED_ARRAY_PTR(wxAuiPaneInfo*, wxAuiPaneInfoPtrArray, class WXDLLIMPEXP_AUI);
139 WX_DEFINE_USER_EXPORTED_ARRAY_PTR(wxAuiDockInfo*, wxAuiDockInfoPtrArray, class WXDLLIMPEXP_AUI);
140 #endif // SWIG
141
142 extern WXDLLIMPEXP_AUI wxAuiDockInfo wxAuiNullDockInfo;
143 extern WXDLLIMPEXP_AUI wxAuiPaneInfo wxAuiNullPaneInfo;
144
145
146
147 class WXDLLIMPEXP_AUI wxAuiPaneInfo
148 {
149 public:
150
151 wxAuiPaneInfo()
152 {
153 window = NULL;
154 frame = NULL;
155 state = 0;
156 dock_direction = wxAUI_DOCK_LEFT;
157 dock_layer = 0;
158 dock_row = 0;
159 dock_pos = 0;
160 floating_pos = wxDefaultPosition;
161 floating_size = wxDefaultSize;
162 best_size = wxDefaultSize;
163 min_size = wxDefaultSize;
164 max_size = wxDefaultSize;
165 dock_proportion = 0;
166
167 DefaultPane();
168 }
169
170 ~wxAuiPaneInfo() {}
171
172 #ifndef SWIG
173 wxAuiPaneInfo(const wxAuiPaneInfo& c)
174 {
175 name = c.name;
176 caption = c.caption;
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 // now assign
227 *this = source;
228 }
229
230 bool IsOk() const { return window != NULL; }
231 bool IsFixed() const { return !HasFlag(optionResizable); }
232 bool IsResizable() const { return HasFlag(optionResizable); }
233 bool IsShown() const { return !HasFlag(optionHidden); }
234 bool IsFloating() const { return HasFlag(optionFloating); }
235 bool IsDocked() const { return !HasFlag(optionFloating); }
236 bool IsToolbar() const { return HasFlag(optionToolbar); }
237 bool IsTopDockable() const { return HasFlag(optionTopDockable); }
238 bool IsBottomDockable() const { return HasFlag(optionBottomDockable); }
239 bool IsLeftDockable() const { return HasFlag(optionLeftDockable); }
240 bool IsRightDockable() const { return HasFlag(optionRightDockable); }
241 bool IsFloatable() const { return HasFlag(optionFloatable); }
242 bool IsMovable() const { return HasFlag(optionMovable); }
243 bool IsDestroyOnClose() const { return HasFlag(optionDestroyOnClose); }
244 bool IsMaximized() const { return HasFlag(optionMaximized); }
245 bool HasCaption() const { return HasFlag(optionCaption); }
246 bool HasGripper() const { return HasFlag(optionGripper); }
247 bool HasBorder() const { return HasFlag(optionPaneBorder); }
248 bool HasCloseButton() const { return HasFlag(buttonClose); }
249 bool HasMaximizeButton() const { return HasFlag(buttonMaximize); }
250 bool HasMinimizeButton() const { return HasFlag(buttonMinimize); }
251 bool HasPinButton() const { return HasFlag(buttonPin); }
252 bool HasGripperTop() const { return HasFlag(optionGripperTop); }
253
254 #ifdef SWIG
255 %typemap(out) wxAuiPaneInfo& { $result = $self; Py_INCREF($result); }
256 #endif
257 wxAuiPaneInfo& Window(wxWindow* w) { window = w; return *this; }
258 wxAuiPaneInfo& Name(const wxString& n) { name = n; return *this; }
259 wxAuiPaneInfo& Caption(const wxString& c) { caption = c; return *this; }
260 wxAuiPaneInfo& Left() { dock_direction = wxAUI_DOCK_LEFT; return *this; }
261 wxAuiPaneInfo& Right() { dock_direction = wxAUI_DOCK_RIGHT; return *this; }
262 wxAuiPaneInfo& Top() { dock_direction = wxAUI_DOCK_TOP; return *this; }
263 wxAuiPaneInfo& Bottom() { dock_direction = wxAUI_DOCK_BOTTOM; return *this; }
264 wxAuiPaneInfo& Center() { dock_direction = wxAUI_DOCK_CENTER; return *this; }
265 wxAuiPaneInfo& Centre() { dock_direction = wxAUI_DOCK_CENTRE; return *this; }
266 wxAuiPaneInfo& Direction(int direction) { dock_direction = direction; return *this; }
267 wxAuiPaneInfo& Layer(int layer) { dock_layer = layer; return *this; }
268 wxAuiPaneInfo& Row(int row) { dock_row = row; return *this; }
269 wxAuiPaneInfo& Position(int pos) { dock_pos = pos; return *this; }
270 wxAuiPaneInfo& BestSize(const wxSize& size) { best_size = size; return *this; }
271 wxAuiPaneInfo& MinSize(const wxSize& size) { min_size = size; return *this; }
272 wxAuiPaneInfo& MaxSize(const wxSize& size) { max_size = size; return *this; }
273 wxAuiPaneInfo& BestSize(int x, int y) { best_size.Set(x,y); return *this; }
274 wxAuiPaneInfo& MinSize(int x, int y) { min_size.Set(x,y); return *this; }
275 wxAuiPaneInfo& MaxSize(int x, int y) { max_size.Set(x,y); return *this; }
276 wxAuiPaneInfo& FloatingPosition(const wxPoint& pos) { floating_pos = pos; return *this; }
277 wxAuiPaneInfo& FloatingPosition(int x, int y) { floating_pos.x = x; floating_pos.y = y; return *this; }
278 wxAuiPaneInfo& FloatingSize(const wxSize& size) { floating_size = size; return *this; }
279 wxAuiPaneInfo& FloatingSize(int x, int y) { floating_size.Set(x,y); return *this; }
280 wxAuiPaneInfo& Fixed() { return SetFlag(optionResizable, false); }
281 wxAuiPaneInfo& Resizable(bool resizable = true) { return SetFlag(optionResizable, resizable); }
282 wxAuiPaneInfo& Dock() { return SetFlag(optionFloating, false); }
283 wxAuiPaneInfo& Float() { return SetFlag(optionFloating, true); }
284 wxAuiPaneInfo& Hide() { return SetFlag(optionHidden, true); }
285 wxAuiPaneInfo& Show(bool show = true) { return SetFlag(optionHidden, !show); }
286 wxAuiPaneInfo& CaptionVisible(bool visible = true) { return SetFlag(optionCaption, visible); }
287 wxAuiPaneInfo& Maximize() { return SetFlag(optionMaximized, true); }
288 wxAuiPaneInfo& Restore() { return SetFlag(optionMaximized, false); }
289 wxAuiPaneInfo& PaneBorder(bool visible = true) { return SetFlag(optionPaneBorder, visible); }
290 wxAuiPaneInfo& Gripper(bool visible = true) { return SetFlag(optionGripper, visible); }
291 wxAuiPaneInfo& GripperTop(bool attop = true) { return SetFlag(optionGripperTop, attop); }
292 wxAuiPaneInfo& CloseButton(bool visible = true) { return SetFlag(buttonClose, visible); }
293 wxAuiPaneInfo& MaximizeButton(bool visible = true) { return SetFlag(buttonMaximize, visible); }
294 wxAuiPaneInfo& MinimizeButton(bool visible = true) { return SetFlag(buttonMinimize, visible); }
295 wxAuiPaneInfo& PinButton(bool visible = true) { return SetFlag(buttonPin, visible); }
296 wxAuiPaneInfo& DestroyOnClose(bool b = true) { return SetFlag(optionDestroyOnClose, b); }
297 wxAuiPaneInfo& TopDockable(bool b = true) { return SetFlag(optionTopDockable, b); }
298 wxAuiPaneInfo& BottomDockable(bool b = true) { return SetFlag(optionBottomDockable, b); }
299 wxAuiPaneInfo& LeftDockable(bool b = true) { return SetFlag(optionLeftDockable, b); }
300 wxAuiPaneInfo& RightDockable(bool b = true) { return SetFlag(optionRightDockable, b); }
301 wxAuiPaneInfo& Floatable(bool b = true) { return SetFlag(optionFloatable, b); }
302 wxAuiPaneInfo& Movable(bool b = true) { return SetFlag(optionMovable, b); }
303 wxAuiPaneInfo& DockFixed(bool b = true) { return SetFlag(optionDockFixed, b); }
304
305 wxAuiPaneInfo& Dockable(bool b = true)
306 {
307 return TopDockable(b).BottomDockable(b).LeftDockable(b).RightDockable(b);
308 }
309
310 wxAuiPaneInfo& DefaultPane()
311 {
312 state |= optionTopDockable | optionBottomDockable |
313 optionLeftDockable | optionRightDockable |
314 optionFloatable | optionMovable | optionResizable |
315 optionCaption | optionPaneBorder | buttonClose;
316 return *this;
317 }
318
319 wxAuiPaneInfo& CentrePane() { return CenterPane(); }
320 wxAuiPaneInfo& CenterPane()
321 {
322 state = 0;
323 return Center().PaneBorder().Resizable();
324 }
325
326 wxAuiPaneInfo& ToolbarPane()
327 {
328 DefaultPane();
329 state |= (optionToolbar | optionGripper);
330 state &= ~(optionResizable | optionCaption);
331 if (dock_layer == 0)
332 dock_layer = 10;
333 return *this;
334 }
335
336 wxAuiPaneInfo& SetFlag(unsigned int flag, bool option_state)
337 {
338 if (option_state)
339 state |= flag;
340 else
341 state &= ~flag;
342 return *this;
343 }
344
345 bool HasFlag(unsigned int flag) const
346 {
347 return (state & flag) != 0;
348 }
349
350 #ifdef SWIG
351 %typemap(out) wxAuiPaneInfo& ;
352 #endif
353
354 public:
355
356 // NOTE: You can add and subtract flags from this list,
357 // but do not change the values of the flags, because
358 // they are stored in a binary integer format in the
359 // perspective string. If you really need to change the
360 // values around, you'll have to ensure backwards-compatibility
361 // in the perspective loading code.
362 enum wxAuiPaneState
363 {
364 optionFloating = 1 << 0,
365 optionHidden = 1 << 1,
366 optionLeftDockable = 1 << 2,
367 optionRightDockable = 1 << 3,
368 optionTopDockable = 1 << 4,
369 optionBottomDockable = 1 << 5,
370 optionFloatable = 1 << 6,
371 optionMovable = 1 << 7,
372 optionResizable = 1 << 8,
373 optionPaneBorder = 1 << 9,
374 optionCaption = 1 << 10,
375 optionGripper = 1 << 11,
376 optionDestroyOnClose = 1 << 12,
377 optionToolbar = 1 << 13,
378 optionActive = 1 << 14,
379 optionGripperTop = 1 << 15,
380 optionMaximized = 1 << 16,
381 optionDockFixed = 1 << 17,
382
383 buttonClose = 1 << 21,
384 buttonMaximize = 1 << 22,
385 buttonMinimize = 1 << 23,
386 buttonPin = 1 << 24,
387
388 buttonCustom1 = 1 << 26,
389 buttonCustom2 = 1 << 27,
390 buttonCustom3 = 1 << 28,
391
392 savedHiddenState = 1 << 30, // used internally
393 actionPane = 1 << 31 // used internally
394 };
395
396 public:
397 wxString name; // name of the pane
398 wxString caption; // caption displayed on the window
399
400 wxWindow* window; // window that is in this pane
401 wxFrame* frame; // floating frame window that holds the pane
402 unsigned int state; // a combination of wxPaneState values
403
404 int dock_direction; // dock direction (top, bottom, left, right, center)
405 int dock_layer; // layer number (0 = innermost layer)
406 int dock_row; // row number on the docking bar (0 = first row)
407 int dock_pos; // position inside the row (0 = first position)
408
409 wxSize best_size; // size that the layout engine will prefer
410 wxSize min_size; // minimum size the pane window can tolerate
411 wxSize max_size; // maximum size the pane window can tolerate
412
413 wxPoint floating_pos; // position while floating
414 wxSize floating_size; // size while floating
415 int dock_proportion; // proportion while docked
416
417 wxAuiPaneButtonArray buttons; // buttons on the pane
418
419 wxRect rect; // current rectangle (populated by wxAUI)
420 };
421
422
423
424 class WXDLLIMPEXP_AUI wxAuiManager : public wxEvtHandler
425 {
426 friend class wxAuiFloatingFrame;
427
428 public:
429
430 wxAuiManager(wxWindow* managed_wnd = NULL,
431 unsigned int flags = wxAUI_MGR_DEFAULT);
432 virtual ~wxAuiManager();
433 void UnInit();
434
435 void SetFlags(unsigned int flags);
436 unsigned int GetFlags() const;
437
438 void SetManagedWindow(wxWindow* managed_wnd);
439 wxWindow* GetManagedWindow() const;
440
441 static wxAuiManager* GetManager(wxWindow* window);
442
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 virtual bool CanDockPanel(const wxAuiPaneInfo & p);
486
487 void StartPaneDrag(
488 wxWindow* pane_window,
489 const wxPoint& offset);
490
491 wxRect CalculateHintRect(
492 wxWindow* pane_window,
493 const wxPoint& pt,
494 const wxPoint& offset);
495
496 void DrawHintRect(
497 wxWindow* pane_window,
498 const wxPoint& pt,
499 const wxPoint& offset);
500
501 virtual void ShowHint(const wxRect& rect);
502 virtual void HideHint();
503
504 public:
505
506 // deprecated -- please use SetManagedWindow() and
507 // and GetManagedWindow() instead
508
509 wxDEPRECATED( void SetFrame(wxFrame* frame) );
510 wxDEPRECATED( wxFrame* GetFrame() const );
511
512 protected:
513
514 // Sometimes floating frames are deleted after wxAuiManager, so we need
515 // to clear m_owner_mgr in the floating frame to avoid a crash. To do so,
516 // we register frames with wxAuiManager so it can keep track.
517 void RegisterFloatingFrame(wxAuiFloatingFrame* frame);
518 void UnregisterFloatingFrame(wxAuiFloatingFrame* frame);
519
520 void UpdateHintWindowConfig();
521
522 void DoFrameLayout();
523
524 void LayoutAddPane(wxSizer* container,
525 wxAuiDockInfo& dock,
526 wxAuiPaneInfo& pane,
527 wxAuiDockUIPartArray& uiparts,
528 bool spacer_only);
529
530 void LayoutAddDock(wxSizer* container,
531 wxAuiDockInfo& dock,
532 wxAuiDockUIPartArray& uiparts,
533 bool spacer_only);
534
535 wxSizer* LayoutAll(wxAuiPaneInfoArray& panes,
536 wxAuiDockInfoArray& docks,
537 wxAuiDockUIPartArray& uiparts,
538 bool spacer_only = false);
539
540 virtual bool ProcessDockResult(wxAuiPaneInfo& target,
541 const wxAuiPaneInfo& new_pos);
542
543 bool DoDrop(wxAuiDockInfoArray& docks,
544 wxAuiPaneInfoArray& panes,
545 wxAuiPaneInfo& drop,
546 const wxPoint& pt,
547 const wxPoint& action_offset = wxPoint(0,0));
548
549 wxAuiDockUIPart* HitTest(int x, int y);
550 wxAuiDockUIPart* GetPanePart(wxWindow* pane);
551 int GetDockPixelOffset(wxAuiPaneInfo& test);
552 void OnFloatingPaneMoveStart(wxWindow* window);
553 void OnFloatingPaneMoving(wxWindow* window, wxDirection dir );
554 void OnFloatingPaneMoved(wxWindow* window, wxDirection dir);
555 void OnFloatingPaneActivated(wxWindow* window);
556 void OnFloatingPaneClosed(wxWindow* window, wxCloseEvent& evt);
557 void OnFloatingPaneResized(wxWindow* window, const wxSize& size);
558 void Render(wxDC* dc);
559 void Repaint(wxDC* dc = NULL);
560 void ProcessMgrEvent(wxAuiManagerEvent& event);
561 void UpdateButtonOnScreen(wxAuiDockUIPart* button_ui_part,
562 const wxMouseEvent& event);
563 void GetPanePositionsAndSizes(wxAuiDockInfo& dock,
564 wxArrayInt& positions,
565 wxArrayInt& sizes);
566
567
568 public:
569
570 // public events (which can be invoked externally)
571 void OnRender(wxAuiManagerEvent& evt);
572 void OnPaneButton(wxAuiManagerEvent& evt);
573
574 protected:
575
576 // protected events
577 void OnPaint(wxPaintEvent& evt);
578 void OnEraseBackground(wxEraseEvent& evt);
579 void OnSize(wxSizeEvent& evt);
580 void OnSetCursor(wxSetCursorEvent& evt);
581 void OnLeftDown(wxMouseEvent& evt);
582 void OnLeftUp(wxMouseEvent& evt);
583 void OnMotion(wxMouseEvent& evt);
584 void OnLeaveWindow(wxMouseEvent& evt);
585 void OnChildFocus(wxChildFocusEvent& evt);
586 void OnHintFadeTimer(wxTimerEvent& evt);
587 void OnFindManager(wxAuiManagerEvent& evt);
588
589 protected:
590
591 enum
592 {
593 actionNone = 0,
594 actionResize,
595 actionClickButton,
596 actionClickCaption,
597 actionDragToolbarPane,
598 actionDragFloatingPane
599 };
600
601 protected:
602
603 wxWindow* m_frame; // the window being managed
604 wxAuiDockArt* m_art; // dock art object which does all drawing
605 unsigned int m_flags; // manager flags wxAUI_MGR_*
606
607 wxAuiPaneInfoArray m_panes; // array of panes structures
608 wxAuiDockInfoArray m_docks; // array of docks structures
609 wxAuiDockUIPartArray m_uiparts; // array of UI parts (captions, buttons, etc)
610 wxAuiFloatingFramePtrArray m_floating_frames; // array of floating frames
611
612 int m_action; // current mouse action
613 wxPoint m_action_start; // position where the action click started
614 wxPoint m_action_offset; // offset from upper left of the item clicked
615 wxAuiDockUIPart* m_action_part; // ptr to the part the action happened to
616 wxWindow* m_action_window; // action frame or window (NULL if none)
617 wxRect m_action_hintrect; // hint rectangle for the action
618 wxRect m_last_rect;
619 wxAuiDockUIPart* m_hover_button;// button uipart being hovered over
620 wxRect m_last_hint; // last hint rectangle
621 wxPoint m_last_mouse_move; // last mouse move position (see OnMotion)
622 bool m_skipping;
623 bool m_has_maximized;
624
625 double m_dock_constraint_x; // 0.0 .. 1.0; max pct of window width a dock can consume
626 double m_dock_constraint_y; // 0.0 .. 1.0; max pct of window height a dock can consume
627
628 wxFrame* m_hint_wnd; // transparent hint window, if supported by platform
629 wxTimer m_hint_fadetimer; // transparent fade timer
630 wxByte m_hint_fadeamt; // transparent fade amount
631 wxByte m_hint_fademax; // maximum value of hint fade
632
633 void* m_reserved;
634
635 #ifndef SWIG
636 DECLARE_EVENT_TABLE()
637 DECLARE_CLASS(wxAuiManager)
638 #endif // SWIG
639 };
640
641
642
643 // event declarations/classes
644
645 class WXDLLIMPEXP_AUI wxAuiManagerEvent : public wxEvent
646 {
647 public:
648 wxAuiManagerEvent(wxEventType type=wxEVT_NULL) : wxEvent(0, type)
649 {
650 manager = NULL;
651 pane = NULL;
652 button = 0;
653 veto_flag = false;
654 canveto_flag = true;
655 dc = NULL;
656 }
657 #ifndef SWIG
658 wxAuiManagerEvent(const wxAuiManagerEvent& c) : wxEvent(c)
659 {
660 manager = c.manager;
661 pane = c.pane;
662 button = c.button;
663 veto_flag = c.veto_flag;
664 canveto_flag = c.canveto_flag;
665 dc = c.dc;
666 }
667 #endif
668 wxEvent *Clone() const { return new wxAuiManagerEvent(*this); }
669
670 void SetManager(wxAuiManager* mgr) { manager = mgr; }
671 void SetPane(wxAuiPaneInfo* p) { pane = p; }
672 void SetButton(int b) { button = b; }
673 void SetDC(wxDC* pdc) { dc = pdc; }
674
675 wxAuiManager* GetManager() const { return manager; }
676 wxAuiPaneInfo* GetPane() const { return pane; }
677 int GetButton() const { return button; }
678 wxDC* GetDC() const { return dc; }
679
680 void Veto(bool veto = true) { veto_flag = veto; }
681 bool GetVeto() const { return veto_flag; }
682 void SetCanVeto(bool can_veto) { canveto_flag = can_veto; }
683 bool CanVeto() const { return canveto_flag && veto_flag; }
684
685 public:
686 wxAuiManager* manager;
687 wxAuiPaneInfo* pane;
688 int button;
689 bool veto_flag;
690 bool canveto_flag;
691 wxDC* dc;
692
693 #ifndef SWIG
694 private:
695 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxAuiManagerEvent)
696 #endif
697 };
698
699
700 class WXDLLIMPEXP_AUI wxAuiDockInfo
701 {
702 public:
703 wxAuiDockInfo()
704 {
705 dock_direction = 0;
706 dock_layer = 0;
707 dock_row = 0;
708 size = 0;
709 min_size = 0;
710 resizable = true;
711 fixed = false;
712 toolbar = false;
713 reserved1 = false;
714 }
715
716 #ifndef SWIG
717 wxAuiDockInfo(const wxAuiDockInfo& c)
718 {
719 dock_direction = c.dock_direction;
720 dock_layer = c.dock_layer;
721 dock_row = c.dock_row;
722 size = c.size;
723 min_size = c.min_size;
724 resizable = c.resizable;
725 fixed = c.fixed;
726 toolbar = c.toolbar;
727 panes = c.panes;
728 rect = c.rect;
729 reserved1 = c.reserved1;
730 }
731
732 wxAuiDockInfo& operator=(const wxAuiDockInfo& c)
733 {
734 dock_direction = c.dock_direction;
735 dock_layer = c.dock_layer;
736 dock_row = c.dock_row;
737 size = c.size;
738 min_size = c.min_size;
739 resizable = c.resizable;
740 fixed = c.fixed;
741 toolbar = c.toolbar;
742 panes = c.panes;
743 rect = c.rect;
744 reserved1 = c.reserved1;
745 return *this;
746 }
747 #endif // SWIG
748
749 bool IsOk() const { return dock_direction != 0; }
750 bool IsHorizontal() const { return dock_direction == wxAUI_DOCK_TOP ||
751 dock_direction == wxAUI_DOCK_BOTTOM; }
752 bool IsVertical() const { return dock_direction == wxAUI_DOCK_LEFT ||
753 dock_direction == wxAUI_DOCK_RIGHT ||
754 dock_direction == wxAUI_DOCK_CENTER; }
755 public:
756 wxAuiPaneInfoPtrArray panes; // array of panes
757 wxRect rect; // current rectangle
758 int dock_direction; // dock direction (top, bottom, left, right, center)
759 int dock_layer; // layer number (0 = innermost layer)
760 int dock_row; // row number on the docking bar (0 = first row)
761 int size; // size of the dock
762 int min_size; // minimum size of a dock (0 if there is no min)
763 bool resizable; // flag indicating whether the dock is resizable
764 bool toolbar; // flag indicating dock contains only toolbars
765 bool fixed; // flag indicating that the dock operates on
766 // absolute coordinates as opposed to proportional
767 bool reserved1;
768 };
769
770
771 class WXDLLIMPEXP_AUI wxAuiDockUIPart
772 {
773 public:
774 enum
775 {
776 typeCaption,
777 typeGripper,
778 typeDock,
779 typeDockSizer,
780 typePane,
781 typePaneSizer,
782 typeBackground,
783 typePaneBorder,
784 typePaneButton
785 };
786
787 int type; // ui part type (see enum above)
788 int orientation; // orientation (either wxHORIZONTAL or wxVERTICAL)
789 wxAuiDockInfo* dock; // which dock the item is associated with
790 wxAuiPaneInfo* pane; // which pane the item is associated with
791 wxAuiPaneButton* button; // which pane button the item is associated with
792 wxSizer* cont_sizer; // the part's containing sizer
793 wxSizerItem* sizer_item; // the sizer item of the part
794 wxRect rect; // client coord rectangle of the part itself
795 };
796
797
798 class WXDLLIMPEXP_AUI wxAuiPaneButton
799 {
800 public:
801 int button_id; // id of the button (e.g. buttonClose)
802 };
803
804
805
806 #ifndef SWIG
807
808 extern WXDLLIMPEXP_AUI const wxEventType wxEVT_AUI_PANE_BUTTON;
809 extern WXDLLIMPEXP_AUI const wxEventType wxEVT_AUI_PANE_CLOSE;
810 extern WXDLLIMPEXP_AUI const wxEventType wxEVT_AUI_PANE_MAXIMIZE;
811 extern WXDLLIMPEXP_AUI const wxEventType wxEVT_AUI_PANE_RESTORE;
812 extern WXDLLIMPEXP_AUI const wxEventType wxEVT_AUI_RENDER;
813 extern WXDLLIMPEXP_AUI const wxEventType wxEVT_AUI_FIND_MANAGER;
814
815 typedef void (wxEvtHandler::*wxAuiManagerEventFunction)(wxAuiManagerEvent&);
816
817 #define wxAuiManagerEventHandler(func) \
818 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxAuiManagerEventFunction, &func)
819
820 #define EVT_AUI_PANE_BUTTON(func) \
821 wx__DECLARE_EVT0(wxEVT_AUI_PANE_BUTTON, wxAuiManagerEventHandler(func))
822 #define EVT_AUI_PANE_CLOSE(func) \
823 wx__DECLARE_EVT0(wxEVT_AUI_PANE_CLOSE, wxAuiManagerEventHandler(func))
824 #define EVT_AUI_PANE_MAXIMIZE(func) \
825 wx__DECLARE_EVT0(wxEVT_AUI_PANE_MAXIMIZE, wxAuiManagerEventHandler(func))
826 #define EVT_AUI_PANE_RESTORE(func) \
827 wx__DECLARE_EVT0(wxEVT_AUI_PANE_RESTORE, wxAuiManagerEventHandler(func))
828 #define EVT_AUI_RENDER(func) \
829 wx__DECLARE_EVT0(wxEVT_AUI_RENDER, wxAuiManagerEventHandler(func))
830 #define EVT_AUI_FIND_MANAGER(func) \
831 wx__DECLARE_EVT0(wxEVT_AUI_FIND_MANAGER, wxAuiManagerEventHandler(func))
832
833 #else
834
835 %constant wxEventType wxEVT_AUI_PANE_BUTTON;
836 %constant wxEventType wxEVT_AUI_PANE_CLOSE;
837 %constant wxEventType wxEVT_AUI_PANE_MAXIMIZE;
838 %constant wxEventType wxEVT_AUI_PANE_RESTORE;
839 %constant wxEventType wxEVT_AUI_RENDER;
840 %constant wxEventType wxEVT_AUI_FIND_MANAGER;
841
842 %pythoncode {
843 EVT_AUI_PANE_BUTTON = wx.PyEventBinder( wxEVT_AUI_PANE_BUTTON )
844 EVT_AUI_PANE_CLOSE = wx.PyEventBinder( wxEVT_AUI_PANE_CLOSE )
845 EVT_AUI_PANE_MAXIMIZE = wx.PyEventBinder( wxEVT_AUI_PANE_MAXIMIZE )
846 EVT_AUI_PANE_RESTORE = wx.PyEventBinder( wxEVT_AUI_PANE_RESTORE )
847 EVT_AUI_RENDER = wx.PyEventBinder( wxEVT_AUI_RENDER )
848 EVT_AUI_FIND_MANAGER = wx.PyEventBinder( wxEVT_AUI_FIND_MANAGER )
849 }
850 #endif // SWIG
851
852 #endif // wxUSE_AUI
853 #endif //_WX_FRAMEMANAGER_H_
854