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