More AUI controls

This commit is contained in:
Tim Warren 2015-05-11 17:02:11 -04:00
parent 8e023c1373
commit c5b2974c5a
2 changed files with 27 additions and 21 deletions

View File

@ -4,6 +4,7 @@
#include "widget.h" #include "widget.h"
extern TyroMenu *mbar; extern TyroMenu *mbar;
static wxAuiManager *manager;
static TabContainer *notebook; static TabContainer *notebook;
MainFrame::MainFrame(wxFrame *frame, const wxString &title) MainFrame::MainFrame(wxFrame *frame, const wxString &title)
@ -23,29 +24,35 @@ MainFrame::MainFrame(wxFrame *frame, const wxString &title)
SetMenuBar(mbar); SetMenuBar(mbar);
this->SetupStatusBar(); this->SetupStatusBar();
this->SetupToolbar();
// Create the tab container // Create the tab container
notebook = new TabContainer(this); notebook = new TabContainer(this);
// Set up control layout // Setup control layout
wxBoxSizer *base_sizer = new wxBoxSizer(wxVERTICAL); wxAuiManager *manager = new wxAuiManager(this);
this->SetupToolbar();
base_sizer->Add(notebook, 1, wxEXPAND | wxALL, 5);
base_sizer->SetContainingWindow(this); wxAuiPaneInfo toolBarPaneInfo;
base_sizer->SetMinSize(800,600); toolBarPaneInfo.ToolbarPane().Top();
manager->AddPane(toolBar, toolBarPaneInfo);
wxAuiPaneInfo notebookPaneInfo;
notebookPaneInfo.CenterPane();
manager->AddPane(notebook, notebookPaneInfo);
this->EnableEditControls(false); this->EnableEditControls(false);
this->BindEvents(); this->BindEvents();
// Do the layout // Do the layout
SetSizerAndFit(base_sizer); manager->Update();
} }
MainFrame::~MainFrame() MainFrame::~MainFrame()
{ {
wxLogDebug("Main Frame Destructor Called."); wxLogDebug("Main Frame Destructor Called.");
delete notebook; //delete toolBar;
//delete notebook;
//delete manager;
} }
void MainFrame::SetupStatusBar() void MainFrame::SetupStatusBar()
@ -64,12 +71,12 @@ void MainFrame::SetupToolbar()
{ {
// Icon files // Icon files
#ifdef __WXMAC__ #ifdef __WXMAC__
#include "../../resources/xpm/128/new.xpm" #include "../../resources/xpm/32/new.xpm"
#include "../../resources/xpm/128/open.xpm" #include "../../resources/xpm/32/open.xpm"
#include "../../resources/xpm/128/save.xpm" #include "../../resources/xpm/32/save.xpm"
#include "../../resources/xpm/128/cut.xpm" #include "../../resources/xpm/32/cut.xpm"
#include "../../resources/xpm/128/copy.xpm" #include "../../resources/xpm/32/copy.xpm"
#include "../../resources/xpm/128/paste.xpm" #include "../../resources/xpm/32/paste.xpm"
wxBitmap new_file_icon(new_file); wxBitmap new_file_icon(new_file);
wxBitmap open_file_icon(open); wxBitmap open_file_icon(open);
@ -102,9 +109,7 @@ void MainFrame::SetupToolbar()
wxBitmap paste_icon = wxArtProvider::GetBitmap(wxART_PASTE, wxART_TOOLBAR); wxBitmap paste_icon = wxArtProvider::GetBitmap(wxART_PASTE, wxART_TOOLBAR);
#endif #endif
CreateToolBar(wxNO_BORDER | wxTB_FLAT | wxTB_HORIZONTAL); toolBar = new wxAuiToolBar(this);
toolBar = GetToolBar();
toolBar->AddTool(wxID_NEW, "New", new_file_icon, "New file"); toolBar->AddTool(wxID_NEW, "New", new_file_icon, "New file");
toolBar->AddTool(wxID_OPEN, "Open", open_file_icon, "Open file"); toolBar->AddTool(wxID_OPEN, "Open", open_file_icon, "Open file");
@ -113,7 +118,8 @@ void MainFrame::SetupToolbar()
toolBar->AddTool(wxID_COPY, "Copy", copy_icon, "Copy"); toolBar->AddTool(wxID_COPY, "Copy", copy_icon, "Copy");
toolBar->AddTool(wxID_CUT, "Cut", cut_icon, "Cut"); toolBar->AddTool(wxID_CUT, "Cut", cut_icon, "Cut");
toolBar->AddTool(wxID_PASTE, "Paste", paste_icon, "Paste"); toolBar->AddTool(wxID_PASTE, "Paste", paste_icon, "Paste");
toolBar->AddStretchSpacer();
toolBar->Realize(); toolBar->Realize();
} }

View File

@ -14,7 +14,7 @@ class MainFrame: public wxFrame
~MainFrame(); ~MainFrame();
void EnableEditControls(bool enable=true); void EnableEditControls(bool enable=true);
private: private:
wxToolBar *toolBar; wxAuiToolBar *toolBar;
wxFindReplaceData *findReplaceData; wxFindReplaceData *findReplaceData;
wxFindReplaceDialog *findDlg; wxFindReplaceDialog *findDlg;
wxFindReplaceDialog *replaceDlg; wxFindReplaceDialog *replaceDlg;