***************** wx.aui.AuiManager ***************** Inheritance diagram for `wx.aui.AuiManager`: | .. inheritance-diagram:: wx.aui.AuiManager | Description =========== `wx.aui.AuiManager` is the central class of the wxAUI class framework. `wx.aui.AuiManager` manages the panes associated with it for a particular `wx.Frame <../Widgets/wx.Frame.html>`_, using a pane's `wx.aui.AuiPaneInfo `_ information to determine each pane's docking and floating behavior. `wx.aui.AuiManager` uses wxWidgets' sizer mechanism to plan the layout of each frame. It uses a replaceable dock art class to do all drawing, so all drawing is localized in one area, and may be customized depending on an application's specific needs. `wx.aui.AuiManager` works as follows: the programmer adds panes to the class, or makes changes to existing pane properties (dock position, floating state, show state, etc.). To apply these changes, `wx.aui.AuiManager`'s `Update <#Update>`_ function is called. This batch processing can be used to avoid flicker, by modifying more than one pane at a time, and then "committing" all of the changes at once by calling `Update()`. Panes can be added quite easily:: # Create several text controls text1 = wx.TextCtrl(self, -1, 'Pane 1 - sample text', wx.DefaultPosition, \ wx.Size(200, 150), wx.NO_BORDER|wx.TE_MULTILINE) text2 = wx.TextCtrl(self, -1, 'Pane 2 - sample text', wx.DefaultPosition, \ wx.Size(200, 150), wx.NO_BORDER|wx.TE_MULTILINE) # Add the panes to the manager self._mgr.AddPane(text1, wx.LEFT, 'Pane Number One') self._mgr.AddPane(text2, wx.BOTTOM, 'Pane Number Two') # Update the manager self._mgr.Update() Later on, the positions can be modified easily. The following will float an existing pane in a tool window:: self._mgr.GetPane(text1).Float() .. seealso:: `wx.aui.AuiPaneInfo `_, `wx.aui.AuiDockArt `_ Layers, Rows and Directions, Positions ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Inside wxAUI, the docking layout is figured out by checking several pane parameters. Four of these are important for determining where a pane will end up: 1. **Direction**: Each docked pane has a direction, Top, Bottom, Left, Right, or Center. This is fairly self-explanatory. The pane will be placed in the location specified by this variable. 2. **Position**: More than one pane can be placed inside of a dock. Imagine two panes being docked on the left side of a window. One pane can be placed over another. In proportionally managed docks, the pane position indicates its sequential position, starting with zero. So, in our scenario with two panes docked on the left side, the top pane in the dock would have position 0, and the second one would occupy position 1. 3. **Row**: A row can allow for two docks to be placed next to each other. One of the most common places for this to happen is in the toolbar. Multiple toolbar rows are allowed, the first row being row 0, and the second row 1. Rows can also be used on vertically docked panes. 4. **Layer**: A layer is akin to an onion. Layer 0 is the very center of the managed pane. Thus, if a pane is in layer 0, it will be closest to the center window (also sometimes known as the "content window"). Increasing layers "swallow up" all layers of a lower value. This can look very similar to multiple rows, but is different because all panes in a lower level yield to panes in higher levels. The best way to understand layers is by running the wxAUI sample. Constants ^^^^^^^^^ `wxAuiManagerDock` constants: ======================================================== =================================================== Flags Value ======================================================== =================================================== ``wx.aui.AUI_DOCK_NONE`` 0 ``wx.aui.AUI_DOCK_TOP`` 1 ``wx.aui.AUI_DOCK_RIGHT`` 2 ``wx.aui.AUI_DOCK_BOTTOM`` 3 ``wx.aui.AUI_DOCK_LEFT`` 4 ``wx.aui.AUI_DOCK_CENTER`` 5 ``wx.aui.AUI_DOCK_CENTRE`` ``wx.aui.AUI_DOCK_CENTER`` ======================================================== =================================================== | | `wxAuiManagerOption` constants, which can be used with `SetFlags <#SetFlags>`_ and `GetFlags <#GetFlags>`_: ======================================================== =================================================== Flags Value ======================================================== =================================================== ``wx.aui.AUI_MGR_ALLOW_FLOATING`` 1 << 0 ``wx.aui.AUI_MGR_ALLOW_ACTIVE_PANE`` 1 << 1 ``wx.aui.AUI_MGR_TRANSPARENT_DRAG`` 1 << 2 ``wx.aui.AUI_MGR_TRANSPARENT_HINT`` 1 << 3 ``wx.aui.AUI_MGR_VENETIAN_BLINDS_HINT`` 1 << 4 ``wx.aui.AUI_MGR_RECTANGLE_HINT`` 1 << 5 ``wx.aui.AUI_MGR_HINT_FADE`` 1 << 6 ``wx.aui.AUI_MGR_NO_VENETIAN_BLINDS_FADE`` 1 << 7 ``wx.aui.AUI_MGR_DEFAULT`` ``wx.aui.AUI_MGR_ALLOW_FLOATING`` | ``wx.aui.AUI_MGR_TRANSPARENT_HINT`` | ``wx.aui.AUI_MGR_HINT_FADE`` | ``wx.aui.AUI_MGR_NO_VENETIAN_BLINDS_FADE`` ======================================================== =================================================== Derived From ^^^^^^^^^^^^^ * `wx.EvtHandler <../Widgets/wx.EvtHandler.html>`_ Methods Summary ^^^^^^^^^^^^^^^ * `__init__ <#__init__>`_ * `AddPane <#AddPane>`_ * `CalculateHintRect <#CalculateHintRect>`_ * `ClosePane <#ClosePane>`_ * `CreateFloatingFrame <#CreateFloatingFrame>`_ * `DetachPane <#DetachPane>`_ * `DrawHintRect <#DrawHintRect>`_ * `GetAllPanes <#GetAllPanes>`_ * `GetArtProvider <#GetArtProvider>`_ * `GetDockSizeConstraint <#GetDockSizeConstraint>`_ * `GetFlags <#GetFlags>`_ * `GetManagedWindow <#GetManagedWindow>`_ * `GetManager <#GetManager>`_ * `GetPane <#GetPane>`_ * `HideHint <#HideHint>`_ * `InsertPane <#InsertPane>`_ * `LoadPaneInfo <#LoadPaneInfo>`_ * `LoadPerspective <#LoadPerspective>`_ * `MaximizePane <#MaximizePane>`_ * `OnPaneButton <#OnPaneButton>`_ * `OnRender <#OnRender>`_ * `RestoreMaximizedPane <#RestoreMaximizedPane>`_ * `RestorePane <#RestorePane>`_ * `SavePaneInfo <#SavePaneInfo>`_ * `SavePerspective <#SavePerspective>`_ * `SetArtProvider <#SetArtProvider>`_ * `SetDockSizeConstraint <#SetDockSizeConstraint>`_ * `SetFlags <#SetFlags>`_ * `SetManagedWindow <#SetManagedWindow>`_ * `ShowHint <#ShowHint>`_ * `StartPaneDrag <#StartPaneDrag>`_ * `UnInit <#UnInit>`_ * `Update <#Update>`_ Properties Summary ^^^^^^^^^^^^^^^^^^ * `AllPanes <#AllPanes>`_ * `ArtProvider <#ArtProvider>`_ * `Flags <#Flags>`_ * `ManagedWindow <#ManagedWindow>`_ Class API ========= Methods ^^^^^^^ .. method:: __init__(managed_wnd=None, flags=wx.aui.AUI_MGR_DEFAULT) Constructor. **Parameters:** * `managed_wnd` (`wx.Window <../Widgets/wx.Window.html>`_): specifies the window which should be managed. * `flags` (int): specifies options which allow the frame management behavior to be modified, and is one of the `wxAuiManagerOption` flags. | **Returns:** `wx.aui.AuiManager `_ -------- .. method:: AddPane(window, info=None, caption=None) `AddPane` tells the frame manager to start managing a child window. There are two versions of this function. The first verison accepts a `wx.aui.AuiPaneInfo `_ object for the `info` parameter and allows the full spectrum of pane parameter possibilities. (Say that 3 times fast!) The second version is used for simpler user interfaces which do not require as much configuration. In this case the `info` parameter specifies the direction property of the pane info, and defaults to ``wx.LEFT``. The pane caption may also be specified as an extra parameter in this form. **Parameters:** * `window` (`wx.Window <../Widgets/wx.Window.html>`_) * `info` (`wx.aui.AuiPaneInfo `_) * `caption` (string) | **Returns:** `bool` -------- .. method:: CalculateHintRect(pane_window, pt, offset) | **Parameters:** * `pane_window` (`wx.Window <../Widgets/wx.Window.html>`_) * `pt` (`wx.Point <../Widgets/wx.Point.html>`_) * `offset` (`wx.Point <../Widgets/wx.Point.html>`_) | **Returns:** `wx.Rect <../Widgets/wx.Rect.html>`_ -------- .. method:: ClosePane(pane_info) | **Parameters:** * `pane_info` (`wx.aui.AuiPaneInfo `_) -------- .. method:: CreateFloatingFrame(parent, p) | **Parameters:** * `parent` (`wx.Window <../Widgets/wx.Window.html>`_) * `p` (`wx.aui.AuiPaneInfo `_) | **Returns:** `wx.aui.AuiFloatingFrame` -------- .. method:: DetachPane(window) Tells the `wx.aui.AuiManager` to stop managing the pane specified by window. The window, if in a floated frame, is reparented to the frame managed by `wx.aui.AuiManager`. **Parameters:** * `window` (`wx.Window <../Widgets/wx.Window.html>`_) | **Returns:** `bool` -------- .. method:: DrawHintRect(pane_window, pt, offset) | **Parameters:** * `pane_window` (`wx.Window <../Widgets/wx.Window.html>`_) * `pt` (`wx.Point <../Widgets/wx.Point.html>`_) * `offset` (`wx.Point <../Widgets/wx.Point.html>`_) -------- .. method:: GetAllPanes() Returns an array of all panes managed by the frame manager. | **Returns:** `list of wx.aui.AuiPaneInfo` -------- .. method:: GetArtProvider() Returns the current art provider being used. | **Returns:** `wx.aui.AuiDockArt `_ .. seealso:: `wx.aui.AuiDockArt `_ -------- .. method:: GetDockSizeConstraint(widthpct, heightpct) Returns the current dock constraint values. See `SetDockSizeConstraint <#SetDockSizeConstraint>`_ for more information. **Parameters:** * `widthpct` (double) * `heightpct` (double) -------- .. method:: GetFlags() Returns the current manager's flags, a combination of `wxAuiManagerOption` flags above. | **Returns:** `int` -------- .. method:: GetManagedWindow() Returns the frame currently being managed by `wx.aui.AuiManager`. | **Returns:** `wx.Window <../Widgets/wx.Window.html>`_ -------- .. method:: GetManager(window) Calling this method will return the `wx.aui.AuiManager` for a given window. The `window` parameter should specify any child window or sub-child window of the frame or window managed by `wx.aui.AuiManager`. The `window` parameter need not be managed by the manager itself, nor does it even need to be a child or sub-child of a managed window. It must however be inside the window hierarchy underneath the managed window. **Parameters:** * `window` (`wx.Window <../Widgets/wx.Window.html>`_) | **Returns:** `wx.aui.AuiManager `_ -------- .. method:: GetPane(window) `GetPane` is used to lookup a `wx.aui.AuiPaneInfo` object either by window pointer or by pane name, which acts as a unique id for a window pane. The returned `wx.aui.AuiPaneInfo` object may then be modified to change a pane's look, state or position. After one or more modifications to `wx.aui.AuiPaneInfo`, `Update() <#Update>`_ should be called to commit the changes to the user interface. If the lookup failed (meaning the pane could not be found in the manager), a call to the returned `wx.aui.AuiPaneInfo`'s `IsOk() `_ method will return ``False``. **Parameters:** * `window` (`wx.Window <../Widgets/wx.Window.html>`_) | **Returns:** `wx.aui.AuiPaneInfo `_ -------- .. method:: HideHint() Hides any docking hint that may be visible. -------- .. method:: InsertPane(window, insert_locateion, insert_level=wx.aui.AUI_INSERT_PANE) This method is used to insert either a previously unmanaged pane window into the frame manager, or to insert a currently managed pane somewhere else. `InsertPane` will push all panes, rows, or docks aside and insert the window into the position specified by `insert_location`. Because `insert_location` can specify either a pane, dock row, or dock layer, the `insert_level` parameter is used to disambiguate this. The parameter `insert_level` can take a value of ``wx.aui.AUI_INSERT_PANE``, ``wx.aui.AUI_INSERT_ROW`` or ``wx.aui.AUI_INSERT_DOCK``. **Parameters:** * `window` (`wx.Window <../Widgets/wx.Window.html>`_) * `insert_location` (`wx.aui.AuiPaneInfo `_) * `insert_level` (int) | **Returns:** `bool` -------- .. method:: LoadPaneInfo(pane_part, pane) This is similar to to `LoadPerspective <#LoadPerspective>`_, with the exception that it only loads information about a single pane. It is used in combination with `SavePaneInfo <#SavePaneInfo>`_. **Parameters:** * `pane_part` (string) * `pane` (`wx.aui.AuiPaneInfo `_) -------- .. method:: LoadPerspective(perspective, update=True) Loads a saved perspective. If `update` is ``True``, `Update <#Update>`_ is automatically invoked, thus realizing the saved perspective on screen. **Parameters:** * `perspective` (string) * `update` (bool) | **Returns:** `bool` -------- .. method:: MaximizePane(pane_info) | **Parameters:** * `pane_info` (`wx.aui.AuiPaneInfo `_) -------- .. method:: OnPaneButton(event) | **Parameters:** * `event` (`wx.aui.AuiManagerEvent`) -------- .. method:: OnRender(event) | **Parameters:** * `event` (`wx.aui.AuiManagerEvent`) -------- .. method:: RestoreMaximizedPane() `No docstrings available for this method.` -------- .. method:: RestorePane(pane_info) | **Parameters:** * `pane_info` (`wx.aui.AuiPaneInfo `_) -------- .. method:: SavePaneInfo(pane) This is similar to `SavePerspective <#SavePerspective>`_, with the exception that it only saves information about a single pane. It is used in combination with `LoadPaneInfo <#LoadPaneInfo>`_. **Parameters:** * `pane` (`wx.aui.AuiPaneInfo `_) | **Returns:** `string` -------- .. method:: SavePerspective() Saves the entire user interface layout into an encoded string, which can then be stored by the application (probably using `wx.Config <../Widgets/wx.ConfigBase.html>`_). When a perspective is restored using `LoadPerspective <#LoadPerspective>`_, the entire user interface will return to the state it was when the perspective was saved. | **Returns:** `string` -------- .. method:: SetArtProvider(art_provider) Instructs `wx.aui.AuiManager` to use art provider specified by parameter `art_provider` for all drawing calls. This allows plugable look-and-feel features. The previous art provider object, if any, will be deleted by `wx.aui.AuiManager`. **Parameters:** * `art_provider` (`wx.aui.AuiDockArt `_) .. seealso:: `wx.aui.AuiDockArt `_ -------- .. method:: SetDockSizeConstraint(widthpct, heightpct) When a user creates a new dock by dragging a window into a docked position, often times the large size of the window will create a dock that is unwieldly large. `wx.aui.AuiManager` by default limits the size of any new dock to 1/3 of the window size. For horizontal docks, this would be 1/3 of the window height. For vertical docks, 1/3 of the width. Calling this function will adjust this constraint value. The numbers must be between 0.0 and 1.0. For instance, calling `SetDockSizeContraint` with 0.5, 0.5 will cause new docks to be limited to half of the size of the entire managed window. **Parameters:** * `widthpct` (double) * `heightpct` (double) -------- .. method:: SetFlags(flags) This method is used to specify `wx.aui.AuiManager`'s settings flags. `flags` specifies options which allow the frame management behavior to be modified and is one combination of the `wxAuiManagerOption` above. **Parameters:** * `flags` (int) -------- .. method:: SetManagedWindow(managed_wnd) Called to specify the frame or window which is to be managed by `wx.aui.AuiManager`. Frame management is not restricted to just frames. Child windows or custom controls are also allowed. **Parameters:** * `managed_wnd` (`wx.Window <../Widgets/wx.Window.html>`_) -------- .. method:: ShowHint(rect) This function is used by controls to explicitly show a hint window at the 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. **Parameters:** * `rect` (`wx.Rect <../Widgets/wx.Rect.html>`_) -------- .. method:: StartPaneDrag(pane_window, offset) | **Parameters:** * `pane_window` (`wx.Window <../Widgets/wx.Window.html>`_) * `offset` (`wx.Point <../Widgets/wx.Point.html>`_) -------- .. method:: UnInit() Uninitializes the framework and should be called before a managed frame or window is destroyed. `UnInit` is usually called in the managed `wx.Frame`'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. -------- .. method:: Update() This method is called after any number of changes are made to any of the managed panes. `Update` must be invoked after `AddPane() <#AddPane>`_ or `InsertPane() <#InsertPane>`_ are called in order to "realize" or "commit" the changes. In addition, any number of changes may be made to `wx.aui.AuiPaneInfo `_ structures (retrieved with `GetPane <#GetPane>`_), but to realize the changes, `Update` must be called. This construction allows pane flicker to be avoided by updating the whole layout at one time. -------- Properties ^^^^^^^^^^ .. attribute:: AllPanes See `GetAllPanes <#GetAllPanes>`_ .. attribute:: ArtProvider See `GetArtProvider <#GetArtProvider>`_ and `SetArtProvider <#SetArtProvider>`_ .. attribute:: Flags See `GetFlags <#GetFlags>`_ and `SetFlags <#SetFlags>`_ .. attribute:: ManagedWindow See `GetManagedWindow <#GetManagedWindow>`_ and `SetManagedWindow <#SetManagedWindow>`_