]> git.saurik.com Git - wxWidgets.git/blobdiff - src/aui/auibook.cpp
Fix --enable-webview_xxx options names in configure.
[wxWidgets.git] / src / aui / auibook.cpp
index 2d58a372293f4331ad2261cda861d18213378ad0..9288685ecad50005adc9d071d839cd9a1c558974 100644 (file)
@@ -925,7 +925,7 @@ bool wxAuiTabContainer::ButtonHitTest(int x, int y,
 static void ShowWnd(wxWindow* wnd, bool show)
 {
 #if wxUSE_MDI
-    if (wnd->IsKindOf(CLASSINFO(wxAuiMDIChildFrame)))
+    if (wxDynamicCast(wnd, wxAuiMDIChildFrame))
     {
         wxAuiMDIChildFrame* cf = (wxAuiMDIChildFrame*)wnd;
         cf->DoShow(show);
@@ -1050,8 +1050,8 @@ void wxAuiTabCtrl::OnLeftDown(wxMouseEvent& evt)
         // wxAuiNotebooks always want to receive this event
         // even if the tab is already active, because they may
         // have multiple tab controls
-        if (new_selection != GetActivePage() ||
-            GetParent()->IsKindOf(CLASSINFO(wxAuiNotebook)))
+        if ((new_selection != GetActivePage() ||
+            wxDynamicCast(GetParent(), wxAuiNotebook)) && !m_hoverButton)
         {
             wxAuiNotebookEvent e(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGING, m_windowId);
             e.SetSelection(new_selection);
@@ -1237,7 +1237,22 @@ void wxAuiTabCtrl::OnMotion(wxMouseEvent& evt)
         }
     }
 
+    wxWindow* wnd = NULL;
+
+#if wxUSE_TOOLTIPS
+   if (evt.Moving() && TabHitTest(evt.m_x, evt.m_y, &wnd))
+    {
+        wxString tooltip(m_pages[GetIdxFromWindow(wnd)].tooltip);
 
+        // If the text changes, set it else, keep old, to avoid
+        // 'moving tooltip' effect
+        if (GetToolTipText() != tooltip)
+            SetToolTip(tooltip);
+    }
+    else
+        UnsetToolTip();
+#endif
+   
     if (!evt.LeftIsDown() || m_clickPt == wxDefaultPosition)
         return;
 
@@ -1554,7 +1569,7 @@ public:
             // TODO: else if (GetFlags() & wxAUI_NB_RIGHT){}
 
 #if wxUSE_MDI
-            if (page.window->IsKindOf(CLASSINFO(wxAuiMDIChildFrame)))
+            if (wxDynamicCast(page.window, wxAuiMDIChildFrame))
             {
                 wxAuiMDIChildFrame* wnd = (wxAuiMDIChildFrame*)page.window;
                 wnd->ApplyMDIChildFrameRect();
@@ -1973,7 +1988,7 @@ bool wxAuiNotebook::DeletePage(size_t page_idx)
 
 #if wxUSE_MDI
     // actually destroy the window now
-    if (wnd->IsKindOf(CLASSINFO(wxAuiMDIChildFrame)))
+    if (wxDynamicCast(wnd, wxAuiMDIChildFrame))
     {
         // delete the child frame with pending delete, as is
         // customary with frame windows
@@ -2126,6 +2141,37 @@ wxString wxAuiNotebook::GetPageText(size_t page_idx) const
     return page_info.caption;
 }
 
+bool wxAuiNotebook::SetPageToolTip(size_t page_idx, const wxString& text)
+{
+    if (page_idx >= m_tabs.GetPageCount())
+        return false;
+
+    // update our own tab catalog
+    wxAuiNotebookPage& page_info = m_tabs.GetPage(page_idx);
+    page_info.tooltip = text;
+
+    wxAuiTabCtrl* ctrl;
+    int ctrl_idx;
+    if (!FindTab(page_info.window, &ctrl, &ctrl_idx))
+        return false;
+
+    wxAuiNotebookPage& info = ctrl->GetPage(ctrl_idx);
+    info.tooltip = text;
+
+    // NB: we don't update the tooltip if it is already being displayed, it
+    //     typically never happens, no need to code that
+    return true;
+}
+
+wxString wxAuiNotebook::GetPageToolTip(size_t page_idx) const
+{
+    if (page_idx >= m_tabs.GetPageCount())
+        return wxString();
+
+    const wxAuiNotebookPage& page_info = m_tabs.GetPage(page_idx);
+    return page_info.tooltip;
+}
+
 bool wxAuiNotebook::SetPageBitmap(size_t page_idx, const wxBitmap& bitmap)
 {
     if (page_idx >= m_tabs.GetPageCount())
@@ -2515,11 +2561,11 @@ void wxAuiNotebook::OnTabDragMotion(wxAuiNotebookEvent& evt)
             return;
 
         // make sure we are not over the hint window
-        if (!tab_ctrl->IsKindOf(CLASSINFO(wxFrame)))
+        if (!wxDynamicCast(tab_ctrl, wxFrame))
         {
             while (tab_ctrl)
             {
-                if (tab_ctrl->IsKindOf(CLASSINFO(wxAuiTabCtrl)))
+                if (wxDynamicCast(tab_ctrl, wxAuiTabCtrl))
                     break;
                 tab_ctrl = tab_ctrl->GetParent();
             }
@@ -2601,7 +2647,7 @@ void wxAuiNotebook::OnTabEndDrag(wxAuiNotebookEvent& evt)
 
         while (tab_ctrl)
         {
-            if (tab_ctrl->IsKindOf(CLASSINFO(wxAuiTabCtrl)))
+            if (wxDynamicCast(tab_ctrl, wxAuiTabCtrl))
                 break;
             tab_ctrl = tab_ctrl->GetParent();
         }
@@ -3051,7 +3097,7 @@ void wxAuiNotebook::OnTabButton(wxAuiNotebookEvent& evt)
 
 
 #if wxUSE_MDI
-            if (close_wnd->IsKindOf(CLASSINFO(wxAuiMDIChildFrame)))
+            if (wxDynamicCast(close_wnd, wxAuiMDIChildFrame))
             {
                 close_wnd->Close();
             }
@@ -3189,34 +3235,6 @@ int wxAuiNotebook::GetHeightForPageHeight(int pageHeight)
     return tabCtrlHeight + pageHeight + decorHeight;
 }
 
-// Advances the selection, generation page selection events
-void wxAuiNotebook::AdvanceSelection(bool forward)
-{
-    if (GetPageCount() <= 1)
-        return;
-
-    int currentSelection = GetSelection();
-
-    if (forward)
-    {
-        if (currentSelection == (int) (GetPageCount() - 1))
-            return;
-        else if (currentSelection == -1)
-            currentSelection = 0;
-        else
-            currentSelection ++;
-    }
-    else
-    {
-        if (currentSelection <= 0)
-            return;
-        else
-            currentSelection --;
-    }
-
-    SetSelection(currentSelection);
-}
-
 // Shows the window menu
 bool wxAuiNotebook::ShowWindowMenu()
 {
@@ -3238,11 +3256,11 @@ bool wxAuiNotebook::ShowWindowMenu()
         return false;
 }
 
-void wxAuiNotebook::Thaw()
+void wxAuiNotebook::DoThaw()
 {
     DoSizing();
 
-    wxControl::Thaw();
+    wxBookCtrlBase::DoThaw();
 }
 
 void wxAuiNotebook::SetPageSize (const wxSize& WXUNUSED(size))
@@ -3267,13 +3285,6 @@ bool wxAuiNotebook::SetPageImage(size_t n, int imageId)
     return SetPageBitmap(n, GetImageList()->GetBitmap(imageId));
 }
 
-wxWindow* wxAuiNotebook::GetCurrentPage () const
-{
-    const int sel = GetSelection();
-
-    return sel == wxNOT_FOUND ? NULL : GetPage(sel);
-}
-
 int wxAuiNotebook::ChangeSelection(size_t n)
 {
     return DoModifySelection(n, false);