]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/widgets/notebook.cpp
Fix wrong configure test for abi::__forced_unwind in previous commit.
[wxWidgets.git] / samples / widgets / notebook.cpp
index add4b52b3de5ec8258083e824262261cefa31490..71161eea3510a70a5d4a7390533ef681fe8883db 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     06.04.01
 // Id:          $Id$
 // Copyright:   (c) 2001 Vadim Zeitlin, 2006 Wlodzimierz Skiba
 // Created:     06.04.01
 // Id:          $Id$
 // Copyright:   (c) 2001 Vadim Zeitlin, 2006 Wlodzimierz Skiba
-// License:     wxWindows license
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 // ============================================================================
 /////////////////////////////////////////////////////////////////////////////
 
 // ============================================================================
@@ -86,12 +86,15 @@ enum Orient
 class BookWidgetsPage : public WidgetsPage
 {
 public:
 class BookWidgetsPage : public WidgetsPage
 {
 public:
-    BookWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist, char* icon[]);
+    BookWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist, const char *const icon[]);
     virtual ~BookWidgetsPage();
 
     virtual wxControl *GetWidget() const { return m_book; }
     virtual void RecreateWidget() { RecreateBook(); }
 
     virtual ~BookWidgetsPage();
 
     virtual wxControl *GetWidget() const { return m_book; }
     virtual void RecreateWidget() { RecreateBook(); }
 
+    // lazy creation of the content
+    virtual void CreateContent();
+
 protected:
     // event handlers
     void OnButtonReset(wxCommandEvent& event);
 protected:
     // event handlers
     void OnButtonReset(wxCommandEvent& event);
@@ -119,8 +122,10 @@ protected:
     void RecreateBook();
     virtual wxBookCtrlBase *CreateBook(long flags) = 0;
 
     void RecreateBook();
     virtual wxBookCtrlBase *CreateBook(long flags) = 0;
 
+#if USE_ICONS_IN_BOOK
     // create or destroy the image list
     void CreateImageList();
     // create or destroy the image list
     void CreateImageList();
+#endif // USE_ICONS_IN_BOOK
 
     // create a new page
     wxWindow *CreateNewPage();
 
     // create a new page
     wxWindow *CreateNewPage();
@@ -151,8 +156,10 @@ protected:
     wxBookCtrlBase *m_book;
     wxSizer *m_sizerBook;
 
     wxBookCtrlBase *m_book;
     wxSizer *m_sizerBook;
 
-    // thei mage list for our book
+#if USE_ICONS_IN_BOOK
+    // the image list for our book
     wxImageList *m_imageList;
     wxImageList *m_imageList;
+#endif // USE_ICONS_IN_BOOK
 
 private:
     DECLARE_EVENT_TABLE()
 
 private:
     DECLARE_EVENT_TABLE()
@@ -185,33 +192,39 @@ END_EVENT_TABLE()
 // implementation
 // ============================================================================
 
 // implementation
 // ============================================================================
 
