]> git.saurik.com Git - wxWidgets.git/blame - interface/aui/aui.h
make it callable from any path
[wxWidgets.git] / interface / aui / aui.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: aui/aui.h
3// Purpose: documentation for wxAuiManager class
4// Author: wxWidgets team
5// RCS-ID: $Id$
6// Licence: wxWindows license
7/////////////////////////////////////////////////////////////////////////////
8
9/**
10 @class wxAuiManager
11 @headerfile aui.h wx/aui/aui.h
12
13 wxAuiManager is the central class of the wxAUI class framework.
14
15 See also @ref overview_wxauioverview "wxAUI overview".
16
17 wxAuiManager manages the panes associated with it
18 for a particular wxFrame, using a pane's wxAuiPaneInfo information to
19 determine each pane's docking and floating behavior. wxAuiManager
20 uses wxWidgets' sizer mechanism to plan the layout of each frame. It
21 uses a replaceable dock art class to do all drawing, so all drawing is
22 localized in one area, and may be customized depending on an
23 application's specific needs.
24
25 wxAuiManager works as follows: the programmer adds panes to the class,
26 or makes changes to existing pane properties (dock position, floating
27 state, show state, etc.). To apply these changes, wxAuiManager's
28 Update() function is called. This batch processing can be used to avoid
29 flicker, by modifying more than one pane at a time, and then "committing"
30 all of the changes at once by calling Update().
31
32 Panes can be added quite easily:
33
34 @code
35 wxTextCtrl* text1 = new wxTextCtrl(this, -1);
36 wxTextCtrl* text2 = new wxTextCtrl(this, -1);
37 m_mgr.AddPane(text1, wxLEFT, wxT("Pane Caption"));
38 m_mgr.AddPane(text2, wxBOTTOM, wxT("Pane Caption"));
39 m_mgr.Update();
40 @endcode
41
42 Later on, the positions can be modified easily. The following will float
43 an existing pane in a tool window:
44
45 @code
46 m_mgr.GetPane(text1).Float();
47 @endcode
48
49 @library{wxbase}
50 @category{aui}
51
52 @seealso
53 wxAuiPaneInfo, wxAuiDockArt
54*/
55class wxAuiManager : public wxEvtHandler
56{
57public:
58 /**
59 Constructor. @e managed_wnd specifies the wxFrame which should be managed.
60 @e flags specifies options which allow the frame management behavior
61 to be modified.
62 */
63 wxAuiManager(wxWindow* managed_wnd = @NULL,
64 unsigned int flags = wxAUI_MGR_DEFAULT);
65
66 /**
67
68 */
69 ~wxAuiManager();
70
71 //@{
72 /**
73 AddPane() tells the frame manager to start managing a child window. There are
74 several versions of this function. The first version allows the full spectrum of pane parameter possibilities. The second version is used for simpler user interfaces which do not require as much configuration. The last version allows a drop position to be specified, which will determine where the pane will be added.
75 */
76 bool AddPane(wxWindow* window, const wxAuiPaneInfo& pane_info);
77 bool AddPane(wxWindow* window, int direction = wxLEFT,
78 const wxString& caption = wxEmptyString);
79 bool AddPane(wxWindow* window,
80 const wxAuiPaneInfo& pane_info,
81 const wxPoint& drop_pos);
82 //@}
83
84 /**
85 Tells the wxAuiManager to stop managing the pane specified by window.
86 The window, if in a floated frame, is reparented to the frame managed
87 by wxAuiManager.
88 */
89 bool DetachPane(wxWindow* window);
90
91 /**
92 Returns an array of all panes managed by the frame manager.
93 */
94 wxAuiPaneInfoArray GetAllPanes();
95
96 /**
97 Returns the current art provider being used.
98
99 See also: wxAuiDockArt.
100 */
101 wxAuiDockArt* GetArtProvider();
102
103 /**
104 Returns the current dock constraint values. See SetDockSizeConstraint() for
105 more information.
106 */
107 void GetDockSizeConstraint(double* widthpct, double* heightpct);
108
109 /**
110 Returns the current manager's flags.
111 */
112 unsigned int GetFlags();
113
114 /**
115 Returns the frame currently being managed by wxAuiManager.
116 */
117 wxWindow* GetManagedWindow();
118
119 /**
120 Calling this method will return the wxAuiManager for a given window. The @e
121 window parameter should
122 specify any child window or sub-child window of the frame or window managed by
123 wxAuiManager.
124 The @e window parameter need not be managed by the manager itself, nor does it
125 even need to be a child
126 or sub-child of a managed window. It must however be inside the window
127 hierarchy underneath the managed
128 window.
129 */
130 static wxAuiManager* GetManager(wxWindow* window);
131
132 //@{
133 /**
134 @e GetPane is used to lookup a wxAuiPaneInfo object
135 either by window pointer or by pane name, which acts as a unique id for
136 a window pane. The returned wxAuiPaneInfo object may then be modified to
137 change a pane's look, state or position. After one or more
138 modifications to wxAuiPaneInfo, wxAuiManager::Update() should be called
139 to commit the changes to the user interface. If the lookup failed
140 (meaning the pane could not be found in the manager), a call to the
141 returned wxAuiPaneInfo's IsOk() method will return @false.
142 */
143 wxAuiPaneInfo GetPane(wxWindow* window);
144 wxAuiPaneInfo GetPane(const wxString& name);
145 //@}
146
147 /**
148 HideHint() hides any docking hint that may be visible.
149 */
150 void HideHint();
151
152 /**
153 This method is used to insert either a previously unmanaged pane window
154 into the frame manager, or to insert a currently managed pane somewhere
155 else. @e InsertPane will push all panes, rows, or docks aside and
156 insert the window into the position specified by @e insert_location.
157 Because @e insert_location can specify either a pane, dock row, or dock
158 layer, the @e insert_level parameter is used to disambiguate this. The
159 parameter @e insert_level can take a value of wxAUI_INSERT_PANE,
160 wxAUI_INSERT_ROW
161 or wxAUI_INSERT_DOCK.
162 */
163 bool InsertPane(wxWindow* window,
164 const wxAuiPaneInfo& insert_location,
165 int insert_level = wxAUI_INSERT_PANE);
166
167 /**
168 LoadPaneInfo() is similar to to LoadPerspective, with the exception that it
169 only loads information about a single pane. It is used in combination with SavePaneInfo().
170 */
171 void LoadPaneInfo(wxString pane_part, wxAuiPaneInfo& pane);
172
173 /**
174 Loads a saved perspective. If update is @true, wxAuiManager::Update()
175 is automatically invoked, thus realizing the saved perspective on screen.
176 */
177 bool LoadPerspective(const wxString& perspective,
178 bool update = @true);
179
180 /**
181 ProcessDockResult() is a protected member of the wxAUI layout manager. It can
182 be overridden by derived classes to provide custom docking calculations.
183 */
184 bool ProcessDockResult(wxAuiPaneInfo& target,
185 const wxAuiPaneInfo& new_pos);
186
187 /**
188 SavePaneInfo() is similar to SavePerspective, with the exception that it only
189 saves information about a single pane. It is used in combination with LoadPaneInfo().
190 */
191 wxString SavePaneInfo(wxAuiPaneInfo& pane);
192
193 /**
194 Saves the entire user interface layout into an encoded wxString, which
195 can then be stored by the application (probably using wxConfig). When
196 a perspective is restored using LoadPerspective(), the entire user
197 interface will return to the state it was when the perspective was saved.
198 */
199 wxString SavePerspective();
200
201 /**
202 Instructs wxAuiManager to use art provider specified by parameter
203 @e art_provider for all drawing calls. This allows plugable
204 look-and-feel features. The previous art provider object, if any,
205 will be deleted by wxAuiManager.
206
207 See also: wxAuiDockArt.
208 */
209 void SetArtProvider(wxAuiDockArt* art_provider);
210
211 /**
212 When a user creates a new dock by dragging a window into a docked position,
213 often times the large size of the
214 window will create a dock that is unwieldly large. wxAuiManager by default
215 limits the size of any
216 new dock to 1/3 of the window size. For horizontal docks, this would be 1/3 of
217 the window height. For
218 vertical docks, 1/3 of the width. Calling this function will adjust this
219 constraint value. The numbers
220 must be between 0.0 and 1.0. For instance, calling SetDockSizeContraint with
221 0.5, 0.5 will cause new
222 docks to be limited to half of the size of the entire managed window.
223 */
224 void SetDockSizeConstraint(double widthpct, double heightpct);
225
226 /**
227 This method is used to specify wxAuiManager's settings flags. @e flags
228 specifies options which allow the frame management behavior to be modified.
229 */
230 void SetFlags(unsigned int flags);
231
232 /**
233 Called to specify the frame or window which is to be managed by wxAuiManager.
234 Frame management is not restricted to just frames. Child windows or custom controls are also allowed.
235 */
236 void SetManagedWindow(wxWindow* managed_wnd);
237
238 /**
239 This function is used by controls to explicitly show a hint window at the
240 specified rectangle. It is rarely called, and is mostly used by controls implementing custom pane drag/drop behaviour. The specified rectangle should be in screen coordinates.
241 */
242 void ShowHint(const wxRect& rect);
243
244 /**
245 Uninitializes the framework and should be called before a managed frame or
246 window is destroyed. UnInit() is usually called in the managed wxFrame's destructor. It is necessary to call this function before the managed frame or window is destroyed, otherwise the manager cannot remove its custom event handlers from a window.
247 */
248 void UnInit();
249
250 /**
251 This method is called after any number of changes are
252 made to any of the managed panes. Update() must be invoked after
253 AddPane() or InsertPane() are called in order to "realize" or "commit"
254 the changes. In addition, any number of changes may be made to
255 wxAuiPaneInfo structures (retrieved with wxAuiManager::GetPane), but to
256 realize the changes, Update() must be called. This construction allows
257 pane flicker to be avoided by updating the whole layout at one time.
258 */
259 void Update();
260};
261
262
263/**
264 @class wxAuiPaneInfo
265 @headerfile aui.h wx/aui/aui.h
266
267 wxAuiPaneInfo is part of the wxAUI class framework.
268 See also @ref overview_wxauioverview "wxAUI overview".
269
270 wxAuiPaneInfo specifies all the parameters for a pane.
271 These parameters specify where the pane is on the
272 screen, whether it is docked or floating, or hidden.
273 In addition, these parameters specify the pane's
274 docked position, floating position, preferred size,
275 minimum size, caption text among many other parameters.
276
277 @library{wxbase}
278 @category{aui}
279
280 @seealso
281 wxAuiManager, wxAuiDockArt
282*/
283class wxAuiPaneInfo
284{
285public:
286 //@{
287 /**
288 Copy constructor.
289 */
290 wxAuiPaneInfo();
291 wxAuiPaneInfo(const wxAuiPaneInfo& c);
292 //@}
293
294 //@{
295 /**
296 BestSize() sets the ideal size for the pane. The docking manager will attempt
297 to use this size as much as possible when docking or floating the pane.
298 */
299 wxAuiPaneInfo BestSize(const wxSize& size);
300 wxAuiPaneInfo BestSize(int x, int y);
301 //@}
302
303 /**
304 Bottom() sets the pane dock position to the bottom side of the frame. This is
305 the same thing as calling Direction(wxAUI_DOCK_BOTTOM).
306 */
307 wxAuiPaneInfo Bottom();
308
309 /**
310 BottomDockable() indicates whether a pane can be docked at the bottom of the
311 frame.
312 */
313 wxAuiPaneInfo BottomDockable(bool b = @true);
314
315 /**
316 Caption() sets the caption of the pane.
317 */
318 wxAuiPaneInfo Caption(const wxString& c);
319
320 /**
321 CaptionVisible indicates that a pane caption should be visible. If @false, no
322 pane caption is drawn.
323 */
324 wxAuiPaneInfo CaptionVisible(bool visible = @true);
325
326 //@{
327 /**
328 Center() sets the pane dock position to the left side of the frame.
329 The centre pane is the space in the middle after all border panes (left, top,
330 right, bottom) are subtracted from the layout.
331
332 This is the same thing as calling Direction(wxAUI_DOCK_CENTRE).
333 */
334 wxAuiPaneInfo Centre();
335 wxAuiPaneInfo Center();
336 //@}
337
338 //@{
339 /**
340 CentrePane() specifies that the pane should adopt the default center pane
341 settings. Centre panes usually do not have caption bars. This function provides an easy way of preparing a pane to be displayed in the center dock position.
342 */
343 wxAuiPaneInfo CentrePane();
344 wxAuiPaneInfo CenterPane();
345 //@}
346
347 /**
348 CloseButton() indicates that a close button should be drawn for the pane.
349 */
350 wxAuiPaneInfo CloseButton(bool visible = @true);
351
352 /**
353 DefaultPane() specifies that the pane should adopt the default pane settings.
354 */
355 wxAuiPaneInfo DefaultPane();
356
357 /**
358 DestroyOnClose() indicates whether a pane should be detroyed when it is closed.
359 Normally a pane is simply hidden when the close button is clicked. Setting DestroyOnClose to @true will cause the window to be destroyed when the user clicks the pane's close button.
360 */
361 wxAuiPaneInfo DestroyOnClose(bool b = @true);
362
363 /**
364 Direction() determines the direction of the docked pane. It is functionally the
365 same as calling Left(), Right(), Top() or Bottom(), except that docking direction may be specified programmatically via the parameter.
366 */
367 wxAuiPaneInfo Direction(int direction);
368
369 /**
370 Dock() indicates that a pane should be docked. It is the opposite of Float().
371 */
372 wxAuiPaneInfo Dock();
373
374 /**
375 DockFixed() causes the containing dock to have no resize sash. This is useful
376 for creating panes that span the entire width or height of a dock, but should not be resizable in the other direction.
377 */
378 wxAuiPaneInfo DockFixed(bool b = @true);
379
380 /**
381 Dockable() specifies whether a frame can be docked or not. It is the same as
382 specifying TopDockable(b).BottomDockable(b).LeftDockable(b).RightDockable(b).
383 */
384 wxAuiPaneInfo Dockable(bool b = @true);
385
386 /**
387 Fixed() forces a pane to be fixed size so that it cannot be resized. After
388 calling Fixed(), IsFixed() will return @true.
389 */
390 wxAuiPaneInfo Fixed();
391
392 /**
393 Float() indicates that a pane should be floated. It is the opposite of Dock().
394 */
395 wxAuiPaneInfo Float();
396
397 /**
398 Floatable() sets whether the user will be able to undock a pane and turn it
399 into a floating window.
400 */
401 wxAuiPaneInfo Floatable(bool b = @true);
402
403 //@{
404 /**
405 FloatingPosition() sets the position of the floating pane.
406 */
407 wxAuiPaneInfo FloatingPosition(const wxPoint& pos);
408 wxAuiPaneInfo FloatingPosition(int x, int y);
409 //@}
410
411 //@{
412 /**
413 FloatingSize() sets the size of the floating pane.
414 */
415 wxAuiPaneInfo FloatingSize(const wxSize& size);
416 wxAuiPaneInfo FloatingSize(int x, int y);
417 //@}
418
419 /**
420 Gripper() indicates that a gripper should be drawn for the pane.
421 */
422 wxAuiPaneInfo Gripper(bool visible = @true);
423
424 /**
425 GripperTop() indicates that a gripper should be drawn at the top of the pane.
426 */
427 wxAuiPaneInfo GripperTop(bool attop = @true);
428
429 /**
430 HasBorder() returns @true if the pane displays a border.
431 */
432 bool HasBorder();
433
434 /**
435 HasCaption() returns @true if the pane displays a caption.
436 */
437 bool HasCaption();
438
439 /**
440 HasCloseButton() returns @true if the pane displays a button to close the pane.
441 */
442 bool HasCloseButton();
443
444 /**
445 HasFlag() returns @true if the the property specified by flag is active for the
446 pane.
447 */
448 bool HasFlag(unsigned int flag);
449
450 /**
451 HasGripper() returns @true if the pane displays a gripper.
452 */
453 bool HasGripper();
454
455 /**
456 HasGripper() returns @true if the pane displays a gripper at the top.
457 */
458 bool HasGripperTop();
459
460 /**
461 HasMaximizeButton() returns @true if the pane displays a button to maximize the
462 pane.
463 */
464 bool HasMaximizeButton();
465
466 /**
467 HasMinimizeButton() returns @true if the pane displays a button to minimize the
468 pane.
469 */
470 bool HasMinimizeButton();
471
472 /**
473 HasPinButton() returns @true if the pane displays a button to float the pane.
474 */
475 bool HasPinButton();
476
477 /**
478 Hide() indicates that a pane should be hidden.
479 */
480 wxAuiPaneInfo Hide();
481
482 /**
483 IsBottomDockable() returns @true if the pane can be docked at the bottom of the
484 managed frame.
485 */
486 bool IsBottomDockable();
487
488 /**
489 IsDocked() returns @true if the pane is docked.
490 */
491 bool IsDocked();
492
493 /**
494 IsFixed() returns @true if the pane cannot be resized.
495 */
496 bool IsFixed();
497
498 /**
499 IsFloatable() returns @true if the pane can be undocked and displayed as a
500 floating window.
501 */
502 bool IsFloatable();
503
504 /**
505 IsFloating() returns @true if the pane is floating.
506 */
507 bool IsFloating();
508
509 /**
510 IsLeftDockable() returns @true if the pane can be docked on the left of the
511 managed frame.
512 */
513 bool IsLeftDockable();
514
515 /**
516 IsMoveable() returns @true if the docked frame can be undocked or moved to
517 another dock position.
518 */
519 bool IsMovable();
520
521 /**
522 IsOk() returns @true if the wxAuiPaneInfo structure is valid. A pane structure
523 is valid if it has an associated window.
524 */
525#define bool IsOk() /* implementation is private */
526
527 /**
528 IsResizable() returns @true if the pane can be resized.
529 */
530 bool IsResizable();
531
532 /**
533 IsRightDockable() returns @true if the pane can be docked on the right of the
534 managed frame.
535 */
536 bool IsRightDockable();
537
538 /**
539 IsShown() returns @true if the pane is currently shown.
540 */
541 bool IsShown();
542
543 /**
544 IsToolbar() returns @true if the pane contains a toolbar.
545 */
546 bool IsToolbar();
547
548 /**
549 IsTopDockable() returns @true if the pane can be docked at the top of the
550 managed frame.
551 */
552 bool IsTopDockable();
553
554 /**
555 Layer() determines the layer of the docked pane. The dock layer is similar to
556 an onion, the inner-most layer being layer 0. Each shell moving in the outward direction has a higher layer number. This allows for more complex docking layout formation.
557 */
558 wxAuiPaneInfo Layer(int layer);
559
560 /**
561 Left() sets the pane dock position to the left side of the frame. This is the
562 same thing as calling Direction(wxAUI_DOCK_LEFT).
563 */
564 wxAuiPaneInfo Left();
565
566 /**
567 LeftDockable() indicates whether a pane can be docked on the left of the frame.
568 */
569 wxAuiPaneInfo LeftDockable(bool b = @true);
570
571 //@{
572 /**
573 MaxSize() sets the maximum size of the pane.
574 */
575 wxAuiPaneInfo MaxSize(const wxSize& size);
576 wxAuiPaneInfo MaxSize(int x, int y);
577 //@}
578
579 /**
580 MaximizeButton() indicates that a maximize button should be drawn for the pane.
581 */
582 wxAuiPaneInfo MaximizeButton(bool visible = @true);
583
584 //@{
585 /**
586 MinSize() sets the minimum size of the pane. Please note that this is only
587 partially supported as of this writing.
588 */
589 wxAuiPaneInfo MinSize(const wxSize& size);
590 wxAuiPaneInfo MinSize(int x, int y);
591 //@}
592
593 /**
594 MinimizeButton() indicates that a minimize button should be drawn for the pane.
595 */
596 wxAuiPaneInfo MinimizeButton(bool visible = @true);
597
598 /**
599 Movable indicates whether a frame can be moved.
600 */
601 wxAuiPaneInfo Movable(bool b = @true);
602
603 /**
604 Name() sets the name of the pane so it can be referenced in lookup functions.
605 If a name is not specified by the user, a random name is assigned to the pane when it is added to the manager.
606 */
607 wxAuiPaneInfo Name(const wxString& n);
608
609 /**
610 PaneBorder indicates that a border should be drawn for the pane.
611 */
612 wxAuiPaneInfo PaneBorder(bool visible = @true);
613
614 /**
615 PinButton() indicates that a pin button should be drawn for the pane.
616 */
617 wxAuiPaneInfo PinButton(bool visible = @true);
618
619 /**
620 Position() determines the position of the docked pane.
621 */
622 wxAuiPaneInfo Position(int pos);
623
624 /**
625 Resizable() allows a pane to be resized if the parameter is @true, and forces it
626 to be a fixed size if the parameter is @false. This is simply an antonym for Fixed().
627 */
628 wxAuiPaneInfo Resizable(bool resizable = @true);
629
630 /**
631 Right() sets the pane dock position to the right side of the frame.
632 */
633 wxAuiPaneInfo Right();
634
635 /**
636 RightDockable() indicates whether a pane can be docked on the right of the
637 frame.
638 */
639 wxAuiPaneInfo RightDockable(bool b = @true);
640
641 /**
642 Row() determines the row of the docked pane.
643 */
644#define wxAuiPaneInfo Row(int row) /* implementation is private */
645
646 /**
647 Write the safe parts of a newly loaded PaneInfo structure "source" into "this"
648 used on loading perspectives etc.
649 */
650 void SafeSet(wxAuiPaneInfo source);
651
652 /**
653 SetFlag() turns the property given by flag on or off with the option_state
654 parameter.
655 */
656 wxAuiPaneInfo SetFlag(unsigned int flag, bool option_state);
657
658 /**
659 Show() indicates that a pane should be shown.
660 */
661 wxAuiPaneInfo Show(bool show = @true);
662
663 /**
664 ToolbarPane() specifies that the pane should adopt the default toolbar pane
665 settings.
666 */
667 wxAuiPaneInfo ToolbarPane();
668
669 /**
670 Top() sets the pane dock position to the top of the frame.
671 */
672#define wxAuiPaneInfo Top() /* implementation is private */
673
674 /**
675 TopDockable() indicates whether a pane can be docked at the top of the frame.
676 */
677 wxAuiPaneInfo TopDockable(bool b = @true);
678
679 /**
680 Window() assigns the window pointer that the wxAuiPaneInfo should use. This
681 normally does not need to be specified, as the window pointer is automatically assigned to the wxAuiPaneInfo structure as soon as it is added to the manager.
682 */
683 wxAuiPaneInfo Window(wxWindow* w);
684
685 /**
686 Makes a copy of the wxAuiPaneInfo object.
687 */
688 wxAuiPaneInfo& operator operator=(const wxAuiPaneInfo& c);
689};