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