minor cleanup: corrected typos, etc.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36328 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -56,15 +56,15 @@ extern TECObjectRef s_TECNativeCToUnicode ;
|
|||||||
wxMacWindowClipper::wxMacWindowClipper( const wxWindow* win ) :
|
wxMacWindowClipper::wxMacWindowClipper( const wxWindow* win ) :
|
||||||
wxMacPortSaver( (GrafPtr) GetWindowPort((WindowRef) win->MacGetTopLevelWindowRef()) )
|
wxMacPortSaver( (GrafPtr) GetWindowPort((WindowRef) win->MacGetTopLevelWindowRef()) )
|
||||||
{
|
{
|
||||||
m_newPort =(GrafPtr) GetWindowPort((WindowRef) win->MacGetTopLevelWindowRef()) ;
|
m_newPort = (GrafPtr) GetWindowPort((WindowRef) win->MacGetTopLevelWindowRef()) ;
|
||||||
m_formerClip = NewRgn() ;
|
m_formerClip = NewRgn() ;
|
||||||
m_newClip = NewRgn() ;
|
m_newClip = NewRgn() ;
|
||||||
GetClip( m_formerClip ) ;
|
GetClip( m_formerClip ) ;
|
||||||
|
|
||||||
if ( win )
|
if ( win )
|
||||||
{
|
{
|
||||||
// guard against half constructed objects, this just leads to a empty clip
|
// guard against half constructed objects, this just leads to a empty clip
|
||||||
if( win->GetPeer() )
|
if ( win->GetPeer() )
|
||||||
{
|
{
|
||||||
int x = 0 , y = 0;
|
int x = 0 , y = 0;
|
||||||
win->MacWindowToRootWindow( &x,&y ) ;
|
win->MacWindowToRootWindow( &x,&y ) ;
|
||||||
@@ -90,7 +90,7 @@ wxMacWindowStateSaver::wxMacWindowStateSaver( const wxWindow* win ) :
|
|||||||
wxMacWindowClipper( win )
|
wxMacWindowClipper( win )
|
||||||
{
|
{
|
||||||
// the port is already set at this point
|
// the port is already set at this point
|
||||||
m_newPort =(GrafPtr) GetWindowPort((WindowRef) win->MacGetTopLevelWindowRef()) ;
|
m_newPort = (GrafPtr) GetWindowPort((WindowRef) win->MacGetTopLevelWindowRef()) ;
|
||||||
GetThemeDrawingState( &m_themeDrawingState ) ;
|
GetThemeDrawingState( &m_themeDrawingState ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,6 +109,7 @@ wxMacPortSetter::wxMacPortSetter( const wxDC* dc ) :
|
|||||||
m_dc = dc ;
|
m_dc = dc ;
|
||||||
// dc->MacSetupPort(&m_ph) ;
|
// dc->MacSetupPort(&m_ph) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMacPortSetter::~wxMacPortSetter()
|
wxMacPortSetter::~wxMacPortSetter()
|
||||||
{
|
{
|
||||||
// m_dc->MacCleanupPort(&m_ph) ;
|
// m_dc->MacCleanupPort(&m_ph) ;
|
||||||
@@ -210,6 +211,7 @@ wxMacCGContext::~wxMacCGContext()
|
|||||||
CGContextRestoreGState( m_cgContext ) ;
|
CGContextRestoreGState( m_cgContext ) ;
|
||||||
CGContextRestoreGState( m_cgContext ) ;
|
CGContextRestoreGState( m_cgContext ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( m_qdPort )
|
if ( m_qdPort )
|
||||||
CGContextRelease( m_cgContext ) ;
|
CGContextRelease( m_cgContext ) ;
|
||||||
}
|
}
|
||||||
@@ -217,7 +219,7 @@ wxMacCGContext::~wxMacCGContext()
|
|||||||
|
|
||||||
void wxMacCGContext::Clip( const wxRegion ®ion )
|
void wxMacCGContext::Clip( const wxRegion ®ion )
|
||||||
{
|
{
|
||||||
// ClipCGContextToRegion ( m_cgContext, &bounds , (RgnHandle) dc->m_macCurrentClipRgn ) ;
|
// ClipCGContextToRegion ( m_cgContext, &bounds , (RgnHandle) dc->m_macCurrentClipRgn ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMacCGContext::StrokePath( const wxGraphicPath *p )
|
void wxMacCGContext::StrokePath( const wxGraphicPath *p )
|
||||||
@@ -231,6 +233,7 @@ void wxMacCGContext::DrawPath( const wxGraphicPath *p , int fillStyle )
|
|||||||
{
|
{
|
||||||
const wxMacCGPath* path = dynamic_cast< const wxMacCGPath*>( p ) ;
|
const wxMacCGPath* path = dynamic_cast< const wxMacCGPath*>( p ) ;
|
||||||
CGPathDrawingMode mode = m_mode ;
|
CGPathDrawingMode mode = m_mode ;
|
||||||
|
|
||||||
if ( fillStyle == wxODDEVEN_RULE )
|
if ( fillStyle == wxODDEVEN_RULE )
|
||||||
{
|
{
|
||||||
if ( mode == kCGPathFill )
|
if ( mode == kCGPathFill )
|
||||||
@@ -238,6 +241,7 @@ void wxMacCGContext::DrawPath( const wxGraphicPath *p , int fillStyle )
|
|||||||
else if ( mode == kCGPathFillStroke )
|
else if ( mode == kCGPathFillStroke )
|
||||||
mode = kCGPathEOFillStroke ;
|
mode = kCGPathEOFillStroke ;
|
||||||
}
|
}
|
||||||
|
|
||||||
CGContextAddPath( m_cgContext , path->GetPath() ) ;
|
CGContextAddPath( m_cgContext , path->GetPath() ) ;
|
||||||
CGContextDrawPath( m_cgContext , mode ) ;
|
CGContextDrawPath( m_cgContext , mode ) ;
|
||||||
}
|
}
|
||||||
@@ -275,7 +279,7 @@ wxGraphicPath* wxMacCGContext::CreatePath()
|
|||||||
|
|
||||||
CGContextRef wxMacCGContext::GetNativeContext()
|
CGContextRef wxMacCGContext::GetNativeContext()
|
||||||
{
|
{
|
||||||
if( m_cgContext == NULL )
|
if ( m_cgContext == NULL )
|
||||||
{
|
{
|
||||||
Rect bounds ;
|
Rect bounds ;
|
||||||
GetPortBounds( (CGrafPtr) m_qdPort , &bounds ) ;
|
GetPortBounds( (CGrafPtr) m_qdPort , &bounds ) ;
|
||||||
@@ -290,6 +294,7 @@ CGContextRef wxMacCGContext::GetNativeContext()
|
|||||||
SetPen( m_pen ) ;
|
SetPen( m_pen ) ;
|
||||||
SetBrush( m_brush ) ;
|
SetBrush( m_brush ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_cgContext ;
|
return m_cgContext ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -309,34 +314,33 @@ void wxMacCGContext::SetNativeContext( CGContextRef cg )
|
|||||||
class wxMacCGPattern
|
class wxMacCGPattern
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
wxMacCGPattern()
|
wxMacCGPattern() {}
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
// is guaranteed to be called only with a non-Null CGContextRef
|
// is guaranteed to be called only with a non-Null CGContextRef
|
||||||
virtual void Render( CGContextRef ctxRef ) = 0 ;
|
virtual void Render( CGContextRef ctxRef ) = 0 ;
|
||||||
|
|
||||||
operator CGPatternRef() const { return m_patternRef ; }
|
operator CGPatternRef() const { return m_patternRef ; }
|
||||||
|
|
||||||
protected :
|
protected :
|
||||||
virtual ~wxMacCGPattern()
|
virtual ~wxMacCGPattern()
|
||||||
{
|
{
|
||||||
// as this is called only when our m_patternRef is been released, don't release
|
// as this is called only when our m_patternRef is been released;
|
||||||
// it again
|
// don't release it again
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _Render( void *info, CGContextRef ctxRef )
|
static void _Render( void *info, CGContextRef ctxRef )
|
||||||
{
|
{
|
||||||
wxMacCGPattern* self = (wxMacCGPattern*) info ;
|
wxMacCGPattern* self = (wxMacCGPattern*) info ;
|
||||||
if ( self && ctxRef )
|
if ( self && ctxRef )
|
||||||
self->Render( ctxRef ) ;
|
self->Render( ctxRef ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _Dispose( void *info )
|
static void _Dispose( void *info )
|
||||||
{
|
{
|
||||||
wxMacCGPattern* self = (wxMacCGPattern*) info ;
|
wxMacCGPattern* self = (wxMacCGPattern*) info ;
|
||||||
delete self ;
|
delete self ;
|
||||||
}
|
}
|
||||||
|
|
||||||
CGPatternRef m_patternRef ;
|
CGPatternRef m_patternRef ;
|
||||||
|
|
||||||
static const CGPatternCallbacks ms_Callbacks ;
|
static const CGPatternCallbacks ms_Callbacks ;
|
||||||
@@ -357,9 +361,8 @@ public :
|
|||||||
ImagePattern( CGImageRef image , CGAffineTransform transform )
|
ImagePattern( CGImageRef image , CGAffineTransform transform )
|
||||||
{
|
{
|
||||||
if ( image )
|
if ( image )
|
||||||
{
|
|
||||||
CFRetain( image ) ;
|
CFRetain( image ) ;
|
||||||
}
|
|
||||||
Init( image , transform ) ;
|
Init( image , transform ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -381,12 +384,13 @@ protected :
|
|||||||
kCGPatternTilingNoDistortion, true , &wxMacCGPattern::ms_Callbacks ) ;
|
kCGPatternTilingNoDistortion, true , &wxMacCGPattern::ms_Callbacks ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
~ImagePattern()
|
~ImagePattern()
|
||||||
{
|
{
|
||||||
if ( m_image )
|
if ( m_image )
|
||||||
CGImageRelease( m_image ) ;
|
CGImageRelease( m_image ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
CGImageRef m_image ;
|
CGImageRef m_image ;
|
||||||
CGRect m_imageBounds ;
|
CGRect m_imageBounds ;
|
||||||
} ;
|
} ;
|
||||||
@@ -424,7 +428,7 @@ public :
|
|||||||
|
|
||||||
virtual void Render( CGContextRef ctxRef )
|
virtual void Render( CGContextRef ctxRef )
|
||||||
{
|
{
|
||||||
switch( m_hatch )
|
switch ( m_hatch )
|
||||||
{
|
{
|
||||||
case wxBDIAGONAL_HATCH :
|
case wxBDIAGONAL_HATCH :
|
||||||
{
|
{
|
||||||
@@ -434,6 +438,7 @@ public :
|
|||||||
StrokeLineSegments( ctxRef , pts , 2 ) ;
|
StrokeLineSegments( ctxRef , pts , 2 ) ;
|
||||||
}
|
}
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
case wxCROSSDIAG_HATCH :
|
case wxCROSSDIAG_HATCH :
|
||||||
{
|
{
|
||||||
CGPoint pts[] = {
|
CGPoint pts[] = {
|
||||||
@@ -443,6 +448,7 @@ public :
|
|||||||
StrokeLineSegments( ctxRef , pts , 4 ) ;
|
StrokeLineSegments( ctxRef , pts , 4 ) ;
|
||||||
}
|
}
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
case wxFDIAGONAL_HATCH :
|
case wxFDIAGONAL_HATCH :
|
||||||
{
|
{
|
||||||
CGPoint pts[] = {
|
CGPoint pts[] = {
|
||||||
@@ -451,6 +457,7 @@ public :
|
|||||||
StrokeLineSegments( ctxRef , pts , 2 ) ;
|
StrokeLineSegments( ctxRef , pts , 2 ) ;
|
||||||
}
|
}
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
case wxCROSS_HATCH :
|
case wxCROSS_HATCH :
|
||||||
{
|
{
|
||||||
CGPoint pts[] = {
|
CGPoint pts[] = {
|
||||||
@@ -460,6 +467,7 @@ public :
|
|||||||
StrokeLineSegments( ctxRef , pts , 4 ) ;
|
StrokeLineSegments( ctxRef , pts , 4 ) ;
|
||||||
}
|
}
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
case wxHORIZONTAL_HATCH :
|
case wxHORIZONTAL_HATCH :
|
||||||
{
|
{
|
||||||
CGPoint pts[] = {
|
CGPoint pts[] = {
|
||||||
@@ -468,6 +476,7 @@ public :
|
|||||||
StrokeLineSegments( ctxRef , pts , 2 ) ;
|
StrokeLineSegments( ctxRef , pts , 2 ) ;
|
||||||
}
|
}
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
case wxVERTICAL_HATCH :
|
case wxVERTICAL_HATCH :
|
||||||
{
|
{
|
||||||
CGPoint pts[] = {
|
CGPoint pts[] = {
|
||||||
@@ -480,9 +489,8 @@ public :
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected :
|
protected :
|
||||||
~HatchPattern()
|
~HatchPattern() {}
|
||||||
{
|
|
||||||
}
|
|
||||||
int m_hatch ;
|
int m_hatch ;
|
||||||
CGRect m_imageBounds ;
|
CGRect m_imageBounds ;
|
||||||
} ;
|
} ;
|
||||||
@@ -508,6 +516,7 @@ void wxMacCGContext::SetPen( const wxPen &pen )
|
|||||||
{
|
{
|
||||||
m_mode = kCGPathFill ;
|
m_mode = kCGPathFill ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( stroke )
|
if ( stroke )
|
||||||
{
|
{
|
||||||
RGBColor col = MAC_WXCOLORREF( pen.GetColour().GetPixel() ) ;
|
RGBColor col = MAC_WXCOLORREF( pen.GetColour().GetPixel() ) ;
|
||||||
@@ -520,7 +529,7 @@ void wxMacCGContext::SetPen( const wxPen &pen )
|
|||||||
CGContextSetLineWidth( m_cgContext , penWidth ) ;
|
CGContextSetLineWidth( m_cgContext , penWidth ) ;
|
||||||
|
|
||||||
CGLineCap cap ;
|
CGLineCap cap ;
|
||||||
switch( pen.GetCap() )
|
switch ( pen.GetCap() )
|
||||||
{
|
{
|
||||||
case wxCAP_ROUND :
|
case wxCAP_ROUND :
|
||||||
cap = kCGLineCapRound ;
|
cap = kCGLineCapRound ;
|
||||||
@@ -537,7 +546,7 @@ void wxMacCGContext::SetPen( const wxPen &pen )
|
|||||||
}
|
}
|
||||||
|
|
||||||
CGLineJoin join ;
|
CGLineJoin join ;
|
||||||
switch( pen.GetJoin() )
|
switch ( pen.GetJoin() )
|
||||||
{
|
{
|
||||||
case wxJOIN_BEVEL :
|
case wxJOIN_BEVEL :
|
||||||
join = kCGLineJoinBevel ;
|
join = kCGLineJoinBevel ;
|
||||||
@@ -568,26 +577,31 @@ void wxMacCGContext::SetPen( const wxPen &pen )
|
|||||||
const float dotted_dashed[] = { 9.0 , 6.0 , 3.0 , 3.0 };
|
const float dotted_dashed[] = { 9.0 , 6.0 , 3.0 , 3.0 };
|
||||||
|
|
||||||
|
|
||||||
switch( pen.GetStyle() )
|
switch ( pen.GetStyle() )
|
||||||
{
|
{
|
||||||
case wxSOLID :
|
case wxSOLID :
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
case wxDOT :
|
case wxDOT :
|
||||||
lengths = dotted ;
|
lengths = dotted ;
|
||||||
count = WXSIZEOF(dotted);
|
count = WXSIZEOF(dotted);
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
case wxLONG_DASH :
|
case wxLONG_DASH :
|
||||||
lengths = dashed ;
|
lengths = dashed ;
|
||||||
count = WXSIZEOF(dashed) ;
|
count = WXSIZEOF(dashed) ;
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
case wxSHORT_DASH :
|
case wxSHORT_DASH :
|
||||||
lengths = short_dashed ;
|
lengths = short_dashed ;
|
||||||
count = WXSIZEOF(short_dashed) ;
|
count = WXSIZEOF(short_dashed) ;
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
case wxDOT_DASH :
|
case wxDOT_DASH :
|
||||||
lengths = dotted_dashed ;
|
lengths = dotted_dashed ;
|
||||||
count = WXSIZEOF(dotted_dashed);
|
count = WXSIZEOF(dotted_dashed);
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
case wxUSER_DASH :
|
case wxUSER_DASH :
|
||||||
wxDash *dashes ;
|
wxDash *dashes ;
|
||||||
count = pen.GetDashes( &dashes ) ;
|
count = pen.GetDashes( &dashes ) ;
|
||||||
@@ -606,6 +620,7 @@ void wxMacCGContext::SetPen( const wxPen &pen )
|
|||||||
}
|
}
|
||||||
lengths = userLengths ;
|
lengths = userLengths ;
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
case wxSTIPPLE :
|
case wxSTIPPLE :
|
||||||
{
|
{
|
||||||
float alphaArray[1] = { 1.0 } ;
|
float alphaArray[1] = { 1.0 } ;
|
||||||
@@ -619,6 +634,7 @@ void wxMacCGContext::SetPen( const wxPen &pen )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
default :
|
default :
|
||||||
{
|
{
|
||||||
wxMacCFRefHolder<CGColorSpaceRef> patternSpace( CGColorSpaceCreatePattern( wxMacGetGenericRGBColorSpace() ) ) ;
|
wxMacCFRefHolder<CGColorSpaceRef> patternSpace( CGColorSpaceCreatePattern( wxMacGetGenericRGBColorSpace() ) ) ;
|
||||||
@@ -643,10 +659,12 @@ void wxMacCGContext::SetPen( const wxPen &pen )
|
|||||||
{
|
{
|
||||||
CGContextSetLineDash( m_cgContext , 0 , NULL , 0 ) ;
|
CGContextSetLineDash( m_cgContext , 0 , NULL , 0 ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
CGContextSetLineCap( m_cgContext , cap ) ;
|
CGContextSetLineCap( m_cgContext , cap ) ;
|
||||||
|
|
||||||
delete[] userLengths ;
|
delete[] userLengths ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( fill && stroke )
|
if ( fill && stroke )
|
||||||
{
|
{
|
||||||
m_mode = kCGPathFillStroke ;
|
m_mode = kCGPathFillStroke ;
|
||||||
@@ -706,14 +724,12 @@ void wxMacCGContext::SetBrush( const wxBrush &brush )
|
|||||||
}
|
}
|
||||||
m_mode = kCGPathFill ;
|
m_mode = kCGPathFill ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( stroke )
|
if ( stroke )
|
||||||
{
|
|
||||||
m_mode = kCGPathStroke ;
|
m_mode = kCGPathStroke ;
|
||||||
}
|
|
||||||
if ( fill && stroke )
|
if ( fill && stroke )
|
||||||
{
|
|
||||||
m_mode = kCGPathFillStroke ;
|
m_mode = kCGPathFillStroke ;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -737,6 +753,7 @@ void AddRoundedRectToPath(CGContextRef c, CGRect rect, float ovalWidth,
|
|||||||
CGContextAddRect(c, rect);
|
CGContextAddRect(c, rect);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CGContextSaveGState(c);
|
CGContextSaveGState(c);
|
||||||
CGContextTranslateCTM(c, CGRectGetMinX(rect), CGRectGetMinY(rect));
|
CGContextTranslateCTM(c, CGRectGetMinX(rect), CGRectGetMinY(rect));
|
||||||
CGContextScaleCTM(c, ovalWidth, ovalHeight);
|
CGContextScaleCTM(c, ovalWidth, ovalHeight);
|
||||||
@@ -753,8 +770,8 @@ void AddRoundedRectToPath(CGContextRef c, CGRect rect, float ovalWidth,
|
|||||||
|
|
||||||
wxDC::wxDC()
|
wxDC::wxDC()
|
||||||
{
|
{
|
||||||
m_ok = FALSE;
|
m_ok = false;
|
||||||
m_colour = TRUE;
|
m_colour = true;
|
||||||
m_mm_to_pix_x = mm2pt;
|
m_mm_to_pix_x = mm2pt;
|
||||||
m_mm_to_pix_y = mm2pt;
|
m_mm_to_pix_y = mm2pt;
|
||||||
|
|
||||||
@@ -766,10 +783,10 @@ wxDC::wxDC()
|
|||||||
m_userScaleY = 1.0;
|
m_userScaleY = 1.0;
|
||||||
m_scaleX = 1.0;
|
m_scaleX = 1.0;
|
||||||
m_scaleY = 1.0;
|
m_scaleY = 1.0;
|
||||||
m_needComputeScaleX = FALSE;
|
m_needComputeScaleX = false;
|
||||||
m_needComputeScaleY = FALSE;
|
m_needComputeScaleY = false;
|
||||||
|
|
||||||
m_ok = FALSE ;
|
m_ok = false ;
|
||||||
m_macPort = 0 ;
|
m_macPort = 0 ;
|
||||||
m_macLocalOrigin.x = m_macLocalOrigin.y = 0 ;
|
m_macLocalOrigin.x = m_macLocalOrigin.y = 0 ;
|
||||||
|
|
||||||
@@ -782,9 +799,9 @@ wxDC::wxDC()
|
|||||||
m_graphicContext = NULL ;
|
m_graphicContext = NULL ;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxDC::~wxDC(void)
|
wxDC::~wxDC()
|
||||||
{
|
{
|
||||||
if( m_macATSUIStyle )
|
if ( m_macATSUIStyle )
|
||||||
{
|
{
|
||||||
::ATSUDisposeStyle((ATSUStyle)m_macATSUIStyle);
|
::ATSUDisposeStyle((ATSUStyle)m_macATSUIStyle);
|
||||||
m_macATSUIStyle = NULL ;
|
m_macATSUIStyle = NULL ;
|
||||||
@@ -848,7 +865,7 @@ void wxDC::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord hei
|
|||||||
|
|
||||||
// SetRectRgn( (RgnHandle) m_macCurrentClipRgn , xx , yy , xx + ww , yy + hh ) ;
|
// SetRectRgn( (RgnHandle) m_macCurrentClipRgn , xx , yy , xx + ww , yy + hh ) ;
|
||||||
// SectRgn( (RgnHandle) m_macCurrentClipRgn , (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) m_macCurrentClipRgn ) ;
|
// SectRgn( (RgnHandle) m_macCurrentClipRgn , (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) m_macCurrentClipRgn ) ;
|
||||||
if( m_clipping )
|
if ( m_clipping )
|
||||||
{
|
{
|
||||||
m_clipX1 = wxMax( m_clipX1 , xx );
|
m_clipX1 = wxMax( m_clipX1 , xx );
|
||||||
m_clipY1 = wxMax( m_clipY1 , yy );
|
m_clipY1 = wxMax( m_clipY1 , yy );
|
||||||
@@ -857,7 +874,7 @@ void wxDC::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord hei
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_clipping = TRUE;
|
m_clipping = true;
|
||||||
m_clipX1 = xx;
|
m_clipX1 = xx;
|
||||||
m_clipY1 = yy;
|
m_clipY1 = yy;
|
||||||
m_clipX2 = xx + ww;
|
m_clipX2 = xx + ww;
|
||||||
@@ -875,6 +892,7 @@ void wxDC::DoSetClippingRegionAsRegion( const wxRegion ®ion )
|
|||||||
DestroyClippingRegion();
|
DestroyClippingRegion();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxCoord x, y, w, h;
|
wxCoord x, y, w, h;
|
||||||
region.GetBox( x, y, w, h );
|
region.GetBox( x, y, w, h );
|
||||||
wxCoord xx, yy, ww, hh;
|
wxCoord xx, yy, ww, hh;
|
||||||
@@ -898,7 +916,7 @@ void wxDC::DoSetClippingRegionAsRegion( const wxRegion ®ion )
|
|||||||
}
|
}
|
||||||
SectRgn( (RgnHandle) m_macCurrentClipRgn , (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) m_macCurrentClipRgn ) ;
|
SectRgn( (RgnHandle) m_macCurrentClipRgn , (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) m_macCurrentClipRgn ) ;
|
||||||
*/
|
*/
|
||||||
if( m_clipping )
|
if ( m_clipping )
|
||||||
{
|
{
|
||||||
m_clipX1 = wxMax( m_clipX1 , xx );
|
m_clipX1 = wxMax( m_clipX1 , xx );
|
||||||
m_clipY1 = wxMax( m_clipY1 , yy );
|
m_clipY1 = wxMax( m_clipY1 , yy );
|
||||||
@@ -907,7 +925,7 @@ void wxDC::DoSetClippingRegionAsRegion( const wxRegion ®ion )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_clipping = TRUE;
|
m_clipping = true;
|
||||||
m_clipX1 = xx;
|
m_clipX1 = xx;
|
||||||
m_clipY1 = yy;
|
m_clipY1 = yy;
|
||||||
m_clipX2 = xx + ww;
|
m_clipX2 = xx + ww;
|
||||||
@@ -924,7 +942,7 @@ void wxDC::DestroyClippingRegion()
|
|||||||
CGContextSaveGState( cgContext );
|
CGContextSaveGState( cgContext );
|
||||||
m_graphicContext->SetPen( m_pen ) ;
|
m_graphicContext->SetPen( m_pen ) ;
|
||||||
m_graphicContext->SetBrush( m_brush ) ;
|
m_graphicContext->SetBrush( m_brush ) ;
|
||||||
m_clipping = FALSE;
|
m_clipping = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDC::DoGetSizeMM( int* width, int* height ) const
|
void wxDC::DoGetSizeMM( int* width, int* height ) const
|
||||||
@@ -959,24 +977,29 @@ void wxDC::SetMapMode( int mode )
|
|||||||
case wxMM_TWIPS:
|
case wxMM_TWIPS:
|
||||||
SetLogicalScale( twips2mm*m_mm_to_pix_x, twips2mm*m_mm_to_pix_y );
|
SetLogicalScale( twips2mm*m_mm_to_pix_x, twips2mm*m_mm_to_pix_y );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case wxMM_POINTS:
|
case wxMM_POINTS:
|
||||||
SetLogicalScale( pt2mm*m_mm_to_pix_x, pt2mm*m_mm_to_pix_y );
|
SetLogicalScale( pt2mm*m_mm_to_pix_x, pt2mm*m_mm_to_pix_y );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case wxMM_METRIC:
|
case wxMM_METRIC:
|
||||||
SetLogicalScale( m_mm_to_pix_x, m_mm_to_pix_y );
|
SetLogicalScale( m_mm_to_pix_x, m_mm_to_pix_y );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case wxMM_LOMETRIC:
|
case wxMM_LOMETRIC:
|
||||||
SetLogicalScale( m_mm_to_pix_x/10.0, m_mm_to_pix_y/10.0 );
|
SetLogicalScale( m_mm_to_pix_x/10.0, m_mm_to_pix_y/10.0 );
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
case wxMM_TEXT:
|
case wxMM_TEXT:
|
||||||
|
default:
|
||||||
SetLogicalScale( 1.0, 1.0 );
|
SetLogicalScale( 1.0, 1.0 );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode != wxMM_TEXT)
|
if (mode != wxMM_TEXT)
|
||||||
{
|
{
|
||||||
m_needComputeScaleX = TRUE;
|
m_needComputeScaleX =
|
||||||
m_needComputeScaleY = TRUE;
|
m_needComputeScaleY = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1036,12 +1059,14 @@ void wxDC::ComputeScaleAndOrigin()
|
|||||||
m_scaleY = m_logicalScaleY * m_userScaleY;
|
m_scaleY = m_logicalScaleY * m_userScaleY;
|
||||||
m_deviceOriginX = m_externalDeviceOriginX;
|
m_deviceOriginX = m_externalDeviceOriginX;
|
||||||
m_deviceOriginY = m_externalDeviceOriginY;
|
m_deviceOriginY = m_externalDeviceOriginY;
|
||||||
|
|
||||||
// CMB: if scale has changed call SetPen to recalulate the line width
|
// CMB: if scale has changed call SetPen to recalulate the line width
|
||||||
if (m_scaleX != origScaleX || m_scaleY != origScaleY)
|
if (m_scaleX != origScaleX || m_scaleY != origScaleY)
|
||||||
{
|
{
|
||||||
// this is a bit artificial, but we need to force wxDC to think
|
// this is a bit artificial, but we need to force wxDC to think
|
||||||
// the pen has changed
|
// the pen has changed
|
||||||
wxPen pen(GetPen());
|
wxPen pen(GetPen());
|
||||||
|
|
||||||
m_pen = wxNullPen;
|
m_pen = wxNullPen;
|
||||||
SetPen(pen);
|
SetPen(pen);
|
||||||
}
|
}
|
||||||
@@ -1066,6 +1091,7 @@ void wxDC::SetPen( const wxPen &pen )
|
|||||||
{
|
{
|
||||||
if ( m_pen == pen )
|
if ( m_pen == pen )
|
||||||
return ;
|
return ;
|
||||||
|
|
||||||
m_pen = pen;
|
m_pen = pen;
|
||||||
if ( m_graphicContext )
|
if ( m_graphicContext )
|
||||||
{
|
{
|
||||||
@@ -1091,6 +1117,7 @@ void wxDC::SetBrush( const wxBrush &brush )
|
|||||||
{
|
{
|
||||||
if (m_brush == brush)
|
if (m_brush == brush)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_brush = brush;
|
m_brush = brush;
|
||||||
if ( m_graphicContext )
|
if ( m_graphicContext )
|
||||||
{
|
{
|
||||||
@@ -1116,6 +1143,7 @@ void wxDC::SetBackground( const wxBrush &brush )
|
|||||||
{
|
{
|
||||||
if (m_backgroundBrush == brush)
|
if (m_backgroundBrush == brush)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_backgroundBrush = brush;
|
m_backgroundBrush = brush;
|
||||||
if (!m_backgroundBrush.Ok())
|
if (!m_backgroundBrush.Ok())
|
||||||
return;
|
return;
|
||||||
@@ -1125,6 +1153,7 @@ void wxDC::SetLogicalFunction( int function )
|
|||||||
{
|
{
|
||||||
if (m_logicalFunction == function)
|
if (m_logicalFunction == function)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_logicalFunction = function ;
|
m_logicalFunction = function ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1150,6 +1179,7 @@ bool wxDC::DoGetPixel( wxCoord x, wxCoord y, wxColour *col ) const
|
|||||||
col->Set( colour.red >> 8,
|
col->Set( colour.red >> 8,
|
||||||
colour.green >> 8,
|
colour.green >> 8,
|
||||||
colour.blue >> 8);
|
colour.blue >> 8);
|
||||||
|
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1316,6 +1346,7 @@ void wxDC::DoDrawLines(int n, wxPoint points[],
|
|||||||
|
|
||||||
path->AddLineToPoint( x2 , y2 ) ;
|
path->AddLineToPoint( x2 , y2 ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_graphicContext->StrokePath( path ) ;
|
m_graphicContext->StrokePath( path ) ;
|
||||||
delete path ;
|
delete path ;
|
||||||
}
|
}
|
||||||
@@ -1403,10 +1434,10 @@ void wxDC::DoDrawPolygon(int n, wxPoint points[],
|
|||||||
|
|
||||||
path->AddLineToPoint( x2 , y2 ) ;
|
path->AddLineToPoint( x2 , y2 ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( x1 != x2 || y1 != y2 )
|
if ( x1 != x2 || y1 != y2 )
|
||||||
{
|
|
||||||
path->AddLineToPoint( x1,y1 ) ;
|
path->AddLineToPoint( x1,y1 ) ;
|
||||||
}
|
|
||||||
path->CloseSubpath() ;
|
path->CloseSubpath() ;
|
||||||
m_graphicContext->DrawPath( path , fillStyle ) ;
|
m_graphicContext->DrawPath( path , fillStyle ) ;
|
||||||
delete path ;
|
delete path ;
|
||||||
@@ -1426,6 +1457,7 @@ void wxDC::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
|
|||||||
// CMB: draw nothing if transformed w or h is 0
|
// CMB: draw nothing if transformed w or h is 0
|
||||||
if (ww == 0 || hh == 0)
|
if (ww == 0 || hh == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// CMB: handle -ve width and/or height
|
// CMB: handle -ve width and/or height
|
||||||
if (ww < 0)
|
if (ww < 0)
|
||||||
{
|
{
|
||||||
@@ -1437,6 +1469,7 @@ void wxDC::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
|
|||||||
hh = -hh;
|
hh = -hh;
|
||||||
yy = yy - hh;
|
yy = yy - hh;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxGraphicPath* path = m_graphicContext->CreatePath() ;
|
wxGraphicPath* path = m_graphicContext->CreatePath() ;
|
||||||
path->AddRectangle( xx , yy , ww , hh ) ;
|
path->AddRectangle( xx , yy , ww , hh ) ;
|
||||||
m_graphicContext->DrawPath( path ) ;
|
m_graphicContext->DrawPath( path ) ;
|
||||||
@@ -1452,7 +1485,6 @@ void wxDC::DoDrawRoundedRectangle(wxCoord x, wxCoord y,
|
|||||||
if ( m_logicalFunction != wxCOPY )
|
if ( m_logicalFunction != wxCOPY )
|
||||||
return ;
|
return ;
|
||||||
|
|
||||||
|
|
||||||
if (radius < 0.0)
|
if (radius < 0.0)
|
||||||
radius = - radius * ((width < height) ? width : height);
|
radius = - radius * ((width < height) ? width : height);
|
||||||
wxCoord xx = XLOG2DEVMAC(x);
|
wxCoord xx = XLOG2DEVMAC(x);
|
||||||
@@ -1462,6 +1494,7 @@ void wxDC::DoDrawRoundedRectangle(wxCoord x, wxCoord y,
|
|||||||
// CMB: draw nothing if transformed w or h is 0
|
// CMB: draw nothing if transformed w or h is 0
|
||||||
if (ww == 0 || hh == 0)
|
if (ww == 0 || hh == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// CMB: handle -ve width and/or height
|
// CMB: handle -ve width and/or height
|
||||||
if (ww < 0)
|
if (ww < 0)
|
||||||
{
|
{
|
||||||
@@ -1473,6 +1506,7 @@ void wxDC::DoDrawRoundedRectangle(wxCoord x, wxCoord y,
|
|||||||
hh = -hh;
|
hh = -hh;
|
||||||
yy = yy - hh;
|
yy = yy - hh;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMacCGContext* mctx = ((wxMacCGContext*) m_graphicContext) ;
|
wxMacCGContext* mctx = ((wxMacCGContext*) m_graphicContext) ;
|
||||||
CGContextRef ctx = mctx->GetNativeContext() ;
|
CGContextRef ctx = mctx->GetNativeContext() ;
|
||||||
AddRoundedRectToPath( ctx , CGRectMake( xx , yy , ww , hh ) , 16 ,16 ) ;
|
AddRoundedRectToPath( ctx , CGRectMake( xx , yy , ww , hh ) , 16 ,16 ) ;
|
||||||
@@ -1493,6 +1527,7 @@ void wxDC::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
|
|||||||
// CMB: draw nothing if transformed w or h is 0
|
// CMB: draw nothing if transformed w or h is 0
|
||||||
if (ww == 0 || hh == 0)
|
if (ww == 0 || hh == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// CMB: handle -ve width and/or height
|
// CMB: handle -ve width and/or height
|
||||||
if (ww < 0)
|
if (ww < 0)
|
||||||
{
|
{
|
||||||
@@ -1527,10 +1562,12 @@ bool wxDC::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
|
|||||||
wxCHECK_MSG(Ok(), false, wxT("wxDC::DoBlit Illegal dc"));
|
wxCHECK_MSG(Ok(), false, wxT("wxDC::DoBlit Illegal dc"));
|
||||||
wxCHECK_MSG(source->Ok(), false, wxT("wxDC::DoBlit Illegal source DC"));
|
wxCHECK_MSG(source->Ok(), false, wxT("wxDC::DoBlit Illegal source DC"));
|
||||||
if ( logical_func == wxNO_OP )
|
if ( logical_func == wxNO_OP )
|
||||||
return TRUE ;
|
return true ;
|
||||||
|
|
||||||
if (xsrcMask == -1 && ysrcMask == -1)
|
if (xsrcMask == -1 && ysrcMask == -1)
|
||||||
{
|
{
|
||||||
xsrcMask = xsrc; ysrcMask = ysrc;
|
xsrcMask = xsrc;
|
||||||
|
ysrcMask = ysrc;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxCoord yysrc = source->YLOG2DEVMAC(ysrc) ;
|
wxCoord yysrc = source->YLOG2DEVMAC(ysrc) ;
|
||||||
@@ -1575,6 +1612,7 @@ bool wxDC::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
|
|||||||
blit = wxNullBitmap ;
|
blit = wxNullBitmap ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( blit.Ok() )
|
if ( blit.Ok() )
|
||||||
{
|
{
|
||||||
CGContextRef cg = ((wxMacCGContext*)(m_graphicContext))->GetNativeContext() ;
|
CGContextRef cg = ((wxMacCGContext*)(m_graphicContext))->GetNativeContext() ;
|
||||||
@@ -1583,7 +1621,6 @@ bool wxDC::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
|
|||||||
HIViewDrawCGImage( cg , &r , image ) ;
|
HIViewDrawCGImage( cg , &r , image ) ;
|
||||||
CGImageRelease( image ) ;
|
CGImageRelease( image ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1591,9 +1628,10 @@ bool wxDC::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
|
|||||||
CGContextRef cg = (wxMacCGContext*)(source->GetGraphicContext())->GetNativeContext() ;
|
CGContextRef cg = (wxMacCGContext*)(source->GetGraphicContext())->GetNativeContext() ;
|
||||||
void *data = CGBitmapContextGetData( cg ) ;
|
void *data = CGBitmapContextGetData( cg ) ;
|
||||||
*/
|
*/
|
||||||
return FALSE ; // wxFAIL_MSG( wxT("Blitting is only supported from bitmap contexts") ) ;
|
return false ; // wxFAIL_MSG( wxT("Blitting is only supported from bitmap contexts") ) ;
|
||||||
}
|
}
|
||||||
return TRUE;
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDC::DoDrawRotatedText(const wxString& str, wxCoord x, wxCoord y,
|
void wxDC::DoDrawRotatedText(const wxString& str, wxCoord x, wxCoord y,
|
||||||
@@ -1603,7 +1641,6 @@ void wxDC::DoDrawRotatedText(const wxString& str, wxCoord x, wxCoord y,
|
|||||||
|
|
||||||
if ( str.Length() == 0 )
|
if ( str.Length() == 0 )
|
||||||
return ;
|
return ;
|
||||||
|
|
||||||
if ( m_logicalFunction != wxCOPY )
|
if ( m_logicalFunction != wxCOPY )
|
||||||
return ;
|
return ;
|
||||||
|
|
||||||
@@ -1734,6 +1771,7 @@ void wxDC::DoDrawRotatedText(const wxString& str, wxCoord x, wxCoord y,
|
|||||||
CalcBoundingBox(XDEV2LOG(rect.right), YDEV2LOG(rect.bottom) );
|
CalcBoundingBox(XDEV2LOG(rect.right), YDEV2LOG(rect.bottom) );
|
||||||
|
|
||||||
::ATSUDisposeTextLayout(atsuLayout);
|
::ATSUDisposeTextLayout(atsuLayout);
|
||||||
|
|
||||||
#if SIZEOF_WCHAR_T == 4
|
#if SIZEOF_WCHAR_T == 4
|
||||||
free( ubuf ) ;
|
free( ubuf ) ;
|
||||||
#endif
|
#endif
|
||||||
@@ -1796,7 +1834,6 @@ void wxDC::DoGetTextExtent( const wxString &str, wxCoord *width, wxCoord *heigh
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
status = ::ATSUCreateTextLayoutWithTextPtr( (UniCharArrayPtr) ubuf , 0 , chars , chars , 1 ,
|
status = ::ATSUCreateTextLayoutWithTextPtr( (UniCharArrayPtr) ubuf , 0 , chars , chars , 1 ,
|
||||||
&chars , (ATSUStyle*) &m_macATSUIStyle , &atsuLayout ) ;
|
&chars , (ATSUStyle*) &m_macATSUIStyle , &atsuLayout ) ;
|
||||||
|
|
||||||
@@ -1831,7 +1868,6 @@ void wxDC::DoGetTextExtent( const wxString &str, wxCoord *width, wxCoord *heigh
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool wxDC::DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const
|
bool wxDC::DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG(Ok(), false, wxT("Invalid DC"));
|
wxCHECK_MSG(Ok(), false, wxT("Invalid DC"));
|
||||||
@@ -1868,26 +1904,26 @@ bool wxDC::DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) con
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
OSStatus status;
|
OSStatus status;
|
||||||
status = ::ATSUCreateTextLayoutWithTextPtr( (UniCharArrayPtr) ubuf , 0 , chars , chars , 1 ,
|
status = ::ATSUCreateTextLayoutWithTextPtr( (UniCharArrayPtr) ubuf , 0 , chars , chars , 1 ,
|
||||||
&chars , (ATSUStyle*) &m_macATSUIStyle , &atsuLayout ) ;
|
&chars , (ATSUStyle*) &m_macATSUIStyle , &atsuLayout ) ;
|
||||||
|
|
||||||
for ( int pos = 0; pos < (int)chars; pos ++ ) {
|
for ( int pos = 0; pos < (int)chars; pos ++ )
|
||||||
unsigned long actualNumberOfBounds = 0;
|
{
|
||||||
ATSTrapezoid glyphBounds;
|
unsigned long actualNumberOfBounds = 0;
|
||||||
|
ATSTrapezoid glyphBounds;
|
||||||
|
|
||||||
// We get a single bound, since the text should only require one. If it requires more, there is an issue
|
// We get a single bound, since the text should only require one. If it requires more, there is an issue
|
||||||
OSStatus result;
|
OSStatus result;
|
||||||
result = ATSUGetGlyphBounds( atsuLayout, 0, 0, kATSUFromTextBeginning, pos + 1, kATSUseDeviceOrigins, 1, &glyphBounds, &actualNumberOfBounds );
|
result = ATSUGetGlyphBounds( atsuLayout, 0, 0, kATSUFromTextBeginning, pos + 1,
|
||||||
if (result != noErr || actualNumberOfBounds != 1 )
|
kATSUseDeviceOrigins, 1, &glyphBounds, &actualNumberOfBounds );
|
||||||
{
|
if (result != noErr || actualNumberOfBounds != 1 )
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
widths[pos] = XDEV2LOGREL(FixedToInt( glyphBounds.upperRight.x - glyphBounds.upperLeft.x ));
|
||||||
|
//unsigned char uch = s[i];
|
||||||
|
}
|
||||||
|
|
||||||
widths[pos] = XDEV2LOGREL(FixedToInt( glyphBounds.upperRight.x - glyphBounds.upperLeft.x ));
|
|
||||||
//unsigned char uch = s[i];
|
|
||||||
|
|
||||||
}
|
|
||||||
::ATSUDisposeTextLayout(atsuLayout);
|
::ATSUDisposeTextLayout(atsuLayout);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1928,18 +1964,19 @@ void wxDC::Clear(void)
|
|||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
RGBColor color;
|
RGBColor color;
|
||||||
GetThemeBrushAsColor( m_backgroundBrush.MacGetTheme(), 32, true, &color );
|
GetThemeBrushAsColor( m_backgroundBrush.MacGetTheme(), 32, true, &color );
|
||||||
CGContextSetRGBFillColor( cg, (float) color.red / 65536,
|
CGContextSetRGBFillColor( cg, (float) color.red / 65536,
|
||||||
(float) color.green / 65536, (float) color.blue / 65536, 1 );
|
(float) color.green / 65536, (float) color.blue / 65536, 1 );
|
||||||
CGContextFillRect( cg, rect );
|
CGContextFillRect( cg, rect );
|
||||||
}
|
}
|
||||||
|
|
||||||
// reset to normal value
|
// reset to normal value
|
||||||
RGBColor col = MAC_WXCOLORREF( GetBrush().GetColour().GetPixel() ) ;
|
RGBColor col = MAC_WXCOLORREF( GetBrush().GetColour().GetPixel() ) ;
|
||||||
CGContextSetRGBFillColor( cg, col.red / 65536.0, col.green / 65536.0, col.blue / 65536.0, 1.0 );
|
CGContextSetRGBFillColor( cg, col.red / 65536.0, col.green / 65536.0, col.blue / 65536.0, 1.0 );
|
||||||
}
|
}
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
case kwxMacBrushThemeBackground :
|
case kwxMacBrushThemeBackground :
|
||||||
{
|
{
|
||||||
wxFAIL_MSG( wxT("There shouldn't be theme backgrounds under Quartz") ) ;
|
wxFAIL_MSG( wxT("There shouldn't be theme backgrounds under Quartz") ) ;
|
||||||
@@ -1956,23 +1993,24 @@ void wxDC::Clear(void)
|
|||||||
HIThemeApplyBackground( &rect , &drawInfo, cg ,
|
HIThemeApplyBackground( &rect , &drawInfo, cg ,
|
||||||
kHIThemeOrientationNormal) ;
|
kHIThemeOrientationNormal) ;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
#endif
|
#endif
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break ;
|
break ;
|
||||||
case kwxMacBrushColour :
|
|
||||||
{
|
|
||||||
RGBColor col = MAC_WXCOLORREF( m_backgroundBrush.GetColour().GetPixel()) ;
|
|
||||||
CGContextSetRGBFillColor( cg , col.red / 65536.0 , col.green / 65536.0 , col.blue / 65536.0 , 1.0 ) ;
|
|
||||||
CGContextFillRect(cg, rect);
|
|
||||||
|
|
||||||
// reset to normal value
|
case kwxMacBrushColour :
|
||||||
col = MAC_WXCOLORREF( GetBrush().GetColour().GetPixel() ) ;
|
{
|
||||||
CGContextSetRGBFillColor( cg , col.red / 65536.0 , col.green / 65536.0 , col.blue / 65536.0 , 1.0 ) ;
|
RGBColor col = MAC_WXCOLORREF( m_backgroundBrush.GetColour().GetPixel()) ;
|
||||||
}
|
CGContextSetRGBFillColor( cg , col.red / 65536.0 , col.green / 65536.0 , col.blue / 65536.0 , 1.0 ) ;
|
||||||
break ;
|
CGContextFillRect(cg, rect);
|
||||||
|
|
||||||
|
// reset to normal value
|
||||||
|
col = MAC_WXCOLORREF( GetBrush().GetColour().GetPixel() ) ;
|
||||||
|
CGContextSetRGBFillColor( cg , col.red / 65536.0 , col.green / 65536.0 , col.blue / 65536.0 , 1.0 ) ;
|
||||||
|
}
|
||||||
|
break ;
|
||||||
|
|
||||||
|
default
|
||||||
|
break ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1981,7 +2019,7 @@ void wxDC::MacInstallFont() const
|
|||||||
{
|
{
|
||||||
wxCHECK_RET(Ok(), wxT("Invalid DC"));
|
wxCHECK_RET(Ok(), wxT("Invalid DC"));
|
||||||
|
|
||||||
if( m_macATSUIStyle )
|
if ( m_macATSUIStyle )
|
||||||
{
|
{
|
||||||
::ATSUDisposeStyle((ATSUStyle)m_macATSUIStyle);
|
::ATSUDisposeStyle((ATSUStyle)m_macATSUIStyle);
|
||||||
m_macATSUIStyle = NULL ;
|
m_macATSUIStyle = NULL ;
|
||||||
|
@@ -246,9 +246,7 @@ bool wxToolBar::Create(wxWindow *parent,
|
|||||||
LRESULT style = ::SendMessage(GetHwnd(), TB_GETSTYLE, 0, 0L);
|
LRESULT style = ::SendMessage(GetHwnd(), TB_GETSTYLE, 0, 0L);
|
||||||
|
|
||||||
if ( !(style & TBSTYLE_FLAT) )
|
if ( !(style & TBSTYLE_FLAT) )
|
||||||
{
|
|
||||||
::SendMessage(GetHwnd(), TB_SETSTYLE, 0, style | TBSTYLE_FLAT);
|
::SendMessage(GetHwnd(), TB_SETSTYLE, 0, style | TBSTYLE_FLAT);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif // wxUSE_UXTHEME
|
#endif // wxUSE_UXTHEME
|
||||||
|
|
||||||
@@ -362,6 +360,7 @@ wxSize wxToolBar::DoGetBestSize() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
CacheBestSize(sizeBest);
|
CacheBestSize(sizeBest);
|
||||||
|
|
||||||
return sizeBest;
|
return sizeBest;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -374,8 +373,8 @@ WXDWORD wxToolBar::MSWGetStyle(long style, WXDWORD *exstyle) const
|
|||||||
(style & ~wxBORDER_MASK) | wxBORDER_NONE, exstyle
|
(style & ~wxBORDER_MASK) | wxBORDER_NONE, exstyle
|
||||||
);
|
);
|
||||||
|
|
||||||
// always include this one, it never hurts and setting it later only if we
|
// always include this one, it never hurts and setting it later
|
||||||
// do have tooltips wouldn't work
|
// only if we do have tooltips wouldn't work
|
||||||
msStyle |= TBSTYLE_TOOLTIPS;
|
msStyle |= TBSTYLE_TOOLTIPS;
|
||||||
|
|
||||||
if ( style & (wxTB_FLAT | wxTB_HORZ_LAYOUT) )
|
if ( style & (wxTB_FLAT | wxTB_HORZ_LAYOUT) )
|
||||||
@@ -460,7 +459,6 @@ bool wxToolBar::DoDeleteTool(size_t pos, wxToolBarToolBase *tool)
|
|||||||
if ( tool->IsControl() )
|
if ( tool->IsControl() )
|
||||||
{
|
{
|
||||||
nButtonsToDelete = ((wxToolBarTool *)tool)->GetSeparatorsCount();
|
nButtonsToDelete = ((wxToolBarTool *)tool)->GetSeparatorsCount();
|
||||||
|
|
||||||
width *= nButtonsToDelete;
|
width *= nButtonsToDelete;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -493,6 +491,7 @@ bool wxToolBar::DoDeleteTool(size_t pos, wxToolBarToolBase *tool)
|
|||||||
}
|
}
|
||||||
|
|
||||||
InvalidateBestSize();
|
InvalidateBestSize();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -535,10 +534,8 @@ bool wxToolBar::Realize()
|
|||||||
{
|
{
|
||||||
const size_t nTools = GetToolsCount();
|
const size_t nTools = GetToolsCount();
|
||||||
if ( nTools == 0 )
|
if ( nTools == 0 )
|
||||||
{
|
|
||||||
// nothing to do
|
// nothing to do
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
|
|
||||||
const bool isVertical = HasFlag(wxTB_VERTICAL);
|
const bool isVertical = HasFlag(wxTB_VERTICAL);
|
||||||
|
|
||||||
@@ -831,9 +828,7 @@ bool wxToolBar::Realize()
|
|||||||
{
|
{
|
||||||
const wxString& label = tool->GetLabel();
|
const wxString& label = tool->GetLabel();
|
||||||
if ( !label.empty() )
|
if ( !label.empty() )
|
||||||
{
|
|
||||||
button.iString = (int)label.c_str();
|
button.iString = (int)label.c_str();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
button.idCommand = tool->GetId();
|
button.idCommand = tool->GetId();
|
||||||
@@ -887,12 +882,14 @@ bool wxToolBar::Realize()
|
|||||||
button.fsStyle = TBSTYLE_CHECK;
|
button.fsStyle = TBSTYLE_CHECK;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
|
||||||
wxFAIL_MSG( _T("unexpected toolbar button kind") );
|
|
||||||
// fall through
|
|
||||||
|
|
||||||
case wxITEM_NORMAL:
|
case wxITEM_NORMAL:
|
||||||
button.fsStyle = TBSTYLE_BUTTON;
|
button.fsStyle = TBSTYLE_BUTTON;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
wxFAIL_MSG( _T("unexpected toolbar button kind") );
|
||||||
|
button.fsStyle = TBSTYLE_BUTTON;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
bitmapId++;
|
bitmapId++;
|
||||||
@@ -1021,7 +1018,7 @@ bool wxToolBar::Realize()
|
|||||||
left = 0;
|
left = 0;
|
||||||
top = y;
|
top = y;
|
||||||
|
|
||||||
y += height + 2*GetMargins().y;
|
y += height + 2 * GetMargins().y;
|
||||||
}
|
}
|
||||||
else // horizontal toolbar
|
else // horizontal toolbar
|
||||||
{
|
{
|
||||||
@@ -1041,18 +1038,14 @@ bool wxToolBar::Realize()
|
|||||||
if ( !isVertical )
|
if ( !isVertical )
|
||||||
{
|
{
|
||||||
if ( m_maxRows == 0 )
|
if ( m_maxRows == 0 )
|
||||||
{
|
|
||||||
// if not set yet, only one row
|
// if not set yet, only one row
|
||||||
SetRows(1);
|
SetRows(1);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if ( m_nButtons > 0 ) // vertical non empty toolbar
|
else if ( m_nButtons > 0 ) // vertical non empty toolbar
|
||||||
{
|
{
|
||||||
if ( m_maxRows == 0 )
|
if ( m_maxRows == 0 )
|
||||||
{
|
|
||||||
// if not set yet, have one column
|
// if not set yet, have one column
|
||||||
SetRows(m_nButtons);
|
SetRows(m_nButtons);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
InvalidateBestSize();
|
InvalidateBestSize();
|
||||||
@@ -1214,13 +1207,12 @@ wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord x, wxCoord y) const
|
|||||||
pt.x = x;
|
pt.x = x;
|
||||||
pt.y = y;
|
pt.y = y;
|
||||||
int index = (int)::SendMessage(GetHwnd(), TB_HITTEST, 0, (LPARAM)&pt);
|
int index = (int)::SendMessage(GetHwnd(), TB_HITTEST, 0, (LPARAM)&pt);
|
||||||
|
|
||||||
// MBN: when the point ( x, y ) is close to the toolbar border
|
// MBN: when the point ( x, y ) is close to the toolbar border
|
||||||
// TB_HITTEST returns m_nButtons ( not -1 )
|
// TB_HITTEST returns m_nButtons ( not -1 )
|
||||||
if ( index < 0 || (size_t)index >= m_nButtons )
|
if ( index < 0 || (size_t)index >= m_nButtons )
|
||||||
{
|
|
||||||
// it's a separator or there is no tool at all there
|
// it's a separator or there is no tool at all there
|
||||||
return (wxToolBarToolBase *)NULL;
|
return (wxToolBarToolBase *)NULL;
|
||||||
}
|
|
||||||
|
|
||||||
// when TB_SETBUTTONINFO is available (both during compile- and run-time),
|
// when TB_SETBUTTONINFO is available (both during compile- and run-time),
|
||||||
// we don't use the dummy separators hack
|
// we don't use the dummy separators hack
|
||||||
@@ -1244,9 +1236,7 @@ void wxToolBar::UpdateSize()
|
|||||||
// we must also refresh the frame after the toolbar size (possibly) changed
|
// we must also refresh the frame after the toolbar size (possibly) changed
|
||||||
wxFrame *frame = wxDynamicCast(GetParent(), wxFrame);
|
wxFrame *frame = wxDynamicCast(GetParent(), wxFrame);
|
||||||
if ( frame )
|
if ( frame )
|
||||||
{
|
|
||||||
frame->SendSizeEvent();
|
frame->SendSizeEvent();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -1427,10 +1417,10 @@ bool wxToolBar::HandleSize(WXWPARAM WXUNUSED(wParam), WXLPARAM lParam)
|
|||||||
|
|
||||||
bool wxToolBar::HandlePaint(WXWPARAM wParam, WXLPARAM lParam)
|
bool wxToolBar::HandlePaint(WXWPARAM wParam, WXLPARAM lParam)
|
||||||
{
|
{
|
||||||
// erase any dummy separators which we used for aligning the controls if
|
// erase any dummy separators which were used
|
||||||
// any here
|
// for aligning the controls if any here
|
||||||
|
|
||||||
// first of all, do we have any controls at all?
|
// first of all, are there any controls at all?
|
||||||
wxToolBarToolsList::compatibility_iterator node;
|
wxToolBarToolsList::compatibility_iterator node;
|
||||||
for ( node = m_tools.GetFirst(); node; node = node->GetNext() )
|
for ( node = m_tools.GetFirst(); node; node = node->GetNext() )
|
||||||
{
|
{
|
||||||
@@ -1439,10 +1429,8 @@ bool wxToolBar::HandlePaint(WXWPARAM wParam, WXLPARAM lParam)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( !node )
|
if ( !node )
|
||||||
{
|
|
||||||
// no controls, nothing to erase
|
// no controls, nothing to erase
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
// prepare the DC on which we'll be drawing
|
// prepare the DC on which we'll be drawing
|
||||||
wxClientDC dc(this);
|
wxClientDC dc(this);
|
||||||
@@ -1451,10 +1439,8 @@ bool wxToolBar::HandlePaint(WXWPARAM wParam, WXLPARAM lParam)
|
|||||||
|
|
||||||
RECT r;
|
RECT r;
|
||||||
if ( !::GetUpdateRect(GetHwnd(), &r, FALSE) )
|
if ( !::GetUpdateRect(GetHwnd(), &r, FALSE) )
|
||||||
{
|
|
||||||
// nothing to redraw anyhow
|
// nothing to redraw anyhow
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
wxRect rectUpdate;
|
wxRect rectUpdate;
|
||||||
wxCopyRECTToRect(r, rectUpdate);
|
wxCopyRECTToRect(r, rectUpdate);
|
||||||
@@ -1532,14 +1518,14 @@ void wxToolBar::HandleMouseMove(WXWPARAM WXUNUSED(wParam), WXLPARAM lParam)
|
|||||||
wxToolBarToolBase* tool = FindToolForPosition( x, y );
|
wxToolBarToolBase* tool = FindToolForPosition( x, y );
|
||||||
|
|
||||||
// cursor left current tool
|
// cursor left current tool
|
||||||
if( tool != m_pInTool && !tool )
|
if ( tool != m_pInTool && !tool )
|
||||||
{
|
{
|
||||||
m_pInTool = 0;
|
m_pInTool = 0;
|
||||||
OnMouseEnter( -1 );
|
OnMouseEnter( -1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
// cursor entered a tool
|
// cursor entered a tool
|
||||||
if( tool != m_pInTool && tool )
|
if ( tool != m_pInTool && tool )
|
||||||
{
|
{
|
||||||
m_pInTool = tool;
|
m_pInTool = tool;
|
||||||
OnMouseEnter( tool->GetId() );
|
OnMouseEnter( tool->GetId() );
|
||||||
@@ -1566,6 +1552,9 @@ WXLRESULT wxToolBar::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam
|
|||||||
if ( HandlePaint(wParam, lParam) )
|
if ( HandlePaint(wParam, lParam) )
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return wxControl::MSWWindowProc(nMsg, wParam, lParam);
|
return wxControl::MSWWindowProc(nMsg, wParam, lParam);
|
||||||
@@ -1681,5 +1670,5 @@ WXHBITMAP wxToolBar::MapBitmap(WXHBITMAP bitmap, int width, int height)
|
|||||||
#endif // 0
|
#endif // 0
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // wxUSE_TOOLBAR && Win95
|
#endif // wxUSE_TOOLBAR
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user