Contents Up Previous Next

wxFrameManager

wxFrameManager is the central class of the wxAUI class framework.

See also wxAUI overview.

wxFrameManager manages the panes associated with it for a particular wxFrame, using a pane's wxPaneInfo information to determine each pane's docking and floating behavior. wxFrameManager 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 applications' specific needs.

wxFrameManager 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, wxFrameManager's 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:

wxTextCtrl* text1 = new wxTextCtrl(this, -1);
wxTextCtrl* text2 = new wxTextCtrl(this, -1);
m_mgr.AddPane(text1, wxLEFT, wxT("Pane Caption"));
m_mgr.AddPane(text2, wxBOTTOM, wxT("Pane Caption"));
m_mgr.Update();
Later on, the positions can be modified easily. The following will float an existing pane in a tool window:

m_mgr.GetPane(text1).Float();
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:

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.

Position: More than one pane can be placed inside of a dock. Imagine to 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 it's 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.

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 in row 0, and the second in row 1. Rows can also be used on vertically docked panes.

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.

Derived from

wxEvent

Include files

<wx/aui/aui.h>

See also

wxPaneInfo

Data structures

enum wxFrameManagerDock
{
    wxAUI_DOCK_NONE = 0,
    wxAUI_DOCK_TOP = 1,
    wxAUI_DOCK_RIGHT = 2,
    wxAUI_DOCK_BOTTOM = 3,
    wxAUI_DOCK_LEFT = 4,
    wxAUI_DOCK_CENTER = 5,
    wxAUI_DOCK_CENTRE = wxAUI_DOCK_CENTER
}

enum wxFrameManagerOption

    wxAUI_MGR_ALLOW_FLOATING        = 1 << 0,
    wxAUI_MGR_ALLOW_ACTIVE_PANE     = 1 << 1,
    wxAUI_MGR_TRANSPARENT_DRAG      = 1 << 2,
    wxAUI_MGR_TRANSPARENT_HINT      = 1 << 3,
    wxAUI_MGR_TRANSPARENT_HINT_FADE = 1 << 4,
    wxAUI_MGR_DISABLE_VENETIAN_BLINDS = 1 << 5,
    wxAUI_MGR_DISABLE_VENETIAN_BLINDS_FADE = 1 << 6,

    wxAUI_MGR_DEFAULT = wxAUI_MGR_ALLOW_FLOATING |
                        wxAUI_MGR_TRANSPARENT_HINT |
                        wxAUI_MGR_TRANSPARENT_HINT_FADE |
                        wxAUI_MGR_DISABLE_VENETIAN_BLINDS_FADE

Members

wxFrameManager::wxFrameManager
wxFrameManager::~wxFrameManager
wxFrameManager::AddPane
wxFrameManager::DetachPane
wxFrameManager::DoDrop
wxFrameManager::DoFrameLayout
wxFrameManager::DrawHintRect
wxFrameManager::GetAllPanes
wxFrameManager::GetArtProvider
wxFrameManager::GetDockPixelOffset
wxFrameManager::GetFlags
wxFrameManager::GetManagedWindow
wxFrameManager::GetPane
wxFrameManager::GetPanePart
wxFrameManager::GetPanePositionsAndSizes
wxFrameManager::HideHint
wxFrameManager::HitTest
wxFrameManager::InsertPane
wxFrameManager::LayoutAddDock
wxFrameManager::LayoutAddPane
wxFrameManager::LayoutAll
wxFrameManager::LoadPaneInfo
wxFrameManager::LoadPerspective
wxFrameManager::LookupPane
wxFrameManager::ProcessDockResult
wxFrameManager::ProcessMgrEvent
wxFrameManager::Render
wxFrameManager::Repaint
wxFrameManager::SavePaneInfo
wxFrameManager::SavePerspective
wxFrameManager::SetArtProvider
wxFrameManager::SetFlags
wxFrameManager::SetManagedWindow
wxFrameManager::ShowHint
wxFrameManager::UnInit
wxFrameManager::Update
wxFrameManager::UpdateButtonOnScreen
wxFrameManager::wxDEPRECATED


wxFrameManager::wxFrameManager

wxFrameManager(wxWindow* managed_wnd = NULL, unsigned int flags = wxAUI_MGR_DEFAULT)

Constructor. frame specifies the wxFrame which should be managed. flags specifies options which allow the frame management behavior to be modified.


wxFrameManager::~wxFrameManager

~wxFrameManager()


wxFrameManager::AddPane

bool AddPane(wxWindow* window, const wxPaneInfo& pane_info)

bool AddPane(wxWindow* window, const wxPaneInfo& pane_info, const wxPoint& drop_pos)

bool AddPane(wxWindow* window, int direction = wxLEFT, const wxString& caption = wxEmptyString)

Tells the frame manager to start managing a child window.


wxFrameManager::DetachPane

bool DetachPane(wxWindow* window)

Tells the wxFrameManager to stop managing the pane specified by window. The window, if in a floated frame, is reparented to the frame managed by wxFrameManager.


wxFrameManager::DoDrop

bool DoDrop(wxDockInfoArray& docks, wxPaneInfoArray& panes, wxPaneInfo& drop, const wxPoint& pt, const wxPoint& action_offset = wxPoint(0,0))


