]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/notebook/notebook.cpp
Restored wxNotebook::HitTest for wxOSX-Carbon.
[wxWidgets.git] / samples / notebook / notebook.cpp
index b56dbaeb9f50f83834a9530c0d67ad58cf5deddd..3aceabbe2fc94d2af6a3e79edbc3f5601174838e 100644 (file)
@@ -548,7 +548,8 @@ void MyFrame::RecreateBook()
 
     m_bookCtrl->Hide();
 
-    if ( m_chkShowImages )
+    // wxToolbook doesn't work without icons so always use them for it.
+    if ( m_chkShowImages || m_type == Type_Toolbook )
     {
         m_bookCtrl->SetImageList(m_imageList);
     }
@@ -971,6 +972,12 @@ void MyFrame::OnBookCtrl(wxBookCtrlBaseEvent& event)
              nameControl,
              veto;
     const wxEventType eventType = event.GetEventType();
+
+    // NB: can't use wxStaticCast here as wxBookCtrlBase is not in
+    //     wxRTTI
+    const wxBookCtrlBase * const
+        book = static_cast<wxBookCtrlBase *>(event.GetEventObject());
+
     for ( size_t n = 0; n < WXSIZEOF(events); n++ )
     {
         const EventInfo& ei = events[n];
@@ -982,10 +989,6 @@ void MyFrame::OnBookCtrl(wxBookCtrlBaseEvent& event)
         {
             const int idx = event.GetOldSelection();
 
-            // NB: can't use wxStaticCast here as wxBookCtrlBase is not in
-            //     wxRTTI
-            const wxBookCtrlBase * const
-                book = static_cast<wxBookCtrlBase *>(event.GetEventObject());
             if ( idx != wxNOT_FOUND &&
                     book && book->GetPageText(idx) == VETO_PAGE_NAME )
             {
@@ -1016,13 +1019,14 @@ void MyFrame::OnBookCtrl(wxBookCtrlBaseEvent& event)
 
     static int s_num = 0;
 
-    wxLogMessage(wxT("Event #%d: %s: %s (%d) new sel %d, old %d%s"),
+    wxLogMessage(wxT("Event #%d: %s: %s (%d) new sel %d, old %d, current %d%s"),
                  ++s_num,
                  nameControl.c_str(),
                  nameEvent.c_str(),
                  eventType,
                  event.GetSelection(),
                  event.GetOldSelection(),
+                 book->GetSelection(),
                  veto.c_str());
 
 #if USE_LOG