added Calc(Un)ScrolledPosition taking wxPoint

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14657 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík 2002-03-17 14:13:14 +00:00
parent 66ce9e0609
commit 8c2f379786
6 changed files with 68 additions and 12 deletions

View File

@ -98,8 +98,27 @@ public:
// Actual size in pixels when scrolling is taken into account
virtual void GetVirtualSize(int *x, int *y) const;
virtual void CalcScrolledPosition(int x, int y, int *xx, int *yy) const;
virtual void CalcUnscrolledPosition(int x, int y, int *xx, int *yy) const;
// translate between scrolled and unscrolled coordinates
void CalcScrolledPosition(int x, int y, int *xx, int *yy) const
{ DoCalcScrolledPosition(x, y, xx, yy); }
wxPoint CalcScrolledPosition(const wxPoint& pt) const
{
wxPoint p2;
DoCalcScrolledPosition(pt.x, pt.y, &p2.x, &p2.y);
return p2;
}
void CalcUnscrolledPosition(int x, int y, int *xx, int *yy) const
{ DoCalcUnscrolledPosition(x, y, xx, yy); }
wxPoint CalcUnscrolledPosition(const wxPoint& pt) const
{
wxPoint p2;
DoCalcUnscrolledPosition(pt.x, pt.y, &p2.x, &p2.y);
return p2;
}
virtual void DoCalcScrolledPosition(int x, int y, int *xx, int *yy) const;
virtual void DoCalcUnscrolledPosition(int x, int y, int *xx, int *yy) const;
// Override this function to draw the graphic (or just process EVT_PAINT)
virtual void OnDraw(wxDC& WXUNUSED(dc)) {}

View File

@ -98,8 +98,27 @@ public:
// Actual size in pixels when scrolling is taken into account
virtual void GetVirtualSize(int *x, int *y) const;
virtual void CalcScrolledPosition(int x, int y, int *xx, int *yy) const;
virtual void CalcUnscrolledPosition(int x, int y, int *xx, int *yy) const;
// translate between scrolled and unscrolled coordinates
void CalcScrolledPosition(int x, int y, int *xx, int *yy) const
{ DoCalcScrolledPosition(x, y, xx, yy); }
wxPoint CalcScrolledPosition(const wxPoint& pt) const
{
wxPoint p2;
DoCalcScrolledPosition(pt.x, pt.y, &p2.x, &p2.y);
return p2;
}
void CalcUnscrolledPosition(int x, int y, int *xx, int *yy) const
{ DoCalcUnscrolledPosition(x, y, xx, yy); }
wxPoint CalcUnscrolledPosition(const wxPoint& pt) const
{
wxPoint p2;
DoCalcUnscrolledPosition(pt.x, pt.y, &p2.x, &p2.y);
return p2;
}
virtual void DoCalcScrolledPosition(int x, int y, int *xx, int *yy) const;
virtual void DoCalcUnscrolledPosition(int x, int y, int *xx, int *yy) const;
// Override this function to draw the graphic (or just process EVT_PAINT)
virtual void OnDraw(wxDC& WXUNUSED(dc)) {}

View File

@ -67,8 +67,26 @@ public:
double GetScaleY() const { return m_scaleY; }
// translate between scrolled and unscrolled coordinates
virtual void CalcScrolledPosition(int x, int y, int *xx, int *yy) const;
virtual void CalcUnscrolledPosition(int x, int y, int *xx, int *yy) const;
void CalcScrolledPosition(int x, int y, int *xx, int *yy) const
{ DoCalcScrolledPosition(x, y, xx, yy); }
wxPoint CalcScrolledPosition(const wxPoint& pt) const
{
wxPoint p2;
DoCalcScrolledPosition(pt.x, pt.y, &p2.x, &p2.y);
return p2;
}
void CalcUnscrolledPosition(int x, int y, int *xx, int *yy) const
{ DoCalcUnscrolledPosition(x, y, xx, yy); }
wxPoint CalcUnscrolledPosition(const wxPoint& pt) const
{
wxPoint p2;
DoCalcUnscrolledPosition(pt.x, pt.y, &p2.x, &p2.y);
return p2;
}
virtual void DoCalcScrolledPosition(int x, int y, int *xx, int *yy) const;
virtual void DoCalcUnscrolledPosition(int x, int y, int *xx, int *yy) const;
// Adjust the scrollbars
virtual void AdjustScrollbars(void);

View File

@ -814,7 +814,7 @@ void wxScrollHelper::GetViewStart (int *x, int *y) const
*y = m_yScrollPosition;
}
void wxScrollHelper::CalcScrolledPosition(int x, int y, int *xx, int *yy) const
void wxScrollHelper::DoCalcScrolledPosition(int x, int y, int *xx, int *yy) const
{
if ( xx )
*xx = x - m_xScrollPosition * m_xScrollPixelsPerLine;
@ -822,7 +822,7 @@ void wxScrollHelper::CalcScrolledPosition(int x, int y, int *xx, int *yy) const
*yy = y - m_yScrollPosition * m_yScrollPixelsPerLine;
}
void wxScrollHelper::CalcUnscrolledPosition(int x, int y, int *xx, int *yy) const
void wxScrollHelper::DoCalcUnscrolledPosition(int x, int y, int *xx, int *yy) const
{
if ( xx )
*xx = x + m_xScrollPosition * m_xScrollPixelsPerLine;

View File

@ -588,7 +588,7 @@ void wxScrolledWindow::GetViewStart (int *x, int *y) const
*y = m_yScrollPosition;
}
void wxScrolledWindow::CalcScrolledPosition(int x, int y, int *xx, int *yy) const
void wxScrolledWindow::DoCalcScrolledPosition(int x, int y, int *xx, int *yy) const
{
if ( xx )
*xx = x - m_xScrollPosition * m_xScrollPixelsPerLine;
@ -596,7 +596,7 @@ void wxScrolledWindow::CalcScrolledPosition(int x, int y, int *xx, int *yy) cons
*yy = y - m_yScrollPosition * m_yScrollPixelsPerLine;
}
void wxScrolledWindow::CalcUnscrolledPosition(int x, int y, int *xx, int *yy) const
void wxScrolledWindow::DoCalcUnscrolledPosition(int x, int y, int *xx, int *yy) const
{
if ( xx )
*xx = x + m_xScrollPosition * m_xScrollPixelsPerLine;

View File

@ -588,7 +588,7 @@ void wxScrolledWindow::GetViewStart (int *x, int *y) const
*y = m_yScrollPosition;
}
void wxScrolledWindow::CalcScrolledPosition(int x, int y, int *xx, int *yy) const
void wxScrolledWindow::DoCalcScrolledPosition(int x, int y, int *xx, int *yy) const
{
if ( xx )
*xx = x - m_xScrollPosition * m_xScrollPixelsPerLine;
@ -596,7 +596,7 @@ void wxScrolledWindow::CalcScrolledPosition(int x, int y, int *xx, int *yy) cons
*yy = y - m_yScrollPosition * m_yScrollPixelsPerLine;
}
void wxScrolledWindow::CalcUnscrolledPosition(int x, int y, int *xx, int *yy) const
void wxScrolledWindow::DoCalcUnscrolledPosition(int x, int y, int *xx, int *yy) const
{
if ( xx )
*xx = x + m_xScrollPosition * m_xScrollPixelsPerLine;