-BookWidgetsPage::BookWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist, char* icon[])
+BookWidgetsPage::BookWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist, const char *const icon[])
                 :WidgetsPage(book, imaglist, icon)
 {
     // init everything
     m_chkImages = NULL;
                 :WidgetsPage(book, imaglist, icon)
 {
     // init everything
     m_chkImages = NULL;
+#if USE_ICONS_IN_BOOK
     m_imageList = NULL;
     m_imageList = NULL;
+#endif // USE_ICONS_IN_BOOK
 
     m_book = NULL;
 
     m_book = NULL;
+    m_radioOrient = NULL;
     m_sizerBook = (wxSizer *)NULL;
     m_sizerBook = (wxSizer *)NULL;
+}
 
 
+void BookWidgetsPage::CreateContent()
+{
     wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
 
     // left pane
     wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
 
     // left pane
-    wxStaticBox *box = new wxStaticBox(this, wxID_ANY, _T("&Set style"));
+    wxStaticBox *box = new wxStaticBox(this, wxID_ANY, wxT("&Set style"));
 
     // must be in sync with Orient enum
     wxArrayString orientations;
 
     // must be in sync with Orient enum
     wxArrayString orientations;
-    orientations.Add(_T("&top"));
-    orientations.Add(_T("&bottom"));
-    orientations.Add(_T("&left"));
-    orientations.Add(_T("&right"));
+    orientations.Add(wxT("&top"));
+    orientations.Add(wxT("&bottom"));
+    orientations.Add(wxT("&left"));
+    orientations.Add(wxT("&right"));
 
     wxASSERT_MSG( orientations.GetCount() == Orient_Max,
 
     wxASSERT_MSG( orientations.GetCount() == Orient_Max,
-                  _T("forgot to update something") );
+                  wxT("forgot to update something") );
 
 
-    m_chkImages = new wxCheckBox(this, wxID_ANY, _T("Show &images"));
-    m_radioOrient = new wxRadioBox(this, wxID_ANY, _T("&Tab orientation"),
+    m_chkImages = new wxCheckBox(this, wxID_ANY, wxT("Show &images"));
+    m_radioOrient = new wxRadioBox(this, wxID_ANY, wxT("&Tab orientation"),
                                    wxDefaultPosition, wxDefaultSize,
                                    orientations, 1, wxRA_SPECIFY_COLS);
 
                                    wxDefaultPosition, wxDefaultSize,
                                    orientations, 1, wxRA_SPECIFY_COLS);
 
@@ -221,48 +234,48 @@ BookWidgetsPage::BookWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist, c
     sizerLeft->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer
     sizerLeft->Add(m_radioOrient, 0, wxALL, 5);
 
     sizerLeft->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer
     sizerLeft->Add(m_radioOrient, 0, wxALL, 5);
 
-    wxButton *btn = new wxButton(this, BookPage_Reset, _T("&Reset"));
+    wxButton *btn = new wxButton(this, BookPage_Reset, wxT("&Reset"));
     sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15);
 
     // middle pane
     sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15);
 
     // middle pane
-    wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY, _T("&Contents"));
+    wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY, wxT("&Contents"));
     wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL);
 
     wxTextCtrl *text;
     wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL);
 
     wxTextCtrl *text;
-    wxSizer *sizerRow = CreateSizerWithTextAndLabel(_T("Number of pages: "),
+    wxSizer *sizerRow = CreateSizerWithTextAndLabel(wxT("Number of pages: "),
                                                     BookPage_NumPagesText,
                                                     &text);
     text->SetEditable(false);
     sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
 
                                                     BookPage_NumPagesText,
                                                     &text);
     text->SetEditable(false);
     sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
 
-    sizerRow = CreateSizerWithTextAndLabel(_T("Current selection: "),
+    sizerRow = CreateSizerWithTextAndLabel(wxT("Current selection: "),
                                            BookPage_CurSelectText,
                                            &text);
     text->SetEditable(false);
     sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
 
     sizerRow = CreateSizerWithTextAndButton(BookPage_SelectPage,
                                            BookPage_CurSelectText,
                                            &text);
     text->SetEditable(false);
     sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
 
     sizerRow = CreateSizerWithTextAndButton(BookPage_SelectPage,
-                                            _T("&Select page"),
+                                            wxT("&Select page"),
                                             BookPage_SelectText,
                                             &m_textSelect);
     sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
 
                                             BookPage_SelectText,
                                             &m_textSelect);
     sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
 
-    btn = new wxButton(this, BookPage_AddPage, _T("&Add page"));
+    btn = new wxButton(this, BookPage_AddPage, wxT("&Add page"));
     sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
 
     sizerRow = CreateSizerWithTextAndButton(BookPage_InsertPage,
     sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
 
     sizerRow = CreateSizerWithTextAndButton(BookPage_InsertPage,
-                                            _T("&Insert page at"),
+                                            wxT("&Insert page at"),
                                             BookPage_InsertText,
                                             &m_textInsert);
     sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
 
     sizerRow = CreateSizerWithTextAndButton(BookPage_RemovePage,
                                             BookPage_InsertText,
                                             &m_textInsert);
     sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
 
     sizerRow = CreateSizerWithTextAndButton(BookPage_RemovePage,
-                                            _T("&Remove page"),
+                                            wxT("&Remove page"),
                                             BookPage_RemoveText,
                                             &m_textRemove);
     sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
 
                                             BookPage_RemoveText,
                                             &m_textRemove);
     sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
 
-    btn = new wxButton(this, BookPage_DeleteAll, _T("&Delete All"));
+    btn = new wxButton(this, BookPage_DeleteAll, wxT("&Delete All"));
     sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
 
     // right pane
     sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
 
     // right pane
@@ -273,18 +286,22 @@ BookWidgetsPage::BookWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist, c
     sizerTop->Add(sizerMiddle, 0, wxGROW | wxALL, 10);
     sizerTop->Add(m_sizerBook, 1, wxGROW | (wxALL & ~wxRIGHT), 10);
 
     sizerTop->Add(sizerMiddle, 0, wxGROW | wxALL, 10);
     sizerTop->Add(m_sizerBook, 1, wxGROW | (wxALL & ~wxRIGHT), 10);
 
+    RecreateBook();
+
     // final initializations
     Reset();
     // final initializations
     Reset();
+#if USE_ICONS_IN_BOOK
     CreateImageList();
     CreateImageList();
+#endif // USE_ICONS_IN_BOOK
 
     SetSizer(sizerTop);
 
     SetSizer(sizerTop);
-
-    sizerTop->Fit(this);
 }
 
 BookWidgetsPage::~BookWidgetsPage()
 {
 }
 
 BookWidgetsPage::~BookWidgetsPage()
 {
+#if USE_ICONS_IN_BOOK
     delete m_imageList;
     delete m_imageList;
+#endif // USE_ICONS_IN_BOOK
 }
 
 // ----------------------------------------------------------------------------
 }
 
 // ----------------------------------------------------------------------------
@@ -297,6 +314,7 @@ void BookWidgetsPage::Reset()
     m_radioOrient->SetSelection(Orient_Top);
 }
 
     m_radioOrient->SetSelection(Orient_Top);
 }
 
+#if USE_ICONS_IN_BOOK
 void BookWidgetsPage::CreateImageList()
 {
     if ( m_chkImages->GetValue() )
 void BookWidgetsPage::CreateImageList()
 {
     if ( m_chkImages->GetValue() )
@@ -317,25 +335,27 @@ void BookWidgetsPage::CreateImageList()
     }
     else // no images
     {
     }
     else // no images
     {
-        if ( m_imageList )
-        {
-            delete m_imageList;
-            m_imageList = NULL;
-        }
+        wxDELETE(m_imageList);
     }
 
     // because of the bug in wxMSW we can't use SetImageList(NULL) - although
     // it would be logical if this removed the image list from book, under
     // MSW it crashes instead - FIXME
 }
     }
 
     // because of the bug in wxMSW we can't use SetImageList(NULL) - although
     // it would be logical if this removed the image list from book, under
     // MSW it crashes instead - FIXME
 }
+#endif // USE_ICONS_IN_BOOK
 
 void BookWidgetsPage::RecreateBook()
 {
 
 void BookWidgetsPage::RecreateBook()
 {
+    // do not recreate anything in case page content was not prepared yet
+    if(!m_radioOrient)
+        return;
+
     int flags = ms_defaultFlags;
     int flags = ms_defaultFlags;
+
     switch ( m_radioOrient->GetSelection() )
     {
         default:
     switch ( m_radioOrient->GetSelection() )
     {
         default:
-            wxFAIL_MSG( _T("unknown orientation") );
+            wxFAIL_MSG( wxT("unknown orientation") );
             // fall through
 
         case Orient_Top:
             // fall through
 
         case Orient_Top:
@@ -359,7 +379,9 @@ void BookWidgetsPage::RecreateBook()
 
     m_book = CreateBook(flags);
 
 
     m_book = CreateBook(flags);
 
+#if USE_ICONS_IN_BOOK
     CreateImageList();
     CreateImageList();
+#endif // USE_ICONS_IN_BOOK
 
     if ( oldBook )
     {
 
     if ( oldBook )
     {
@@ -398,8 +420,9 @@ void BookWidgetsPage::RecreateBook()
 
 int BookWidgetsPage::GetTextValue(wxTextCtrl *text) const
 {
 
 int BookWidgetsPage::GetTextValue(wxTextCtrl *text) const
 {
-    long pos;
-    if ( !text->GetValue().ToLong(&pos) )
+    long pos = -1;
+
+    if ( !text || !text->GetValue().ToLong(&pos) )
         pos = -1;
 
     return (int)pos;
         pos = -1;
 
     return (int)pos;
@@ -407,6 +430,7 @@ int BookWidgetsPage::GetTextValue(wxTextCtrl *text) const
 
 int BookWidgetsPage::GetIconIndex() const
 {
 
 int BookWidgetsPage::GetIconIndex() const
 {
+#if USE_ICONS_IN_BOOK
     if ( m_imageList )
     {
        int nImages = m_imageList->GetImageCount();
     if ( m_imageList )
     {
        int nImages = m_imageList->GetImageCount();
@@ -415,13 +439,14 @@ int BookWidgetsPage::GetIconIndex() const
            return m_book->GetPageCount() % nImages;
        }
     }
            return m_book->GetPageCount() % nImages;
        }
     }
+#endif // USE_ICONS_IN_BOOK
 
     return -1;
 }
 
 wxWindow *BookWidgetsPage::CreateNewPage()
 {
 
     return -1;
 }
 
 wxWindow *BookWidgetsPage::CreateNewPage()
 {
-    return new wxTextCtrl(m_book, wxID_ANY, _T("I'm a book page"));
+    return new wxTextCtrl(m_book, wxID_ANY, wxT("I'm a book page"));
 }
 
 // ----------------------------------------------------------------------------
 }
 
 // ----------------------------------------------------------------------------
@@ -443,30 +468,30 @@ void BookWidgetsPage::OnButtonDeleteAll(wxCommandEvent& WXUNUSED(event))
 void BookWidgetsPage::OnButtonSelectPage(wxCommandEvent& WXUNUSED(event))
 {
     int pos = GetTextValue(m_textSelect);
 void BookWidgetsPage::OnButtonSelectPage(wxCommandEvent& WXUNUSED(event))
 {
     int pos = GetTextValue(m_textSelect);
-    wxCHECK_RET( IsValidValue(pos), _T("button should be disabled") );
+    wxCHECK_RET( IsValidValue(pos), wxT("button should be disabled") );
 
     m_book->SetSelection(pos);
 }
 
 void BookWidgetsPage::OnButtonAddPage(wxCommandEvent& WXUNUSED(event))
 {
 
     m_book->SetSelection(pos);
 }
 
 void BookWidgetsPage::OnButtonAddPage(wxCommandEvent& WXUNUSED(event))
 {
-    m_book->AddPage(CreateNewPage(), _T("Added page"), false,
+    m_book->AddPage(CreateNewPage(), wxT("Added page"), false,
                     GetIconIndex());
 }
 
 void BookWidgetsPage::OnButtonInsertPage(wxCommandEvent& WXUNUSED(event))
 {
     int pos = GetTextValue(m_textInsert);
                     GetIconIndex());
 }
 
 void BookWidgetsPage::OnButtonInsertPage(wxCommandEvent& WXUNUSED(event))
 {
     int pos = GetTextValue(m_textInsert);
-    wxCHECK_RET( IsValidValue(pos), _T("button should be disabled") );
+    wxCHECK_RET( IsValidValue(pos), wxT("button should be disabled") );
 
 
-    m_book->InsertPage(pos, CreateNewPage(), _T("Inserted page"), false,
+    m_book->InsertPage(pos, CreateNewPage(), wxT("Inserted page"), false,
                        GetIconIndex());
 }
 
 void BookWidgetsPage::OnButtonRemovePage(wxCommandEvent& WXUNUSED(event))
 {
     int pos = GetTextValue(m_textRemove);
                        GetIconIndex());
 }
 
 void BookWidgetsPage::OnButtonRemovePage(wxCommandEvent& WXUNUSED(event))
 {
     int pos = GetTextValue(m_textRemove);
-    wxCHECK_RET( IsValidValue(pos), _T("button should be disabled") );
+    wxCHECK_RET( IsValidValue(pos), wxT("button should be disabled") );
 
     m_book->DeletePage(pos);
 }
 
     m_book->DeletePage(pos);
 }
@@ -488,18 +513,21 @@ void BookWidgetsPage::OnUpdateUIRemoveButton(wxUpdateUIEvent& event)
 
 void BookWidgetsPage::OnUpdateUIResetButton(wxUpdateUIEvent& event)
 {
 
 void BookWidgetsPage::OnUpdateUIResetButton(wxUpdateUIEvent& event)
 {
-    event.Enable( !m_chkImages->GetValue() ||
-                  m_radioOrient->GetSelection() != wxBK_TOP );
+    if(m_chkImages && m_radioOrient)
+        event.Enable( !m_chkImages->GetValue() ||
+                      m_radioOrient->GetSelection() != wxBK_TOP );
 }
 
 void BookWidgetsPage::OnUpdateUINumPagesText(wxUpdateUIEvent& event)
 {
 }
 
 void BookWidgetsPage::OnUpdateUINumPagesText(wxUpdateUIEvent& event)
 {
-    event.SetText( wxString::Format(_T("%d"), m_book->GetPageCount()) );
+    if(m_book)
+        event.SetText( wxString::Format(wxT("%u"), unsigned(m_book->GetPageCount())) );
 }
 
 void BookWidgetsPage::OnUpdateUICurSelectText(wxUpdateUIEvent& event)
 {
 }
 
 void BookWidgetsPage::OnUpdateUICurSelectText(wxUpdateUIEvent& event)
 {
-    event.SetText( wxString::Format(_T("%d"), m_book->GetSelection()) );
+    if(m_book)
+        event.SetText( wxString::Format(wxT("%d"), m_book->GetSelection()) );
 }
 
 void BookWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event))
 }
 
 void BookWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event))
@@ -538,7 +566,6 @@ protected:
         return new wxNotebook(this, BookPage_Book,
                               wxDefaultPosition, wxDefaultSize,
                               flags);
         return new wxNotebook(this, BookPage_Book,
                               wxDefaultPosition, wxDefaultSize,
                               flags);
-
     }
 
 private:
     }
 
 private:
@@ -563,13 +590,13 @@ END_EVENT_TABLE()
     #define FAMILY_CTRLS NATIVE_CTRLS
 #endif
 
     #define FAMILY_CTRLS NATIVE_CTRLS
 #endif
 
-IMPLEMENT_WIDGETS_PAGE(NotebookWidgetsPage, _T("Notebook"),
+IMPLEMENT_WIDGETS_PAGE(NotebookWidgetsPage, wxT("Notebook"),
                        FAMILY_CTRLS | BOOK_CTRLS
                        );
 
 void NotebookWidgetsPage::OnPageChanging(wxNotebookEvent& event)
 {
                        FAMILY_CTRLS | BOOK_CTRLS
                        );
 
 void NotebookWidgetsPage::OnPageChanging(wxNotebookEvent& event)
 {
-    wxLogMessage(_T("Notebook page changing from %d to %d (currently %d)."),
+    wxLogMessage(wxT("Notebook page changing from %d to %d (currently %d)."),
                  event.GetOldSelection(),
                  event.GetSelection(),
                  m_book->GetSelection());
                  event.GetOldSelection(),
                  event.GetSelection(),
                  m_book->GetSelection());
@@ -579,7 +606,7 @@ void NotebookWidgetsPage::OnPageChanging(wxNotebookEvent& event)
 
 void NotebookWidgetsPage::OnPageChanged(wxNotebookEvent& event)
 {
 
 void NotebookWidgetsPage::OnPageChanged(wxNotebookEvent& event)
 {
-    wxLogMessage(_T("Notebook page changed from %d to %d (currently %d)."),
+    wxLogMessage(wxT("Notebook page changed from %d to %d (currently %d)."),
                  event.GetOldSelection(),
                  event.GetSelection(),
                  m_book->GetSelection());
                  event.GetOldSelection(),
                  event.GetSelection(),
                  m_book->GetSelection());
@@ -620,7 +647,6 @@ protected:
         return new wxListbook(this, BookPage_Book,
                               wxDefaultPosition, wxDefaultSize,
                               flags);
         return new wxListbook(this, BookPage_Book,
                               wxDefaultPosition, wxDefaultSize,
                               flags);
-
     }
 
 private:
     }
 
 private:
@@ -637,13 +663,13 @@ BEGIN_EVENT_TABLE(ListbookWidgetsPage, BookWidgetsPage)
     EVT_LISTBOOK_PAGE_CHANGED(wxID_ANY, ListbookWidgetsPage::OnPageChanged)
 END_EVENT_TABLE()
 
     EVT_LISTBOOK_PAGE_CHANGED(wxID_ANY, ListbookWidgetsPage::OnPageChanged)
 END_EVENT_TABLE()
 
-IMPLEMENT_WIDGETS_PAGE(ListbookWidgetsPage, _T("Listbook"),
+IMPLEMENT_WIDGETS_PAGE(ListbookWidgetsPage, wxT("Listbook"),
                        GENERIC_CTRLS | BOOK_CTRLS
                        );
 
 void ListbookWidgetsPage::OnPageChanging(wxListbookEvent& event)
 {
                        GENERIC_CTRLS | BOOK_CTRLS
                        );
 
 void ListbookWidgetsPage::OnPageChanging(wxListbookEvent& event)
 {
-    wxLogMessage(_T("Listbook page changing from %d to %d (currently %d)."),
+    wxLogMessage(wxT("Listbook page changing from %d to %d (currently %d)."),
                  event.GetOldSelection(),
                  event.GetSelection(),
                  m_book->GetSelection());
                  event.GetOldSelection(),
                  event.GetSelection(),
                  m_book->GetSelection());
@@ -653,7 +679,7 @@ void ListbookWidgetsPage::OnPageChanging(wxListbookEvent& event)
 
 void ListbookWidgetsPage::OnPageChanged(wxListbookEvent& event)
 {
 
 void ListbookWidgetsPage::OnPageChanged(wxListbookEvent& event)
 {
-    wxLogMessage(_T("Listbook page changed from %d to %d (currently %d)."),
+    wxLogMessage(wxT("Listbook page changed from %d to %d (currently %d)."),
                  event.GetOldSelection(),
                  event.GetSelection(),
                  m_book->GetSelection());
                  event.GetOldSelection(),
                  event.GetSelection(),
                  m_book->GetSelection());
@@ -694,7 +720,6 @@ protected:
         return new wxChoicebook(this, BookPage_Book,
                                 wxDefaultPosition, wxDefaultSize,
                                 flags);
         return new wxChoicebook(this, BookPage_Book,
                                 wxDefaultPosition, wxDefaultSize,
                                 flags);
-
     }
 
 private:
     }
 
 private:
@@ -711,13 +736,13 @@ BEGIN_EVENT_TABLE(ChoicebookWidgetsPage, BookWidgetsPage)
     EVT_CHOICEBOOK_PAGE_CHANGED(wxID_ANY, ChoicebookWidgetsPage::OnPageChanged)
 END_EVENT_TABLE()
 
     EVT_CHOICEBOOK_PAGE_CHANGED(wxID_ANY, ChoicebookWidgetsPage::OnPageChanged)
 END_EVENT_TABLE()
 
-IMPLEMENT_WIDGETS_PAGE(ChoicebookWidgetsPage, _T("Choicebook"),
+IMPLEMENT_WIDGETS_PAGE(ChoicebookWidgetsPage, wxT("Choicebook"),
                        GENERIC_CTRLS | BOOK_CTRLS
                        );
 
 void ChoicebookWidgetsPage::OnPageChanging(wxChoicebookEvent& event)
 {
                        GENERIC_CTRLS | BOOK_CTRLS
                        );
 
 void ChoicebookWidgetsPage::OnPageChanging(wxChoicebookEvent& event)
 {
-    wxLogMessage(_T("Choicebook page changing from %d to %d (currently %d)."),
+    wxLogMessage(wxT("Choicebook page changing from %d to %d (currently %d)."),
                  event.GetOldSelection(),
                  event.GetSelection(),
                  m_book->GetSelection());
                  event.GetOldSelection(),
                  event.GetSelection(),
                  m_book->GetSelection());
@@ -727,7 +752,7 @@ void ChoicebookWidgetsPage::OnPageChanging(wxChoicebookEvent& event)
 
 void ChoicebookWidgetsPage::OnPageChanged(wxChoicebookEvent& event)
 {
 
 void ChoicebookWidgetsPage::OnPageChanged(wxChoicebookEvent& event)
 {
-    wxLogMessage(_T("Choicebook page changed from %d to %d (currently %d)."),
+    wxLogMessage(wxT("Choicebook page changed from %d to %d (currently %d)."),
                  event.GetOldSelection(),
                  event.GetSelection(),
                  m_book->GetSelection());
                  event.GetOldSelection(),
                  event.GetSelection(),
                  m_book->GetSelection());