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