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