corrections for theme brush alignments under X (no more SetOrigin calls)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13223 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor 2001-12-29 09:59:59 +00:00
parent 5b36f53bd1
commit 7d9d1fd708
26 changed files with 348 additions and 516 deletions

View File

@ -2619,7 +2619,6 @@ AGAPortHelper::~AGAPortHelper()
TextSize( size );
TextFace( style );
TextMode( mode );
SetOrigin( 0 , 0 ) ;
SetPort( port ) ;
}
}

View File

@ -1161,7 +1161,6 @@ void wxApp::MacHandleMouseDownEvent( EventRecord *ev )
#else
SetPort( (window) ) ;
#endif
SetOrigin( 0 , 0 ) ;
LocalToGlobal( &pt ) ;
SetPort( port ) ;
win->SetSize( pt.h , pt.v , -1 ,
@ -1232,7 +1231,6 @@ void wxApp::MacHandleMouseDownEvent( EventRecord *ev )
#else
SetPort( (window) ) ;
#endif
SetOrigin( 0 , 0 ) ;
SetPort( port ) ;
}
if ( window != frontWindow && wxTheApp->s_captureWindow == NULL )

View File

@ -24,8 +24,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxBrush, wxGDIObject)
wxBrushRefData::wxBrushRefData()
{
m_style = wxSOLID;
m_isMacTheme = false ;
m_isMacThemeBackground = false ;
m_macBrushKind = kwxMacBrushColour ;
}
wxBrushRefData::wxBrushRefData(const wxBrushRefData& data)
@ -33,8 +32,10 @@ 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()
@ -74,7 +75,7 @@ wxBrush::wxBrush(ThemeBrush macThemeBrush )
{
m_refData = new wxBrushRefData;
M_BRUSHDATA->m_isMacTheme = true;
M_BRUSHDATA->m_macBrushKind = kwxMacBrushTheme;
M_BRUSHDATA->m_macThemeBrush = macThemeBrush;
RealizeResource();
@ -97,8 +98,7 @@ void wxBrush::Unshare()
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();
@ -108,8 +108,7 @@ void wxBrush::SetColour(unsigned char r, unsigned char g, unsigned char b)
{
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();
@ -119,8 +118,7 @@ void wxBrush::SetStyle(int Style)
{
Unshare();
M_BRUSHDATA->m_isMacTheme = false;
M_BRUSHDATA->m_isMacThemeBackground = false ;
M_BRUSHDATA->m_macBrushKind = kwxMacBrushColour;
M_BRUSHDATA->m_style = Style;
RealizeResource();
@ -130,6 +128,7 @@ void wxBrush::SetStipple(const wxBitmap& Stipple)
{
Unshare();
M_BRUSHDATA->m_macBrushKind = kwxMacBrushColour;
M_BRUSHDATA->m_stipple = Stipple;
RealizeResource();
@ -139,21 +138,19 @@ void wxBrush::SetMacTheme(ThemeBrush macThemeBrush)
{
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();
}
@ -162,3 +159,17 @@ bool wxBrush::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 ;
}
}

View File

@ -2619,7 +2619,6 @@ AGAPortHelper::~AGAPortHelper()
TextSize( size );
TextFace( style );
TextMode( mode );
SetOrigin( 0 , 0 ) ;
SetPort( port ) ;
}
}

View File

@ -1161,7 +1161,6 @@ void wxApp::MacHandleMouseDownEvent( EventRecord *ev )
#else
SetPort( (window) ) ;
#endif
SetOrigin( 0 , 0 ) ;
LocalToGlobal( &pt ) ;
SetPort( port ) ;
win->SetSize( pt.h , pt.v , -1 ,
@ -1232,7 +1231,6 @@ void wxApp::MacHandleMouseDownEvent( EventRecord *ev )
#else
SetPort( (window) ) ;
#endif
SetOrigin( 0 , 0 ) ;
SetPort( port ) ;
}
if ( window != frontWindow && wxTheApp->s_captureWindow == NULL )

View File

