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