TextSize( size );
TextFace( style );
TextMode( mode );
- SetOrigin( 0 , 0 ) ;
SetPort( port ) ;
}
}
#else
SetPort( (window) ) ;
#endif
- SetOrigin( 0 , 0 ) ;
LocalToGlobal( &pt ) ;
SetPort( port ) ;
win->SetSize( pt.h , pt.v , -1 ,
#else
SetPort( (window) ) ;
#endif
- SetOrigin( 0 , 0 ) ;
SetPort( port ) ;
}
if ( window != frontWindow && wxTheApp->s_captureWindow == NULL )
wxBrushRefData::wxBrushRefData()
{
m_style = wxSOLID;
- m_isMacTheme = false ;
- m_isMacThemeBackground = false ;
+ m_macBrushKind = kwxMacBrushColour ;
}
wxBrushRefData::wxBrushRefData(const wxBrushRefData& data)
m_style = data.m_style;
m_stipple = data.m_stipple;
m_colour = data.m_colour;
- m_isMacTheme = data.m_isMacTheme ;
+ m_macBrushKind = data.m_macBrushKind ;
m_macThemeBrush = data.m_macThemeBrush ;
+ m_macThemeBackground = data.m_macThemeBackground ;
+ m_macThemeBackgroundExtent = data.m_macThemeBackgroundExtent ;
}
wxBrushRefData::~wxBrushRefData()
{
m_refData = new wxBrushRefData;
- M_BRUSHDATA->m_isMacTheme = true;
+ M_BRUSHDATA->m_macBrushKind = kwxMacBrushTheme;
M_BRUSHDATA->m_macThemeBrush = macThemeBrush;
RealizeResource();
void wxBrush::SetColour(const wxColour& col)
{
Unshare();
- M_BRUSHDATA->m_isMacTheme = false;
- M_BRUSHDATA->m_isMacThemeBackground = false ;
+ M_BRUSHDATA->m_macBrushKind = kwxMacBrushColour;
M_BRUSHDATA->m_colour = col;
RealizeResource();
{
Unshare();
- M_BRUSHDATA->m_isMacTheme = false;
- M_BRUSHDATA->m_isMacThemeBackground = false ;
+ M_BRUSHDATA->m_macBrushKind = kwxMacBrushColour;
M_BRUSHDATA->m_colour.Set(r, g, b);
RealizeResource();
{
Unshare();
- M_BRUSHDATA->m_isMacTheme = false;
- M_BRUSHDATA->m_isMacThemeBackground = false ;
+ M_BRUSHDATA->m_macBrushKind = kwxMacBrushColour;
M_BRUSHDATA->m_style = Style;
RealizeResource();
{
Unshare();
+ M_BRUSHDATA->m_macBrushKind = kwxMacBrushColour;
M_BRUSHDATA->m_stipple = Stipple;
RealizeResource();
{
Unshare();
- M_BRUSHDATA->m_isMacTheme = true;
- M_BRUSHDATA->m_isMacThemeBackground = false ;
+ M_BRUSHDATA->m_macBrushKind = kwxMacBrushTheme;
M_BRUSHDATA->m_macThemeBrush = macThemeBrush;
RealizeResource();
}
-void wxBrush::SetMacThemeBackground(ThemeBackgroundKind macThemeBackground)
+void wxBrush::SetMacThemeBackground(ThemeBackgroundKind macThemeBackground, const Rect &extent)
{
Unshare();
- M_BRUSHDATA->m_isMacTheme = false;
- M_BRUSHDATA->m_isMacThemeBackground = true ;
+ M_BRUSHDATA->m_macBrushKind = kwxMacBrushThemeBackground;
M_BRUSHDATA->m_macThemeBackground = macThemeBackground;
-
+ M_BRUSHDATA->m_macThemeBackgroundExtent = extent ;
RealizeResource();
}
return TRUE;
}
+ThemeBackgroundKind wxBrush::GetMacThemeBackground(Rect *extent) const
+{
+ if ( M_BRUSHDATA && M_BRUSHDATA->m_macBrushKind == kwxMacBrushThemeBackground )
+ {
+ if ( extent )
+ *extent = M_BRUSHDATA->m_macThemeBackgroundExtent ;
+ return M_BRUSHDATA->m_macThemeBackground ;
+ }
+ else
+ {
+ return 0 ;
+ }
+}
+
TextSize( size );
TextFace( style );
TextMode( mode );
- SetOrigin( 0 , 0 ) ;
SetPort( port ) ;
}
}
#else
SetPort( (window) ) ;
#endif
- SetOrigin( 0 , 0 ) ;
LocalToGlobal( &pt ) ;
SetPort( port ) ;
win->SetSize( pt.h , pt.v , -1 ,
#else
SetPort( (window) ) ;
#endif
- SetOrigin( 0 , 0 ) ;
SetPort( port ) ;
}
if ( window != frontWindow && wxTheApp->s_captureWindow == NULL )
wxBrushRefData::wxBrushRefData()
{
m_style = wxSOLID;
- m_isMacTheme = false ;
- m_isMacThemeBackground = false ;
+ m_macBrushKind = kwxMacBrushColour ;
}
wxBrushRefData::wxBrushRefData(const wxBrushRefData& data)
m_style = data.m_style;
m_stipple = data.m_stipple;
m_colour = data.m_colour;
- m_isMacTheme = data.m_isMacTheme ;
+ m_macBrushKind = data.m_macBrushKind ;
m_macThemeBrush = data.m_macThemeBrush ;
+ m_macThemeBackground = data.m_macThemeBackground ;
+ m_macThemeBackgroundExtent = data.m_macThemeBackgroundExtent ;
}
wxBrushRefData::~wxBrushRefData()
{
m_refData = new wxBrushRefData;
- M_BRUSHDATA->m_isMacTheme = true;
+ M_BRUSHDATA->m_macBrushKind = kwxMacBrushTheme;
M_BRUSHDATA->m_macThemeBrush = macThemeBrush;
RealizeResource();
void wxBrush::SetColour(const wxColour& col)
{
Unshare();
- M_BRUSHDATA->m_isMacTheme = false;
- M_BRUSHDATA->m_isMacThemeBackground = false ;
+ M_BRUSHDATA->m_macBrushKind = kwxMacBrushColour;
M_BRUSHDATA->m_colour = col;
RealizeResource();
{
Unshare();
- M_BRUSHDATA->m_isMacTheme = false;
- M_BRUSHDATA->m_isMacThemeBackground = false ;
+ M_BRUSHDATA->m_macBrushKind = kwxMacBrushColour;
M_BRUSHDATA->m_colour.Set(r, g, b);
RealizeResource();
{
Unshare();
- M_BRUSHDATA->m_isMacTheme = false;
- M_BRUSHDATA->m_isMacThemeBackground = false ;
+ M_BRUSHDATA->m_macBrushKind = kwxMacBrushColour;
M_BRUSHDATA->m_style = Style;
RealizeResource();
{
Unshare();
+ M_BRUSHDATA->m_macBrushKind = kwxMacBrushColour;
M_BRUSHDATA->m_stipple = Stipple;
RealizeResource();
{
Unshare();
- M_BRUSHDATA->m_isMacTheme = true;
- M_BRUSHDATA->m_isMacThemeBackground = false ;
+ M_BRUSHDATA->m_macBrushKind = kwxMacBrushTheme;
M_BRUSHDATA->m_macThemeBrush = macThemeBrush;
RealizeResource();
}
-void wxBrush::SetMacThemeBackground(ThemeBackgroundKind macThemeBackground)
+void wxBrush::SetMacThemeBackground(ThemeBackgroundKind macThemeBackground, const Rect &extent)
{
Unshare();
- M_BRUSHDATA->m_isMacTheme = false;
- M_BRUSHDATA->m_isMacThemeBackground = true ;
+ M_BRUSHDATA->m_macBrushKind = kwxMacBrushThemeBackground;
M_BRUSHDATA->m_macThemeBackground = macThemeBackground;
-
+ M_BRUSHDATA->m_macThemeBackgroundExtent = extent ;
RealizeResource();
}
return TRUE;
}
+ThemeBackgroundKind wxBrush::GetMacThemeBackground(Rect *extent) const
+{
+ if ( M_BRUSHDATA && M_BRUSHDATA->m_macBrushKind == kwxMacBrushThemeBackground )
+ {
+ if ( extent )
+ *extent = M_BRUSHDATA->m_macThemeBackgroundExtent ;
+ return M_BRUSHDATA->m_macThemeBackground ;
+ }
+ else
+ {
+ return 0 ;
+ }
+}
+
{
wxMacDrawingHelper help( win ) ;
// the mac control manager always assumes to have the origin at 0,0
- SetOrigin( 0 , 0 ) ;
wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ;
UMADrawControl( m_macControl ) ;
}
{
wxMacDrawingHelper help( win ) ;
// the mac control manager always assumes to have the origin at 0,0
- SetOrigin( 0 , 0 ) ;
wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ;
UMADrawControl( m_macControl ) ;
}
}
void wxDC::MacSetupPort(AGAPortHelper* help) const
{
-// help->Setup( m_macPort ) ;
- ::SetOrigin(-m_macLocalOrigin.h, -m_macLocalOrigin.v);
SetClip( m_macCurrentClipRgn);
m_macFontInstalled = false ;
wxMacPortSetter helper(this) ;
- wxCoord xx = XLOG2DEV(x);
- wxCoord yy = YLOG2DEV(y);
+ wxCoord xx = XLOG2DEVMAC(x);
+ wxCoord yy = YLOG2DEVMAC(y);
wxCoord w = bmp.GetWidth();
wxCoord h = bmp.GetHeight();
wxCoord ww = XLOG2DEVREL(w);
wxCHECK_RET(Ok(), wxT("wxDC::DoSetClippingRegion Invalid DC"));
wxCoord xx, yy, ww, hh;
- xx = XLOG2DEV(x);
- yy = YLOG2DEV(y);
+ xx = XLOG2DEVMAC(x);
+ yy = YLOG2DEVMAC(y);
ww = XLOG2DEVREL(width);
hh = YLOG2DEVREL(height);
region.GetBox( x, y, w, h );
wxCoord xx, yy, ww, hh;
- xx = XLOG2DEV(x);
- yy = YLOG2DEV(y);
+ xx = XLOG2DEVMAC(x);
+ yy = YLOG2DEVMAC(y);
ww = XLOG2DEVREL(w);
hh = YLOG2DEVREL(h);
RGBColor colour;
- GetCPixel( XLOG2DEV(x), YLOG2DEV(y), &colour );
+ GetCPixel( XLOG2DEVMAC(x), YLOG2DEVMAC(y), &colour );
// Convert from Mac colour to wx
col->Set( colour.red >> 8,
wxCoord offset = ( (m_pen.GetWidth() == 0 ? 1 :
m_pen.GetWidth() ) * (wxCoord)m_scaleX - 1) / 2;
- wxCoord xx1 = XLOG2DEV(x1) - offset;
- wxCoord yy1 = YLOG2DEV(y1) - offset;
- wxCoord xx2 = XLOG2DEV(x2) - offset;
- wxCoord yy2 = YLOG2DEV(y2) - offset;
+ wxCoord xx1 = XLOG2DEVMAC(x1) - offset;
+ wxCoord yy1 = YLOG2DEVMAC(y1) - offset;
+ wxCoord xx2 = XLOG2DEVMAC(x2) - offset;
+ wxCoord yy2 = YLOG2DEVMAC(y2) - offset;
if ((m_pen.GetCap() == wxCAP_ROUND) &&
(m_pen.GetWidth() <= 1))
int w = 0;
int h = 0;
GetSize( &w, &h );
- wxCoord xx = XLOG2DEV(x);
- wxCoord yy = YLOG2DEV(y);
+ wxCoord xx = XLOG2DEVMAC(x);
+ wxCoord yy = YLOG2DEVMAC(y);
MacInstallPen();
- ::MoveTo( 0, yy );
- ::LineTo( XLOG2DEVREL(w), yy );
- ::MoveTo( xx, 0 );
- ::LineTo( xx, YLOG2DEVREL(h) );
+ ::MoveTo( XLOG2DEVMAC(0), yy );
+ ::LineTo( XLOG2DEVMAC(w), yy );
+ ::MoveTo( xx, YLOG2DEVMAC(0) );
+ ::LineTo( xx, YLOG2DEVMAC(h) );
}
}
{
wxCHECK_RET(Ok(), wxT("wxDC::DoDrawArc Invalid DC"));
- wxCoord xx1 = XLOG2DEV(x1);
- wxCoord yy1 = YLOG2DEV(y1);
- wxCoord xx2 = XLOG2DEV(x2);
- wxCoord yy2 = YLOG2DEV(y2);
- wxCoord xxc = XLOG2DEV(xc);
- wxCoord yyc = YLOG2DEV(yc);
+ wxCoord xx1 = XLOG2DEVMAC(x1);
+ wxCoord yy1 = YLOG2DEVMAC(y1);
+ wxCoord xx2 = XLOG2DEVMAC(x2);
+ wxCoord yy2 = YLOG2DEVMAC(y2);
+ wxCoord xxc = XLOG2DEVMAC(xc);
+ wxCoord yyc = YLOG2DEVMAC(yc);
double dx = xx1 - xxc;
double dy = yy1 - yyc;
double radius = sqrt((double)(dx*dx+dy*dy));
Rect r;
double angle = sa - ea; // Order important Mac in opposite direction to wx
- wxCoord xx = XLOG2DEV(x);
- wxCoord yy = YLOG2DEV(y);
+ wxCoord xx = XLOG2DEVMAC(x);
+ wxCoord yy = YLOG2DEVMAC(y);
wxCoord ww = m_signX * XLOG2DEVREL(w);
wxCoord hh = m_signY * YLOG2DEVREL(h);
if (m_pen.GetStyle() != wxTRANSPARENT)
{
MacInstallPen() ;
- wxCoord xx1 = XLOG2DEV(x);
- wxCoord yy1 = YLOG2DEV(y);
+ wxCoord xx1 = XLOG2DEVMAC(x);
+ wxCoord yy1 = YLOG2DEVMAC(y);
::MoveTo(xx1,yy1);
::LineTo(xx1+1, yy1+1);
m_pen.GetWidth() ) * (wxCoord)m_scaleX - 1) / 2 ;
wxCoord x1, x2 , y1 , y2 ;
- x1 = XLOG2DEV(points[0].x + xoffset);
- y1 = YLOG2DEV(points[0].y + yoffset);
+ x1 = XLOG2DEVMAC(points[0].x + xoffset);
+ y1 = YLOG2DEVMAC(points[0].y + yoffset);
::MoveTo(x1 - offset, y1 - offset );
for (int i = 0; i < n-1; i++)
{
- x2 = XLOG2DEV(points[i+1].x + xoffset);
- y2 = YLOG2DEV(points[i+1].y + yoffset);
+ x2 = XLOG2DEVMAC(points[i+1].x + xoffset);
+ y2 = YLOG2DEVMAC(points[i+1].y + yoffset);
::LineTo( x2 - offset, y2 - offset );
}
}
{
PolyHandle polygon = OpenPoly();
- x1 = XLOG2DEV(points[0].x + xoffset);
- y1 = YLOG2DEV(points[0].y + yoffset);
+ x1 = XLOG2DEVMAC(points[0].x + xoffset);
+ y1 = YLOG2DEVMAC(points[0].y + yoffset);
::MoveTo(x1,y1);
for (int i = 0; i < n-1; i++)
{
- x2 = XLOG2DEV(points[i+1].x + xoffset);
- y2 = YLOG2DEV(points[i+1].y + yoffset);
+ x2 = XLOG2DEVMAC(points[i+1].x + xoffset);
+ y2 = YLOG2DEVMAC(points[i+1].y + yoffset);
::LineTo(x2, y2);
}
{
PolyHandle polygon = OpenPoly();
- x1 = XLOG2DEV(points[0].x + xoffset);
- y1 = YLOG2DEV(points[0].y + yoffset);
+ x1 = XLOG2DEVMAC(points[0].x + xoffset);
+ y1 = YLOG2DEVMAC(points[0].y + yoffset);
::MoveTo(x1,y1);
for (int i = 0; i < n-1; i++)
{
- x2 = XLOG2DEV(points[i+1].x + xoffset);
- y2 = YLOG2DEV(points[i+1].y + yoffset);
+ x2 = XLOG2DEVMAC(points[i+1].x + xoffset);
+ y2 = YLOG2DEVMAC(points[i+1].y + yoffset);
::LineTo(x2, y2);
}
wxCHECK_RET(Ok(), wxT("Invalid DC"));
wxMacPortSetter helper(this) ;
- wxCoord xx = XLOG2DEV(x);
- wxCoord yy = YLOG2DEV(y);
+ wxCoord xx = XLOG2DEVMAC(x);
+ wxCoord yy = YLOG2DEVMAC(y);
wxCoord ww = m_signX * XLOG2DEVREL(width);
wxCoord hh = m_signY * YLOG2DEVREL(height);
if (radius < 0.0)
radius = - radius * ((width < height) ? width : height);
- wxCoord xx = XLOG2DEV(x);
- wxCoord yy = YLOG2DEV(y);
+ wxCoord xx = XLOG2DEVMAC(x);
+ wxCoord yy = YLOG2DEVMAC(y);
wxCoord ww = m_signX * XLOG2DEVREL(width);
wxCoord hh = m_signY * YLOG2DEVREL(height);
wxCHECK_RET(Ok(), wxT("Invalid DC"));
wxMacPortSetter helper(this) ;
- wxCoord xx = XLOG2DEV(x);
- wxCoord yy = YLOG2DEV(y);
+ wxCoord xx = XLOG2DEVMAC(x);
+ wxCoord yy = YLOG2DEVMAC(y);
wxCoord ww = m_signX * XLOG2DEVREL(width);
wxCoord hh = m_signY * YLOG2DEVREL(height);
if ( LockPixels(bmappixels) )
{
Rect srcrect , dstrect ;
- srcrect.top = source->YLOG2DEV(ysrc) + source->m_macLocalOrigin.v ;
- srcrect.left = source->XLOG2DEV(xsrc) + source->m_macLocalOrigin.h ;
- srcrect.right = source->XLOG2DEV(xsrc + width ) + source->m_macLocalOrigin.v;
- srcrect.bottom = source->YLOG2DEV(ysrc + height) + source->m_macLocalOrigin.h;
- dstrect.top = YLOG2DEV(ydest) ;
- dstrect.left = XLOG2DEV(xdest) ;
- dstrect.bottom = YLOG2DEV(ydest + height ) ;
- dstrect.right = XLOG2DEV(xdest + width ) ;
+ srcrect.top = source->YLOG2DEVMAC(ysrc) ;
+ srcrect.left = source->XLOG2DEVMAC(xsrc) ;
+ srcrect.right = source->XLOG2DEVMAC(xsrc + width ) ;
+ srcrect.bottom = source->YLOG2DEVMAC(ysrc + height) ;
+ dstrect.top = YLOG2DEVMAC(ydest) ;
+ dstrect.left = XLOG2DEVMAC(xdest) ;
+ dstrect.bottom = YLOG2DEVMAC(ydest + height ) ;
+ dstrect.right = XLOG2DEVMAC(xdest + width ) ;
short mode = (logical_func == wxCOPY ? srcCopy :
// logical_func == wxCLEAR ? WHITENESS :
textPixel = data[(srcY*w + srcX)*3] == 0;
if ( textPixel || (m_backgroundMode == wxSOLID) )
{
- SetCPixel(XLOG2DEV(x + dstX), YLOG2DEV(y + dstY),
+ SetCPixel(XLOG2DEVMAC(x + dstX), YLOG2DEVMAC(y + dstY),
textPixel ? &colText : &colBack);
}
}
#if 0
if ( m_font.GetUnderlined() )
{
- ::MoveTo(XLOG2DEV(x + x4), YLOG2DEV(y + y4 + font->descent));
- ::LineTo(XLOG2DEV(x + x3), YLOG2DEV(y + y3 + font->descent));
+ ::MoveTo(XLOG2DEVMAC(x + x4), YLOG2DEVMAC(y + y4 + font->descent));
+ ::LineTo(XLOG2DEVMAC(x + x3), YLOG2DEVMAC(y + y3 + font->descent));
}
#endif // 0
wxCHECK_RET(Ok(), wxT("wxDC::DoDrawText Invalid DC"));
wxMacPortSetter helper(this) ;
- long xx = XLOG2DEV(x);
- long yy = YLOG2DEV(y);
+ long xx = XLOG2DEVMAC(x);
+ long yy = YLOG2DEVMAC(y);
// if (m_pen.GetStyle() != wxTRANSPARENT)
{
m_macFontInstalled = false ;
}
-int wxDC::MacSetupBackgroundForCurrentPort(const wxBrush& background )
+void wxDC::MacSetupBackgroundForCurrentPort(const wxBrush& background )
{
Pattern whiteColor ;
- if ( background.IsMacTheme() )
- {
- SetThemeBackground( background.GetMacTheme() , wxDisplayDepth() , true ) ;
- }
- else if ( background.IsMacThemeBackground() )
- {
- Rect originBox = { 0,0,1,1 } ;
- ::ApplyThemeBackground( background.GetMacThemeBackground() , &originBox ,kThemeStateActive ,
- wxDisplayDepth() , true ) ;
- }
- else
- {
- ::RGBBackColor( &background.GetColour().GetPixel() );
- int brushStyle = background.GetStyle();
- if (brushStyle == wxSOLID)
- ::BackPat(GetQDGlobalsWhite(&whiteColor));
- else if (IS_HATCH(brushStyle))
- {
- Pattern pat ;
- wxMacGetHatchPattern(brushStyle, &pat);
- ::BackPat(&pat);
- }
- else
- {
- ::BackPat(GetQDGlobalsWhite(&whiteColor));
- }
- }
- return 0 ;
+ switch( background.MacGetBrushKind() )
+ {
+ case kwxMacBrushTheme :
+ {
+ ::SetThemeBackground( background.GetMacTheme() , wxDisplayDepth() , true ) ;
+ break ;
+ }
+ case kwxMacBrushThemeBackground :
+ {
+ Rect extent ;
+ ThemeBackgroundKind bg = background.GetMacThemeBackground( &extent ) ;
+ ::ApplyThemeBackground( bg , &extent ,kThemeStateActive , wxDisplayDepth() , true ) ;
+ break ;
+ }
+ case kwxMacBrushColour :
+ {
+ ::RGBBackColor( &background.GetColour().GetPixel() );
+ int brushStyle = background.GetStyle();
+ if (brushStyle == wxSOLID)
+ ::BackPat(GetQDGlobalsWhite(&whiteColor));
+ else if (IS_HATCH(brushStyle))
+ {
+ Pattern pat ;
+ wxMacGetHatchPattern(brushStyle, &pat);
+ ::BackPat(&pat);
+ }
+ else
+ {
+ ::BackPat(GetQDGlobalsWhite(&whiteColor));
+ }
+ break ;
+ }
+ }
}
void wxDC::MacInstallBrush() const
the_canvas->MacGetPortParams(&m_macLocalOrigin, &clipRect , &windowref , &rootwindow );
SetRectRgn( m_macBoundaryClipRgn , clipRect.left , clipRect.top , clipRect.right , clipRect.bottom ) ;
SectRgn( m_macBoundaryClipRgn , the_canvas->MacGetVisibleRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ;
+ OffsetRgn( m_macBoundaryClipRgn , m_macLocalOrigin.h , m_macLocalOrigin.v ) ;
CopyRgn( m_macBoundaryClipRgn , m_macCurrentClipRgn ) ;
m_macPort = UMAGetWindowPort( windowref ) ;
m_minY = m_minX = 0;
SetRectRgn( m_macBoundaryClipRgn , clipRect.left + origin.x , clipRect.top + origin.y , clipRect.right + origin.x , clipRect.bottom + origin.y ) ;
SectRgn( m_macBoundaryClipRgn , window->MacGetVisibleRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ;
OffsetRgn( m_macBoundaryClipRgn , -origin.x , -origin.y ) ;
+ OffsetRgn( m_macBoundaryClipRgn , m_macLocalOrigin.h , m_macLocalOrigin.v ) ;
CopyRgn( m_macBoundaryClipRgn , m_macCurrentClipRgn ) ;
m_macPort = UMAGetWindowPort( windowref ) ;
m_minY = m_minX = 0;
SectRgn( m_macBoundaryClipRgn , window->MacGetVisibleRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ;
OffsetRgn( m_macBoundaryClipRgn , -origin.x , -origin.y ) ;
SectRgn( m_macBoundaryClipRgn , window->GetUpdateRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ;
+ OffsetRgn( m_macBoundaryClipRgn , m_macLocalOrigin.h , m_macLocalOrigin.v ) ;
CopyRgn( m_macBoundaryClipRgn , m_macCurrentClipRgn ) ;
m_macPort = UMAGetWindowPort( windowref ) ;
m_ok = TRUE ;
m_macLocalOrigin.h = (**m_printData.m_macPrintInfo).rPaper.left ;
m_macLocalOrigin.v = (**m_printData.m_macPrintInfo).rPaper.top ;
- SetOrigin( - m_macLocalOrigin.h , - m_macLocalOrigin.v ) ;
Rect clip = { -32000 , -32000 , 32000 , 32000 } ;
::ClipRect( &clip ) ;
err = PrError() ;
{
wxMacDrawingHelper help( win ) ;
// the mac control manager always assumes to have the origin at 0,0
- SetOrigin( 0 , 0 ) ;
bool hasTabBehind = false ;
wxWindow* parent = GetParent() ;
{
wxMacDrawingHelper help( win ) ;
// the mac control manager always assumes to have the origin at 0,0
- SetOrigin( 0 , 0 ) ;
bool hasTabBehind = false ;
wxWindow* parent = GetParent() ;
{
wxMacDrawingHelper help( win ) ;
// the mac control manager always assumes to have the origin at 0,0
- SetOrigin( 0 , 0 ) ;
bool hasTabBehind = false ;
wxWindow* parent = GetParent() ;
if ( win )
{
wxMacDrawingHelper help( win ) ;
- // the mac control manager always assumes to have the origin at 0,0
- SetOrigin( 0 , 0 ) ;
-
+ // the mac control manager always assumes to have the origin at 0,0
bool hasTabBehind = false ;
wxWindow* parent = GetParent() ;
while ( parent )
{
wxMacDrawingHelper help( win ) ;
// the mac control manager always assumes to have the origin at 0,0
- SetOrigin( 0 , 0 ) ;
-
bool hasTabBehind = false ;
wxWindow* parent = GetParent() ;
while ( parent )
#endif
m_shown = true ;
- SetOrigin( 0 , 0 ) ;
TextFont( kFontIDGeneva ) ;
TextSize( 10 ) ;
TextFace( 0 ) ;
#endif
m_shown = false ;
- SetOrigin( 0 , 0 ) ;
BackColor( whiteColor ) ;
ForeColor(blackColor ) ;
DrawPicture(m_backpict, &m_rect);
m_macFocus = NULL ;
}
-void wxTopLevelWindowMac::MacDoGetPortClientParams(Point* localOrigin, Rect* clipRect, WindowRef *window , wxWindowMac** rootwin )
-{
- localOrigin->h = 0;
- localOrigin->v = 0;
- clipRect->left = 0;
- clipRect->top = 0;
- clipRect->right = m_width ;//width;
- clipRect->bottom = m_height ;// height;
- *window = m_macWindow ;
- *rootwin = this ;
-}
-
void wxTopLevelWindowMac::MacGetPortParams(Point* localOrigin, Rect* clipRect, WindowRef *window , wxWindowMac** rootwin)
{
localOrigin->h = 0;
void wxTopLevelWindowMac::Clear()
{
- wxMacDrawingClientHelper helper ( this ) ;
- int w ,h ;
- wxPoint origin = GetClientAreaOrigin() ;
- GetClientSize( &w , &h ) ;
- ::SetThemeWindowBackground( m_macWindow , m_macWindowBackgroundTheme , false ) ;
- Rect r = { origin.y , origin.x, origin.y+h , origin.x+w } ;
- EraseRect( &r ) ;
+ wxWindow::Clear() ;
}
ControlHandle wxTopLevelWindowMac::MacGetContainerForEmbedding()
#else
AGAPortHelper help( (m_macWindow) ) ;
#endif
- SetOrigin( 0 , 0 ) ;
BeginUpdate( m_macWindow ) ;
RgnHandle updateRgn = NewRgn();
SetPortWindowPort( inWindow ) ;
- SetOrigin( 0 , 0 ) ;
err = SetKeyboardFocus( inWindow , inControl , inPart ) ;
SetPort( port ) ;
return err ;
GrafPtr port ;
GetPort( &port ) ;
SetPortWindowPort( inWindowRef ) ;
- SetOrigin( 0 , 0 ) ;
HiliteWindow( inWindowRef , inActivate ) ;
ControlHandle control = NULL ;
::GetRootControl( inWindowRef , & control ) ;
GrafPtr port ;
::GetPort( &port ) ;
::SetPort( UMAGetWindowPort( window ) ) ;
- ::SetOrigin( 0 , 0 ) ;
+
::LocalToGlobal( &localwhere ) ;
::SetPort( port ) ;
if(x) *x = localwhere.h ;
if ( focus.Ok() )
{
Rect clientrect = { 0 , 0 , m_height , m_width } ;
+ focus.LocalToWindow( &clientrect ) ;
// ClipRect( &clientrect ) ;
InvalWindowRect( MacGetRootWindow() , &clientrect ) ;
}
if ( focus.Ok() )
{
Rect clientrect = { 0 , 0 , m_height , m_width } ;
+ focus.LocalToWindow( &clientrect ) ;
// ClipRect( &clientrect ) ;
InvalWindowRect( MacGetRootWindow() , &clientrect ) ;
}
// if we have the normal colours in the hierarchy but another control etc. -> use it's background
if ( parent->IsKindOf( CLASSINFO( wxNotebook ) ) || parent->IsKindOf( CLASSINFO( wxTabCtrl ) ))
{
- m_macBackgroundBrush.SetMacThemeBackground( kThemeBackgroundTabPane ) ; // todo eventually change for inactive
+ Rect extent = { 0 , 0 , 0 , 0 } ;
+ int x , y ;
+ x = y = 0 ;
+ wxSize size = GetSize() ;
+ parent->MacClientToRootWindow( &x , &y ) ;
+ extent.left = x ;
+ extent.top = y ;
+ extent.top-- ;
+ extent.right = x + size.x ;
+ extent.bottom = y + size.y ;
+ m_macBackgroundBrush.SetMacThemeBackground( kThemeBackgroundTabPane , extent ) ; // todo eventually change for inactive
break ;
}
}
wxMacDrawingHelper focus( this ) ;
if ( focus.Ok() )
{
- MacPaintBorders() ;
+ MacPaintBorders( focus.GetOrigin().h , focus.GetOrigin().v) ;
}
}
}
}
-void wxWindowMac::MacPaintBorders( )
+void wxWindowMac::MacPaintBorders( int left , int top )
{
if( IsTopLevel() )
return ;
if (HasFlag(wxRAISED_BORDER) || HasFlag( wxSUNKEN_BORDER) || HasFlag(wxDOUBLE_BORDER) )
{
#if wxMAC_USE_THEME_BORDER
- Rect rect = { 0 , 0 , m_height , m_width } ;
+ Rect rect = { top , left , m_height + top , m_width + left } ;
SInt32 border = 0 ;
/*
GetThemeMetric( kThemeMetricListBoxFrameOutset , &border ) ;
#else
bool sunken = HasFlag( wxSUNKEN_BORDER ) ;
RGBForeColor( &face );
- MoveTo( 0 , m_height - 2 );
- LineTo( 0 , 0 );
- LineTo( m_width - 2 , 0 );
+ MoveTo( left + 0 , top + m_height - 2 );
+ LineTo( left + 0 , top + 0 );
+ LineTo( left + m_width - 2 , top + 0 );
- MoveTo( 2 , m_height - 3 );
- LineTo( m_width - 3 , m_height - 3 );
- LineTo( m_width - 3 , 2 );
+ MoveTo( left + 2 , top + m_height - 3 );
+ LineTo( left + m_width - 3 , top + m_height - 3 );
+ LineTo( left + m_width - 3 , top + 2 );
RGBForeColor( sunken ? &face : &black );
- MoveTo( 0 , m_height - 1 );
- LineTo( m_width - 1 , m_height - 1 );
- LineTo( m_width - 1 , 0 );
+ MoveTo( left + 0 , top + m_height - 1 );
+ LineTo( left + m_width - 1 , top + m_height - 1 );
+ LineTo( left + m_width - 1 , top + 0 );
RGBForeColor( sunken ? &shadow : &white );
- MoveTo( 1 , m_height - 3 );
- LineTo( 1, 1 );
- LineTo( m_width - 3 , 1 );
+ MoveTo( left + 1 , top + m_height - 3 );
+ LineTo( left + 1, top + 1 );
+ LineTo( left + m_width - 3 , top + 1 );
RGBForeColor( sunken ? &white : &shadow );
- MoveTo( 1 , m_height - 2 );
- LineTo( m_width - 2 , m_height - 2 );
- LineTo( m_width - 2 , 1 );
+ MoveTo( left + 1 , top + m_height - 2 );
+ LineTo( left + m_width - 2 , top + m_height - 2 );
+ LineTo( left + m_width - 2 , top + 1 );
RGBForeColor( sunken ? &black : &face );
- MoveTo( 2 , m_height - 4 );
- LineTo( 2 , 2 );
- LineTo( m_width - 4 , 2 );
+ MoveTo( left + 2 , top + m_height - 4 );
+ LineTo( left + 2 , top + 2 );
+ LineTo( left + m_width - 4 , top + 2 );
#endif
}
else if (HasFlag(wxSIMPLE_BORDER))
{
- Rect rect = { 0 , 0 , m_height , m_width } ;
+ Rect rect = { top , left , m_height + top , m_width + left } ;
RGBForeColor( &black ) ;
FrameRect( &rect ) ;
}
// Does a physical scroll
void wxWindowMac::ScrollWindow(int dx, int dy, const wxRect *rect)
{
- wxMacDrawingClientHelper focus( this ) ;
+ wxMacDrawingHelper focus( this , true ) ;
if ( focus.Ok() )
{
int width , height ;
GetClientSize( &width , &height ) ;
Rect scrollrect = { 0 , 0 , height , width } ;
-
+ focus.LocalToWindow( &scrollrect ) ;
RgnHandle updateRgn = NewRgn() ;
ClipRect( &scrollrect ) ;
if ( rect )
{
Rect r = { rect->y , rect->x , rect->y + rect->height , rect->x + rect->width } ;
+ focus.LocalToWindow( &r ) ;
SectRect( &scrollrect , &r , &scrollrect ) ;
}
ScrollRect( &scrollrect , dx , dy , updateRgn ) ;
}
}
-bool wxWindowMac::MacSetPortFocusParams( const Point & localOrigin, const Rect & clipRect, WindowRef window , wxWindowMac* win )
-{
- if ( window == NULL )
- return false ;
-
- GrafPtr currPort;
- GrafPtr port ;
-
- ::GetPort(&currPort);
- port = UMAGetWindowPort( window) ;
- if (currPort != port )
- ::SetPort(port);
-
-// wxASSERT( port->portRect.left == 0 && port->portRect.top == 0 ) ;
- ::SetOrigin(-localOrigin.h, -localOrigin.v);
- return true;
-}
-
bool wxWindowMac::MacSetPortDrawingParams( const Point & localOrigin, const Rect & clipRect, WindowRef window , wxWindowMac* win )
{
if ( window == NULL )
port = UMAGetWindowPort( window) ;
if (currPort != port )
::SetPort(port);
-// wxASSERT( port->portRect.left == 0 && port->portRect.top == 0 ) ;
- ::SetOrigin(-localOrigin.h, -localOrigin.v);
- ::ClipRect(&clipRect);
+ Rect cr = clipRect ;
+ OffsetRect( &cr , localOrigin.h , localOrigin.v ) ;
+ ::ClipRect(&cr);
::PenNormal() ;
::RGBBackColor(& win->GetBackgroundColour().GetPixel() ) ;
SectRect(clipRect, &myClip, clipRect);
}
-void wxWindowMac::MacDoGetPortClientParams(Point* localOrigin, Rect* clipRect, WindowRef *window , wxWindowMac** rootwin )
-{
- wxASSERT( GetParent() != NULL ) ;
-
- GetParent()->MacDoGetPortClientParams( localOrigin , clipRect , window, rootwin) ;
-
- localOrigin->h += m_x;
- localOrigin->v += m_y;
- OffsetRect(clipRect, -m_x, -m_y);
-
- Rect myClip;
- myClip.left = 0;
- myClip.top = 0;
- myClip.right = m_width ;//width;
- myClip.bottom = m_height ;// height;
- SectRect(clipRect, &myClip, clipRect);
-}
-
void wxWindowMac::MacGetPortClientParams(Point* localOrigin, Rect* clipRect, WindowRef *window , wxWindowMac** rootwin )
{
- MacDoGetPortClientParams( localOrigin , clipRect , window , rootwin ) ;
+ MacGetPortParams( localOrigin , clipRect, window , rootwin ) ;
int width , height ;
GetClientSize( &width , &height ) ;
localOrigin->v += client.y;
OffsetRect(clipRect, -client.x, -client.y);
- Rect myClip;
- myClip.left = 0;
- myClip.top = 0;
- myClip.right = width;
- myClip.bottom = height;
+ Rect myClip = { 0 , 0 , height , width } ;
SectRect(clipRect, &myClip, clipRect);
}
}
-wxMacDrawingHelper::wxMacDrawingHelper( wxWindowMac * theWindow )
+wxMacDrawingHelper::wxMacDrawingHelper( wxWindowMac * theWindow , bool clientArea )
{
m_ok = false ;
- Point localOrigin ;
Rect clipRect ;
WindowRef window ;
wxWindowMac *rootwin ;
GetPort( &m_formerPort ) ;
if ( theWindow )
{
- theWindow->MacGetPortParams( &localOrigin , &clipRect , &window , &rootwin) ;
+ if ( clientArea )
+ theWindow->MacGetPortClientParams( &m_origin , &clipRect , &window , &rootwin) ;
+ else
+ theWindow->MacGetPortParams( &m_origin , &clipRect , &window , &rootwin) ;
m_currentPort = UMAGetWindowPort( window ) ;
if ( m_formerPort != m_currentPort )
SetPort( m_currentPort ) ;
GetPenState( &m_savedPenState ) ;
- theWindow->MacSetPortDrawingParams( localOrigin, clipRect, window , rootwin ) ;
+ theWindow->MacSetPortDrawingParams( m_origin, clipRect, window , rootwin ) ;
m_ok = true ;
}
}
{
SetPort( m_currentPort ) ;
SetPenState( &m_savedPenState ) ;
- SetOrigin( 0 , 0 ) ;
- Rect portRect ;
- GetPortBounds( m_currentPort , &portRect ) ;
- ClipRect( &portRect ) ;
- }
-
- if ( m_formerPort != m_currentPort )
- SetPort( m_formerPort ) ;
-}
-
-wxMacDrawingClientHelper::wxMacDrawingClientHelper( wxWindowMac * theWindow )
-{
- m_ok = false ;
- Point localOrigin ;
- Rect clipRect ;
- WindowRef window ;
- wxWindowMac *rootwin ;
- m_currentPort = NULL ;
-
- GetPort( &m_formerPort ) ;
-
- if ( theWindow )
- {
- theWindow->MacGetPortClientParams( &localOrigin , &clipRect , &window , &rootwin) ;
- m_currentPort = UMAGetWindowPort( window ) ;
- if ( m_formerPort != m_currentPort )
- SetPort( m_currentPort ) ;
- GetPenState( &m_savedPenState ) ;
- theWindow->MacSetPortDrawingParams( localOrigin, clipRect, window , rootwin ) ;
- m_ok = true ;
- }
-}
-
-wxMacDrawingClientHelper::~wxMacDrawingClientHelper()
-{
- if ( m_ok )
- {
- SetPort( m_currentPort ) ;
- SetPenState( &m_savedPenState ) ;
- SetOrigin( 0 , 0 ) ;
Rect portRect ;
GetPortBounds( m_currentPort , &portRect ) ;
ClipRect( &portRect ) ;
{
wxMacDrawingHelper help( win ) ;
// the mac control manager always assumes to have the origin at 0,0
- SetOrigin( 0 , 0 ) ;
wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ;
UMADrawControl( m_macControl ) ;
}
{
wxMacDrawingHelper help( win ) ;
// the mac control manager always assumes to have the origin at 0,0
- SetOrigin( 0 , 0 ) ;
wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ;
UMADrawControl( m_macControl ) ;
}
}
void wxDC::MacSetupPort(AGAPortHelper* help) const
{
-// help->Setup( m_macPort ) ;
- ::SetOrigin(-m_macLocalOrigin.h, -m_macLocalOrigin.v);
SetClip( m_macCurrentClipRgn);
m_macFontInstalled = false ;
wxMacPortSetter helper(this) ;
- wxCoord xx = XLOG2DEV(x);
- wxCoord yy = YLOG2DEV(y);
+ wxCoord xx = XLOG2DEVMAC(x);
+ wxCoord yy = YLOG2DEVMAC(y);
wxCoord w = bmp.GetWidth();
wxCoord h = bmp.GetHeight();
wxCoord ww = XLOG2DEVREL(w);
wxCHECK_RET(Ok(), wxT("wxDC::DoSetClippingRegion Invalid DC"));
wxCoord xx, yy, ww, hh;
- xx = XLOG2DEV(x);
- yy = YLOG2DEV(y);
+ xx = XLOG2DEVMAC(x);
+ yy = YLOG2DEVMAC(y);
ww = XLOG2DEVREL(width);
hh = YLOG2DEVREL(height);
region.GetBox( x, y, w, h );
wxCoord xx, yy, ww, hh;
- xx = XLOG2DEV(x);
- yy = YLOG2DEV(y);
+ xx = XLOG2DEVMAC(x);
+ yy = YLOG2DEVMAC(y);
ww = XLOG2DEVREL(w);
hh = YLOG2DEVREL(h);
RGBColor colour;
- GetCPixel( XLOG2DEV(x), YLOG2DEV(y), &colour );
+ GetCPixel( XLOG2DEVMAC(x), YLOG2DEVMAC(y), &colour );
// Convert from Mac colour to wx
col->Set( colour.red >> 8,
wxCoord offset = ( (m_pen.GetWidth() == 0 ? 1 :
m_pen.GetWidth() ) * (wxCoord)m_scaleX - 1) / 2;
- wxCoord xx1 = XLOG2DEV(x1) - offset;
- wxCoord yy1 = YLOG2DEV(y1) - offset;
- wxCoord xx2 = XLOG2DEV(x2) - offset;
- wxCoord yy2 = YLOG2DEV(y2) - offset;
+ wxCoord xx1 = XLOG2DEVMAC(x1) - offset;
+ wxCoord yy1 = YLOG2DEVMAC(y1) - offset;
+ wxCoord xx2 = XLOG2DEVMAC(x2) - offset;
+ wxCoord yy2 = YLOG2DEVMAC(y2) - offset;
if ((m_pen.GetCap() == wxCAP_ROUND) &&
(m_pen.GetWidth() <= 1))
int w = 0;
int h = 0;
GetSize( &w, &h );
- wxCoord xx = XLOG2DEV(x);
- wxCoord yy = YLOG2DEV(y);
+ wxCoord xx = XLOG2DEVMAC(x);
+ wxCoord yy = YLOG2DEVMAC(y);
MacInstallPen();
- ::MoveTo( 0, yy );
- ::LineTo( XLOG2DEVREL(w), yy );
- ::MoveTo( xx, 0 );
- ::LineTo( xx, YLOG2DEVREL(h) );
+ ::MoveTo( XLOG2DEVMAC(0), yy );
+ ::LineTo( XLOG2DEVMAC(w), yy );
+ ::MoveTo( xx, YLOG2DEVMAC(0) );
+ ::LineTo( xx, YLOG2DEVMAC(h) );
}
}
{
wxCHECK_RET(Ok(), wxT("wxDC::DoDrawArc Invalid DC"));
- wxCoord xx1 = XLOG2DEV(x1);
- wxCoord yy1 = YLOG2DEV(y1);
- wxCoord xx2 = XLOG2DEV(x2);
- wxCoord yy2 = YLOG2DEV(y2);
- wxCoord xxc = XLOG2DEV(xc);
- wxCoord yyc = YLOG2DEV(yc);
+ wxCoord xx1 = XLOG2DEVMAC(x1);
+ wxCoord yy1 = YLOG2DEVMAC(y1);
+ wxCoord xx2 = XLOG2DEVMAC(x2);
+ wxCoord yy2 = YLOG2DEVMAC(y2);
+ wxCoord xxc = XLOG2DEVMAC(xc);
+ wxCoord yyc = YLOG2DEVMAC(yc);
double dx = xx1 - xxc;
double dy = yy1 - yyc;
double radius = sqrt((double)(dx*dx+dy*dy));
Rect r;
double angle = sa - ea; // Order important Mac in opposite direction to wx
- wxCoord xx = XLOG2DEV(x);
- wxCoord yy = YLOG2DEV(y);
+ wxCoord xx = XLOG2DEVMAC(x);
+ wxCoord yy = YLOG2DEVMAC(y);
wxCoord ww = m_signX * XLOG2DEVREL(w);
wxCoord hh = m_signY * YLOG2DEVREL(h);
if (m_pen.GetStyle() != wxTRANSPARENT)
{
MacInstallPen() ;
- wxCoord xx1 = XLOG2DEV(x);
- wxCoord yy1 = YLOG2DEV(y);
+ wxCoord xx1 = XLOG2DEVMAC(x);
+ wxCoord yy1 = YLOG2DEVMAC(y);
::MoveTo(xx1,yy1);
::LineTo(xx1+1, yy1+1);
m_pen.GetWidth() ) * (wxCoord)m_scaleX - 1) / 2 ;
wxCoord x1, x2 , y1 , y2 ;
- x1 = XLOG2DEV(points[0].x + xoffset);
- y1 = YLOG2DEV(points[0].y + yoffset);
+ x1 = XLOG2DEVMAC(points[0].x + xoffset);
+ y1 = YLOG2DEVMAC(points[0].y + yoffset);
::MoveTo(x1 - offset, y1 - offset );
for (int i = 0; i < n-1; i++)
{
- x2 = XLOG2DEV(points[i+1].x + xoffset);
- y2 = YLOG2DEV(points[i+1].y + yoffset);
+ x2 = XLOG2DEVMAC(points[i+1].x + xoffset);
+ y2 = YLOG2DEVMAC(points[i+1].y + yoffset);
::LineTo( x2 - offset, y2 - offset );
}
}
{
PolyHandle polygon = OpenPoly();
- x1 = XLOG2DEV(points[0].x + xoffset);
- y1 = YLOG2DEV(points[0].y + yoffset);
+ x1 = XLOG2DEVMAC(points[0].x + xoffset);
+ y1 = YLOG2DEVMAC(points[0].y + yoffset);
::MoveTo(x1,y1);
for (int i = 0; i < n-1; i++)
{
- x2 = XLOG2DEV(points[i+1].x + xoffset);
- y2 = YLOG2DEV(points[i+1].y + yoffset);
+ x2 = XLOG2DEVMAC(points[i+1].x + xoffset);
+ y2 = YLOG2DEVMAC(points[i+1].y + yoffset);
::LineTo(x2, y2);
}
{
PolyHandle polygon = OpenPoly();
- x1 = XLOG2DEV(points[0].x + xoffset);
- y1 = YLOG2DEV(points[0].y + yoffset);
+ x1 = XLOG2DEVMAC(points[0].x + xoffset);
+ y1 = YLOG2DEVMAC(points[0].y + yoffset);
::MoveTo(x1,y1);
for (int i = 0; i < n-1; i++)
{
- x2 = XLOG2DEV(points[i+1].x + xoffset);
- y2 = YLOG2DEV(points[i+1].y + yoffset);
+ x2 = XLOG2DEVMAC(points[i+1].x + xoffset);
+ y2 = YLOG2DEVMAC(points[i+1].y + yoffset);
::LineTo(x2, y2);
}
wxCHECK_RET(Ok(), wxT("Invalid DC"));
wxMacPortSetter helper(this) ;
- wxCoord xx = XLOG2DEV(x);
- wxCoord yy = YLOG2DEV(y);
+ wxCoord xx = XLOG2DEVMAC(x);
+ wxCoord yy = YLOG2DEVMAC(y);
wxCoord ww = m_signX * XLOG2DEVREL(width);
wxCoord hh = m_signY * YLOG2DEVREL(height);
if (radius < 0.0)
radius = - radius * ((width < height) ? width : height);
- wxCoord xx = XLOG2DEV(x);
- wxCoord yy = YLOG2DEV(y);
+ wxCoord xx = XLOG2DEVMAC(x);
+ wxCoord yy = YLOG2DEVMAC(y);
wxCoord ww = m_signX * XLOG2DEVREL(width);
wxCoord hh = m_signY * YLOG2DEVREL(height);
wxCHECK_RET(Ok(), wxT("Invalid DC"));
wxMacPortSetter helper(this) ;
- wxCoord xx = XLOG2DEV(x);
- wxCoord yy = YLOG2DEV(y);
+ wxCoord xx = XLOG2DEVMAC(x);
+ wxCoord yy = YLOG2DEVMAC(y);
wxCoord ww = m_signX * XLOG2DEVREL(width);
wxCoord hh = m_signY * YLOG2DEVREL(height);
if ( LockPixels(bmappixels) )
{
Rect srcrect , dstrect ;
- srcrect.top = source->YLOG2DEV(ysrc) + source->m_macLocalOrigin.v ;
- srcrect.left = source->XLOG2DEV(xsrc) + source->m_macLocalOrigin.h ;
- srcrect.right = source->XLOG2DEV(xsrc + width ) + source->m_macLocalOrigin.v;
- srcrect.bottom = source->YLOG2DEV(ysrc + height) + source->m_macLocalOrigin.h;
- dstrect.top = YLOG2DEV(ydest) ;
- dstrect.left = XLOG2DEV(xdest) ;
- dstrect.bottom = YLOG2DEV(ydest + height ) ;
- dstrect.right = XLOG2DEV(xdest + width ) ;
+ srcrect.top = source->YLOG2DEVMAC(ysrc) ;
+ srcrect.left = source->XLOG2DEVMAC(xsrc) ;
+ srcrect.right = source->XLOG2DEVMAC(xsrc + width ) ;
+ srcrect.bottom = source->YLOG2DEVMAC(ysrc + height) ;
+ dstrect.top = YLOG2DEVMAC(ydest) ;
+ dstrect.left = XLOG2DEVMAC(xdest) ;
+ dstrect.bottom = YLOG2DEVMAC(ydest + height ) ;
+ dstrect.right = XLOG2DEVMAC(xdest + width ) ;
short mode = (logical_func == wxCOPY ? srcCopy :
// logical_func == wxCLEAR ? WHITENESS :
textPixel = data[(srcY*w + srcX)*3] == 0;
if ( textPixel || (m_backgroundMode == wxSOLID) )
{
- SetCPixel(XLOG2DEV(x + dstX), YLOG2DEV(y + dstY),
+ SetCPixel(XLOG2DEVMAC(x + dstX), YLOG2DEVMAC(y + dstY),
textPixel ? &colText : &colBack);
}
}
#if 0
if ( m_font.GetUnderlined() )
{
- ::MoveTo(XLOG2DEV(x + x4), YLOG2DEV(y + y4 + font->descent));
- ::LineTo(XLOG2DEV(x + x3), YLOG2DEV(y + y3 + font->descent));
+ ::MoveTo(XLOG2DEVMAC(x + x4), YLOG2DEVMAC(y + y4 + font->descent));
+ ::LineTo(XLOG2DEVMAC(x + x3), YLOG2DEVMAC(y + y3 + font->descent));
}
#endif // 0
wxCHECK_RET(Ok(), wxT("wxDC::DoDrawText Invalid DC"));
wxMacPortSetter helper(this) ;
- long xx = XLOG2DEV(x);
- long yy = YLOG2DEV(y);
+ long xx = XLOG2DEVMAC(x);
+ long yy = YLOG2DEVMAC(y);
// if (m_pen.GetStyle() != wxTRANSPARENT)
{
m_macFontInstalled = false ;
}
-int wxDC::MacSetupBackgroundForCurrentPort(const wxBrush& background )
+void wxDC::MacSetupBackgroundForCurrentPort(const wxBrush& background )
{
Pattern whiteColor ;
- if ( background.IsMacTheme() )
- {
- SetThemeBackground( background.GetMacTheme() , wxDisplayDepth() , true ) ;
- }
- else if ( background.IsMacThemeBackground() )
- {
- Rect originBox = { 0,0,1,1 } ;
- ::ApplyThemeBackground( background.GetMacThemeBackground() , &originBox ,kThemeStateActive ,
- wxDisplayDepth() , true ) ;
- }
- else
- {
- ::RGBBackColor( &background.GetColour().GetPixel() );
- int brushStyle = background.GetStyle();
- if (brushStyle == wxSOLID)
- ::BackPat(GetQDGlobalsWhite(&whiteColor));
- else if (IS_HATCH(brushStyle))
- {
- Pattern pat ;
- wxMacGetHatchPattern(brushStyle, &pat);
- ::BackPat(&pat);
- }
- else
- {
- ::BackPat(GetQDGlobalsWhite(&whiteColor));
- }
- }
- return 0 ;
+ switch( background.MacGetBrushKind() )
+ {
+ case kwxMacBrushTheme :
+ {
+ ::SetThemeBackground( background.GetMacTheme() , wxDisplayDepth() , true ) ;
+ break ;
+ }
+ case kwxMacBrushThemeBackground :
+ {
+ Rect extent ;
+ ThemeBackgroundKind bg = background.GetMacThemeBackground( &extent ) ;
+ ::ApplyThemeBackground( bg , &extent ,kThemeStateActive , wxDisplayDepth() , true ) ;
+ break ;
+ }
+ case kwxMacBrushColour :
+ {
+ ::RGBBackColor( &background.GetColour().GetPixel() );
+ int brushStyle = background.GetStyle();
+ if (brushStyle == wxSOLID)
+ ::BackPat(GetQDGlobalsWhite(&whiteColor));
+ else if (IS_HATCH(brushStyle))
+ {
+ Pattern pat ;
+ wxMacGetHatchPattern(brushStyle, &pat);
+ ::BackPat(&pat);
+ }
+ else
+ {
+ ::BackPat(GetQDGlobalsWhite(&whiteColor));
+ }
+ break ;
+ }
+ }
}
void wxDC::MacInstallBrush() const
the_canvas->MacGetPortParams(&m_macLocalOrigin, &clipRect , &windowref , &rootwindow );
SetRectRgn( m_macBoundaryClipRgn , clipRect.left , clipRect.top , clipRect.right , clipRect.bottom ) ;
SectRgn( m_macBoundaryClipRgn , the_canvas->MacGetVisibleRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ;
+ OffsetRgn( m_macBoundaryClipRgn , m_macLocalOrigin.h , m_macLocalOrigin.v ) ;
CopyRgn( m_macBoundaryClipRgn , m_macCurrentClipRgn ) ;
m_macPort = UMAGetWindowPort( windowref ) ;
m_minY = m_minX = 0;
SetRectRgn( m_macBoundaryClipRgn , clipRect.left + origin.x , clipRect.top + origin.y , clipRect.right + origin.x , clipRect.bottom + origin.y ) ;
SectRgn( m_macBoundaryClipRgn , window->MacGetVisibleRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ;
OffsetRgn( m_macBoundaryClipRgn , -origin.x , -origin.y ) ;
+ OffsetRgn( m_macBoundaryClipRgn , m_macLocalOrigin.h , m_macLocalOrigin.v ) ;
CopyRgn( m_macBoundaryClipRgn , m_macCurrentClipRgn ) ;
m_macPort = UMAGetWindowPort( windowref ) ;
m_minY = m_minX = 0;
SectRgn( m_macBoundaryClipRgn , window->MacGetVisibleRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ;
OffsetRgn( m_macBoundaryClipRgn , -origin.x , -origin.y ) ;
SectRgn( m_macBoundaryClipRgn , window->GetUpdateRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ;
+ OffsetRgn( m_macBoundaryClipRgn , m_macLocalOrigin.h , m_macLocalOrigin.v ) ;
CopyRgn( m_macBoundaryClipRgn , m_macCurrentClipRgn ) ;
m_macPort = UMAGetWindowPort( windowref ) ;
m_ok = TRUE ;
m_macLocalOrigin.h = (**m_printData.m_macPrintInfo).rPaper.left ;
m_macLocalOrigin.v = (**m_printData.m_macPrintInfo).rPaper.top ;
- SetOrigin( - m_macLocalOrigin.h , - m_macLocalOrigin.v ) ;
Rect clip = { -32000 , -32000 , 32000 , 32000 } ;
::ClipRect( &clip ) ;
err = PrError() ;
{
wxMacDrawingHelper help( win ) ;
// the mac control manager always assumes to have the origin at 0,0
- SetOrigin( 0 , 0 ) ;
bool hasTabBehind = false ;
wxWindow* parent = GetParent() ;
{
wxMacDrawingHelper help( win ) ;
// the mac control manager always assumes to have the origin at 0,0
- SetOrigin( 0 , 0 ) ;
bool hasTabBehind = false ;
wxWindow* parent = GetParent() ;
{
wxMacDrawingHelper help( win ) ;
// the mac control manager always assumes to have the origin at 0,0
- SetOrigin( 0 , 0 ) ;
bool hasTabBehind = false ;
wxWindow* parent = GetParent() ;
if ( win )
{
wxMacDrawingHelper help( win ) ;
- // the mac control manager always assumes to have the origin at 0,0
- SetOrigin( 0 , 0 ) ;
-
+ // the mac control manager always assumes to have the origin at 0,0
bool hasTabBehind = false ;
wxWindow* parent = GetParent() ;
while ( parent )
{
wxMacDrawingHelper help( win ) ;
// the mac control manager always assumes to have the origin at 0,0
- SetOrigin( 0 , 0 ) ;
-
bool hasTabBehind = false ;
wxWindow* parent = GetParent() ;
while ( parent )
#endif
m_shown = true ;
- SetOrigin( 0 , 0 ) ;
TextFont( kFontIDGeneva ) ;
TextSize( 10 ) ;
TextFace( 0 ) ;
#endif
m_shown = false ;
- SetOrigin( 0 , 0 ) ;
BackColor( whiteColor ) ;
ForeColor(blackColor ) ;
DrawPicture(m_backpict, &m_rect);
m_macFocus = NULL ;
}
-void wxTopLevelWindowMac::MacDoGetPortClientParams(Point* localOrigin, Rect* clipRect, WindowRef *window , wxWindowMac** rootwin )
-{
- localOrigin->h = 0;
- localOrigin->v = 0;
- clipRect->left = 0;
- clipRect->top = 0;
- clipRect->right = m_width ;//width;
- clipRect->bottom = m_height ;// height;
- *window = m_macWindow ;
- *rootwin = this ;
-}
-
void wxTopLevelWindowMac::MacGetPortParams(Point* localOrigin, Rect* clipRect, WindowRef *window , wxWindowMac** rootwin)
{
localOrigin->h = 0;
void wxTopLevelWindowMac::Clear()
{
- wxMacDrawingClientHelper helper ( this ) ;
- int w ,h ;
- wxPoint origin = GetClientAreaOrigin() ;
- GetClientSize( &w , &h ) ;
- ::SetThemeWindowBackground( m_macWindow , m_macWindowBackgroundTheme , false ) ;
- Rect r = { origin.y , origin.x, origin.y+h , origin.x+w } ;
- EraseRect( &r ) ;
+ wxWindow::Clear() ;
}
ControlHandle wxTopLevelWindowMac::MacGetContainerForEmbedding()
#else
AGAPortHelper help( (m_macWindow) ) ;
#endif
- SetOrigin( 0 , 0 ) ;
BeginUpdate( m_macWindow ) ;
RgnHandle updateRgn = NewRgn();
SetPortWindowPort( inWindow ) ;
- SetOrigin( 0 , 0 ) ;
err = SetKeyboardFocus( inWindow , inControl , inPart ) ;
SetPort( port ) ;
return err ;
GrafPtr port ;
GetPort( &port ) ;
SetPortWindowPort( inWindowRef ) ;
- SetOrigin( 0 , 0 ) ;
HiliteWindow( inWindowRef , inActivate ) ;
ControlHandle control = NULL ;
::GetRootControl( inWindowRef , & control ) ;
GrafPtr port ;
::GetPort( &port ) ;
::SetPort( UMAGetWindowPort( window ) ) ;
- ::SetOrigin( 0 , 0 ) ;
+
::LocalToGlobal( &localwhere ) ;
::SetPort( port ) ;
if(x) *x = localwhere.h ;
if ( focus.Ok() )
{
Rect clientrect = { 0 , 0 , m_height , m_width } ;
+ focus.LocalToWindow( &clientrect ) ;
// ClipRect( &clientrect ) ;
InvalWindowRect( MacGetRootWindow() , &clientrect ) ;
}
if ( focus.Ok() )
{
Rect clientrect = { 0 , 0 , m_height , m_width } ;
+ focus.LocalToWindow( &clientrect ) ;
// ClipRect( &clientrect ) ;
InvalWindowRect( MacGetRootWindow() , &clientrect ) ;
}
// if we have the normal colours in the hierarchy but another control etc. -> use it's background
if ( parent->IsKindOf( CLASSINFO( wxNotebook ) ) || parent->IsKindOf( CLASSINFO( wxTabCtrl ) ))
{
- m_macBackgroundBrush.SetMacThemeBackground( kThemeBackgroundTabPane ) ; // todo eventually change for inactive
+ Rect extent = { 0 , 0 , 0 , 0 } ;
+ int x , y ;
+ x = y = 0 ;
+ wxSize size = GetSize() ;
+ parent->MacClientToRootWindow( &x , &y ) ;
+ extent.left = x ;
+ extent.top = y ;
+ extent.top-- ;
+ extent.right = x + size.x ;
+ extent.bottom = y + size.y ;
+ m_macBackgroundBrush.SetMacThemeBackground( kThemeBackgroundTabPane , extent ) ; // todo eventually change for inactive
break ;
}
}
wxMacDrawingHelper focus( this ) ;
if ( focus.Ok() )
{
- MacPaintBorders() ;
+ MacPaintBorders( focus.GetOrigin().h , focus.GetOrigin().v) ;
}
}
}
}
-void wxWindowMac::MacPaintBorders( )
+void wxWindowMac::MacPaintBorders( int left , int top )
{
if( IsTopLevel() )
return ;
if (HasFlag(wxRAISED_BORDER) || HasFlag( wxSUNKEN_BORDER) || HasFlag(wxDOUBLE_BORDER) )
{
#if wxMAC_USE_THEME_BORDER
- Rect rect = { 0 , 0 , m_height , m_width } ;
+ Rect rect = { top , left , m_height + top , m_width + left } ;
SInt32 border = 0 ;
/*
GetThemeMetric( kThemeMetricListBoxFrameOutset , &border ) ;
#else
bool sunken = HasFlag( wxSUNKEN_BORDER ) ;
RGBForeColor( &face );
- MoveTo( 0 , m_height - 2 );
- LineTo( 0 , 0 );
- LineTo( m_width - 2 , 0 );
+ MoveTo( left + 0 , top + m_height - 2 );
+ LineTo( left + 0 , top + 0 );
+ LineTo( left + m_width - 2 , top + 0 );
- MoveTo( 2 , m_height - 3 );
- LineTo( m_width - 3 , m_height - 3 );
- LineTo( m_width - 3 , 2 );
+ MoveTo( left + 2 , top + m_height - 3 );
+ LineTo( left + m_width - 3 , top + m_height - 3 );
+ LineTo( left + m_width - 3 , top + 2 );
RGBForeColor( sunken ? &face : &black );
- MoveTo( 0 , m_height - 1 );
- LineTo( m_width - 1 , m_height - 1 );
- LineTo( m_width - 1 , 0 );
+ MoveTo( left + 0 , top + m_height - 1 );
+ LineTo( left + m_width - 1 , top + m_height - 1 );
+ LineTo( left + m_width - 1 , top + 0 );
RGBForeColor( sunken ? &shadow : &white );
- MoveTo( 1 , m_height - 3 );
- LineTo( 1, 1 );
- LineTo( m_width - 3 , 1 );
+ MoveTo( left + 1 , top + m_height - 3 );
+ LineTo( left + 1, top + 1 );
+ LineTo( left + m_width - 3 , top + 1 );
RGBForeColor( sunken ? &white : &shadow );
- MoveTo( 1 , m_height - 2 );
- LineTo( m_width - 2 , m_height - 2 );
- LineTo( m_width - 2 , 1 );
+ MoveTo( left + 1 , top + m_height - 2 );
+ LineTo( left + m_width - 2 , top + m_height - 2 );
+ LineTo( left + m_width - 2 , top + 1 );
RGBForeColor( sunken ? &black : &face );
- MoveTo( 2 , m_height - 4 );
- LineTo( 2 , 2 );
- LineTo( m_width - 4 , 2 );
+ MoveTo( left + 2 , top + m_height - 4 );
+ LineTo( left + 2 , top + 2 );
+ LineTo( left + m_width - 4 , top + 2 );
#endif
}
else if (HasFlag(wxSIMPLE_BORDER))
{
- Rect rect = { 0 , 0 , m_height , m_width } ;
+ Rect rect = { top , left , m_height + top , m_width + left } ;
RGBForeColor( &black ) ;
FrameRect( &rect ) ;
}
// Does a physical scroll
void wxWindowMac::ScrollWindow(int dx, int dy, const wxRect *rect)
{
- wxMacDrawingClientHelper focus( this ) ;
+ wxMacDrawingHelper focus( this , true ) ;
if ( focus.Ok() )
{
int width , height ;
GetClientSize( &width , &height ) ;
Rect scrollrect = { 0 , 0 , height , width } ;
-
+ focus.LocalToWindow( &scrollrect ) ;
RgnHandle updateRgn = NewRgn() ;
ClipRect( &scrollrect ) ;
if ( rect )
{
Rect r = { rect->y , rect->x , rect->y + rect->height , rect->x + rect->width } ;
+ focus.LocalToWindow( &r ) ;
SectRect( &scrollrect , &r , &scrollrect ) ;
}
ScrollRect( &scrollrect , dx , dy , updateRgn ) ;
}
}
-bool wxWindowMac::MacSetPortFocusParams( const Point & localOrigin, const Rect & clipRect, WindowRef window , wxWindowMac* win )
-{
- if ( window == NULL )
- return false ;
-
- GrafPtr currPort;
- GrafPtr port ;
-
- ::GetPort(&currPort);
- port = UMAGetWindowPort( window) ;
- if (currPort != port )
- ::SetPort(port);
-
-// wxASSERT( port->portRect.left == 0 && port->portRect.top == 0 ) ;
- ::SetOrigin(-localOrigin.h, -localOrigin.v);
- return true;
-}
-
bool wxWindowMac::MacSetPortDrawingParams( const Point & localOrigin, const Rect & clipRect, WindowRef window , wxWindowMac* win )
{
if ( window == NULL )
port = UMAGetWindowPort( window) ;
if (currPort != port )
::SetPort(port);
-// wxASSERT( port->portRect.left == 0 && port->portRect.top == 0 ) ;
- ::SetOrigin(-localOrigin.h, -localOrigin.v);
- ::ClipRect(&clipRect);
+ Rect cr = clipRect ;
+ OffsetRect( &cr , localOrigin.h , localOrigin.v ) ;
+ ::ClipRect(&cr);
::PenNormal() ;
::RGBBackColor(& win->GetBackgroundColour().GetPixel() ) ;
SectRect(clipRect, &myClip, clipRect);
}
-void wxWindowMac::MacDoGetPortClientParams(Point* localOrigin, Rect* clipRect, WindowRef *window , wxWindowMac** rootwin )
-{
- wxASSERT( GetParent() != NULL ) ;
-
- GetParent()->MacDoGetPortClientParams( localOrigin , clipRect , window, rootwin) ;
-
- localOrigin->h += m_x;
- localOrigin->v += m_y;
- OffsetRect(clipRect, -m_x, -m_y);
-
- Rect myClip;
- myClip.left = 0;
- myClip.top = 0;
- myClip.right = m_width ;//width;
- myClip.bottom = m_height ;// height;
- SectRect(clipRect, &myClip, clipRect);
-}
-
void wxWindowMac::MacGetPortClientParams(Point* localOrigin, Rect* clipRect, WindowRef *window , wxWindowMac** rootwin )
{
- MacDoGetPortClientParams( localOrigin , clipRect , window , rootwin ) ;
+ MacGetPortParams( localOrigin , clipRect, window , rootwin ) ;
int width , height ;
GetClientSize( &width , &height ) ;
localOrigin->v += client.y;
OffsetRect(clipRect, -client.x, -client.y);
- Rect myClip;
- myClip.left = 0;
- myClip.top = 0;
- myClip.right = width;
- myClip.bottom = height;
+ Rect myClip = { 0 , 0 , height , width } ;
SectRect(clipRect, &myClip, clipRect);
}
}
-wxMacDrawingHelper::wxMacDrawingHelper( wxWindowMac * theWindow )
+wxMacDrawingHelper::wxMacDrawingHelper( wxWindowMac * theWindow , bool clientArea )
{
m_ok = false ;
- Point localOrigin ;
Rect clipRect ;
WindowRef window ;
wxWindowMac *rootwin ;
GetPort( &m_formerPort ) ;
if ( theWindow )
{
- theWindow->MacGetPortParams( &localOrigin , &clipRect , &window , &rootwin) ;
+ if ( clientArea )
+ theWindow->MacGetPortClientParams( &m_origin , &clipRect , &window , &rootwin) ;
+ else
+ theWindow->MacGetPortParams( &m_origin , &clipRect , &window , &rootwin) ;
m_currentPort = UMAGetWindowPort( window ) ;
if ( m_formerPort != m_currentPort )
SetPort( m_currentPort ) ;
GetPenState( &m_savedPenState ) ;
- theWindow->MacSetPortDrawingParams( localOrigin, clipRect, window , rootwin ) ;
+ theWindow->MacSetPortDrawingParams( m_origin, clipRect, window , rootwin ) ;
m_ok = true ;
}
}
{
SetPort( m_currentPort ) ;
SetPenState( &m_savedPenState ) ;
- SetOrigin( 0 , 0 ) ;
- Rect portRect ;
- GetPortBounds( m_currentPort , &portRect ) ;
- ClipRect( &portRect ) ;
- }
-
- if ( m_formerPort != m_currentPort )
- SetPort( m_formerPort ) ;
-}
-
-wxMacDrawingClientHelper::wxMacDrawingClientHelper( wxWindowMac * theWindow )
-{
- m_ok = false ;
- Point localOrigin ;
- Rect clipRect ;
- WindowRef window ;
- wxWindowMac *rootwin ;
- m_currentPort = NULL ;
-
- GetPort( &m_formerPort ) ;
-
- if ( theWindow )
- {
- theWindow->MacGetPortClientParams( &localOrigin , &clipRect , &window , &rootwin) ;
- m_currentPort = UMAGetWindowPort( window ) ;
- if ( m_formerPort != m_currentPort )
- SetPort( m_currentPort ) ;
- GetPenState( &m_savedPenState ) ;
- theWindow->MacSetPortDrawingParams( localOrigin, clipRect, window , rootwin ) ;
- m_ok = true ;
- }
-}
-
-wxMacDrawingClientHelper::~wxMacDrawingClientHelper()
-{
- if ( m_ok )
- {
- SetPort( m_currentPort ) ;
- SetPenState( &m_savedPenState ) ;
- SetOrigin( 0 , 0 ) ;
Rect portRect ;
GetPortBounds( m_currentPort , &portRect ) ;
ClipRect( &portRect ) ;