@ -24,8 +24,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxBrush, wxGDIObject)
wxBrushRefData::wxBrushRefData()
{
m_style = wxSOLID;
m_isMacTheme = false ;
m_isMacThemeBackground = false ;
m_macBrushKind = kwxMacBrushColour ;
}
wxBrushRefData::wxBrushRefData(const wxBrushRefData& data)
@ -33,8 +32,10 @@ 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()
@ -74,7 +75,7 @@ wxBrush::wxBrush(ThemeBrush macThemeBrush )
{
m_refData = new wxBrushRefData;
M_BRUSHDATA->m_isMacTheme = true;
M_BRUSHDATA->m_macBrushKind = kwxMacBrushTheme;
M_BRUSHDATA->m_macThemeBrush = macThemeBrush;
RealizeResource();
@ -97,8 +98,7 @@ void wxBrush::Unshare()
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();
@ -108,8 +108,7 @@ void wxBrush::SetColour(unsigned char r, unsigned char g, unsigned char b)
{
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();
@ -119,8 +118,7 @@ void wxBrush::SetStyle(int Style)
{
Unshare();
M_BRUSHDATA->m_isMacTheme = false;
M_BRUSHDATA->m_isMacThemeBackground = false ;
M_BRUSHDATA->m_macBrushKind = kwxMacBrushColour;
M_BRUSHDATA->m_style = Style;
RealizeResource();
@ -130,6 +128,7 @@ void wxBrush::SetStipple(const wxBitmap& Stipple)
{
Unshare();
M_BRUSHDATA->m_macBrushKind = kwxMacBrushColour;
M_BRUSHDATA->m_stipple = Stipple;
RealizeResource();
@ -139,21 +138,19 @@ void wxBrush::SetMacTheme(ThemeBrush macThemeBrush)
{
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();
}
@ -162,3 +159,17 @@ bool wxBrush::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 ;
}
}

View File

@ -647,7 +647,6 @@ void wxControl::MacRedrawControl()
{
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 ) ;
}
@ -667,7 +666,6 @@ void wxControl::OnPaint(wxPaintEvent& event)
{
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 ) ;
}

View File

