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