wxAUI

From WxWiki
Jump to: navigation, search
Official Classes SmallBlocks.png Archive Containers Controls Data Structures Database Date & Time Debug Device Contexts Dialogs Document & Views Drag & Drop Events Filesystem Frames Graphics Grid Cell Help HTML Logging Miscellaneous Networking Printing Sizers Streams Threading Windows

wxAUI is an Advanced User Interface library that aims to implement "cutting-edge" interface usability and design features so developers can quickly and easily create beautiful and usable application interfaces. The centerpiece of the library is a docking manager which allows windows and toolbars to be floated/docked onto a frame.

To get a feel for how the user interface works, feel free to check out some screenshots or download the sample application (Windows only).

As of wxWidgets 2.8.0, wxAUI is distributed with wxWidgets.

Licensing

wxAUI is licensed under the wxWindows license.

wxAUI Homepage and Further Information

More information, including FAQ, forum, downloads, sample code and documentation can be found on the wxAUI homepage. In July 2006, wxAUI source was integrated into the wxWidgets CVS and was first released in wxWidgets 2.7.0.

The wxAUI homepage will still be used as a central location for all things wxAUI, such as updating everyone on major feature and enhancements to the library. The wxAUI forum will also continue to be a great place for submitting questions, feedback, bugs or patches.

Vision and Design Principles

Project Vision

wxAUI attempts to encapsulate the following aspects of the user interface:

  • Frame Management: Frame management provides the means to open, move and hide common controls that are needed to interact with the document, and allow these configurations to be saved into different perspectives and loaded at a later time.
  • Toolbars: Toolbars are a specialized subset of the frame management system and should behave similarly to other docked components. However, they also require additional functionality, such as "spring-loaded" rebar support, "chevron" buttons and end-user customizability.
  • Modeless Controls: Modeless controls expose a tool pallete or set of options that float above the application content while allowing it to be accessed. Usually accessed by the toolbar, these controls disappear when an option is selected, but may also be "torn off" the toolbar into a floating frame of their own.
  • Look and Feel: Look and feel encompasses the way controls are drawn, both when shown statically as well as when they are being moved. This aspect of user interface design incorporates "special effects" such as transparent window dragging as well as frame animation.

Design Principles

wxAUI adheres to the following principles:

  • Use native floating frames to obtain a native look and feel for all platforms
  • Use existing wxWidgets code where possible, such as sizer implementation for frame management
  • Use classes included in wxCore and wxBase only
  • Use standard wxWidgets coding conventions

Roadmap

Current Status

The current stable release, wxAUI version 0.9.2, implements basic frame docking and toolbar support and includes:

  • Native, floating/docking frames
  • Cross-platform: Windows, Linux and Mac
  • Customizable floating/docking behavior
  • Toolbars, incorporating "spring-loaded" dragging
  • Customizable look and feel
  • Perspective saving and loading
  • Optional transparent window effects while dragging and docking

Roadmap to 1.0

The plan for reaching wxAUI version 1.0:

  • Add "chevron" button support for toolbars that become partially hidden off screen
  • Add hide/show control for docked panes
  • Fix minimum/maximum size issues
  • Optimize frame docking hint locations and mouse drop locations
  • Streamline the "feel" of frame and toolbar dragging
  • Fix various drawing glitches and toolbar instability
  • Adding tab options to view and organize documents

1.0 and Beyond

Beyond version 1.0, there are endless numbers of features to implement, but here are a few, in no particular order:

  • Drop-down combos and menus in toolbars and tear-away frames
  • Customizable toolbars for adding/removing icons and changing icon size preferences
  • Optional Heads Up Display (HUD) display mode for precisely positioned frame docking
  • Optional interface animation such as smooth showing/hiding of frames
  • Optional dock collapse button
  • Optional Minimize/Maximize/Pin pane buttons
  • Optional Active Pane vs. Inactive Pane

Example Usage

Getting Started

To use wxAUI, you need to do the following six things:

  • Include "wx/aui/aui.h" in your implementation file
  • Create a member variable of wxAuiManager in your derived wxFrame class
  • Put the frame under the control of the wxAuiManager in your wxFrame constructor using the wxAuiManager ::SetManagedWindow() function
  • Create whatever controls you want and add them to the wxAuiManager using the wxAuiManager ::AddPane() function
  • Tell the manager to "start managing" the newly added panes using the wxAuiManager ::Update() function
  • Uninitialize the wxAuiManager in the your wxFrame destructor using the wxAuiManager ::UnInit() function.

Coding Example

The following code example shows a simple implementation that utilizes wxFrameManager to manage three text controls in a frame window:

#include <wx/wx.h>
#include <wx/aui/aui.h>
 
class MyFrame : public wxFrame
{
public:
    MyFrame(wxWindow* parent) : wxFrame(parent, -1, _("wxAUI Test"),
                                    wxDefaultPosition, wxSize(800,600),
                                    wxDEFAULT_FRAME_STYLE)                              
    {
        // notify wxAUI which frame to use
        m_mgr.SetManagedWindow(this);
 
        // create several text controls
        wxTextCtrl* text1 = new wxTextCtrl(this, -1, _("Pane 1 - sample text"),
        wxDefaultPosition, wxSize(200,150),
        wxNO_BORDER | wxTE_MULTILINE);
 
        wxTextCtrl* text2 = new wxTextCtrl(this, -1, _("Pane 2 - sample text"),
        wxDefaultPosition, wxSize(200,150),
        wxNO_BORDER | wxTE_MULTILINE);
 
        wxTextCtrl* text3 = new wxTextCtrl(this, -1, _("Main content window"),
        wxDefaultPosition, wxSize(200,150),
        wxNO_BORDER | wxTE_MULTILINE);
 
        // add the panes to the manager
        m_mgr.AddPane(text1, wxLEFT, wxT("Pane Number One"));
        m_mgr.AddPane(text2, wxBOTTOM, wxT("Pane Number Two"));
        m_mgr.AddPane(text3, wxCENTER);
 
        // tell the manager to "commit" all the changes just made
        m_mgr.Update();
    }
 
    ~MyFrame()
    {
        // deinitialize the frame manager
        m_mgr.UnInit();
    }
 
private:
    wxAuiManager m_mgr;
};
 
// our normal wxApp-derived class, as usual
class MyApp : public wxApp
{
public:
 
    bool OnInit()
    {
        wxFrame* frame = new MyFrame(NULL);
        SetTopWindow(frame);
        frame->Show();
        return true;                    
    }
};
 
DECLARE_APP(MyApp);
IMPLEMENT_APP(MyApp);

See Also