]> git.saurik.com Git - wxWidgets.git/commitdiff
Added wxBookCtrlBase::FindPage().
authorVadim Zeitlin <vadim@wxwidgets.org>
Fri, 29 Mar 2013 19:53:13 +0000 (19:53 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Fri, 29 Mar 2013 19:53:13 +0000 (19:53 +0000)
Add helper function to find the index of the given page.

Closes #15125.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73734 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/changes.txt
include/wx/bookctrl.h
interface/wx/bookctrl.h
src/common/bookctrl.cpp

index 27117857dafc5050f076f6a6bd7b44a797dcef23..23b2862cc2513f66cabd038658996d42e908c0ee 100644 (file)
@@ -624,6 +624,7 @@ All (GUI):
 - Add wxAUI_TB_PLAIN_BACKGROUND wxAuiToolBar style (Allann Jones).
 - Make wxGenericDataViewCtrl::SetFont() really work (Laurent Poujoulat).
 - Remove wxLogWindow::OnFrameCreate(), it was never called anyhow.
+- Added wxBookCtrlBase::FindPage() (troelsk).
 - Added wxDocument::Activate() (troelsk).
 - Added wxDocManager::FindDocumentByPath() (troelsk).
 
index 018d1200f6a99c5b6b3e42fcfa5cd9527fe08b26..cd2929eb5a5d64a1783335e55d74942d069bfb93 100644 (file)
@@ -215,6 +215,9 @@ public:
         }
     }
 
+    // return the index of the given page or wxNOT_FOUND
+    int FindPage(const wxWindow* page) const;
+
     // hit test: returns which page is hit and, optionally, where (icon, label)
     virtual int HitTest(const wxPoint& WXUNUSED(pt),
                         long * WXUNUSED(flags) = NULL) const
index bbffcc27d62b01a7c3cbfb5d7e9b062078789a73..17b6920b8f27ee50517c2b744f07235ee7b6a04e 100644 (file)
@@ -193,6 +193,17 @@ public:
     */
     virtual int ChangeSelection(size_t page) = 0;
 
+    /**
+        Returns the index of the specified tab window or @c wxNOT_FOUND
+        if not found.
+
+        @param page One of the control pages.
+        @return The zero-based tab index or @c wxNOT_FOUND if not found.
+
+        @since 2.9.5
+    */
+    int FindPage(const wxWindow* page) const;
+
     //@}
 
 
index 9f0e284652550a55169d1529220b9825783bb5ee..9ec08bad1c9d98829693abcd4aab3e1e4d32c163 100644 (file)
@@ -431,6 +431,18 @@ int wxBookCtrlBase::GetNextPage(bool forward) const
     return nPage;
 }
 
+int wxBookCtrlBase::FindPage(const wxWindow* page) const
+{
+    const size_t nCount = m_pages.size();
+    for ( size_t nPage = 0; nPage < nCount; nPage++ )
+    {
+        if ( m_pages[nPage] == page )
+            return (int)nPage;
+    }
+
+    return wxNOT_FOUND;
+}
+
 bool wxBookCtrlBase::DoSetSelectionAfterInsertion(size_t n, bool bSelect)
 {
     if ( bSelect )