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