setting and restoring the graf port
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13236 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2556,70 +2556,56 @@ void AGAApplyThemeBackground(ThemeBackgroundKind inKind,
|
|||||||
|
|
||||||
#endif // !TARGET_CARBON
|
#endif // !TARGET_CARBON
|
||||||
|
|
||||||
|
// this helper class stores and restores the current grafport
|
||||||
|
// status in a theme savvy manner, pen mode, patterns and fonts
|
||||||
|
// attributes
|
||||||
|
|
||||||
AGAPortHelper::AGAPortHelper( GrafPtr newport)
|
AGAPortHelper::AGAPortHelper( GrafPtr newport)
|
||||||
{
|
{
|
||||||
GetPort( &port ) ;
|
m_clip = NULL ;
|
||||||
SetPort( newport ) ;
|
Setup( newport ) ;
|
||||||
// wxASSERT( newport->portRect.left == 0 && newport->portRect.top == 0 ) ;
|
|
||||||
GetPenState( &oldPenState ) ;
|
|
||||||
GetBackColor( &oldBackColor ) ;
|
|
||||||
GetForeColor( &oldForeColor ) ;
|
|
||||||
|
|
||||||
clip = NewRgn() ;
|
|
||||||
GetClip( clip );
|
|
||||||
font = GetPortTextFont( newport);
|
|
||||||
size = GetPortTextSize( newport);
|
|
||||||
style = GetPortTextFace( newport);
|
|
||||||
mode = GetPortTextMode( newport);
|
|
||||||
nport = newport ;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
AGAPortHelper::AGAPortHelper()
|
AGAPortHelper::AGAPortHelper()
|
||||||
{
|
{
|
||||||
clip = NULL ;
|
m_clip = NULL ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AGAPortHelper::Setup( GrafPtr newport )
|
void AGAPortHelper::Setup( GrafPtr newport )
|
||||||
{
|
{
|
||||||
GetPort( &port ) ;
|
GetPort( &m_oldPort ) ;
|
||||||
SetPort( newport ) ;
|
SetPort( newport ) ;
|
||||||
// wxASSERT( newport->portRect.left == 0 && newport->portRect.top == 0 ) ;
|
wxASSERT_MSG( m_clip == NULL , "Cannot call setup twice" ) ;
|
||||||
GetPenState( &oldPenState ) ;
|
m_clip = NewRgn() ;
|
||||||
GetBackColor( &oldBackColor ) ;
|
GetClip( m_clip );
|
||||||
GetForeColor( &oldForeColor ) ;
|
m_textFont = GetPortTextFont( newport);
|
||||||
wxASSERT( clip == NULL ) ;
|
m_textSize = GetPortTextSize( newport);
|
||||||
clip = NewRgn() ;
|
m_textStyle = GetPortTextFace( newport);
|
||||||
GetClip( clip );
|
m_textMode = GetPortTextMode( newport);
|
||||||
font = GetPortTextFont( newport);
|
GetThemeDrawingState( &m_drawingState ) ;
|
||||||
size = GetPortTextSize( newport);
|
m_currentPort = newport ;
|
||||||
style = GetPortTextFace( newport);
|
|
||||||
mode = GetPortTextMode( newport);
|
|
||||||
nport = newport ;
|
|
||||||
}
|
}
|
||||||
void AGAPortHelper::Clear()
|
void AGAPortHelper::Clear()
|
||||||
{
|
{
|
||||||
if ( clip )
|
if ( m_clip )
|
||||||
{
|
{
|
||||||
DisposeRgn( clip ) ;
|
DisposeRgn( m_clip ) ;
|
||||||
clip = NULL ;
|
DisposeThemeDrawingState( m_drawingState ) ;
|
||||||
|
m_clip = NULL ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AGAPortHelper::~AGAPortHelper()
|
AGAPortHelper::~AGAPortHelper()
|
||||||
{
|
{
|
||||||
if ( clip )
|
if ( m_clip )
|
||||||
{
|
{
|
||||||
SetPort( nport ) ;
|
SetPort( m_currentPort ) ;
|
||||||
PenNormal() ;
|
SetClip( m_clip ) ;
|
||||||
SetClip( clip ) ;
|
DisposeRgn( m_clip ) ;
|
||||||
DisposeRgn( clip ) ;
|
TextFont( m_textFont );
|
||||||
RGBForeColor(&oldForeColor);
|
TextSize( m_textSize );
|
||||||
RGBBackColor(&oldBackColor);
|
TextFace( m_textStyle );
|
||||||
SetPenState(&oldPenState);
|
TextMode( m_textMode );
|
||||||
|
SetThemeDrawingState( m_drawingState , true ) ;
|
||||||
TextFont( font );
|
SetPort( m_oldPort ) ;
|
||||||
TextSize( size );
|
|
||||||
TextFace( style );
|
|
||||||
TextMode( mode );
|
|
||||||
SetPort( port ) ;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -2556,70 +2556,56 @@ void AGAApplyThemeBackground(ThemeBackgroundKind inKind,
|
|||||||
|
|
||||||
#endif // !TARGET_CARBON
|
#endif // !TARGET_CARBON
|
||||||
|
|
||||||
|
// this helper class stores and restores the current grafport
|
||||||
|
// status in a theme savvy manner, pen mode, patterns and fonts
|
||||||
|
// attributes
|
||||||
|
|
||||||
AGAPortHelper::AGAPortHelper( GrafPtr newport)
|
AGAPortHelper::AGAPortHelper( GrafPtr newport)
|
||||||
{
|
{
|
||||||
GetPort( &port ) ;
|
m_clip = NULL ;
|
||||||
SetPort( newport ) ;
|
Setup( newport ) ;
|
||||||
// wxASSERT( newport->portRect.left == 0 && newport->portRect.top == 0 ) ;
|
|
||||||
GetPenState( &oldPenState ) ;
|
|
||||||
GetBackColor( &oldBackColor ) ;
|
|
||||||
GetForeColor( &oldForeColor ) ;
|
|
||||||
|
|
||||||
clip = NewRgn() ;
|
|
||||||
GetClip( clip );
|
|
||||||
font = GetPortTextFont( newport);
|
|
||||||
size = GetPortTextSize( newport);
|
|
||||||
style = GetPortTextFace( newport);
|
|
||||||
mode = GetPortTextMode( newport);
|
|
||||||
nport = newport ;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
AGAPortHelper::AGAPortHelper()
|
AGAPortHelper::AGAPortHelper()
|
||||||
{
|
{
|
||||||
clip = NULL ;
|
m_clip = NULL ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AGAPortHelper::Setup( GrafPtr newport )
|
void AGAPortHelper::Setup( GrafPtr newport )
|
||||||
{
|
{
|
||||||
GetPort( &port ) ;
|
GetPort( &m_oldPort ) ;
|
||||||
SetPort( newport ) ;
|
SetPort( newport ) ;
|
||||||
// wxASSERT( newport->portRect.left == 0 && newport->portRect.top == 0 ) ;
|
wxASSERT_MSG( m_clip == NULL , "Cannot call setup twice" ) ;
|
||||||
GetPenState( &oldPenState ) ;
|
m_clip = NewRgn() ;
|
||||||
GetBackColor( &oldBackColor ) ;
|
GetClip( m_clip );
|
||||||
GetForeColor( &oldForeColor ) ;
|
m_textFont = GetPortTextFont( newport);
|
||||||
wxASSERT( clip == NULL ) ;
|
m_textSize = GetPortTextSize( newport);
|
||||||
clip = NewRgn() ;
|
m_textStyle = GetPortTextFace( newport);
|
||||||
GetClip( clip );
|
m_textMode = GetPortTextMode( newport);
|
||||||
font = GetPortTextFont( newport);
|
GetThemeDrawingState( &m_drawingState ) ;
|
||||||
size = GetPortTextSize( newport);
|
m_currentPort = newport ;
|
||||||
style = GetPortTextFace( newport);
|
|
||||||
mode = GetPortTextMode( newport);
|
|
||||||
nport = newport ;
|
|
||||||
}
|
}
|
||||||
void AGAPortHelper::Clear()
|
void AGAPortHelper::Clear()
|
||||||
{
|
{
|
||||||
if ( clip )
|
if ( m_clip )
|
||||||
{
|
{
|
||||||
DisposeRgn( clip ) ;
|
DisposeRgn( m_clip ) ;
|
||||||
clip = NULL ;
|
DisposeThemeDrawingState( m_drawingState ) ;
|
||||||
|
m_clip = NULL ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AGAPortHelper::~AGAPortHelper()
|
AGAPortHelper::~AGAPortHelper()
|
||||||
{
|
{
|
||||||
if ( clip )
|
if ( m_clip )
|
||||||
{
|
{
|
||||||
SetPort( nport ) ;
|
SetPort( m_currentPort ) ;
|
||||||
PenNormal() ;
|
SetClip( m_clip ) ;
|
||||||
SetClip( clip ) ;
|
DisposeRgn( m_clip ) ;
|
||||||
DisposeRgn( clip ) ;
|
TextFont( m_textFont );
|
||||||
RGBForeColor(&oldForeColor);
|
TextSize( m_textSize );
|
||||||
RGBBackColor(&oldBackColor);
|
TextFace( m_textStyle );
|
||||||
SetPenState(&oldPenState);
|
TextMode( m_textMode );
|
||||||
|
SetThemeDrawingState( m_drawingState , true ) ;
|
||||||
TextFont( font );
|
SetPort( m_oldPort ) ;
|
||||||
TextSize( size );
|
|
||||||
TextFace( style );
|
|
||||||
TextMode( mode );
|
|
||||||
SetPort( port ) ;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user