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