applied Paul A. Thiessen's patches for correcting coordinates when having borders, exchanged the border painting method.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12494 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2001-11-19 21:24:18 +00:00
parent 05f30eecb7
commit 653b244972
2 changed files with 76 additions and 200 deletions

View File

@@ -421,8 +421,8 @@ void wxWindowMac::MacClientToRootWindow( int *x , int *y ) const
{ {
if ( m_macWindowData == NULL) if ( m_macWindowData == NULL)
{ {
if(x) *x += m_x ; if(x) *x += m_x + MacGetLeftBorderSize();
if(y) *y += m_y ; if(y) *y += m_y + MacGetTopBorderSize();
GetParent()->MacClientToRootWindow( x , y ) ; GetParent()->MacClientToRootWindow( x , y ) ;
} }
} }
@@ -431,8 +431,8 @@ void wxWindowMac::MacRootWindowToClient( int *x , int *y ) const
{ {
if ( m_macWindowData == NULL) if ( m_macWindowData == NULL)
{ {
if(x) *x -= m_x ; if(x) *x -= m_x + MacGetLeftBorderSize();
if(y) *y -= m_y ; if(y) *y -= m_y + MacGetTopBorderSize();
GetParent()->MacRootWindowToClient( x , y ) ; GetParent()->MacRootWindowToClient( x , y ) ;
} }
} }
@@ -1213,33 +1213,34 @@ void wxWindowMac::MacPaintBorders( )
if (HasFlag(wxRAISED_BORDER) || HasFlag( wxSUNKEN_BORDER) || HasFlag(wxDOUBLE_BORDER) ) if (HasFlag(wxRAISED_BORDER) || HasFlag( wxSUNKEN_BORDER) || HasFlag(wxDOUBLE_BORDER) )
{ {
bool sunken = HasFlag( wxSUNKEN_BORDER ) ; bool sunken = HasFlag( wxSUNKEN_BORDER ) ;
RGBColor pen1 = sunken ? white : black ; RGBForeColor( &face );
RGBColor pen2 = sunken ? shadow : face ; MoveTo( 0 , m_height - 2 );
RGBColor pen3 = sunken ? face : shadow ; LineTo( 0 , 0 );
RGBColor pen4 = sunken ? black : white ; LineTo( m_width - 2 , 0 );
RGBForeColor( &pen1 ) ; MoveTo( 2 , m_height - 3 );
{ LineTo( m_width - 3 , m_height - 3 );
Rect rect = { 0 , 0 , m_height , m_width } ; LineTo( m_width - 3 , 2 );
FrameRect( &rect ) ;
} RGBForeColor( sunken ? &face : &black );
RGBForeColor( &pen2 ) ; MoveTo( 0 , m_height - 1 );
{ LineTo( m_width - 1 , m_height - 1 );
Rect rect = { 1 , 1 , m_height -1 , m_width -1} ; LineTo( m_width - 1 , 0 );
FrameRect( &rect ) ;
} RGBForeColor( sunken ? &shadow : &white );
RGBForeColor( &pen3 ) ; MoveTo( 1 , m_height - 3 );
{ LineTo( 1, 1 );
Rect rect = { 0 , 0 , m_height -2 , m_width -2} ; LineTo( m_width - 3 , 1 );
FrameRect( &rect ) ;
} RGBForeColor( sunken ? &white : &shadow );
RGBForeColor( &pen4 ) ; MoveTo( 1 , m_height - 2 );
{ LineTo( m_width - 2 , m_height - 2 );
MoveTo( 0 , 0 ) ; LineTo( m_width - 2 , 1 );
LineTo( m_width - 3 , 0 ) ;
MoveTo( 0 , 0 ) ; RGBForeColor( sunken ? &black : &face );
LineTo( 0 , m_height - 3 ) ; MoveTo( 2 , m_height - 4 );
} LineTo( 2 , 2 );
LineTo( m_width - 4 , 2 );
} }
else if (HasFlag(wxSIMPLE_BORDER)) else if (HasFlag(wxSIMPLE_BORDER))
{ {
@@ -1247,69 +1248,6 @@ void wxWindowMac::MacPaintBorders( )
RGBForeColor( &black ) ; RGBForeColor( &black ) ;
FrameRect( &rect ) ; FrameRect( &rect ) ;
} }
/*
if ( this->GetParent() )
{
wxPaintDC dc(GetParent());
GetParent()->PrepareDC(dc);
if (HasFlag(wxRAISED_BORDER) || HasFlag( wxSUNKEN_BORDER) )
{
bool sunken = HasFlag( wxSUNKEN_BORDER ) ;
wxPen m_penButton3DShadow( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_3DSHADOW ), 1, wxSOLID ) ;
wxPen m_penButton3DFace( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_3DFACE ), 1, wxSOLID ) ;
wxPen wxPen1 = sunken ? *wxWHITE_PEN : *wxBLACK_PEN;
wxPen wxPen2 = sunken ? m_penButton3DShadow : m_penButton3DShadow;
wxPen wxPen3 = sunken ? m_penButton3DFace : m_penButton3DShadow;
wxPen wxPen4 = sunken ? *wxBLACK_PEN : *wxWHITE_PEN;
dc.SetPen(wxPen1);
dc.DrawRectangle(m_x, m_y, m_width, m_height); // outer - right and button
dc.SetPen(wxPen2);
dc.DrawRectangle(m_x+1, m_y+1, m_width-1, m_height-1); // outer - left and top
dc.SetPen(wxPen3);
dc.DrawRectangle(m_x, m_y, m_width-2, m_height-2); // inner - right and button
dc.SetPen(wxPen4);
dc.DrawLine(m_x, m_y, m_x + m_width-3, m_y); // inner - left and top
dc.DrawLine(m_x, m_y, m_x, m_y + m_height-3);
}
else if (HasFlag(wxDOUBLE_BORDER))
{
bool sunken = HasFlag( wxSUNKEN_BORDER ) ;
wxPen m_penButton3DShadow( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_3DSHADOW ), 1, wxSOLID ) ;
wxPen m_penButton3DFace( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_3DFACE ), 1, wxSOLID ) ;
wxPen wxPen1 = sunken ? *wxWHITE_PEN : *wxBLACK_PEN;
wxPen wxPen2 = sunken ? m_penButton3DShadow : m_penButton3DShadow;
wxPen wxPen3 = sunken ? m_penButton3DFace : m_penButton3DShadow;
wxPen wxPen4 = sunken ? *wxBLACK_PEN : *wxWHITE_PEN;
dc.SetPen(wxPen1);
dc.DrawRectangle(m_x, m_y, m_width, m_height); // outer - right and button
dc.SetPen(wxPen2);
dc.DrawRectangle(m_x+1, m_y+1, m_width-1, m_height-1); // outer - left and top
dc.SetPen(wxPen3);
dc.DrawRectangle(m_x, m_y, m_width-2, m_height-2); // inner - right and button
dc.SetPen(wxPen4);
dc.DrawLine(m_x, m_y, m_x + m_width-3, m_y); // inner - left and top
dc.DrawLine(m_x, m_y, m_x, m_y + m_height-3);
}
else if (HasFlag(wxSIMPLE_BORDER))
{
dc.SetPen(*wxBLACK_PEN);
dc.DrawRectangle(m_x, m_y, m_width, m_height);
}
}
*/
} }
// New function that will replace some of the above. // New function that will replace some of the above.
@@ -2345,11 +2283,11 @@ long wxWindowMac::MacGetLeftBorderSize( ) const
if (m_windowStyle & wxRAISED_BORDER || m_windowStyle & wxSUNKEN_BORDER ) if (m_windowStyle & wxRAISED_BORDER || m_windowStyle & wxSUNKEN_BORDER )
{ {
return 2 ; return 3 ;
} }
else if ( m_windowStyle &wxDOUBLE_BORDER) else if ( m_windowStyle &wxDOUBLE_BORDER)
{ {
return 2 ; return 3 ;
} }
else if (m_windowStyle &wxSIMPLE_BORDER) else if (m_windowStyle &wxSIMPLE_BORDER)
{ {
@@ -2373,7 +2311,7 @@ long wxWindowMac::MacGetRightBorderSize( ) const
} }
else if (m_windowStyle &wxSIMPLE_BORDER) else if (m_windowStyle &wxSIMPLE_BORDER)
{ {
return 3 ; return 1 ;
} }
return 0 ; return 0 ;
} }
@@ -2385,11 +2323,11 @@ long wxWindowMac::MacGetTopBorderSize( ) const
if (m_windowStyle & wxRAISED_BORDER || m_windowStyle & wxSUNKEN_BORDER ) if (m_windowStyle & wxRAISED_BORDER || m_windowStyle & wxSUNKEN_BORDER )
{ {
return 2 ; return 3 ;
} }
else if ( m_windowStyle &wxDOUBLE_BORDER) else if ( m_windowStyle &wxDOUBLE_BORDER)
{ {
return 2 ; return 3 ;
} }
else if (m_windowStyle &wxSIMPLE_BORDER) else if (m_windowStyle &wxSIMPLE_BORDER)
{ {
@@ -2413,7 +2351,7 @@ long wxWindowMac::MacGetBottomBorderSize( ) const
} }
else if (m_windowStyle &wxSIMPLE_BORDER) else if (m_windowStyle &wxSIMPLE_BORDER)
{ {
return 3 ; return 1 ;
} }
return 0 ; return 0 ;
} }

