Created
November 6, 2011 18:45
-
-
Save coolhome/1343300 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "FrameTest.hpp" | |
BEGIN_EVENT_TABLE(FrameTest, wxFrame) | |
EVT_TREE_ITEM_ACTIVATED(wxID_ANY, FrameTest::HandleOnSelect) | |
END_EVENT_TABLE() | |
FrameTest::FrameTest(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style) | |
: wxFrame(parent, id, title, pos, size, style) | |
{ | |
m_mgr.SetManagedWindow(this); | |
//Notebook | |
m_notebook = new wxAuiNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0); | |
m_notebook->SetMinSize(wxSize(300,-1)); | |
m_mgr.AddPane(m_notebook, wxAuiPaneInfo().Center().Caption(wxT("Entities")).Show(true)); | |
//Create panel1 | |
m_panel1 = new wxPanel(m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL); | |
m_notebook->AddPage(m_panel1, wxT("Test Tab"), true); | |
//Create the tree for panel1 | |
m_panel1_tree = new wxTreeCtrl(m_panel1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTR_DEFAULT_STYLE | wxTR_EXTENDED); | |
wxTreeItemId explorer_root = m_panel1_tree->AddRoot(wxT("Test Tree")); | |
for(int i = 0; i != 5; i++) | |
{ | |
m_panel1_tree->AppendItem(explorer_root, wxT("Test!")); | |
} | |
//Panel2 | |
m_panel2 = new wxPanel(m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL); | |
m_notebook->AddPage(m_panel2, wxT("Tab 2")); | |
m_mgr.Update(); | |
Centre( wxBOTH ); | |
} | |
FrameTest::~FrameTest() | |
{ | |
m_mgr.UnInit(); | |
} | |
void FrameTest::HandleOnSelect(wxTreeEvent &event) | |
{ | |
m_notebook->SetSelection(1); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include <wx/wx.h> | |
#include <wx/aui/aui.h> | |
#include <wx/notebook.h> | |
#include <wx/treectrl.h> | |
class FrameTest : public wxFrame | |
{ | |
protected: | |
DECLARE_EVENT_TABLE() | |
public: | |
wxAuiManager m_mgr; | |
//Panels | |
wxAuiNotebook* m_notebook; | |
//Some panels | |
wxPanel* m_panel1; | |
wxTreeCtrl *m_panel1_tree; | |
wxPanel *m_panel2; | |
FrameTest(wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 800, 600 ), long style = wxDEFAULT_FRAME_STYLE | wxTAB_TRAVERSAL); | |
~FrameTest(); | |
void HandleOnSelect(wxTreeEvent &event); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment