Refactor: use wxBookCtrlBase::m_selection in all derived classes.
All book control classes with the exception of wxGTK wxNotebook stored the currently selected page in m_selection or m_nSelection (or, in wxUniv wxNotebook case, m_sel) variable. Remove all of them and add m_selection directly to the base class itself so that it can be reused everywhere. Closes #12622. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65931 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -106,7 +106,7 @@ public:
|
||||
}
|
||||
|
||||
// get the currently selected page or wxNOT_FOUND if none
|
||||
virtual int GetSelection() const = 0;
|
||||
int GetSelection() const { return m_selection; }
|
||||
|
||||
// set/get the title of a page
|
||||
virtual bool SetPageText(size_t n, const wxString& strText) = 0;
|
||||
@@ -181,6 +181,7 @@ public:
|
||||
// remove all pages and delete them
|
||||
virtual bool DeleteAllPages()
|
||||
{
|
||||
m_selection = wxNOT_FOUND;
|
||||
DoInvalidateBestSize();
|
||||
WX_CLEAR_ARRAY(m_pages);
|
||||
return true;
|
||||
@@ -332,6 +333,11 @@ protected:
|
||||
// the margin around the choice control
|
||||
int m_controlMargin;
|
||||
|
||||
// The currently selected page (in range 0..m_pages.size()-1 inclusive) or
|
||||
// wxNOT_FOUND if none (this can normally only be the case for an empty
|
||||
// control without any pages).
|
||||
int m_selection;
|
||||
|
||||
private:
|
||||
|
||||
// common part of all ctors
|
||||
@@ -342,6 +348,7 @@ private:
|
||||
|
||||
DECLARE_ABSTRACT_CLASS(wxBookCtrlBase)
|
||||
wxDECLARE_NO_COPY_CLASS(wxBookCtrlBase);
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user