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()
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();
}
}