From c3e016e45e2e64b6fbf1eecfdd07448044995b93 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Tue, 28 Nov 2006 14:55:05 +0000 Subject: [PATCH] Added wxAuiNotebook::GetPageText, GetPageBitmap git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43703 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/latex/wx/auinotebook.tex | 12 ++++++++++++ include/wx/aui/auibook.h | 6 ++++++ src/aui/auibook.cpp | 27 +++++++++++++++++++++++++++ 3 files changed, 45 insertions(+) diff --git a/docs/latex/wx/auinotebook.tex b/docs/latex/wx/auinotebook.tex index 81987b1f35..bfa0b37099 100644 --- a/docs/latex/wx/auinotebook.tex +++ b/docs/latex/wx/auinotebook.tex @@ -87,6 +87,12 @@ Returns the associated art provider. Returns the page specified by the given index. +\membersection{wxAuiNotebook::GetPageBitmap}\label{wxauinotebookgetpagebitmap} + +\constfunc{wxBitmap}{GetPageBitmap}{\param{size\_t }{page}} + +Returns the tab bitmap for the page. + \membersection{wxAuiNotebook::GetPageCount}\label{wxauinotebookgetpagecount} \constfunc{size\_t}{GetPageCount}{\void} @@ -99,6 +105,12 @@ Returns the number of pages in the notebook. Returns the page index for the specified window. If the window is not found in the notebook, wxNOT_FOUND is returned. +\membersection{wxAuiNotebook::GetPageText}\label{wxauinotebookgetpagetext} + +\constfunc{wxString}{GetPageText}{\param{size\_t }{page}} + +Returns the tab label for the page. + \membersection{wxAuiNotebook::GetSelection}\label{wxauinotebookgetselection} \constfunc{int}{GetSelection}{\void} diff --git a/include/wx/aui/auibook.h b/include/wx/aui/auibook.h index 64728f153c..fe6ba7da57 100644 --- a/include/wx/aui/auibook.h +++ b/include/wx/aui/auibook.h @@ -398,6 +398,7 @@ public: int GetIdxFromWindow(wxWindow* page) const; size_t GetPageCount() const; wxAuiNotebookPage& GetPage(size_t idx); + const wxAuiNotebookPage& GetPage(size_t idx) const; wxAuiNotebookPageArray& GetPages(); void SetNormalFont(const wxFont& normal_font); void SetSelectedFont(const wxFont& selected_font); @@ -511,9 +512,14 @@ public: void SetWindowStyleFlag(long style); bool SetPageText(size_t page, const wxString& text); + wxString GetPageText(size_t page_idx) const; + bool SetPageBitmap(size_t page, const wxBitmap& bitmap); + wxBitmap GetPageBitmap(size_t page_idx) const; + size_t SetSelection(size_t new_page); int GetSelection() const; + size_t GetPageCount() const; wxWindow* GetPage(size_t page_idx) const; diff --git a/src/aui/auibook.cpp b/src/aui/auibook.cpp index e6baedb46d..c050aca7b1 100644 --- a/src/aui/auibook.cpp +++ b/src/aui/auibook.cpp @@ -1454,6 +1454,13 @@ wxAuiNotebookPage& wxAuiTabContainer::GetPage(size_t idx) return m_pages[idx]; } +const wxAuiNotebookPage& wxAuiTabContainer::GetPage(size_t idx) const +{ + wxASSERT_MSG(idx < m_pages.GetCount(), wxT("Invalid Page index")); + + return m_pages[idx]; +} + wxAuiNotebookPageArray& wxAuiTabContainer::GetPages() { return m_pages; @@ -2733,6 +2740,16 @@ bool wxAuiNotebook::SetPageText(size_t page_idx, const wxString& text) return true; } +// returns the page caption +wxString wxAuiNotebook::GetPageText(size_t page_idx) const +{ + if (page_idx >= m_tabs.GetPageCount()) + return wxEmptyString; + + // update our own tab catalog + const wxAuiNotebookPage& page_info = m_tabs.GetPage(page_idx); + return page_info.caption; +} bool wxAuiNotebook::SetPageBitmap(size_t page_idx, const wxBitmap& bitmap) { @@ -2760,6 +2777,16 @@ bool wxAuiNotebook::SetPageBitmap(size_t page_idx, const wxBitmap& bitmap) return true; } +// returns the page bitmap +wxBitmap wxAuiNotebook::GetPageBitmap(size_t page_idx) const +{ + if (page_idx >= m_tabs.GetPageCount()) + return wxBitmap(); + + // update our own tab catalog + const wxAuiNotebookPage& page_info = m_tabs.GetPage(page_idx); + return page_info.bitmap; +} // GetSelection() returns the index of the currently active page int wxAuiNotebook::GetSelection() const