#include "Frame.h" #include #include "wx/colordlg.h" #define MENU_EDIT_DELETE_ALL 10000 #define MENU_EDIT_ADD_PAGE 10001 #define MENU_EDIT_DELETE_PAGE 10002 #define MENU_EDIT_SET_SELECTION 10003 #define MENU_EDIT_ADVANCE_SELECTION_FWD 10004 #define MENU_EDIT_ADVANCE_SELECTION_BACK 10005 #define MENU_SET_ALL_TABS_SHAPE_ANGLE 10006 #define MENU_SHOW_IMAGES 10007 #define MENU_USE_VC71_STYLE 10008 #define MENU_USE_DEFULT_STYLE 10009 #define MENU_USE_FANCY_STYLE 10010 #define MENU_SELECT_GRADIENT_COLOR_FROM 10011 #define MENU_SELECT_GRADIENT_COLOR_TO 10012 #define MENU_SELECT_GRADIENT_COLOR_BORDER 10013 #define MENU_SET_PAGE_IMAGE_INDEX 10014 #define MENU_HIDE_X 10015 #define MENU_HIDE_NAV_BUTTONS 10016 #define MENU_USE_MOUSE_MIDDLE_BTN 10017 #define MENU_DRAW_BORDER 10018 #define MENU_USE_BOTTOM_TABS 10019 #define MENU_ENABLE_TAB 10020 #define MENU_DISABLE_TAB 10021 #define MENU_ENABLE_DRAG_N_DROP 10022 #define MENU_DCLICK_CLOSES_TAB 10023 #define MENU_USE_VC8_STYLE 10024 #define MENU_SET_ACTIVE_TEXT_COLOR 10027 #define MENU_DRAW_TAB_X 10028 #define MENU_SET_ACTIVE_TAB_COLOR 10029 #define MENU_SET_TAB_AREA_COLOR 10030 #define MENU_SELECT_NONACTIVE_TEXT_COLOR 10031 #define MENU_GRADIENT_BACKGROUND 10032 #define MENU_COLORFULL_TABS 10033 BEGIN_EVENT_TABLE(Frame, wxFrame) EVT_MENU_RANGE(MENU_HIDE_X, MENU_USE_BOTTOM_TABS, Frame::OnStyle) EVT_MENU(wxID_EXIT, Frame::OnQuit) EVT_MENU(MENU_EDIT_DELETE_ALL, Frame::OnDeleteAll) EVT_MENU(MENU_EDIT_ADD_PAGE, Frame::OnAddPage) EVT_MENU(MENU_EDIT_DELETE_PAGE, Frame::OnDeletePage) EVT_MENU(MENU_EDIT_SET_SELECTION, Frame::OnSetSelection) EVT_MENU(MENU_EDIT_ADVANCE_SELECTION_FWD, Frame::OnAdvanceSelectionFwd) EVT_MENU(MENU_EDIT_ADVANCE_SELECTION_BACK, Frame::OnAdvanceSelectionBack) EVT_MENU(MENU_SET_ALL_TABS_SHAPE_ANGLE, Frame::OnSetAllPagesShapeAngle) EVT_MENU(MENU_SHOW_IMAGES, Frame::OnShowImages) EVT_MENU_RANGE(MENU_SELECT_GRADIENT_COLOR_FROM, MENU_SELECT_GRADIENT_COLOR_BORDER, Frame::OnSelectColor) EVT_MENU(MENU_USE_VC71_STYLE, Frame::OnVC71Style) EVT_MENU(MENU_USE_VC8_STYLE, Frame::OnVC8Style) EVT_MENU(MENU_USE_DEFULT_STYLE, Frame::OnDefaultStyle) EVT_MENU(MENU_USE_FANCY_STYLE, Frame::OnFancyStyle) EVT_MENU(MENU_SET_PAGE_IMAGE_INDEX, Frame::OnSetPageImageIndex) EVT_MENU(MENU_ENABLE_TAB, Frame::OnEnableTab) EVT_MENU(MENU_DISABLE_TAB, Frame::OnDisableTab) EVT_MENU(MENU_ENABLE_DRAG_N_DROP, Frame::OnEnableDrag) EVT_MENU(MENU_SELECT_NONACTIVE_TEXT_COLOR, Frame::OnSelectColor) EVT_MENU(MENU_SET_ACTIVE_TAB_COLOR, Frame::OnSelectColor) EVT_MENU(MENU_SET_TAB_AREA_COLOR, Frame::OnSelectColor) EVT_MENU(MENU_SET_ACTIVE_TEXT_COLOR, Frame::OnSelectColor) EVT_MENU(MENU_DRAW_TAB_X, Frame::OnDrawTabX) EVT_MENU(MENU_DCLICK_CLOSES_TAB, Frame::OnDClickCloseTab) EVT_MENU(MENU_GRADIENT_BACKGROUND, Frame::OnGradientBack) EVT_MENU(MENU_COLORFULL_TABS, Frame::OnColorfullTabs) EVT_FLATNOTEBOOK_PAGE_CHANGING(-1, Frame::OnPageChanging) EVT_FLATNOTEBOOK_PAGE_CHANGED(-1, Frame::OnPageChanged) EVT_FLATNOTEBOOK_PAGE_CLOSING(-1, Frame::OnPageClosing) END_EVENT_TABLE() Frame::Frame(wxWindow* WXUNUSED(parent), const wxChar *title): m_bShowImages(false) , m_bVCStyle(false) { m_ImageList.push_back(wxXmlResource::Get()->LoadBitmap(wxT("book_red"))); m_ImageList.push_back(wxXmlResource::Get()->LoadBitmap(wxT("book_green"))); m_ImageList.push_back(wxXmlResource::Get()->LoadBitmap(wxT("book_blue"))); Create(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(800, 600), wxDEFAULT_FRAME_STYLE | wxMAXIMIZE |wxNO_FULL_REPAINT_ON_RESIZE); Maximize(); } Frame::~Frame(void) { #ifdef DEVELOPMENT delete wxLog::SetActiveTarget(m_logTargetOld); #endif } bool Frame::Create(wxFrame * parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) { wxFrame::Create(parent, id, caption, pos, size, style); // Init the menu bar m_menuBar = new wxMenuBar( wxMB_DOCKABLE ); m_fileMenu = new wxMenu(); wxMenuItem *item = new wxMenuItem(m_fileMenu, wxID_EXIT, wxT("E&xit"), wxT("Exit demo"), wxITEM_NORMAL); m_fileMenu->Append(item); m_editMenu = new wxMenu(); item = new wxMenuItem(m_editMenu, MENU_EDIT_ADD_PAGE, wxT("New Page\tCtrl+N"), wxT("Add New Page"), wxITEM_NORMAL); m_editMenu->Append(item); item = new wxMenuItem(m_editMenu, MENU_EDIT_DELETE_PAGE, wxT("Delete Page\tCtrl+F4"), wxT("Delete Page"), wxITEM_NORMAL); m_editMenu->Append(item); item = new wxMenuItem(m_editMenu, MENU_EDIT_DELETE_ALL, wxT("Delete All Pages"), wxT("Delete All Pages"), wxITEM_NORMAL); m_editMenu->Append(item); item = new wxMenuItem(m_editMenu, MENU_EDIT_SET_SELECTION, wxT("Set Selection"), wxT("Set Selection"), wxITEM_NORMAL); m_editMenu->Append(item); item = new wxMenuItem(m_editMenu, MENU_EDIT_ADVANCE_SELECTION_FWD, wxT("Advance Selection Forward"), wxT("Advance Selection Forward"), wxITEM_NORMAL); m_editMenu->Append(item); item = new wxMenuItem(m_editMenu, MENU_EDIT_ADVANCE_SELECTION_BACK, wxT("Advance Selection Backward"), wxT("Advance Selection Backward"), wxITEM_NORMAL); m_editMenu->Append(item); item = new wxMenuItem(m_editMenu, MENU_SET_ALL_TABS_SHAPE_ANGLE, wxT("Set an inclination of tab header borders"), wxT("Set the shape of tab header"), wxITEM_NORMAL); m_editMenu->Append(item); item = new wxMenuItem(m_editMenu, MENU_SET_PAGE_IMAGE_INDEX, wxT("Set image index of selected page"), wxT("Set image index"), wxITEM_NORMAL); m_editMenu->Append(item); item = new wxMenuItem(m_editMenu, MENU_SHOW_IMAGES, wxT("Show Images"), wxT("Show Images"), wxITEM_CHECK); m_editMenu->Append(item); wxMenu *styleMenu = new wxMenu(); item = new wxMenuItem(styleMenu, MENU_USE_DEFULT_STYLE, wxT("Use Default Style"), wxT("Use VC71 Style"), wxITEM_RADIO); styleMenu->Append(item); item = new wxMenuItem(styleMenu, MENU_USE_VC71_STYLE, wxT("Use VC71 Style"), wxT("Use VC71 Style"), wxITEM_RADIO); styleMenu->Append(item); item = new wxMenuItem(styleMenu, MENU_USE_VC8_STYLE, wxT("Use VC8 Style"), wxT("Use VC8 Style"), wxITEM_RADIO); styleMenu->Append(item); item = new wxMenuItem(styleMenu, MENU_USE_FANCY_STYLE, wxT("Use Fancy Style"), wxT("Use Fancy Style"), wxITEM_RADIO); styleMenu->Append(item); m_editMenu->Append(-1, wxT("Tabs Style"), styleMenu); item = new wxMenuItem(styleMenu, MENU_SELECT_GRADIENT_COLOR_FROM, wxT("Select fancy tab style 'from' color"), wxT("Select fancy tab style 'from' color"), wxITEM_NORMAL); m_editMenu->Append(item); item = new wxMenuItem(styleMenu, MENU_SELECT_GRADIENT_COLOR_TO, wxT("Select fancy tab style 'to' color"), wxT("Select fancy tab style 'to' color"), wxITEM_NORMAL); m_editMenu->Append(item); item = new wxMenuItem(styleMenu, MENU_SELECT_GRADIENT_COLOR_BORDER, wxT("Select fancy tab style 'border' color"), wxT("Select fancy tab style 'border' color"), wxITEM_NORMAL); m_editMenu->Append(item); item = new wxMenuItem(m_editMenu, MENU_HIDE_NAV_BUTTONS, wxT("Hide Navigation Buttons"), wxT("Hide Navigation Buttons"), wxITEM_CHECK); m_editMenu->Append(item); item = new wxMenuItem(m_editMenu, MENU_HIDE_X, wxT("Hide X Button"), wxT("Hide X Button"), wxITEM_CHECK); m_editMenu->Append(item); item = new wxMenuItem(m_editMenu, MENU_USE_MOUSE_MIDDLE_BTN, wxT("Use Mouse Middle Button as 'X' button"), wxT("Use Mouse Middle Button as 'X' button"), wxITEM_CHECK); m_editMenu->Append(item); item = new wxMenuItem(m_editMenu, MENU_USE_BOTTOM_TABS, wxT("Use Bottoms Tabs"), wxT("Use Bottoms Tabs"), wxITEM_CHECK); m_editMenu->Append(item); item = new wxMenuItem(m_editMenu, MENU_ENABLE_TAB, wxT("Enable Tab"), wxT("Enable Tab"), wxITEM_NORMAL); m_editMenu->Append(item); item = new wxMenuItem(m_editMenu, MENU_DISABLE_TAB, wxT("Disable Tab"), wxT("Disable Tab"), wxITEM_NORMAL); m_editMenu->Append(item); item = new wxMenuItem(m_editMenu, MENU_ENABLE_DRAG_N_DROP, wxT("Enable Drag And Drop of Tabs"), wxT("Enable Drag And Drop of Tabs"), wxITEM_CHECK); m_editMenu->Append(item); item->Check(true); item = new wxMenuItem(m_editMenu, MENU_DRAW_BORDER, wxT("Draw Border around tab area"), wxT("Draw Border around tab area"), wxITEM_CHECK); m_editMenu->Append(item); item->Check(true); item = new wxMenuItem(m_editMenu, MENU_DRAW_TAB_X, wxT("Draw X button On Active Tab"), wxT("Draw X button On Active Tab"), wxITEM_CHECK); m_editMenu->Append(item); item = new wxMenuItem(styleMenu, MENU_SET_ACTIVE_TAB_COLOR, wxT("Select Active Tab Color"), wxT("Select Active Tab Color"), wxITEM_NORMAL); m_editMenu->Append(item); item = new wxMenuItem(styleMenu, MENU_SET_TAB_AREA_COLOR, wxT("Select Tab Area Color"), wxT("Select Tab Area Color"), wxITEM_NORMAL); m_editMenu->Append(item); item = new wxMenuItem(styleMenu, MENU_SET_ACTIVE_TEXT_COLOR, wxT("Select active tab text color"), wxT("Select active tab text color"), wxITEM_NORMAL); m_editMenu->Append(item); item = new wxMenuItem(styleMenu, MENU_SELECT_NONACTIVE_TEXT_COLOR, wxT("Select NON-active tab text color"), wxT("Select NON-active tab text color"), wxITEM_NORMAL); m_editMenu->Append(item); item = new wxMenuItem(m_editMenu, MENU_DCLICK_CLOSES_TAB, wxT("Mouse double click closes tab"), wxT("Mouse double click closes tab"), wxITEM_CHECK); m_editMenu->Append(item); item->Check(false); item = new wxMenuItem(m_editMenu, MENU_GRADIENT_BACKGROUND, wxT("Use Gradient Coloring for tab area"), wxT("Use Gradient Coloring for tab area"), wxITEM_CHECK); m_editMenu->Append(item); item->Check( false ); item = new wxMenuItem(m_editMenu, MENU_COLORFULL_TABS, wxT("Colorful tabs"), wxT("Colorful tabs"), wxITEM_CHECK); m_editMenu->Append(item); item->Check( false ); m_menuBar->Append(m_fileMenu, wxT("&File")); m_menuBar->Append(m_editMenu, wxT("&Edit")); SetMenuBar(m_menuBar); // Create a right click menu wxMenu *rmenu = new wxMenu(); item = new wxMenuItem(rmenu, MENU_EDIT_DELETE_PAGE, wxT("Close Tab\tCtrl+F4"), wxT("Close Tab"), wxITEM_NORMAL); rmenu->Append(item); wxBoxSizer *mainSizer = new wxBoxSizer(wxVERTICAL); SetSizer(mainSizer); long bookStyle = 0; m_bVCStyle ? bookStyle |= wxFNB_VC71 : bookStyle |= 0; bookStyle |= wxFNB_TABS_BORDER_SIMPLE; book = new wxStyledNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, bookStyle); secondBook = new wxStyledNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, bookStyle); // Set right click menu to the notebook book->SetRightClickMenu(rmenu); // Set the image list book->SetImageList(&m_ImageList); mainSizer->Add(book, 6, wxEXPAND); // Add spacer between the books wxPanel *spacer = new wxPanel(this, wxID_ANY); spacer->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE)); mainSizer->Add(spacer, 0, wxALL | wxEXPAND); mainSizer->Add(secondBook, 2, wxEXPAND); // Add some pages to the second notebook Freeze(); wxTextCtrl *text = new wxTextCtrl(secondBook, wxID_ANY, wxT("Second Book Page 1"), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE); secondBook->AddPage(text, wxT("Second Book Page 1")); text = new wxTextCtrl(secondBook, wxID_ANY, wxT("Second Book Page 2"), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE); secondBook->AddPage(text, wxT("Second Book Page 2")); Thaw(); #ifdef DEVELOPMENT text = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE | wxTE_READONLY); m_logTargetOld = wxLog::SetActiveTarget( new wxLogTextCtrl(text) ); mainSizer->Add(text, 1, wxEXPAND); #endif Centre(); mainSizer->Layout(); SendSizeEvent(); return true; } void Frame::OnStyle(wxCommandEvent& event) { long style = book->GetWindowStyleFlag(); switch(event.GetId()) { case MENU_HIDE_NAV_BUTTONS: if(event.IsChecked()) { // Hide the navigation buttons style |= wxFNB_NO_NAV_BUTTONS; } else { if(style & wxFNB_NO_NAV_BUTTONS) style ^= wxFNB_NO_NAV_BUTTONS; } book->SetWindowStyleFlag(style); break; case MENU_HIDE_X: if(event.IsChecked()) { // Hide the X button style |= wxFNB_NO_X_BUTTON; } else { if(style & wxFNB_NO_X_BUTTON) style ^= wxFNB_NO_X_BUTTON; } book->SetWindowStyleFlag(style); break; case MENU_DRAW_BORDER: if(event.IsChecked()) { style |= wxFNB_TABS_BORDER_SIMPLE; } else { if(style & wxFNB_TABS_BORDER_SIMPLE) style ^= wxFNB_TABS_BORDER_SIMPLE; } book->SetWindowStyleFlag(style); break; case MENU_USE_MOUSE_MIDDLE_BTN: if(event.IsChecked()) { style |= wxFNB_MOUSE_MIDDLE_CLOSES_TABS; } else { if(style & wxFNB_MOUSE_MIDDLE_CLOSES_TABS) style ^= wxFNB_MOUSE_MIDDLE_CLOSES_TABS; } book->SetWindowStyleFlag(style); break; case MENU_USE_BOTTOM_TABS: if(event.IsChecked()) { style |= wxFNB_BOTTOM; } else { if(style & wxFNB_BOTTOM) style ^= wxFNB_BOTTOM; } book->SetWindowStyleFlag(style); book->Refresh(); break; } } void Frame::OnQuit(wxCommandEvent& WXUNUSED(event)) { Close(true); } void Frame::OnDeleteAll(wxCommandEvent& WXUNUSED(event)) { book->DeleteAllPages(); } void Frame::OnShowImages(wxCommandEvent& event) { m_bShowImages = event.IsChecked(); } void Frame::OnVC71Style(wxCommandEvent& WXUNUSED(event)) { long style = book->GetWindowStyleFlag(); // remove old tabs style long mirror = ~(wxFNB_VC71 | wxFNB_VC8 | wxFNB_FANCY_TABS); style &= mirror; style |= wxFNB_VC71; book->SetWindowStyleFlag(style); } void Frame::OnVC8Style(wxCommandEvent& WXUNUSED(event)) { long style = book->GetWindowStyleFlag(); // remove old tabs style long mirror = ~(wxFNB_VC71 | wxFNB_VC8 | wxFNB_FANCY_TABS); style &= mirror; // set new style style |= wxFNB_VC8; book->SetWindowStyleFlag(style); } void Frame::OnDefaultStyle(wxCommandEvent& WXUNUSED(event)) { long style = book->GetWindowStyleFlag(); // remove old tabs style long mirror = ~(wxFNB_VC71 | wxFNB_VC8 | wxFNB_FANCY_TABS); style &= mirror; book->SetWindowStyleFlag(style); } void Frame::OnFancyStyle(wxCommandEvent& WXUNUSED(event)) { long style = book->GetWindowStyleFlag(); // remove old tabs style long mirror = ~(wxFNB_VC71 | wxFNB_VC8 | wxFNB_FANCY_TABS); style &= mirror; style |= wxFNB_FANCY_TABS; book->SetWindowStyleFlag(style); } void Frame::OnSelectColor(wxCommandEvent& event) { // Open a color dialog wxColourData data; wxColourDialog dlg(this, &data); if(dlg.ShowModal() == wxID_OK) { switch(event.GetId()) { case MENU_SELECT_GRADIENT_COLOR_BORDER: book->SetGradientColorBorder(dlg.GetColourData().GetColour()); break; case MENU_SELECT_GRADIENT_COLOR_FROM: book->SetGradientColorFrom(dlg.GetColourData().GetColour()); break; case MENU_SELECT_GRADIENT_COLOR_TO: book->SetGradientColorTo(dlg.GetColourData().GetColour()); break; case MENU_SET_ACTIVE_TEXT_COLOR: book->SetActiveTabTextColour(dlg.GetColourData().GetColour()); break; case MENU_SELECT_NONACTIVE_TEXT_COLOR: book->SetNonActiveTabTextColour(dlg.GetColourData().GetColour()); break; case MENU_SET_ACTIVE_TAB_COLOR: book->SetActiveTabColour(dlg.GetColourData().GetColour()); break; case MENU_SET_TAB_AREA_COLOR: book->SetTabAreaColour(dlg.GetColourData().GetColour()); break; } book->Refresh(); } } void Frame::OnAddPage(wxCommandEvent& WXUNUSED(event)) { static int newPageCounter = 0; wxString caption; caption.Printf(wxT("New Page Added #%d"), newPageCounter++); Freeze(); book->AddPage(CreatePage(), caption, true, m_bShowImages ? rand() % (int)book->GetImageList()->size() : -1); book->SetSelection(book->GetPageCount()-1); Thaw(); } wxWindow* Frame::CreatePage() { static int newPageCounter = 0; wxString caption; caption.Printf(wxT("New Page Added #%d"), newPageCounter++); // if(newPageCounter % 2) // { return new wxTextCtrl(book, wxID_ANY, caption, wxDefaultPosition, book->GetPageBestSize(), wxTE_MULTILINE); // } // else // { // wxPanel* p = new wxPanel(book, wxID_ANY, wxDefaultPosition, book->GetPageBestSize()); // wxTextCtrl *txt = new wxTextCtrl(p, wxID_ANY, caption); // return p; // } } void Frame::OnDeletePage(wxCommandEvent& WXUNUSED(event)) { book->DeletePage(book->GetSelection()); } void Frame::OnSetSelection(wxCommandEvent& WXUNUSED(event)) { wxTextEntryDialog dlg(this, "Enter Tab Number to select:", "Set Selection"); if(dlg.ShowModal() == wxID_OK) { wxString val = dlg.GetValue(); long tabIdx; val.ToLong(&tabIdx); book->SetSelection((size_t)tabIdx); } } void Frame::OnEnableTab(wxCommandEvent& WXUNUSED(event)) { wxTextEntryDialog dlg(this, "Enter Tab Number to enable:", "Enable Tab"); if(dlg.ShowModal() == wxID_OK) { wxString val = dlg.GetValue(); long tabIdx; val.ToLong(&tabIdx); book->Enable((size_t)tabIdx, true); } } void Frame::OnDisableTab(wxCommandEvent& WXUNUSED(event)) { wxTextEntryDialog dlg(this, "Enter Tab Number to disable:", "Disable Tab"); if(dlg.ShowModal() == wxID_OK) { wxString val = dlg.GetValue(); long tabIdx; val.ToLong(&tabIdx); book->Enable((size_t)tabIdx, false); } } void Frame::OnEnableDrag(wxCommandEvent& event) { long style = book->GetWindowStyleFlag(); if(event.IsChecked()) { if(style & wxFNB_NODRAG) style ^= wxFNB_NODRAG; } else { style |= wxFNB_NODRAG; } book->SetWindowStyleFlag(style); } void Frame::OnSetAllPagesShapeAngle(wxCommandEvent& WXUNUSED(event)) { wxTextEntryDialog dlg(this, wxT("Enter an inclination of header borders (0-15):"), wxT("Set Angle")); if(dlg.ShowModal() == wxID_OK) { wxString val = dlg.GetValue(); unsigned int angle = wxAtoi(val); book->SetAllPagesShapeAngle(angle); } } void Frame::OnSetPageImageIndex(wxCommandEvent& WXUNUSED(event)) { wxTextEntryDialog dlg(this, wxString::Format(wxT("Enter an image index (0-%i):"), book->GetImageList()->size()-1), wxT("Set Angle")); if(dlg.ShowModal() == wxID_OK) { wxString val = dlg.GetValue(); unsigned int imgindex = wxAtoi(val); book->SetPageImageIndex(book->GetSelection(), imgindex); } } void Frame::OnAdvanceSelectionFwd(wxCommandEvent& WXUNUSED(event)) { book->AdvanceSelection(true); } void Frame::OnAdvanceSelectionBack(wxCommandEvent& WXUNUSED(event)) { book->AdvanceSelection(false); } void Frame::OnPageChanging(wxFlatNotebookEvent& WXUNUSED(event)) { #ifdef DEVELOPMENT wxString msg; msg.Printf(wxT("Page is changing: old=%ld new=%ld"), event.GetOldSelection(), event.GetSelection()); wxLogMessage(msg); #endif } void Frame::OnPageChanged(wxFlatNotebookEvent& WXUNUSED(event)) { #ifdef DEVELOPMENT wxString msg; msg.Printf(wxT("Page has changed, new selection is now=%ld"), event.GetSelection()); wxLogMessage(msg); #endif } void Frame::OnPageClosing(wxFlatNotebookEvent& WXUNUSED(event)) { #ifdef DEVELOPMENT wxString msg; msg.Printf(wxT("Page is closing: selection=%ld"), event.GetSelection()); wxLogMessage(msg); #endif } void Frame::OnDrawTabX(wxCommandEvent& event) { long style = book->GetWindowStyleFlag(); if(event.IsChecked()) { style |= wxFNB_X_ON_TAB; } else { if(style & wxFNB_X_ON_TAB) style ^= wxFNB_X_ON_TAB; } book->SetWindowStyleFlag(style); } void Frame::OnDClickCloseTab(wxCommandEvent& event) { long style = book->GetWindowStyleFlag(); if(event.IsChecked()) { style |= wxFNB_DCLICK_CLOSES_TABS; } else { style &= ~(wxFNB_DCLICK_CLOSES_TABS); } book->SetWindowStyleFlag(style); } void Frame::OnGradientBack(wxCommandEvent& event) { long style = book->GetWindowStyleFlag(); if(event.IsChecked()) style |= wxFNB_BACKGROUND_GRADIENT; else style &= ~(wxFNB_BACKGROUND_GRADIENT); book->SetWindowStyleFlag( style ); book->Refresh(); } void Frame::OnColorfullTabs(wxCommandEvent& event) { long style = book->GetWindowStyleFlag(); if(event.IsChecked()) style |= wxFNB_COLORFUL_TABS; else style &= ~(wxFNB_COLORFUL_TABS); book->SetWindowStyleFlag( style ); book->Refresh(); }