From: Vadim Zeitlin Date: Thu, 25 Dec 2008 12:27:20 +0000 (+0000) Subject: make Scroll() itself virtual too as existing code might override it (but new code... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/bc448be3417555aa4bb57499b114d73b4036f9bb make Scroll() itself virtual too as existing code might override it (but new code should override DoScroll() only); use the same access in the derived classes as in wxScrollHelperBase git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57538 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/generic/scrolwin.h b/include/wx/generic/scrolwin.h index 5ffb3caac0..615aeab40e 100644 --- a/include/wx/generic/scrolwin.h +++ b/include/wx/generic/scrolwin.h @@ -23,11 +23,12 @@ public: // implement base class pure virtuals virtual void AdjustScrollbars(); -private: +protected: virtual void DoScroll(int x, int y); virtual void DoShowScrollbars(wxScrollbarVisibility horz, wxScrollbarVisibility vert); +private: // helper of AdjustScrollbars(): does the work for the single scrollbar // // notice that the parameters passed by non-const references are modified diff --git a/include/wx/gtk/scrolwin.h b/include/wx/gtk/scrolwin.h index e65935be7a..f95ef798e2 100644 --- a/include/wx/gtk/scrolwin.h +++ b/include/wx/gtk/scrolwin.h @@ -22,6 +22,7 @@ public: // default ctor doesn't do anything wxScrollHelper(wxWindow *win) : wxScrollHelperBase(win) { } + // implement the base class methods virtual void SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY, int noUnitsX, int noUnitsY, int xPos = 0, int yPos = 0, @@ -29,6 +30,11 @@ public: virtual void AdjustScrollbars(); protected: + virtual void DoScroll(int x, int y); + virtual void DoShowScrollbars(wxScrollbarVisibility horz, + wxScrollbarVisibility vert); + +private: // this does (each) half of AdjustScrollbars() work void DoAdjustScrollbar(GtkRange* range, int pixelsPerLine, @@ -64,11 +70,6 @@ protected: int pixelsPerLine, int *posOld); - // implement the base class methods - virtual void DoScroll(int x, int y); - virtual void DoShowScrollbars(wxScrollbarVisibility horz, - wxScrollbarVisibility vert); - private: DECLARE_NO_COPY_CLASS(wxScrollHelper) }; diff --git a/include/wx/scrolwin.h b/include/wx/scrolwin.h index 41726f3aba..af3ef755d5 100644 --- a/include/wx/scrolwin.h +++ b/include/wx/scrolwin.h @@ -70,8 +70,12 @@ public: bool noRefresh = false ); // scroll to the given (in logical coords) position - void Scroll(int x, int y) { DoScroll(x, y); } - void Scroll(const wxPoint& pt) { DoScroll(pt.x, pt.y); } + // + // notice that for backwards compatibility reasons Scroll() is virtual as + // the existing code could override it but new code should override + // DoScroll() instead + virtual void Scroll(int x, int y) { DoScroll(x, y); } + virtual void Scroll(const wxPoint& pt) { DoScroll(pt.x, pt.y); } // get/set the page size for this orientation (wxVERTICAL/wxHORIZONTAL) int GetScrollPageSize(int orient) const;