adding magnification API into the wxWindow classes for best retina support

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74247 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor 2013-06-17 17:41:34 +00:00
parent 5fbd55b946
commit f86190702b
8 changed files with 30 additions and 0 deletions

View File

@ -247,6 +247,8 @@ public :
virtual void WindowToScreen( int *x, int *y );
virtual double GetMagnificationFactor() const;
virtual bool IsActive();
virtual void SetModified(bool modified);

View File

@ -873,6 +873,8 @@ public :
virtual void ScreenToWindow( int *x, int *y ) = 0;
virtual void WindowToScreen( int *x, int *y ) = 0;
virtual double GetMagnificationFactor() const { return 1.0; }
virtual bool IsActive() = 0;

View File

@ -65,6 +65,8 @@ public:
virtual void UnsubclassWin();
virtual wxPoint GetClientAreaOrigin() const;
virtual double GetMagnificationFactor() const;
// implement base class pure virtuals

View File

@ -97,6 +97,8 @@ public:
virtual int GetCharHeight() const;
virtual int GetCharWidth() const;
virtual double GetMagnificationFactor() const;
public:
virtual void SetScrollbar( int orient, int pos, int thumbVisible,

View File

@ -521,6 +521,11 @@ public:
return wxSize( wxMax( client.x, best.x ), wxMax( client.y, best.y ) );
}
// returns the magnification of the backing store of this window
// eg 2.0 for a window on a retina screen
virtual double GetMagnificationFactor() const
{ return 1.0; }
// return the size of the left/right and top/bottom borders in x and y
// components of the result respectively
virtual wxSize GetWindowBorderSize() const;

View File

@ -1035,6 +1035,11 @@ void wxNonOwnedWindowCocoaImpl::WindowToScreen( int *x, int *y )
*y = p.y;
}
double wxNonOwnedWindowCocoaImpl::GetMagnificationFactor() const
{
return [m_macWindow backingScaleFactor];
}
bool wxNonOwnedWindowCocoaImpl::IsActive()
{
return [m_macWindow isKeyWindow];

View File

@ -478,6 +478,11 @@ void wxNonOwnedWindow::DoGetClientSize( int *width, int *height ) const
*height = h ;
}
double wxNonOwnedWindow::GetMagnificationFactor() const
{
return m_nowpeer->GetMagnificationFactor();
}
void wxNonOwnedWindow::WindowWasPainted()
{
s_lastFlush = clock();

View File

@ -877,6 +877,13 @@ void wxWindowMac::DoGetClientSize( int *x, int *y ) const
*y = hh;
}
double wxWindowMac::GetMagnificationFactor() const
{
wxNonOwnedWindow* tlw = MacGetTopLevelWindow() ;
wxCHECK_MSG( tlw , 1.0, wxT("TopLevel Window missing") ) ;
return tlw->GetMagnificationFactor();
}
bool wxWindowMac::SetCursor(const wxCursor& cursor)
{
if (m_cursor.IsSameAs(cursor))