ScreenToClient() implemented correctly

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2505 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 1999-05-19 01:00:57 +00:00
parent 42e69d6b43
commit dabc0cd5c1
7 changed files with 35 additions and 29 deletions

View File

@ -86,13 +86,6 @@ public:
const wxFont *theFont = (const wxFont *) NULL)
const;
virtual void ClientToScreen( int *x, int *y ) const;
virtual void ScreenToClient( int *x, int *y ) const;
wxPoint ClientToScreen(const wxPoint& pt) const
{ int x = pt.x; int y = pt.y; ClientToScreen(& x, & y); return wxPoint(x, y); }
wxPoint ScreenToClient(const wxPoint& pt) const
{ int x = pt.x; int y = pt.y; ScreenToClient(& x, & y); return wxPoint(x, y); }
virtual bool PopupMenu( wxMenu *menu, int x, int y );
virtual void SetScrollbar( int orient, int pos, int thumbVisible,
@ -215,6 +208,8 @@ public:
wxInsertChildFunction m_insertCallback;
// implement the base class pure virtuals
virtual void DoClientToScreen( int *x, int *y ) const;
virtual void DoScreenToClient( int *x, int *y ) const;
virtual void DoGetPosition( int *x, int *y ) const;
virtual void DoGetSize( int *width, int *height ) const;
virtual void DoGetClientSize( int *width, int *height ) const;

View File

@ -86,13 +86,6 @@ public:
const wxFont *theFont = (const wxFont *) NULL)
const;
virtual void ClientToScreen( int *x, int *y ) const;
virtual void ScreenToClient( int *x, int *y ) const;
wxPoint ClientToScreen(const wxPoint& pt) const
{ int x = pt.x; int y = pt.y; ClientToScreen(& x, & y); return wxPoint(x, y); }
wxPoint ScreenToClient(const wxPoint& pt) const
{ int x = pt.x; int y = pt.y; ScreenToClient(& x, & y); return wxPoint(x, y); }
virtual bool PopupMenu( wxMenu *menu, int x, int y );
virtual void SetScrollbar( int orient, int pos, int thumbVisible,
@ -215,6 +208,8 @@ public:
wxInsertChildFunction m_insertCallback;
// implement the base class pure virtuals
virtual void DoClientToScreen( int *x, int *y ) const;
virtual void DoScreenToClient( int *x, int *y ) const;
virtual void DoGetPosition( int *x, int *y ) const;
virtual void DoGetSize( int *width, int *height ) const;
virtual void DoGetClientSize( int *width, int *height ) const;

View File

@ -110,13 +110,6 @@ public:
const wxFont *theFont = (const wxFont *) NULL)
const;
virtual void ClientToScreen( int *x, int *y ) const;
virtual void ScreenToClient( int *x, int *y ) const;
wxPoint ClientToScreen(const wxPoint& pt) const
{ int x = pt.x; int y = pt.y; ClientToScreen(& x, & y); return wxPoint(x, y); }
wxPoint ScreenToClient(const wxPoint& pt) const
{ int x = pt.x; int y = pt.y; ScreenToClient(& x, & y); return wxPoint(x, y); }
virtual bool PopupMenu( wxMenu *menu, int x, int y );
virtual void SetScrollbar( int orient, int pos, int thumbVisible,
@ -403,6 +396,8 @@ protected:
wxButton *m_btnDefault;
// implement the base class pure virtuals
virtual void DoClientToScreen( int *x, int *y ) const;
virtual void DoScreenToClient( int *x, int *y ) const;
virtual void DoGetPosition( int *x, int *y ) const;
virtual void DoGetSize( int *width, int *height ) const;
virtual void DoGetClientSize( int *width, int *height ) const;

View File

@ -489,8 +489,25 @@ public:
const = 0;
// translate to/from screen/client coordinates (pointers may be NULL)
virtual void ClientToScreen( int *x, int *y ) const = 0;
virtual void ScreenToClient( int *x, int *y ) const = 0;
void ClientToScreen( int *x, int *y ) const
{ DoClientToScreen(x, y); }
void ScreenToClient( int *x, int *y ) const
{ DoScreenToClient(x, y); }
wxPoint ClientToScreen(const wxPoint& pt) const
{
int x = pt.x, y = pt.y;
DoClientToScreen(&x, &y);
return wxPoint(x, y);
}
wxPoint ScreenToClient(const wxPoint& pt) const
{
int x = pt.x, y = pt.y;
DoScreenToClient(&x, &y);
return wxPoint(x, y);
}
// misc
// ----
@ -707,6 +724,10 @@ protected:
// overloaded Something()s in terms of DoSomething() which will be the
// only one to be virtual.
// coordinates translation
virtual void DoClientToScreen( int *x, int *y ) const = 0;
virtual void DoScreenToClient( int *x, int *y ) const = 0;
// retrieve the position/size of the window
virtual void DoGetPosition( int *x, int *y ) const = 0;
virtual void DoGetSize( int *width, int *height ) const = 0;

View File

@ -2129,7 +2129,7 @@ void wxWindow::DoGetPosition( int *x, int *y ) const
if (y) (*y) = m_y;
}
void wxWindow::ClientToScreen( int *x, int *y ) const
void wxWindow::DoClientToScreen( int *x, int *y ) const
{
wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
@ -2158,7 +2158,7 @@ void wxWindow::ClientToScreen( int *x, int *y ) const
if (y) *y += org_y;
}
void wxWindow::ScreenToClient( int *x, int *y ) const
void wxWindow::DoScreenToClient( int *x, int *y ) const
{
wxCHECK_RET( (m_widget != NULL), _T("invalid window") );

View File

@ -2129,7 +2129,7 @@ void wxWindow::DoGetPosition( int *x, int *y ) const
if (y) (*y) = m_y;
}
void wxWindow::ClientToScreen( int *x, int *y ) const
void wxWindow::DoClientToScreen( int *x, int *y ) const
{
wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
@ -2158,7 +2158,7 @@ void wxWindow::ClientToScreen( int *x, int *y ) const
if (y) *y += org_y;
}
void wxWindow::ScreenToClient( int *x, int *y ) const
void wxWindow::DoScreenToClient( int *x, int *y ) const
{
wxCHECK_RET( (m_widget != NULL), _T("invalid window") );

View File

@ -1099,7 +1099,7 @@ void wxWindow::DoGetPosition(int *x, int *y) const
*y = point.y;
}
void wxWindow::ScreenToClient(int *x, int *y) const
void wxWindow::DoScreenToClient(int *x, int *y) const
{
POINT pt;
if ( x )
@ -1116,7 +1116,7 @@ void wxWindow::ScreenToClient(int *x, int *y) const
*y = pt.y;
}
void wxWindow::ClientToScreen(int *x, int *y) const
void wxWindow::DoClientToScreen(int *x, int *y) const
{
POINT pt;
if ( x )