-int MyFrame::SelectFlag(int id, int nb, int lb, int chb)
-{
- switch (id)
- {
- case ID_NOTEBOOK: return nb;
- case ID_LISTBOOK: return lb;
- case ID_CHOICEBOOK: return chb;
- }
- 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()
-{