@ -119,8 +119,6 @@ wxDC::~wxDC(void)
}
void wxDC::MacSetupPort(AGAPortHelper* help) const
{
// help->Setup( m_macPort ) ;
::SetOrigin(-m_macLocalOrigin.h, -m_macLocalOrigin.v);
SetClip( m_macCurrentClipRgn);
m_macFontInstalled = false ;
@ -136,8 +134,8 @@ void wxDC::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, bool useMask
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);
@ -238,8 +236,8 @@ void wxDC::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord hei
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);
@ -278,8 +276,8 @@ void wxDC::DoSetClippingRegionAsRegion( const wxRegion &region )
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);
@ -531,7 +529,7 @@ bool wxDC::DoGetPixel( wxCoord x, wxCoord y, wxColour *col ) const
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,
@ -553,10 +551,10 @@ void wxDC::DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 )
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))
@ -593,14 +591,14 @@ void wxDC::DoCrossHair( wxCoord x, wxCoord y )
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) );
}
}
@ -645,12 +643,12 @@ void wxDC::DoDrawArc( wxCoord x1, wxCoord y1,
{
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));
@ -701,8 +699,8 @@ void wxDC::DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord w, wxCoord h,
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);
@ -736,8 +734,8 @@ void wxDC::DoDrawPoint( wxCoord x, wxCoord y )
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);
@ -759,14 +757,14 @@ void wxDC::DoDrawLines(int n, wxPoint points[],
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 );
}
}
@ -784,14 +782,14 @@ void wxDC::DoDrawPolygon(int n, wxPoint points[],
{
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);
}
@ -807,14 +805,14 @@ void wxDC::DoDrawPolygon(int n, wxPoint points[],
{
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);
}
@ -835,8 +833,8 @@ void wxDC::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord 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);
@ -882,8 +880,8 @@ void wxDC::DoDrawRoundedRectangle(wxCoord x, wxCoord y,
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);
@ -924,8 +922,8 @@ void wxDC::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord 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);
@ -995,14 +993,14 @@ bool wxDC::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord 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 :
@ -1140,7 +1138,7 @@ void wxDC::DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y,
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);
}
}
@ -1151,8 +1149,8 @@ void wxDC::DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y,
#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
@ -1165,8 +1163,8 @@ void wxDC::DoDrawText(const wxString& strtext, wxCoord x, wxCoord y)
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)
{
@ -1561,37 +1559,42 @@ void wxDC::MacInstallPen() const
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

View File

@ -55,6 +55,7 @@ wxWindowDC::wxWindowDC(wxWindow *the_canvas)
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;
@ -90,6 +91,7 @@ wxClientDC::wxClientDC(wxWindow *window)
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;
@ -126,6 +128,7 @@ wxPaintDC::wxPaintDC(wxWindow *window)
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 ;

View File

@ -237,7 +237,6 @@ void wxPrinterDC::StartPage(void)
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() ;

View File

@ -187,7 +187,6 @@ void wxTextCtrl::SetValue(const wxString& st)
{
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() ;
@ -263,7 +262,6 @@ void wxTextCtrl::Paste()
{
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() ;
@ -1895,7 +1893,6 @@ void wxTextCtrl::SetValue(const wxString& st)
{
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() ;
@ -1986,9 +1983,7 @@ void wxTextCtrl::Paste()
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 )

View File

@ -588,8 +588,6 @@ void wxToolBar::OnPaint(wxPaintEvent& event)
{
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 )

View File

@ -226,7 +226,6 @@ void wxMacToolTip::Draw()
#endif
m_shown = true ;
SetOrigin( 0 , 0 ) ;
TextFont( kFontIDGeneva ) ;
TextSize( 10 ) ;
TextFace( 0 ) ;
@ -333,7 +332,6 @@ void wxMacToolTip::Clear()
#endif
m_shown = false ;
SetOrigin( 0 , 0 ) ;
BackColor( whiteColor ) ;
ForeColor(blackColor ) ;
DrawPicture(m_backpict, &m_rect);

View File

@ -279,18 +279,6 @@ void wxTopLevelWindowMac::MacCreateRealWindow( const wxString& title,
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;
@ -305,13 +293,7 @@ void wxTopLevelWindowMac::MacGetPortParams(Point* localOrigin, Rect* clipRect, W
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()
@ -327,7 +309,6 @@ void wxTopLevelWindowMac::MacUpdate( long timestamp)
#else
AGAPortHelper help( (m_macWindow) ) ;
#endif
SetOrigin( 0 , 0 ) ;
BeginUpdate( m_macWindow ) ;
RgnHandle updateRgn = NewRgn();

View File

@ -497,7 +497,6 @@ OSErr UMASetKeyboardFocus (WindowPtr inWindow,
SetPortWindowPort( inWindow ) ;
SetOrigin( 0 , 0 ) ;
err = SetKeyboardFocus( inWindow , inControl , inPart ) ;
SetPort( port ) ;
return err ;
@ -549,7 +548,6 @@ void UMAHighlightAndActivateWindow( WindowRef inWindowRef , bool inActivate )
GrafPtr port ;
GetPort( &port ) ;
SetPortWindowPort( inWindowRef ) ;
SetOrigin( 0 , 0 ) ;
HiliteWindow( inWindowRef , inActivate ) ;
ControlHandle control = NULL ;
::GetRootControl( inWindowRef , & control ) ;

View File

@ -366,7 +366,7 @@ void wxWindowMac::DoClientToScreen(int *x, int *y) const
GrafPtr port ;
::GetPort( &port ) ;
::SetPort( UMAGetWindowPort( window ) ) ;
::SetOrigin( 0 , 0 ) ;
::LocalToGlobal( &localwhere ) ;
::SetPort( port ) ;
if(x) *x = localwhere.h ;
@ -560,6 +560,7 @@ void wxWindowMac::DoMoveWindow(int x, int y, int width, int height)
if ( focus.Ok() )
{
Rect clientrect = { 0 , 0 , m_height , m_width } ;
focus.LocalToWindow( &clientrect ) ;
// ClipRect( &clientrect ) ;
InvalWindowRect( MacGetRootWindow() , &clientrect ) ;
}
@ -575,6 +576,7 @@ void wxWindowMac::DoMoveWindow(int x, int y, int width, int height)
if ( focus.Ok() )
{
Rect clientrect = { 0 , 0 , m_height , m_width } ;
focus.LocalToWindow( &clientrect ) ;
// ClipRect( &clientrect ) ;
InvalWindowRect( MacGetRootWindow() , &clientrect ) ;
}
@ -909,7 +911,17 @@ const wxBrush& wxWindowMac::MacGetBackgroundBrush()
// 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 ;
}
}
@ -939,7 +951,7 @@ void wxWindowMac::OnNcPaint( wxNcPaintEvent& event )
wxMacDrawingHelper focus( this ) ;
if ( focus.Ok() )
{
MacPaintBorders() ;
MacPaintBorders( focus.GetOrigin().h , focus.GetOrigin().v) ;
}
}
@ -1004,7 +1016,7 @@ void wxWindowMac::SetScrollPos(int orient, int pos, bool refresh)
}
}
void wxWindowMac::MacPaintBorders( )
void wxWindowMac::MacPaintBorders( int left , int top )
{
if( IsTopLevel() )
return ;
@ -1018,7 +1030,7 @@ void wxWindowMac::MacPaintBorders( )
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 ) ;
@ -1030,38 +1042,38 @@ void wxWindowMac::MacPaintBorders( )
#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 ) ;
}
@ -1111,19 +1123,20 @@ void wxWindowMac::SetScrollbar(int orient, int pos, int thumbVisible,
// 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 ) ;
@ -1714,24 +1727,6 @@ void wxWindowMac::MacTopLevelWindowChangedPosition()
}
}
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 )
@ -1743,9 +1738,9 @@ bool wxWindowMac::MacSetPortDrawingParams( const Point & localOrigin, const Rect
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() ) ;
@ -1773,27 +1768,9 @@ void wxWindowMac::MacGetPortParams(Point* localOrigin, Rect* clipRect, WindowRef
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 ) ;
@ -1804,11 +1781,7 @@ void wxWindowMac::MacGetPortClientParams(Point* localOrigin, Rect* clipRect, Win
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);
}
@ -1868,10 +1841,9 @@ long wxWindowMac::MacRemoveBordersFromStyle( long style )
}
wxMacDrawingHelper::wxMacDrawingHelper( wxWindowMac * theWindow )
wxMacDrawingHelper::wxMacDrawingHelper( wxWindowMac * theWindow , bool clientArea )
{
m_ok = false ;
Point localOrigin ;
Rect clipRect ;
WindowRef window ;
wxWindowMac *rootwin ;
@ -1880,12 +1852,15 @@ wxMacDrawingHelper::wxMacDrawingHelper( wxWindowMac * theWindow )
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 ;
}
}
@ -1896,46 +1871,6 @@ wxMacDrawingHelper::~wxMacDrawingHelper()
{
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 ) ;