wxFrameManager::DoFrameLayout

void DoFrameLayout()


wxFrameManager::DrawHintRect

void DrawHintRect(wxWindow* pane_window, const wxPoint& pt, const wxPoint& offset)


wxFrameManager::GetAllPanes

wxPaneInfoArray& GetAllPanes()

Returns an array of all panes managed by the frame manager.


wxFrameManager::GetArtProvider

wxDockArt* GetArtProvider() const

Returns the current art provider being used.


wxFrameManager::GetDockPixelOffset

int GetDockPixelOffset(wxPaneInfo& test)


wxFrameManager::GetFlags

unsigned int GetFlags() const

Returns the current manager's flags.


wxFrameManager::GetManagedWindow

wxWindow* GetManagedWindow() const

Returns the frame currently being managed by wxFrameManager.


wxFrameManager::GetPane

wxPaneInfo& GetPane(wxWindow* window)

GetPanel is used to lookup a wxPaneInfo object either by window pointer or by pane name, which acts as a unique id for a window pane. The returned wxPaneInfo object may then be modified to change a pane's look, state or position. After one or more modifications to wxPaneInfo, wxFrameManager::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 wxPaneInfo's IsOk() method will return false.

wxPaneInfo& GetPane(const wxString& name)


wxFrameManager::GetPanePart

wxDockUIPart* GetPanePart(wxWindow* pane)


wxFrameManager::GetPanePositionsAndSizes

void GetPanePositionsAndSizes(wxDockInfo& dock, wxArrayInt& positions, wxArrayInt& sizes)


wxFrameManager::HideHint

void HideHint()


wxFrameManager::HitTest

wxDockUIPart* HitTest(int x, int y)


wxFrameManager::InsertPane

bool InsertPane(wxWindow* window, const wxPaneInfo& insert_location, int insert_level = wxAUI_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 wxAUI_INSERT_PANE, wxAUI_INSERT_ROW or wxAUI_INSERT_DOCK.


wxFrameManager::LayoutAddDock

void LayoutAddDock(wxSizer* container, wxDockInfo& dock, wxDockUIPartArray& uiparts, bool spacer_only)


wxFrameManager::LayoutAddPane

void LayoutAddPane(wxSizer* container, wxDockInfo& dock, wxPaneInfo& pane, wxDockUIPartArray& uiparts, bool spacer_only)


wxFrameManager::LayoutAll

wxSizer* LayoutAll(wxPaneInfoArray& panes, wxDockInfoArray& docks, wxDockUIPartArray& uiparts, bool spacer_only = false)


wxFrameManager::LoadPaneInfo

void LoadPaneInfo(wxString pane_part, wxPaneInfo& pane)


wxFrameManager::LoadPerspective

bool LoadPerspective(const wxString& perspective, bool update = true)

Loads a saved perspective. If update is true, wxFrameManager::Update() is automatically invoked, thus realizing the saved perspective on screen.


wxFrameManager::LookupPane

wxPaneInfo& LookupPane(wxWindow* window)

wxPaneInfo& LookupPane(const wxString& name)


wxFrameManager::ProcessDockResult

bool ProcessDockResult(wxPaneInfo& target, const wxPaneInfo& new_pos)


wxFrameManager::ProcessMgrEvent

void ProcessMgrEvent(wxFrameManagerEvent& event)


wxFrameManager::Render

void Render(wxDC* dc)


wxFrameManager::Repaint

void Repaint(wxDC* dc = NULL)


wxFrameManager::SavePaneInfo

wxString SavePaneInfo(wxPaneInfo& pane)


wxFrameManager::SavePerspective

wxString SavePerspective()

Saves the entire user interface layout into an encoded wxString, which can then be stored by the application (probably using wxConfig). When a perspective is restored using LoadPerspective(), the entire user interface will return to the state it was when the perspective was saved.


wxFrameManager::SetArtProvider

void SetArtProvider(wxDockArt* art_provider)

Instructs wxFrameManager 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 wxFrameManager.


wxFrameManager::SetFlags

void SetFlags(unsigned int flags)

This method is used to specify wxFrameManager's settings flags. flags specifies options which allow the frame management behavior to be modified.


wxFrameManager::SetManagedWindow

void SetManagedWindow(wxWindow* managed_wnd)

Called to specify the frame which is to be managed by wxFrameManager.


wxFrameManager::ShowHint

void ShowHint(const wxRect& rect)


wxFrameManager::UnInit

void UnInit()

Uninitializes the framework and should be called before a frame is destroyed. UnInit() is usually called in the managed wxFrame's destructor.


wxFrameManager::Update

void Update()

This method is called after any number of changes are made to any of the managed panes. Update() must be invoked after AddPane() or InsertPane() are called in order to "realize" or "commit" the changes. In addition, any number of changes may be made to wxPaneInfo structures (retrieved with wxFrameManager::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.


wxFrameManager::UpdateButtonOnScreen

void UpdateButtonOnScreen(wxDockUIPart* button_ui_part, const wxMouseEvent& event)


wxFrameManager::wxDEPRECATED

wxDEPRECATED(void SetFrame(wxFrame* frame))

deprecated -- please use SetManagedWindow() and and GetManagedWindow() instead

wxDEPRECATED(wxFrame* GetFrame() const)