View File

@@ -421,8 +421,8 @@ void wxWindowMac::MacClientToRootWindow( int *x , int *y ) const
{ {
if ( m_macWindowData == NULL) if ( m_macWindowData == NULL)
{ {
if(x) *x += m_x ; if(x) *x += m_x + MacGetLeftBorderSize();
if(y) *y += m_y ; if(y) *y += m_y + MacGetTopBorderSize();
GetParent()->MacClientToRootWindow( x , y ) ; GetParent()->MacClientToRootWindow( x , y ) ;
} }
} }
@@ -431,8 +431,8 @@ void wxWindowMac::MacRootWindowToClient( int *x , int *y ) const
{ {
if ( m_macWindowData == NULL) if ( m_macWindowData == NULL)
{ {
if(x) *x -= m_x ; if(x) *x -= m_x + MacGetLeftBorderSize();
if(y) *y -= m_y ; if(y) *y -= m_y + MacGetTopBorderSize();
GetParent()->MacRootWindowToClient( x , y ) ; GetParent()->MacRootWindowToClient( x , y ) ;
} }
} }
@@ -1213,33 +1213,34 @@ void wxWindowMac::MacPaintBorders( )
if (HasFlag(wxRAISED_BORDER) || HasFlag( wxSUNKEN_BORDER) || HasFlag(wxDOUBLE_BORDER) ) if (HasFlag(wxRAISED_BORDER) || HasFlag( wxSUNKEN_BORDER) || HasFlag(wxDOUBLE_BORDER) )
{ {
bool sunken = HasFlag( wxSUNKEN_BORDER ) ; bool sunken = HasFlag( wxSUNKEN_BORDER ) ;
RGBColor pen1 = sunken ? white : black ; RGBForeColor( &face );
RGBColor pen2 = sunken ? shadow : face ; MoveTo( 0 , m_height - 2 );
RGBColor pen3 = sunken ? face : shadow ; LineTo( 0 , 0 );
RGBColor pen4 = sunken ? black : white ; LineTo( m_width - 2 , 0 );
RGBForeColor( &pen1 ) ; MoveTo( 2 , m_height - 3 );
{ LineTo( m_width - 3 , m_height - 3 );
Rect rect = { 0 , 0 , m_height , m_width } ; LineTo( m_width - 3 , 2 );
FrameRect( &rect ) ;
} RGBForeColor( sunken ? &face : &black );
RGBForeColor( &pen2 ) ; MoveTo( 0 , m_height - 1 );
{ LineTo( m_width - 1 , m_height - 1 );
Rect rect = { 1 , 1 , m_height -1 , m_width -1} ; LineTo( m_width - 1 , 0 );
FrameRect( &rect ) ;
} RGBForeColor( sunken ? &shadow : &white );
RGBForeColor( &pen3 ) ; MoveTo( 1 , m_height - 3 );
{ LineTo( 1, 1 );
Rect rect = { 0 , 0 , m_height -2 , m_width -2} ; LineTo( m_width - 3 , 1 );
FrameRect( &rect ) ;
} RGBForeColor( sunken ? &white : &shadow );
RGBForeColor( &pen4 ) ; MoveTo( 1 , m_height - 2 );
{ LineTo( m_width - 2 , m_height - 2 );
MoveTo( 0 , 0 ) ; LineTo( m_width - 2 , 1 );
LineTo( m_width - 3 , 0 ) ;
MoveTo( 0 , 0 ) ; RGBForeColor( sunken ? &black : &face );
LineTo( 0 , m_height - 3 ) ; MoveTo( 2 , m_height - 4 );
} LineTo( 2 , 2 );
LineTo( m_width - 4 , 2 );
} }
else if (HasFlag(wxSIMPLE_BORDER)) else if (HasFlag(wxSIMPLE_BORDER))
{ {
@@ -1247,69 +1248,6 @@ void wxWindowMac::MacPaintBorders( )
RGBForeColor( &black ) ; RGBForeColor( &black ) ;
FrameRect( &rect ) ; FrameRect( &rect ) ;
} }
/*
if ( this->GetParent() )
{
wxPaintDC dc(GetParent());
GetParent()->PrepareDC(dc);
if (HasFlag(wxRAISED_BORDER) || HasFlag( wxSUNKEN_BORDER) )
{
bool sunken = HasFlag( wxSUNKEN_BORDER ) ;
wxPen m_penButton3DShadow( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_3DSHADOW ), 1, wxSOLID ) ;
wxPen m_penButton3DFace( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_3DFACE ), 1, wxSOLID ) ;
wxPen wxPen1 = sunken ? *wxWHITE_PEN : *wxBLACK_PEN;
wxPen wxPen2 = sunken ? m_penButton3DShadow : m_penButton3DShadow;
wxPen wxPen3 = sunken ? m_penButton3DFace : m_penButton3DShadow;
wxPen wxPen4 = sunken ? *wxBLACK_PEN : *wxWHITE_PEN;
dc.SetPen(wxPen1);
dc.DrawRectangle(m_x, m_y, m_width, m_height); // outer - right and button
dc.SetPen(wxPen2);
dc.DrawRectangle(m_x+1, m_y+1, m_width-1, m_height-1); // outer - left and top
dc.SetPen(wxPen3);
dc.DrawRectangle(m_x, m_y, m_width-2, m_height-2); // inner - right and button
dc.SetPen(wxPen4);
dc.DrawLine(m_x, m_y, m_x + m_width-3, m_y); // inner - left and top
dc.DrawLine(m_x, m_y, m_x, m_y + m_height-3);
}
else if (HasFlag(wxDOUBLE_BORDER))
{
bool sunken = HasFlag( wxSUNKEN_BORDER ) ;
wxPen m_penButton3DShadow( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_3DSHADOW ), 1, wxSOLID ) ;
wxPen m_penButton3DFace( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_3DFACE ), 1, wxSOLID ) ;
wxPen wxPen1 = sunken ? *wxWHITE_PEN : *wxBLACK_PEN;
wxPen wxPen2 = sunken ? m_penButton3DShadow : m_penButton3DShadow;
wxPen wxPen3 = sunken ? m_penButton3DFace : m_penButton3DShadow;
wxPen wxPen4 = sunken ? *wxBLACK_PEN : *wxWHITE_PEN;
dc.SetPen(wxPen1);
dc.DrawRectangle(m_x, m_y, m_width, m_height); // outer - right and button
dc.SetPen(wxPen2);
dc.DrawRectangle(m_x+1, m_y+1, m_width-1, m_height-1); // outer - left and top
dc.SetPen(wxPen3);
dc.DrawRectangle(m_x, m_y, m_width-2, m_height-2); // inner - right and button
dc.SetPen(wxPen4);
dc.DrawLine(m_x, m_y, m_x + m_width-3, m_y); // inner - left and top
dc.DrawLine(m_x, m_y, m_x, m_y + m_height-3);
}
else if (HasFlag(wxSIMPLE_BORDER))
{
dc.SetPen(*wxBLACK_PEN);
dc.DrawRectangle(m_x, m_y, m_width, m_height);
}
}
*/
} }
// New function that will replace some of the above. // New function that will replace some of the above.
@@ -2345,11 +2283,11 @@ long wxWindowMac::MacGetLeftBorderSize( ) const
if (m_windowStyle & wxRAISED_BORDER || m_windowStyle & wxSUNKEN_BORDER ) if (m_windowStyle & wxRAISED_BORDER || m_windowStyle & wxSUNKEN_BORDER )
{ {
return 2 ; return 3 ;
} }
else if ( m_windowStyle &wxDOUBLE_BORDER) else if ( m_windowStyle &wxDOUBLE_BORDER)
{ {
return 2 ; return 3 ;
} }
else if (m_windowStyle &wxSIMPLE_BORDER) else if (m_windowStyle &wxSIMPLE_BORDER)
{ {
@@ -2373,7 +2311,7 @@ long wxWindowMac::MacGetRightBorderSize( ) const
} }
else if (m_windowStyle &wxSIMPLE_BORDER) else if (m_windowStyle &wxSIMPLE_BORDER)
{ {
return 3 ; return 1 ;
} }
return 0 ; return 0 ;
} }
@@ -2385,11 +2323,11 @@ long wxWindowMac::MacGetTopBorderSize( ) const
if (m_windowStyle & wxRAISED_BORDER || m_windowStyle & wxSUNKEN_BORDER ) if (m_windowStyle & wxRAISED_BORDER || m_windowStyle & wxSUNKEN_BORDER )
{ {
return 2 ; return 3 ;
} }
else if ( m_windowStyle &wxDOUBLE_BORDER) else if ( m_windowStyle &wxDOUBLE_BORDER)
{ {
return 2 ; return 3 ;
} }
else if (m_windowStyle &wxSIMPLE_BORDER) else if (m_windowStyle &wxSIMPLE_BORDER)
{ {
@@ -2413,7 +2351,7 @@ long wxWindowMac::MacGetBottomBorderSize( ) const
} }
else if (m_windowStyle &wxSIMPLE_BORDER) else if (m_windowStyle &wxSIMPLE_BORDER)
{ {
return 3 ; return 1 ;
} }
return 0 ; return 0 ;
} }