View File

@ -647,7 +647,6 @@ void wxControl::MacRedrawControl()
{
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 ) ;
}
@ -667,7 +666,6 @@ void wxControl::OnPaint(wxPaintEvent& event)
{
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 ) ;
}

View File

@ -119,8 +119,6 @@ wxDC::~wxDC(void)
}
void wxDC::MacSetupPort(AGAPortHelper* help) const
{
// help->Setup( m_macPort ) ;
::SetOrigin(-m_macLocalOrigin.h, -m_macLocalOrigin.v);
SetClip( m_macCurrentClipRgn);
m_macFontInstalled = false ;
@ -136,8 +134,8 @@ void wxDC::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, bool useMask
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);
@ -238,8 +236,8 @@ void wxDC::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord hei
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);
@ -278,8 +276,8 @@ void wxDC::DoSetClippingRegionAsRegion( const wxRegion &region )
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);
@ -531,7 +529,7 @@ bool wxDC::DoGetPixel( wxCoord x, wxCoord y, wxColour *col ) const
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,
@ -553,10 +551,10 @@ void wxDC::DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 )
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))
@ -593,14 +591,14 @@ void wxDC::DoCrossHair( wxCoord x, wxCoord y )
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) );
}
}
@ -645,12 +643,12 @@ void wxDC::DoDrawArc( wxCoord x1, wxCoord y1,
{
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));
@ -701,8 +699,8 @@ void wxDC::DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord w, wxCoord h,
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);
@ -736,8 +734,8 @@ void wxDC::DoDrawPoint( wxCoord x, wxCoord y )
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);
@ -759,14 +757,14 @@ void wxDC::DoDrawLines(int n, wxPoint points[],
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 );
}
}
@ -784,14 +782,14 @@ void wxDC::DoDrawPolygon(int n, wxPoint points[],
{
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);
}
@ -807,14 +805,14 @@ void wxDC::DoDrawPolygon(int n, wxPoint points[],
{
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);
}
@ -835,8 +833,8 @@ void wxDC::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord 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);
@ -882,8 +880,8 @@ void wxDC::DoDrawRoundedRectangle(wxCoord x, wxCoord y,
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);
@ -924,8 +922,8 @@ void wxDC::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord 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);
@ -995,14 +993,14 @@ bool wxDC::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord 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 :
@ -1140,7 +1138,7 @@ void wxDC::DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y,
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);
}
}
@ -1151,8 +1149,8 @@ void wxDC::DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y,
#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
@ -1165,8 +1163,8 @@ void wxDC::DoDrawText(const wxString& strtext, wxCoord x, wxCoord y)
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)
{
@ -1561,37 +1559,42 @@ void wxDC::MacInstallPen() const
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

View File

@ -55,6 +55,7 @@ wxWindowDC::wxWindowDC(wxWindow *the_canvas)
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;
@ -90,6 +91,7 @@ wxClientDC::wxClientDC(wxWindow *window)
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;
@ -126,6 +128,7 @@ wxPaintDC::wxPaintDC(wxWindow *window)
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 ;

View File

@ -237,7 +237,6 @@ void wxPrinterDC::StartPage(void)
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() ;

View File

@ -187,7 +187,6 @@ void wxTextCtrl::SetValue(const wxString& st)
{
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() ;
@ -263,7 +262,6 @@ void wxTextCtrl::Paste()
{
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() ;
@ -1895,7 +1893,6 @@ void wxTextCtrl::SetValue(const wxString& st)
{
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() ;
@ -1986,9 +1983,7 @@ void wxTextCtrl::Paste()
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 )

View File

@ -588,8 +588,6 @@ void wxToolBar::OnPaint(wxPaintEvent& event)
{
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 )

View File

@ -226,7 +226,6 @@ void wxMacToolTip::Draw()
#endif
m_shown = true ;
SetOrigin( 0 , 0 ) ;
TextFont( kFontIDGeneva ) ;
TextSize( 10 ) ;
TextFace( 0 ) ;
@ -333,7 +332,6 @@ void wxMacToolTip::Clear()
#endif
m_shown = false ;
SetOrigin( 0 , 0 ) ;
BackColor( whiteColor ) ;
ForeColor(blackColor ) ;
DrawPicture(m_backpict, &m_rect);

View File

@ -279,18 +279,6 @@ void wxTopLevelWindowMac::MacCreateRealWindow( const wxString& title,
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;
@ -305,13 +293,7 @@ void wxTopLevelWindowMac::MacGetPortParams(Point* localOrigin, Rect* clipRect, W
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()
@ -327,7 +309,6 @@ void wxTopLevelWindowMac::MacUpdate( long timestamp)
#else
AGAPortHelper help( (m_macWindow) ) ;
#endif
SetOrigin( 0 , 0 ) ;
BeginUpdate( m_macWindow ) ;
RgnHandle updateRgn = NewRgn();

View File

@ -497,7 +497,6 @@ OSErr UMASetKeyboardFocus (WindowPtr inWindow,
SetPortWindowPort( inWindow ) ;
SetOrigin( 0 , 0 ) ;
err = SetKeyboardFocus( inWindow , inControl , inPart ) ;
SetPort( port ) ;
return err ;
@ -549,7 +548,6 @@ void UMAHighlightAndActivateWindow( WindowRef inWindowRef , bool inActivate )
GrafPtr port ;
GetPort( &port ) ;
SetPortWindowPort( inWindowRef ) ;
SetOrigin( 0 , 0 ) ;
HiliteWindow( inWindowRef , inActivate ) ;
ControlHandle control = NULL ;
::GetRootControl( inWindowRef , & control ) ;

View File

@ -366,7 +366,7 @@ void wxWindowMac::DoClientToScreen(int *x, int *y) const
GrafPtr port ;
::GetPort( &port ) ;
::SetPort( UMAGetWindowPort( window ) ) ;
::SetOrigin( 0 , 0 ) ;
::LocalToGlobal( &localwhere ) ;
::SetPort( port ) ;
if(x) *x = localwhere.h ;
@ -560,6 +560,7 @@ void wxWindowMac::DoMoveWindow(int x, int y, int width, int height)
if ( focus.Ok() )
{
Rect clientrect = { 0 , 0 , m_height , m_width } ;
focus.LocalToWindow( &clientrect ) ;
// ClipRect( &clientrect ) ;
InvalWindowRect( MacGetRootWindow() , &clientrect ) ;
}
@ -575,6 +576,7 @@ void wxWindowMac::DoMoveWindow(int x, int y, int width, int height)
if ( focus.Ok() )
{
Rect clientrect = { 0 , 0 , m_height , m_width } ;
focus.LocalToWindow( &clientrect ) ;
// ClipRect( &clientrect ) ;
InvalWindowRect( MacGetRootWindow() , &clientrect ) ;
}
@ -909,7 +911,17 @@ const wxBrush& wxWindowMac::MacGetBackgroundBrush()
// 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 ;
}
}
@ -939,7 +951,7 @@ void wxWindowMac::OnNcPaint( wxNcPaintEvent& event )
wxMacDrawingHelper focus( this ) ;
if ( focus.Ok() )
{
MacPaintBorders() ;
MacPaintBorders( focus.GetOrigin().h , focus.GetOrigin().v) ;
}
}
@ -1004,7 +1016,7 @@ void wxWindowMac::SetScrollPos(int orient, int pos, bool refresh)
}
}
void wxWindowMac::MacPaintBorders( )
void wxWindowMac::MacPaintBorders( int left , int top )
{
if( IsTopLevel() )
return ;
@ -1018,7 +1030,7 @@ void wxWindowMac::MacPaintBorders( )
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 ) ;
@ -1030,38 +1042,38 @@ void wxWindowMac::MacPaintBorders( )
#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 ) ;
}
@ -1111,19 +1123,20 @@ void wxWindowMac::SetScrollbar(int orient, int pos, int thumbVisible,
// 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 ) ;
@ -1714,24 +1727,6 @@ void wxWindowMac::MacTopLevelWindowChangedPosition()
}
}
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 )
@ -1743,9 +1738,9 @@ bool wxWindowMac::MacSetPortDrawingParams( const Point & localOrigin, const Rect
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() ) ;
@ -1773,27 +1768,9 @@ void wxWindowMac::MacGetPortParams(Point* localOrigin, Rect* clipRect, WindowRef
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 ) ;
@ -1804,11 +1781,7 @@ void wxWindowMac::MacGetPortClientParams(Point* localOrigin, Rect* clipRect, Win
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);
}
@ -1868,10 +1841,9 @@ long wxWindowMac::MacRemoveBordersFromStyle( long style )
}
wxMacDrawingHelper::wxMacDrawingHelper( wxWindowMac * theWindow )
wxMacDrawingHelper::wxMacDrawingHelper( wxWindowMac * theWindow , bool clientArea )
{
m_ok = false ;
Point localOrigin ;
Rect clipRect ;
WindowRef window ;
wxWindowMac *rootwin ;
@ -1880,12 +1852,15 @@ wxMacDrawingHelper::wxMacDrawingHelper( wxWindowMac * theWindow )
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 ;
}
}
@ -1896,46 +1871,6 @@ wxMacDrawingHelper::~wxMacDrawingHelper()
{
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 ) ;