wxAUI (1/1)

Introduction

Minimal Example

The full example is available from our Codeplex repository at wxWidgets/wxAUI/Docking1.

File: wxWidgets/wxAUI/Docking1/src/Docking1App.h
#ifndef _TUTORIALS_WXWIDGETS_WXAUI_DOCKING1APP_H_
#define _TUTORIALS_WXWIDGETS_WXAUI_DOCKING1APP_H_

#include <wx/app.h>

class Docking1App : public wxApp
{
public:
    virtual bool OnInit();
};

#endif
File: wxWidgets/wxAUI/Docking1/src/Docking1App.cpp
#include "Docking1App.h"
#include "Docking1Frame.h"

wxIMPLEMENT_APP(Docking1App);

bool Docking1App::OnInit()
{
    Docking1Frame* frame = new Docking1Frame("Docking1");
    frame->Show(true);
    return true;
}
File: wxWidgets/wxAUI/Docking1/src/Docking1Frame.h
#ifndef _TUTORIALS_WXWIDGETS_WXAUI_DOCKING1FRAME_H_
#define _TUTORIALS_WXWIDGETS_WXAUI_DOCKING1FRAME_H_

#include <wx/frame.h>
#include <wx/aui/aui.h>

class Docking1Frame : public wxFrame
{
public:
    Docking1Frame(const wxString& title);
    virtual ~Docking1Frame();

private:
    wxAuiManager m_auiManager;
};

#endif
File: wxWidgets/wxAUI/Docking1/src/Docking1Frame.cpp
#include "Docking1Frame.h"
#include <wx/textctrl.h>

Docking1Frame::Docking1Frame(const wxString& title)
    : wxFrame(NULL, wxID_ANY, title)
{
    m_auiManager.SetManagedWindow(this);

    wxTextCtrl* textCtrl1 = new wxTextCtrl(this, -1, L"Pane 1 Contents");
    m_auiManager.AddPane(textCtrl1, wxLEFT, wxT("Pane 1"));

    m_auiManager.Update();
}

Docking1Frame::~Docking1Frame()
{
    m_auiManager.UnInit();
}
Figure 1:

Simple Docking Example

The full example is available from our Codeplex repository at wxWidgets/wxAUI/Docking2.

File: wxWidgets/wxAUI/Docking1/src/Docking2App.h
#ifndef _TUTORIALS_WXWIDGETS_WXAUI_DOCKING2APP_H_
#define _TUTORIALS_WXWIDGETS_WXAUI_DOCKING2APP_H_

#include <wx/app.h>

class Docking2App : public wxApp
{
public:
    virtual bool OnInit();
};

#endif
File: wxWidgets/wxAUI/Docking1/src/Docking2App.cpp
#include "Docking2App.h"
#include "Docking2Frame.h"

wxIMPLEMENT_APP(Docking2App);

bool Docking2App::OnInit()
{
    Docking2Frame* frame = new Docking2Frame("Docking2");
    frame->Show(true);
    return true;
}
File: wxWidgets/wxAUI/Docking1/src/Docking2Frame.h
#ifndef _TUTORIALS_WXWIDGETS_WXAUI_DOCKING2FRAME_H_
#define _TUTORIALS_WXWIDGETS_WXAUI_DOCKING2FRAME_H_

#include <wx/frame.h>
#include <wx/aui/aui.h>

class Docking2Frame : public wxFrame
{
public:
    Docking2Frame(const wxString& title);
    virtual ~Docking2Frame();

private:
    wxAuiManager m_auiManager;
};

#endif
File: wxWidgets/wxAUI/Docking1/src/Docking2Frame.cpp
#include "Docking2Frame.h"
#include <wx/textctrl.h>

Docking2Frame::Docking2Frame(const wxString& title)
    : wxFrame(NULL, wxID_ANY, title)
{
    m_auiManager.SetManagedWindow(this);

    wxTextCtrl* textCtrl1 = new wxTextCtrl(this, wxID_ANY, L"Pane 1 Contents");
    m_auiManager.AddPane(textCtrl1, wxLEFT, wxT("Pane 1"));

    wxTextCtrl* textCtrl2 = new wxTextCtrl(this, wxID_ANY, L"Pane 2 Contents");
    m_auiManager.AddPane(textCtrl2, wxCENTER, wxT("Pane 2"));

    m_auiManager.Update();
}

Docking2Frame::~Docking2Frame()
{
    m_auiManager.UnInit();
}
Figure 2:
Figure 3:

Further Reading


blog comments powered by Disqus

Copyright(c) 2006-2017 Xavier Leclercq | Privacy policy

Home
Contact Us
Search