From c5b2974c5abe8fd1f883356426b1eeb3c2b33d36 Mon Sep 17 00:00:00 2001 From: Tim Warren Date: Mon, 11 May 2015 17:02:11 -0400 Subject: [PATCH] More AUI controls --- src/widgets/MainFrame.cpp | 46 ++++++++++++++++++++++----------------- src/widgets/MainFrame.h | 2 +- 2 files changed, 27 insertions(+), 21 deletions(-) diff --git a/src/widgets/MainFrame.cpp b/src/widgets/MainFrame.cpp index 47ebdf0..5f67c9d 100644 --- a/src/widgets/MainFrame.cpp +++ b/src/widgets/MainFrame.cpp @@ -4,6 +4,7 @@ #include "widget.h" extern TyroMenu *mbar; +static wxAuiManager *manager; static TabContainer *notebook; MainFrame::MainFrame(wxFrame *frame, const wxString &title) @@ -23,29 +24,35 @@ MainFrame::MainFrame(wxFrame *frame, const wxString &title) SetMenuBar(mbar); this->SetupStatusBar(); - this->SetupToolbar(); // Create the tab container notebook = new TabContainer(this); - - // Set up control layout - wxBoxSizer *base_sizer = new wxBoxSizer(wxVERTICAL); - - base_sizer->Add(notebook, 1, wxEXPAND | wxALL, 5); - base_sizer->SetContainingWindow(this); - base_sizer->SetMinSize(800,600); + + // Setup control layout + wxAuiManager *manager = new wxAuiManager(this); + this->SetupToolbar(); + + wxAuiPaneInfo toolBarPaneInfo; + toolBarPaneInfo.ToolbarPane().Top(); + manager->AddPane(toolBar, toolBarPaneInfo); + + wxAuiPaneInfo notebookPaneInfo; + notebookPaneInfo.CenterPane(); + manager->AddPane(notebook, notebookPaneInfo); this->EnableEditControls(false); this->BindEvents(); // Do the layout - SetSizerAndFit(base_sizer); + manager->Update(); } MainFrame::~MainFrame() { wxLogDebug("Main Frame Destructor Called."); - delete notebook; + //delete toolBar; + //delete notebook; + //delete manager; } void MainFrame::SetupStatusBar() @@ -64,12 +71,12 @@ void MainFrame::SetupToolbar() { // Icon files #ifdef __WXMAC__ - #include "../../resources/xpm/128/new.xpm" - #include "../../resources/xpm/128/open.xpm" - #include "../../resources/xpm/128/save.xpm" - #include "../../resources/xpm/128/cut.xpm" - #include "../../resources/xpm/128/copy.xpm" - #include "../../resources/xpm/128/paste.xpm" + #include "../../resources/xpm/32/new.xpm" + #include "../../resources/xpm/32/open.xpm" + #include "../../resources/xpm/32/save.xpm" + #include "../../resources/xpm/32/cut.xpm" + #include "../../resources/xpm/32/copy.xpm" + #include "../../resources/xpm/32/paste.xpm" wxBitmap new_file_icon(new_file); wxBitmap open_file_icon(open); @@ -102,9 +109,7 @@ void MainFrame::SetupToolbar() wxBitmap paste_icon = wxArtProvider::GetBitmap(wxART_PASTE, wxART_TOOLBAR); #endif - CreateToolBar(wxNO_BORDER | wxTB_FLAT | wxTB_HORIZONTAL); - - toolBar = GetToolBar(); + toolBar = new wxAuiToolBar(this); toolBar->AddTool(wxID_NEW, "New", new_file_icon, "New 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_CUT, "Cut", cut_icon, "Cut"); toolBar->AddTool(wxID_PASTE, "Paste", paste_icon, "Paste"); - + toolBar->AddStretchSpacer(); + toolBar->Realize(); } diff --git a/src/widgets/MainFrame.h b/src/widgets/MainFrame.h index 1358780..ee8f089 100644 --- a/src/widgets/MainFrame.h +++ b/src/widgets/MainFrame.h @@ -14,7 +14,7 @@ class MainFrame: public wxFrame ~MainFrame(); void EnableEditControls(bool enable=true); private: - wxToolBar *toolBar; + wxAuiToolBar *toolBar; wxFindReplaceData *findReplaceData; wxFindReplaceDialog *findDlg; wxFindReplaceDialog *replaceDlg;