#include <wx/aui/framemanager.h>
wxAuiManager is the central class of the wxAUI class framework.
wxAuiManager manages the panes associated with it for a particular wxFrame, using a pane's wxAuiPaneInfo information to determine each pane's docking and floating behaviour.
wxAuiManager 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.
wxAuiManager 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, wxAuiManager'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:
Later on, the positions can be modified easily. The following will float an existing pane in a tool window:
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:
This class supports the following styles:
The following event handler macros redirect the events to member function handlers 'func' with prototypes like:
Event macros for events emitted by this class:
Public Member Functions | |
wxAuiManager (wxWindow *managed_wnd=NULL, unsigned int flags=wxAUI_MGR_DEFAULT) | |
Constructor. More... | |
virtual | ~wxAuiManager () |
Dtor. More... | |
bool | DetachPane (wxWindow *window) |
Tells the wxAuiManager to stop managing the pane specified by window. More... | |
wxAuiPaneInfoArray & | GetAllPanes () |
Returns an array of all panes managed by the frame manager. More... | |
wxAuiDockArt * | GetArtProvider () const |
Returns the current art provider being used. More... | |
void | GetDockSizeConstraint (double *widthpct, double *heightpct) const |
Returns the current dock constraint values. More... | |
unsigned int | GetFlags () const |
Returns the current wxAuiManagerOption's flags. More... | |
wxWindow * | GetManagedWindow () const |
Returns the frame currently being managed by wxAuiManager. More... | |
virtual void | HideHint () |
HideHint() hides any docking hint that may be visible. More... | |
bool | InsertPane (wxWindow *window, const wxAuiPaneInfo &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. More... | |
void | LoadPaneInfo (wxString pane_part, wxAuiPaneInfo &pane) |
LoadPaneInfo() is similar to LoadPerspective, with the exception that it only loads information about a single pane. More... | |
bool | LoadPerspective (const wxString &perspective, bool update=true) |
Loads a saved perspective. More... | |
wxString | SavePaneInfo (wxAuiPaneInfo &pane) |
SavePaneInfo() is similar to SavePerspective, with the exception that it only saves information about a single pane. More... | |
wxString | SavePerspective () |
Saves the entire user interface layout into an encoded wxString, which can then be stored by the application (probably using wxConfig). More... | |
void | SetArtProvider (wxAuiDockArt *art_provider) |
Instructs wxAuiManager to use art provider specified by parameter art_provider for all drawing calls. More... | |
void | SetDockSizeConstraint (double widthpct, double 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. More... | |
void | SetFlags (unsigned int flags) |
This method is used to specify wxAuiManagerOption's flags. More... | |
void | SetManagedWindow (wxWindow *managed_wnd) |
Called to specify the frame or window which is to be managed by wxAuiManager. More... | |
virtual void | ShowHint (const wxRect &rect) |
This function is used by controls to explicitly show a hint window at the specified rectangle. More... | |
void | UnInit () |
Uninitializes the framework and should be called before a managed frame or window is destroyed. More... | |
void | Update () |
This method is called after any number of changes are made to any of the managed panes. More... | |
bool | AddPane (wxWindow *window, const wxAuiPaneInfo &pane_info) |
AddPane() tells the frame manager to start managing a child window. More... | |
bool | AddPane (wxWindow *window, int direction=wxLEFT, const wxString &caption=wxEmptyString) |
AddPane() tells the frame manager to start managing a child window. More... | |
bool | AddPane (wxWindow *window, const wxAuiPaneInfo &pane_info, const wxPoint &drop_pos) |
AddPane() tells the frame manager to start managing a child window. More... | |
wxAuiPaneInfo & | GetPane (wxWindow *window) |
GetPane() is used to lookup a wxAuiPaneInfo object either by window pointer or by pane name, which acts as a unique id for a window pane. More... | |
wxAuiPaneInfo & | GetPane (const wxString &name) |
GetPane() is used to lookup a wxAuiPaneInfo object either by window pointer or by pane name, which acts as a unique id for a window pane. More... | |
Public Member Functions inherited from wxEvtHandler | |
wxEvtHandler () | |
Constructor. More... | |
virtual | ~wxEvtHandler () |
Destructor. More... | |
virtual void | QueueEvent (wxEvent *event) |
Queue event for a later processing. More... | |
virtual void | AddPendingEvent (const wxEvent &event) |
Post an event to be processed later. More... | |
template<typename T , typename T1 , ... > | |
void | CallAfter (void(T::*method)(T1,...), T1 x1,...) |
Asynchronously call the given method. More... | |
template<typename T > | |
void | CallAfter (const T &functor) |
Asynchronously call the given functor. More... | |
virtual bool | ProcessEvent (wxEvent &event) |
Processes an event, searching event tables and calling zero or more suitable event handler function(s). More... | |
bool | ProcessEventLocally (wxEvent &event) |
Try to process the event in this handler and all those chained to it. More... | |
bool | SafelyProcessEvent (wxEvent &event) |
Processes an event by calling ProcessEvent() and handles any exceptions that occur in the process. More... | |
void | ProcessPendingEvents () |
Processes the pending events previously queued using QueueEvent() or AddPendingEvent(); you must call this function only if you are sure there are pending events for this handler, otherwise a wxCHECK will fail. More... | |
void | DeletePendingEvents () |
Deletes all events queued on this event handler using QueueEvent() or AddPendingEvent(). More... | |
virtual bool | SearchEventTable (wxEventTable &table, wxEvent &event) |
Searches the event table, executing an event handler function if an appropriate one is found. More... | |
void | Connect (int id, int lastId, wxEventType eventType, wxObjectEventFunction function, wxObject *userData=NULL, wxEvtHandler *eventSink=NULL) |
Connects the given function dynamically with the event handler, id and event type. More... | |
void | Connect (int id, wxEventType eventType, wxObjectEventFunction function, wxObject *userData=NULL, wxEvtHandler *eventSink=NULL) |
See the Connect(int, int, wxEventType, wxObjectEventFunction, wxObject*, wxEvtHandler*) overload for more info. More... | |
void | Connect (wxEventType eventType, wxObjectEventFunction function, wxObject *userData=NULL, wxEvtHandler *eventSink=NULL) |
See the Connect(int, int, wxEventType, wxObjectEventFunction, wxObject*, wxEvtHandler*) overload for more info. More... | |
bool | Disconnect (wxEventType eventType, wxObjectEventFunction function, wxObject *userData=NULL, wxEvtHandler *eventSink=NULL) |
Disconnects the given function dynamically from the event handler, using the specified parameters as search criteria and returning true if a matching function has been found and removed. More... | |
bool | Disconnect (int id=wxID_ANY, wxEventType eventType=wxEVT_NULL, wxObjectEventFunction function=NULL, wxObject *userData=NULL, wxEvtHandler *eventSink=NULL) |
See the Disconnect(wxEventType, wxObjectEventFunction, wxObject*, wxEvtHandler*) overload for more info. More... | |
bool | Disconnect (int id, int lastId, wxEventType eventType, wxObjectEventFunction function=NULL, wxObject *userData=NULL, wxEvtHandler *eventSink=NULL) |
See the Disconnect(wxEventType, wxObjectEventFunction, wxObject*, wxEvtHandler*) overload for more info. More... | |
template<typename EventTag , typename Functor > | |
void | Bind (const EventTag &eventType, Functor functor, int id=wxID_ANY, int lastId=wxID_ANY, wxObject *userData=NULL) |
Binds the given function, functor or method dynamically with the event. More... | |
template<typename EventTag , typename Class , typename EventArg , typename EventHandler > | |
void | Bind (const EventTag &eventType, void(Class::*method)(EventArg &), EventHandler *handler, int id=wxID_ANY, int lastId=wxID_ANY, wxObject *userData=NULL) |
See the Bind<>(const EventTag&, Functor, int, int, wxObject*) overload for more info. More... | |
template<typename EventTag , typename Functor > | |
bool | Unbind (const EventTag &eventType, Functor functor, int id=wxID_ANY, int lastId=wxID_ANY, wxObject *userData=NULL) |
Unbinds the given function, functor or method dynamically from the event handler, using the specified parameters as search criteria and returning true if a matching function has been found and removed. More... | |
template<typename EventTag , typename Class , typename EventArg , typename EventHandler > | |
bool | Unbind (const EventTag &eventType, void(Class::*method)(EventArg &), EventHandler *handler, int id=wxID_ANY, int lastId=wxID_ANY, wxObject *userData=NULL) |
See the Unbind<>(const EventTag&, Functor, int, int, wxObject*) overload for more info. More... | |
void * | GetClientData () const |
Returns user-supplied client data. More... | |
wxClientData * | GetClientObject () const |
Returns a pointer to the user-supplied client data object. More... | |
void | SetClientData (void *data) |
Sets user-supplied client data. More... | |
void | SetClientObject (wxClientData *data) |
Set the client data object. More... | |
bool | GetEvtHandlerEnabled () const |
Returns true if the event handler is enabled, false otherwise. More... | |
wxEvtHandler * | GetNextHandler () const |
Returns the pointer to the next handler in the chain. More... | |
wxEvtHandler * | GetPreviousHandler () const |
Returns the pointer to the previous handler in the chain. More... | |
void | SetEvtHandlerEnabled (bool enabled) |
Enables or disables the event handler. More... | |
virtual void | SetNextHandler (wxEvtHandler *handler) |
Sets the pointer to the next handler. More... | |
virtual void | SetPreviousHandler (wxEvtHandler *handler) |
Sets the pointer to the previous handler. More... | |
void | Unlink () |
Unlinks this event handler from the chain it's part of (if any); then links the "previous" event handler to the "next" one (so that the chain won't be interrupted). More... | |
bool | IsUnlinked () const |
Returns true if the next and the previous handler pointers of this event handler instance are NULL. More... | |
Public Member Functions inherited from wxObject | |
wxObject () | |
Default ctor; initializes to NULL the internal reference data. More... | |
wxObject (const wxObject &other) | |
Copy ctor. More... | |
virtual | ~wxObject () |
Destructor. More... | |
virtual wxClassInfo * | GetClassInfo () const |
This virtual function is redefined for every class that requires run-time type information, when using the wxDECLARE_CLASS macro (or similar). More... | |
wxObjectRefData * | GetRefData () const |
Returns the wxObject::m_refData pointer, i.e. the data referenced by this object. More... | |
bool | IsKindOf (const wxClassInfo *info) const |
Determines whether this class is a subclass of (or the same class as) the given class. More... | |
bool | IsSameAs (const wxObject &obj) const |
Returns true if this object has the same data pointer as obj. More... | |
void | Ref (const wxObject &clone) |
Makes this object refer to the data in clone. More... | |
void | SetRefData (wxObjectRefData *data) |
Sets the wxObject::m_refData pointer. More... | |
void | UnRef () |
Decrements the reference count in the associated data, and if it is zero, deletes the data. More... | |
void | UnShare () |
This is the same of AllocExclusive() but this method is public. More... | |
void | operator delete (void *buf) |
The delete operator is defined for debugging versions of the library only, when the identifier WXDEBUG is defined. More... | |
void * | operator new (size_t size, const wxString &filename=NULL, int lineNum=0) |
The new operator is defined for debugging versions of the library only, when the identifier WXDEBUG is defined. More... | |
Static Public Member Functions | |
static wxAuiManager * | GetManager (wxWindow *window) |
Calling this method will return the wxAuiManager for a given window. More... | |
Static Public Member Functions inherited from wxEvtHandler | |
static void | AddFilter (wxEventFilter *filter) |
Add an event filter whose FilterEvent() method will be called for each and every event processed by wxWidgets. More... | |
static void | RemoveFilter (wxEventFilter *filter) |
Remove a filter previously installed with AddFilter(). More... | |
Protected Member Functions | |
virtual bool | ProcessDockResult (wxAuiPaneInfo &target, const wxAuiPaneInfo &new_pos) |
ProcessDockResult() is a protected member of the wxAUI layout manager. More... | |
Protected Member Functions inherited from wxEvtHandler | |
virtual bool | TryBefore (wxEvent &event) |
Method called by ProcessEvent() before examining this object event tables. More... | |
virtual bool | TryAfter (wxEvent &event) |
Method called by ProcessEvent() as last resort. More... | |
Protected Member Functions inherited from wxObject | |
void | AllocExclusive () |
Ensure that this object's data is not shared with any other object. More... | |
virtual wxObjectRefData * | CreateRefData () const |
Creates a new instance of the wxObjectRefData-derived class specific to this object and returns it. More... | |
virtual wxObjectRefData * | CloneRefData (const wxObjectRefData *data) const |
Creates a new instance of the wxObjectRefData-derived class specific to this object and initializes it copying data. More... | |
Additional Inherited Members | |
Protected Attributes inherited from wxObject | |
wxObjectRefData * | m_refData |
Pointer to an object which is the object's reference-counted data. More... | |
wxAuiManager::wxAuiManager | ( | wxWindow * | managed_wnd = NULL , |
unsigned int | flags = wxAUI_MGR_DEFAULT |
||
) |
Constructor.
managed_wnd | Specifies the wxFrame which should be managed. |
flags | Specifies the frame management behaviour and visual effects with the wxAuiManagerOption's style flags. |
|
virtual |
Dtor.
bool wxAuiManager::AddPane | ( | wxWindow * | window, |
const wxAuiPaneInfo & | pane_info | ||
) |
AddPane() tells the frame manager to start managing a child window.
There are 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.
bool wxAuiManager::AddPane | ( | wxWindow * | window, |
int | direction = wxLEFT , |
||
const wxString & | caption = wxEmptyString |
||
) |
AddPane() tells the frame manager to start managing a child window.
There are 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.
bool wxAuiManager::AddPane | ( | wxWindow * | window, |
const wxAuiPaneInfo & | pane_info, | ||
const wxPoint & | drop_pos | ||
) |
AddPane() tells the frame manager to start managing a child window.
There are 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.
bool wxAuiManager::DetachPane | ( | wxWindow * | window | ) |
Tells the wxAuiManager to stop managing the pane specified by window.
The window, if in a floated frame, is reparented to the frame managed by wxAuiManager.
wxAuiPaneInfoArray& wxAuiManager::GetAllPanes | ( | ) |
Returns an array of all panes managed by the frame manager.
wxAuiDockArt* wxAuiManager::GetArtProvider | ( | ) | const |
Returns the current art provider being used.
void wxAuiManager::GetDockSizeConstraint | ( | double * | widthpct, |
double * | heightpct | ||
) | const |
Returns the current dock constraint values.
See SetDockSizeConstraint() for more information.
unsigned int wxAuiManager::GetFlags | ( | ) | const |
Returns the current wxAuiManagerOption's flags.
wxWindow* wxAuiManager::GetManagedWindow | ( | ) | const |
Returns the frame currently being managed by wxAuiManager.
|
static |
Calling this method will return the wxAuiManager for a given window.
The window parameter should specify any child window or sub-child window of the frame or window managed by wxAuiManager.
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.
wxAuiPaneInfo& wxAuiManager::GetPane | ( | wxWindow * | window | ) |
GetPane() is used to lookup a wxAuiPaneInfo object either by window pointer or by pane name, which acts as a unique id for a window pane.
The returned wxAuiPaneInfo object may then be modified to change a pane's look, state or position. After one or more modifications to wxAuiPaneInfo, wxAuiManager::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 wxAuiPaneInfo's IsOk() method will return false.
wxAuiPaneInfo& wxAuiManager::GetPane | ( | const wxString & | name | ) |
GetPane() is used to lookup a wxAuiPaneInfo object either by window pointer or by pane name, which acts as a unique id for a window pane.
The returned wxAuiPaneInfo object may then be modified to change a pane's look, state or position. After one or more modifications to wxAuiPaneInfo, wxAuiManager::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 wxAuiPaneInfo's IsOk() method will return false.
|
virtual |
HideHint() hides any docking hint that may be visible.
bool wxAuiManager::InsertPane | ( | wxWindow * | window, |
const wxAuiPaneInfo & | 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.
void wxAuiManager::LoadPaneInfo | ( | wxString | pane_part, |
wxAuiPaneInfo & | pane | ||
) |
LoadPaneInfo() is similar to LoadPerspective, with the exception that it only loads information about a single pane.
It is used in combination with SavePaneInfo().
bool wxAuiManager::LoadPerspective | ( | const wxString & | perspective, |
bool | update = true |
||
) |
Loads a saved perspective.
If update is true, wxAuiManager::Update() is automatically invoked, thus realizing the saved perspective on screen.
|
protectedvirtual |
ProcessDockResult() is a protected member of the wxAUI layout manager.
It can be overridden by derived classes to provide custom docking calculations.
wxString wxAuiManager::SavePaneInfo | ( | wxAuiPaneInfo & | pane | ) |
SavePaneInfo() is similar to SavePerspective, with the exception that it only saves information about a single pane.
It is used in combination with LoadPaneInfo().
wxString wxAuiManager::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.
void wxAuiManager::SetArtProvider | ( | wxAuiDockArt * | art_provider | ) |
Instructs wxAuiManager 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 wxAuiManager.
void wxAuiManager::SetDockSizeConstraint | ( | double | widthpct, |
double | 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.
wxAuiManager 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.
void wxAuiManager::SetFlags | ( | unsigned int | flags | ) |
This method is used to specify wxAuiManagerOption's flags.
flags specifies options which allow the frame management behaviour to be modified.
void wxAuiManager::SetManagedWindow | ( | wxWindow * | managed_wnd | ) |
Called to specify the frame or window which is to be managed by wxAuiManager.
Frame management is not restricted to just frames. Child windows or custom controls are also allowed.
|
virtual |
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.
void wxAuiManager::UnInit | ( | ) |
Uninitializes the framework and should be called before a managed frame or 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.
void wxAuiManager::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 wxAuiPaneInfo structures (retrieved with wxAuiManager::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.