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