void OnCustomizeToolbar(wxCommandEvent& evt);
void OnAllowNotebookDnD(wxAuiNotebookEvent& evt);
void OnNotebookPageClose(wxAuiNotebookEvent& evt);
+ void OnNotebookPageClosed(wxAuiNotebookEvent& evt);
void OnExit(wxCommandEvent& evt);
void OnAbout(wxCommandEvent& evt);
void OnTabAlignment(wxCommandEvent &evt);
EVT_AUI_PANE_CLOSE(MyFrame::OnPaneClose)
EVT_AUINOTEBOOK_ALLOW_DND(wxID_ANY, MyFrame::OnAllowNotebookDnD)
EVT_AUINOTEBOOK_PAGE_CLOSE(wxID_ANY, MyFrame::OnNotebookPageClose)
+ EVT_AUINOTEBOOK_PAGE_CLOSED(wxID_ANY, MyFrame::OnNotebookPageClosed)
END_EVENT_TABLE()
wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_OVERFLOW);
tb3->SetToolBitmapSize(wxSize(16,16));
wxBitmap tb3_bmp1 = wxArtProvider::GetBitmap(wxART_FOLDER, wxART_OTHER, wxSize(16,16));
- tb3->AddTool(ID_SampleItem+16, wxT("Test2"), tb3_bmp1);
- tb3->AddTool(ID_SampleItem+17, wxT("Test"), tb3_bmp1);
- tb3->AddTool(ID_SampleItem+18, wxT("Test"), tb3_bmp1);
- tb3->AddTool(ID_SampleItem+19, wxT("Test"), tb3_bmp1);
+ tb3->AddTool(ID_SampleItem+16, wxT("Check 1"), tb3_bmp1, wxT("Check 1"), wxITEM_CHECK);
+ tb3->AddTool(ID_SampleItem+17, wxT("Check 2"), tb3_bmp1, wxT("Check 2"), wxITEM_CHECK);
+ tb3->AddTool(ID_SampleItem+18, wxT("Check 3"), tb3_bmp1, wxT("Check 3"), wxITEM_CHECK);
+ tb3->AddTool(ID_SampleItem+19, wxT("Check 4"), tb3_bmp1, wxT("Check 4"), wxITEM_CHECK);
tb3->AddSeparator();
- tb3->AddTool(ID_SampleItem+20, wxT("Test"), tb3_bmp1);
- tb3->AddTool(ID_SampleItem+21, wxT("Test"), tb3_bmp1);
+ tb3->AddTool(ID_SampleItem+20, wxT("Radio 1"), tb3_bmp1, wxT("Radio 1"), wxITEM_RADIO);
+ tb3->AddTool(ID_SampleItem+21, wxT("Radio 2"), tb3_bmp1, wxT("Radio 2"), wxITEM_RADIO);
+ tb3->AddTool(ID_SampleItem+22, wxT("Radio 3"), tb3_bmp1, wxT("Radio 3"), wxITEM_RADIO);
+ tb3->AddSeparator();
+ tb3->AddTool(ID_SampleItem+23, wxT("Radio 1 (Group 2)"), tb3_bmp1, wxT("Radio 1 (Group 2)"), wxITEM_RADIO);
+ tb3->AddTool(ID_SampleItem+24, wxT("Radio 2 (Group 2)"), tb3_bmp1, wxT("Radio 2 (Group 2)"), wxITEM_RADIO);
+ tb3->AddTool(ID_SampleItem+25, wxT("Radio 3 (Group 2)"), tb3_bmp1, wxT("Radio 3 (Group 2)"), wxITEM_RADIO);
tb3->SetCustomOverflowItems(prepend_items, append_items);
tb3->Realize();
tb4->AddTool(ID_SampleItem+29, wxT("Item 8"), tb4_bmp1);
tb4->SetToolDropDown(ID_DropDownToolbarItem, true);
tb4->SetCustomOverflowItems(prepend_items, append_items);
+ wxChoice* choice = new wxChoice(tb4, ID_SampleItem+35);
+ choice->AppendString(wxT("One choice"));
+ choice->AppendString(wxT("Another choice"));
+ tb4->AddControl(choice);
tb4->Realize();
}
}
+void MyFrame::OnNotebookPageClosed(wxAuiNotebookEvent& evt)
+{
+ wxAuiNotebook* ctrl = (wxAuiNotebook*)evt.GetEventObject();
+
+ // selection should always be a valid index
+ wxASSERT_MSG( ctrl->GetSelection() < (int)ctrl->GetPageCount(),
+ wxString::Format("Invalid selection %d, only %d pages left",
+ ctrl->GetSelection(),
+ (int)ctrl->GetPageCount()) );
+
+ evt.Skip();
+}
+
void MyFrame::OnAllowNotebookDnD(wxAuiNotebookEvent& evt)
{
// for the purpose of this test application, explicitly
void MyFrame::OnTabAlignment(wxCommandEvent &evt)
{
- size_t i, count;
+ size_t i, count;
wxAuiPaneInfoArray& all_panes = m_mgr.GetAllPanes();
for (i = 0, count = all_panes.GetCount(); i < count; ++i)
{
{
wxAuiNotebook* nb = (wxAuiNotebook*)pane.window;
+ long style = nb->GetWindowStyleFlag();
+ style &= ~(wxAUI_NB_TOP | wxAUI_NB_BOTTOM);
if (evt.GetId() == ID_NotebookAlignTop)
- nb->SetWindowStyleFlag(nb->GetWindowStyleFlag()^wxAUI_NB_BOTTOM|wxAUI_NB_TOP);
- else if (evt.GetId() == ID_NotebookAlignBottom)
- nb->SetWindowStyleFlag(nb->GetWindowStyleFlag()^wxAUI_NB_TOP|wxAUI_NB_BOTTOM);
+ style |= wxAUI_NB_TOP;
+ else if (evt.GetId() == ID_NotebookAlignBottom)
+ style |= wxAUI_NB_BOTTOM;
+ nb->SetWindowStyleFlag(style);
+
nb->Refresh();
}
}
wxPoint(client_size.x, client_size.y),
wxSize(430,200),
m_notebook_style);
+ ctrl->Freeze();
wxBitmap page_bmp = wxArtProvider::GetBitmap(wxART_NORMAL_FILE, wxART_OTHER, wxSize(16,16));
ctrl->AddPage(CreateHTMLCtrl(ctrl), wxT("Welcome to wxAUI") , false, page_bmp);
wxPanel *panel = new wxPanel( ctrl, wxID_ANY );
- wxFlexGridSizer *flex = new wxFlexGridSizer( 2 );
+ wxFlexGridSizer *flex = new wxFlexGridSizer( 4, 2, 0, 0 );
+ flex->AddGrowableRow( 0 );
+ flex->AddGrowableRow( 3 );
+ flex->AddGrowableCol( 1 );
flex->Add( 5,5 ); flex->Add( 5,5 );
flex->Add( new wxStaticText( panel, -1, wxT("wxTextCtrl:") ), 0, wxALL|wxALIGN_CENTRE, 5 );
flex->Add( new wxTextCtrl( panel, -1, wxT(""), wxDefaultPosition, wxSize(100,-1)),
flex->Add( new wxSpinCtrl( panel, -1, wxT("5"), wxDefaultPosition, wxSize(100,-1),
wxSP_ARROW_KEYS, 5, 50, 5 ), 0, wxALL|wxALIGN_CENTRE, 5 );
flex->Add( 5,5 ); flex->Add( 5,5 );
- flex->AddGrowableRow( 0 );
- flex->AddGrowableRow( 3 );
- flex->AddGrowableCol( 1 );
panel->SetSizer( flex );
ctrl->AddPage( panel, wxT("wxPanel"), false, page_bmp );
ctrl->AddPage( new wxTextCtrl( ctrl, wxID_ANY, wxT("Some more text"),
wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxNO_BORDER) , wxT("wxTextCtrl 8") );
+ ctrl->Thaw();
return ctrl;
}