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
This commit is contained in:
Vadim Zeitlin
2008-12-25 12:27:20 +00:00
parent bca1504431
commit bc448be341
3 changed files with 14 additions and 8 deletions

View File

@@ -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

View File

@@ -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)
};

View File

@@ -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;