+ wxFAIL_MSG( wxT("unknown page name") );
+
+ return NULL;
+}
+
+
+//-----------------------------------------------------------------------------
+// MyFrame
+//-----------------------------------------------------------------------------
+
+BEGIN_EVENT_TABLE(MyFrame, wxFrame)
+ // File menu
+ EVT_MENU_RANGE(ID_BOOK_NOTEBOOK, ID_BOOK_MAX, MyFrame::OnType)
+ EVT_MENU_RANGE(ID_ORIENT_DEFAULT, ID_ORIENT_MAX, MyFrame::OnOrient)
+ EVT_MENU(ID_SHOW_IMAGES, MyFrame::OnShowImages)
+ EVT_MENU(ID_MULTI, MyFrame::OnMulti)
+ EVT_MENU(wxID_EXIT, MyFrame::OnExit)
+
+ // Operations menu
+ EVT_MENU(ID_ADD_PAGE, MyFrame::OnAddPage)
+ EVT_MENU(ID_ADD_PAGE_NO_SELECT, MyFrame::OnAddPageNoSelect)
+ EVT_MENU(ID_INSERT_PAGE, MyFrame::OnInsertPage)
+ EVT_MENU(ID_DELETE_CUR_PAGE, MyFrame::OnDeleteCurPage)
+ EVT_MENU(ID_DELETE_LAST_PAGE, MyFrame::OnDeleteLastPage)
+ EVT_MENU(ID_NEXT_PAGE, MyFrame::OnNextPage)
+ EVT_MENU(ID_GO_HOME, MyFrame::OnGoHome)
+
+#if wxUSE_HELP
+ EVT_MENU(ID_CONTEXT_HELP, MyFrame::OnContextHelp)
+#endif // wxUSE_HELP
+ EVT_MENU(ID_HITTEST, MyFrame::OnHitTest)
+
+ // Book controls
+#if wxUSE_NOTEBOOK
+ EVT_NOTEBOOK_PAGE_CHANGED(wxID_ANY, MyFrame::OnNotebook)
+ EVT_NOTEBOOK_PAGE_CHANGING(wxID_ANY, MyFrame::OnNotebook)
+#endif
+#if wxUSE_LISTBOOK
+ EVT_LISTBOOK_PAGE_CHANGED(wxID_ANY, MyFrame::OnListbook)
+ EVT_LISTBOOK_PAGE_CHANGING(wxID_ANY, MyFrame::OnListbook)
+#endif
+#if wxUSE_CHOICEBOOK
+ EVT_CHOICEBOOK_PAGE_CHANGED(wxID_ANY, MyFrame::OnChoicebook)
+ EVT_CHOICEBOOK_PAGE_CHANGING(wxID_ANY, MyFrame::OnChoicebook)
+#endif
+#if wxUSE_TREEBOOK
+ EVT_TREEBOOK_PAGE_CHANGED(wxID_ANY, MyFrame::OnTreebook)
+ EVT_TREEBOOK_PAGE_CHANGING(wxID_ANY, MyFrame::OnTreebook)
+
+ EVT_MENU(ID_ADD_SUB_PAGE, MyFrame::OnAddSubPage)
+ EVT_MENU(ID_ADD_PAGE_BEFORE, MyFrame::OnAddPageBefore)
+ EVT_UPDATE_UI_RANGE(ID_ADD_PAGE_BEFORE, ID_ADD_SUB_PAGE,
+ MyFrame::OnUpdateTreeMenu)
+#endif
+#if wxUSE_TOOLBOOK
+ EVT_TOOLBOOK_PAGE_CHANGED(wxID_ANY, MyFrame::OnToolbook)
+ EVT_TOOLBOOK_PAGE_CHANGING(wxID_ANY, MyFrame::OnToolbook)
+#endif
+
+ // Update title in idle time
+ EVT_IDLE(MyFrame::OnIdle)
+END_EVENT_TABLE()
+
+MyFrame::MyFrame()
+ : wxFrame(NULL, wxID_ANY, wxString(wxT("wxWidgets book controls sample")))
+{
+#if wxUSE_HELP
+ SetExtraStyle(wxFRAME_EX_CONTEXTHELP);
+#endif // wxUSE_HELP
+
+#if wxUSE_NOTEBOOK
+ m_type = Type_Notebook;
+#elif wxUSE_CHOICEBOOK
+ m_type = Type_Choicebook;
+#elif wxUSE_LISTBOOK
+ m_type = Type_Listbook;
+#elif wxUSE_TREEBOOK
+ m_type = Type_Treebook;
+#else
+ #error "Don't use Notebook sample without any book enabled in wxWidgets build!"
+#endif