]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/notebook/notebook.cpp
Warning fix observed in tex2rtf.
[wxWidgets.git] / samples / notebook / notebook.cpp
index 55faa391e65381173d902dcb5a0ab440c9ac4669..cfa1b98282304e8b68f68b50e00eee27bf55f0bc 100644 (file)
@@ -214,17 +214,17 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size,
     menuOrient->AppendRadioItem(ID_ORIENT_RIGHT,   wxT("&Right\tCtrl-8"));
 
     wxMenu *menuDo = new wxMenu;
-    menuDo->Append(ID_ADD_PAGE, wxT("&Add page"));
-    menuDo->Append(ID_INSERT_PAGE, wxT("&Insert page"));
-    menuDo->Append(ID_DELETE_CUR_PAGE, wxT("&Delete current page"));
-    menuDo->Append(ID_DELETE_LAST_PAGE, wxT("D&elete last page"));
-    menuDo->Append(ID_NEXT_PAGE, wxT("&Next page"));
+    menuDo->Append(ID_ADD_PAGE, wxT("&Add page\tAlt-A"));
+    menuDo->Append(ID_INSERT_PAGE, wxT("&Insert page\tAlt-I"));
+    menuDo->Append(ID_DELETE_CUR_PAGE, wxT("&Delete current page\tAlt-D"));
+    menuDo->Append(ID_DELETE_LAST_PAGE, wxT("D&elete last page\tAlt-L"));
+    menuDo->Append(ID_NEXT_PAGE, wxT("&Next page\tAlt-N"));
 
     wxMenu *menuFile = new wxMenu;
     menuFile->Append(wxID_ANY, wxT("&Type"), menuType, wxT("Type of control"));
     menuFile->Append(wxID_ANY, wxT("&Orientation"), menuOrient, wxT("Orientation of control"));
-    menuFile->AppendCheckItem(ID_SHOW_IMAGES, wxT("&Show images"));
-    menuFile->AppendCheckItem(ID_MULTI, wxT("&Multiple lines"));
+    menuFile->AppendCheckItem(ID_SHOW_IMAGES, wxT("&Show images\tAlt-S"));
+    menuFile->AppendCheckItem(ID_MULTI, wxT("&Multiple lines\tAlt-M"));
     menuFile->AppendSeparator();
     menuFile->Append(wxID_EXIT, wxT("E&xit"), wxT("Quits the application"));
     menuFile->Check(ID_SHOW_IMAGES, m_chkShowImages);
@@ -238,9 +238,15 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size,
     // books creation
 
     m_panel      = (wxPanel *)      NULL;
+#if wxUSE_NOTEBOOK
     m_notebook   = (wxNotebook *)   NULL;
+#endif
+#if wxUSE_CHOICEBOOK
     m_choicebook = (wxChoicebook *) NULL;
+#endif
+#if wxUSE_LISTBOOK
     m_listbook   = (wxListbook *)   NULL;
+#endif
 
     // create a dummy image list with a few icons
     wxSize imageSize(32, 32);
@@ -406,9 +412,15 @@ int MyFrame::SelectFlag(int id, int nb, int lb, int chb)
 
 void MyFrame::RecreateBooks()
 {
+#if wxUSE_NOTEBOOK
     RECREATE( wxNotebook   , ID_NOTEBOOK   , notebook   , m_notebook );
+#endif
+#if wxUSE_LISTBOOK
     RECREATE( wxListbook   , ID_LISTBOOK   , listbook   , m_listbook );
+#endif
+#if wxUSE_CHOICEBOOK
     RECREATE( wxChoicebook , ID_CHOICEBOOK , choicebook , m_choicebook );
+#endif
 
     ShowCurrentBook();
 }
@@ -417,9 +429,15 @@ wxBookCtrl *MyFrame::GetCurrentBook()
 {
     switch (m_type)
     {
+#if wxUSE_NOTEBOOK
         case ID_BOOK_NOTEBOOK:   return m_notebook;
+#endif
+#if wxUSE_LISTBOOK
         case ID_BOOK_LISTBOOK:   return m_listbook;
+#endif
+#if wxUSE_CHOICEBOOK
         case ID_BOOK_CHOICEBOOK: return m_choicebook;
+#endif
     }
     return NULL;
 }
@@ -428,9 +446,15 @@ void MyFrame::ShowCurrentBook()
 {
     switch(m_type)
     {
+#if wxUSE_NOTEBOOK
         case ID_BOOK_NOTEBOOK:   if(m_notebook)   m_sizerFrame->Show(m_notebook);   break;
+#endif
+#if wxUSE_LISTBOOK
         case ID_BOOK_LISTBOOK:   if(m_listbook)   m_sizerFrame->Show(m_listbook);   break;
+#endif
+#if wxUSE_CHOICEBOOK
         case ID_BOOK_CHOICEBOOK: if(m_choicebook) m_sizerFrame->Show(m_choicebook); break;
+#endif
     }
 
     m_sizerFrame->Layout();
@@ -452,12 +476,18 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
     EVT_MENU(ID_NEXT_PAGE, MyFrame::OnNextPage)
 
     // Book controls
+#if wxUSE_NOTEBOOK
     EVT_NOTEBOOK_PAGE_CHANGED(ID_NOTEBOOK, MyFrame::OnNotebook)
     EVT_NOTEBOOK_PAGE_CHANGING(ID_NOTEBOOK, MyFrame::OnNotebook)
+#endif
+#if wxUSE_LISTBOOK
     EVT_LISTBOOK_PAGE_CHANGED(ID_LISTBOOK, MyFrame::OnListbook)
     EVT_LISTBOOK_PAGE_CHANGING(ID_LISTBOOK, MyFrame::OnListbook)
+#endif
+#if wxUSE_CHOICEBOOK
     EVT_CHOICEBOOK_PAGE_CHANGED(ID_CHOICEBOOK, MyFrame::OnChoicebook)
     EVT_CHOICEBOOK_PAGE_CHANGING(ID_CHOICEBOOK, MyFrame::OnChoicebook)
+#endif
 
     // Update title in idle time
     EVT_IDLE(MyFrame::OnIdle)
@@ -637,8 +667,6 @@ void MyFrame::OnBook(wxBookEvent& event)
                           wxICON_QUESTION | wxYES_NO, this) != wxYES )                     \
             {                                                                              \
                 event.Veto();                                                              \
-                                                                                           \
-                return;                                                                    \
             }                                                                              \
                                                                                            \
         }                                                                                  \
@@ -656,10 +684,14 @@ void MyFrame::OnBook(wxBookEvent& event)
     wxLogMessage(logMsg.c_str());                                                          \
                                                                                            \
     m_text->SetInsertionPointEnd();                                                        \
-                                                                                           \
-    event.Skip();                                                                          \
 }
 
+#if wxUSE_NOTEBOOK
 BOOKEVENT(OnNotebook,wxNotebookEvent,"wxNotebook",wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING,s_numNotebookEvents)
+#endif
+#if wxUSE_CHOICEBOOK
 BOOKEVENT(OnChoicebook,wxChoicebookEvent,"wxChoicebook",wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED,wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING,s_numChoicebookEvents)
+#endif
+#if wxUSE_LISTBOOK
 BOOKEVENT(OnListbook,wxListbookEvent,"wxListbook",wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED,wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING,s_numListbookEvents)
+#endif