]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/notebook/notebook.cpp
fixed Carbon compilo
[wxWidgets.git] / samples / notebook / notebook.cpp
index a7fdeea343fb55efb3cc720ec411ad38dc9026f2..966b441350a7f9cda98390185a4fae232ab39c0b 100644 (file)
@@ -188,7 +188,16 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size,
                  long style)
     : wxFrame((wxWindow *) NULL, wxID_ANY, title, pos, size, style)
 {
+#if wxUSE_NOTEBOOK
     m_type = ID_BOOK_NOTEBOOK;
+#elif wxUSE_CHOICEBOOK
+    m_type = ID_BOOK_CHOICEBOOK;
+#elif wxUSE_LISTBOOK
+    m_type = ID_BOOK_LISTBOOK;
+#elif
+    #error "Don't use Notebook sample without any book enabled in wxWidgets build!"
+#endif
+
     m_orient = ID_ORIENT_DEFAULT;
     m_chkShowImages = true;
     m_multi = false;
@@ -205,6 +214,7 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size,
 #if wxUSE_CHOICEBOOK
     menuType->AppendRadioItem(ID_BOOK_CHOICEBOOK, wxT("&Choicebook\tCtrl-3"));
 #endif
+    menuType->Check(m_type, true);
 
     wxMenu *menuOrient = new wxMenu;
     menuOrient->AppendRadioItem(ID_ORIENT_DEFAULT, wxT("&Default\tCtrl-4"));
@@ -325,6 +335,12 @@ int MyFrame::SelectFlag(int id, int nb, int lb, int chb)
     return 0;
 }
 
+#ifdef __SMARTPHONE__
+    #define MARGIN 0
+#else
+    #define MARGIN 4
+#endif
+
 #define RECREATE( wxBookType , idBook, oldBook , newBook )                         \
 {                                                                                  \
     int flags;                                                                     \
@@ -393,7 +409,7 @@ int MyFrame::SelectFlag(int id, int nb, int lb, int chb)
         CreateInitialPages(newBook);                                               \
     }                                                                              \
                                                                                    \
-    m_sizerFrame->Insert(0, newBook, 5, wxEXPAND | wxALL, 4);                      \
+    m_sizerFrame->Insert(0, newBook, 5, wxEXPAND | wxALL, MARGIN);                 \
                                                                                    \
     m_sizerFrame->Hide(newBook);                                                   \
 }
@@ -627,6 +643,12 @@ void MyFrame::OnIdle( wxIdleEvent& WXUNUSED(event) )
     }
 }
 
+#if USE_LOG
+    #define BOOKEVENT_LOG m_text->SetInsertionPointEnd();
+#else
+    #define BOOKEVENT_LOG
+#endif
+
 #define BOOKEVENT(OnBook,wxBookEvent,bookStr,wxEVT_PAGE_CHANGED,wxEVT_PAGE_CHANGING,s_num) \
 void MyFrame::OnBook(wxBookEvent& event)                                                   \
 {                                                                                          \
@@ -671,7 +693,7 @@ void MyFrame::OnBook(wxBookEvent& event)
                                                                                            \
     wxLogMessage(logMsg.c_str());                                                          \
                                                                                            \
-    m_text->SetInsertionPointEnd();                                                        \
+    BOOKEVENT_LOG                                                                          \
 }
 
 #if wxUSE_NOTEBOOK