supporting content size scaling (retina display)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67001 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2011-02-22 18:51:10 +00:00
parent 455f62c3b5
commit f18b5ee74c
5 changed files with 21 additions and 1 deletions

View File

@@ -235,6 +235,10 @@ public :
virtual void GetPosition( int &x, int &y ) const = 0; virtual void GetPosition( int &x, int &y ) const = 0;
virtual void GetSize( int &width, int &height ) const = 0; virtual void GetSize( int &width, int &height ) const = 0;
virtual void SetControlSize( wxWindowVariant variant ) = 0; virtual void SetControlSize( wxWindowVariant variant ) = 0;
virtual float GetContentScaleFactor() const
{
return 1.0;
}
// the native coordinates may have an 'aura' for shadows etc, if this is the case the layout // the native coordinates may have an 'aura' for shadows etc, if this is the case the layout
// inset indicates on which insets the real control is drawn // inset indicates on which insets the real control is drawn

View File

@@ -56,7 +56,8 @@ public :
virtual void GetPosition( int &x, int &y ) const; virtual void GetPosition( int &x, int &y ) const;
virtual void GetSize( int &width, int &height ) const; virtual void GetSize( int &width, int &height ) const;
virtual void SetControlSize( wxWindowVariant variant ); virtual void SetControlSize( wxWindowVariant variant );
virtual float GetContentScaleFactor() const ;
virtual void SetNeedsDisplay( const wxRect* where = NULL ); virtual void SetNeedsDisplay( const wxRect* where = NULL );
virtual bool GetNeedsDisplay() const; virtual bool GetNeedsDisplay() const;

View File

@@ -266,6 +266,9 @@ public:
virtual bool OSXHandleKeyEvent( wxKeyEvent& event ); virtual bool OSXHandleKeyEvent( wxKeyEvent& event );
bool IsNativeWindowWrapper() const { return m_isNativeWindowWrapper; } bool IsNativeWindowWrapper() const { return m_isNativeWindowWrapper; }
float GetContentScaleFactor() const ;
protected: protected:
// For controls like radio buttons which are genuinely composite // For controls like radio buttons which are genuinely composite
wxList m_subControls; wxList m_subControls;

View File

@@ -392,6 +392,8 @@ void wxWidgetIPhoneImpl::Move(int x, int y, int width, int height)
[m_osxView setFrame:r]; [m_osxView setFrame:r];
} }
void wxWidgetIPhoneImpl::GetPosition( int &x, int &y ) const void wxWidgetIPhoneImpl::GetPosition( int &x, int &y ) const
{ {
CGRect r = [m_osxView frame]; CGRect r = [m_osxView frame];
@@ -591,6 +593,11 @@ void wxWidgetIPhoneImpl::SetControlSize( wxWindowVariant variant )
{ {
} }
float wxWidgetIPhoneImpl::GetContentScaleFactor() const
{
return [m_osxView contentScaleFactor];
}
void wxWidgetIPhoneImpl::SetFont( const wxFont & font , const wxColour& foreground , long windowStyle, bool ignoreBlack ) void wxWidgetIPhoneImpl::SetFont( const wxFont & font , const wxColour& foreground , long windowStyle, bool ignoreBlack )
{ {
} }

View File

@@ -1115,6 +1115,11 @@ void wxWindowMac::DoSetClientSize(int clientwidth, int clientheight)
} }
} }
float wxWindowMac::GetContentScaleFactor() const
{
return m_peer->GetContentScaleFactor();
}
void wxWindowMac::SetLabel(const wxString& title) void wxWindowMac::SetLabel(const wxString& title)
{ {
if ( title == m_label ) if ( title == m_label )