- return 0;
-}
-
-#define RECREATE( wxBookType , idBook, oldBook , newBook ) \
-{ \
- int flags; \
- \
- switch ( m_orient ) \
- { \
- case ID_ORIENT_TOP: \
- flags = SelectFlag(idBook, wxNB_TOP, wxLB_TOP, wxCHB_TOP); \
- break; \
- \
- case ID_ORIENT_BOTTOM: \
- flags = SelectFlag(idBook, wxNB_BOTTOM, wxLB_BOTTOM, wxCHB_BOTTOM); \
- break; \
- \
- case ID_ORIENT_LEFT: \
- flags = SelectFlag(idBook, wxNB_LEFT, wxLB_LEFT, wxCHB_LEFT); \
- break; \
- \
- case ID_ORIENT_RIGHT: \
- flags = SelectFlag(idBook, wxNB_RIGHT, wxLB_RIGHT, wxCHB_RIGHT); \
- break; \
- \
- default: \
- flags = SelectFlag(idBook, wxNB_DEFAULT, wxLB_DEFAULT, wxCHB_DEFAULT); \
- } \
- \
- if ( m_multi && ( idBook == ID_NOTEBOOK ) ) \
- flags |= wxNB_MULTILINE; \
- \
- wxBookType *oldBook = newBook; \
- \
- newBook = new wxBookType(m_panel, idBook, \
- wxDefaultPosition, wxDefaultSize, \
- flags); \
- \
- if ( m_chkShowImages ) \
- { \
- newBook->SetImageList(m_imageList); \
- } \
- \
- if (oldBook) \
- { \
- int sel = oldBook->GetSelection(); \
- \
- int count = oldBook->GetPageCount(); \
- for (int n = 0; n < count; n++) \
- { \
- wxString str = oldBook->GetPageText(n); \
- \
- wxWindow *page = CreatePage(newBook, str); \
- newBook->AddPage(page, str, false, GetIconIndex(newBook) ); \
- } \
- \
- m_sizerFrame->Detach(oldBook); \
- \
- delete oldBook; \
- \
- if (sel != wxNOT_FOUND) \
- { \
- newBook->SetSelection(sel); \
- } \
- \
- } \
- else \
- { \
- wxPanel *panel = CreateRadioButtonsPage(newBook); \
- newBook->AddPage( panel, RADIOBUTTONS_PAGE_NAME, false, GetIconIndex(newBook) ); \
- \
- panel = CreateVetoPage(newBook); \
- newBook->AddPage( panel, VETO_PAGE_NAME, false, GetIconIndex(newBook) ); \
- \
- panel = CreateBigButtonPage(newBook); \
- newBook->AddPage( panel, MAXIMIZED_BUTTON_PAGE_NAME, false, GetIconIndex(newBook) ); \
- \
- panel = CreateInsertPage(newBook); \
- newBook->InsertPage( 0, panel, I_WAS_INSERTED_PAGE_NAME, false, GetIconIndex(newBook) ); \
- \
- newBook->SetSelection(1); \
- } \
- \
- m_sizerFrame->Insert(0, newBook, 5, wxEXPAND | wxALL, 4); \
- \
- m_sizerFrame->Hide(newBook); \
-}
-
-void MyFrame::RecreateBooks()
-{
- RECREATE( wxNotebook , ID_NOTEBOOK , notebook , m_notebook );
- RECREATE( wxListbook , ID_LISTBOOK , listbook , m_listbook );
- RECREATE( wxChoicebook , ID_CHOICEBOOK , choicebook , m_choicebook );
-
- ShowCurrentBook();
-}
-
-wxBookCtrl *MyFrame::GetCurrentBook()
-{
- switch (m_type)
+
+#if wxUSE_NOTEBOOK
+ if ( m_fixedWidth && m_type == Type_Notebook )
+ flags |= wxNB_FIXEDWIDTH;
+ if ( m_multi && m_type == Type_Notebook )
+ flags |= wxNB_MULTILINE;
+ if ( m_noPageTheme && m_type == Type_Notebook )
+ flags |= wxNB_NOPAGETHEME;
+#endif
+#if wxUSE_TOOLBOOK
+ if ( m_buttonBar && m_type == Type_Toolbook )
+ flags |= wxTBK_BUTTONBAR;
+ if ( m_horzLayout && m_type == Type_Toolbook )
+ flags |= wxTBK_HORZ_LAYOUT;
+#endif
+
+ wxBookCtrlBase *oldBook = m_bookCtrl;
+
+ m_bookCtrl = NULL;
+
+ DISPATCH_ON_TYPE(m_bookCtrl = new,
+ wxNotebook,
+ wxListbook,
+ wxChoicebook,
+ wxTreebook,
+ wxToolbook,
+ (m_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, flags));
+
+ if ( !m_bookCtrl )
+ return;
+
+ m_bookCtrl->Hide();
+
+ // wxToolbook doesn't work without icons so always use them for it.
+ if ( m_chkShowImages || m_type == Type_Toolbook )