mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 17:34:57 +00:00
[User32]
- Sync/Port wine UI code for drawing. svn path=/trunk/; revision=73450
This commit is contained in:
parent
0afae481fa
commit
d41da9f33b
1 changed files with 109 additions and 164 deletions
|
@ -136,7 +136,7 @@ static BOOL IntDrawDiagEdge(HDC hdc, LPRECT rc, UINT uType, UINT uFlags)
|
||||||
|| (uType & BDR_OUTER) == BDR_OUTER)
|
|| (uType & BDR_OUTER) == BDR_OUTER)
|
||||||
&& !(uFlags & (BF_FLAT|BF_MONO)) );
|
&& !(uFlags & (BF_FLAT|BF_MONO)) );
|
||||||
int add = (LTRBInnerMono[uType & (BDR_INNER|BDR_OUTER)] != -1 ? 1 : 0)
|
int add = (LTRBInnerMono[uType & (BDR_INNER|BDR_OUTER)] != -1 ? 1 : 0)
|
||||||
+ (LTRBOuterMono[uType & (BDR_INNER|BDR_OUTER)] != -1 ? 1 : 0);
|
+ (LTRBOuterMono[uType & (BDR_INNER|BDR_OUTER)] != -1 ? 1 : 0);
|
||||||
|
|
||||||
/* Init some vars */
|
/* Init some vars */
|
||||||
OuterPen = InnerPen = (HPEN)GetStockObject(NULL_PEN);
|
OuterPen = InnerPen = (HPEN)GetStockObject(NULL_PEN);
|
||||||
|
@ -181,10 +181,8 @@ static BOOL IntDrawDiagEdge(HDC hdc, LPRECT rc, UINT uType, UINT uFlags)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(InnerI != -1)
|
if(InnerI != -1) InnerPen = GetStockObject(DC_PEN);
|
||||||
InnerPen = GetStockObject(DC_PEN);
|
if(OuterI != -1) OuterPen = GetStockObject(DC_PEN);
|
||||||
if(OuterI != -1)
|
|
||||||
OuterPen = GetStockObject(DC_PEN);
|
|
||||||
|
|
||||||
MoveToEx(hdc, 0, 0, &SavePoint);
|
MoveToEx(hdc, 0, 0, &SavePoint);
|
||||||
|
|
||||||
|
@ -246,9 +244,9 @@ static BOOL IntDrawDiagEdge(HDC hdc, LPRECT rc, UINT uType, UINT uFlags)
|
||||||
{
|
{
|
||||||
case BF_DIAGONAL_ENDBOTTOMLEFT:
|
case BF_DIAGONAL_ENDBOTTOMLEFT:
|
||||||
case (BF_DIAGONAL|BF_BOTTOM):
|
case (BF_DIAGONAL|BF_BOTTOM):
|
||||||
case BF_DIAGONAL:
|
case BF_DIAGONAL:
|
||||||
case (BF_DIAGONAL|BF_LEFT):
|
case (BF_DIAGONAL|BF_LEFT):
|
||||||
MoveToEx(hdc, spx-1, spy, NULL);
|
MoveToEx(hdc, spx-1, spy, NULL);
|
||||||
LineTo(hdc, epx, epy-1);
|
LineTo(hdc, epx, epy-1);
|
||||||
Points[0].x = spx-add;
|
Points[0].x = spx-add;
|
||||||
Points[0].y = spy;
|
Points[0].y = spy;
|
||||||
|
@ -272,10 +270,10 @@ static BOOL IntDrawDiagEdge(HDC hdc, LPRECT rc, UINT uType, UINT uFlags)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case (BF_DIAGONAL|BF_BOTTOM|BF_RIGHT|BF_TOP):
|
case (BF_DIAGONAL|BF_BOTTOM|BF_RIGHT|BF_TOP):
|
||||||
case (BF_DIAGONAL|BF_BOTTOM|BF_RIGHT|BF_TOP|BF_LEFT):
|
case (BF_DIAGONAL|BF_BOTTOM|BF_RIGHT|BF_TOP|BF_LEFT):
|
||||||
case BF_DIAGONAL_ENDTOPRIGHT:
|
case BF_DIAGONAL_ENDTOPRIGHT:
|
||||||
case (BF_DIAGONAL|BF_RIGHT|BF_TOP|BF_LEFT):
|
case (BF_DIAGONAL|BF_RIGHT|BF_TOP|BF_LEFT):
|
||||||
MoveToEx(hdc, spx+1, spy, NULL);
|
MoveToEx(hdc, spx+1, spy, NULL);
|
||||||
LineTo(hdc, epx, epy+1);
|
LineTo(hdc, epx, epy+1);
|
||||||
Points[0].x = epx-1;
|
Points[0].x = epx-1;
|
||||||
Points[0].y = epy+1+add;
|
Points[0].y = epy+1+add;
|
||||||
|
@ -301,9 +299,9 @@ static BOOL IntDrawDiagEdge(HDC hdc, LPRECT rc, UINT uType, UINT uFlags)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case (BF_DIAGONAL|BF_TOP):
|
case (BF_DIAGONAL|BF_TOP):
|
||||||
case (BF_DIAGONAL|BF_BOTTOM|BF_TOP):
|
case (BF_DIAGONAL|BF_BOTTOM|BF_TOP):
|
||||||
case (BF_DIAGONAL|BF_BOTTOM|BF_TOP|BF_LEFT):
|
case (BF_DIAGONAL|BF_BOTTOM|BF_TOP|BF_LEFT):
|
||||||
MoveToEx(hdc, spx+1, spy-1, NULL);
|
MoveToEx(hdc, spx+1, spy-1, NULL);
|
||||||
LineTo(hdc, epx, epy);
|
LineTo(hdc, epx, epy);
|
||||||
Points[0].x = epx-1;
|
Points[0].x = epx-1;
|
||||||
Points[0].y = epy+1;
|
Points[0].y = epy+1;
|
||||||
|
@ -316,9 +314,9 @@ static BOOL IntDrawDiagEdge(HDC hdc, LPRECT rc, UINT uType, UINT uFlags)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case (BF_DIAGONAL|BF_RIGHT):
|
case (BF_DIAGONAL|BF_RIGHT):
|
||||||
case (BF_DIAGONAL|BF_RIGHT|BF_LEFT):
|
case (BF_DIAGONAL|BF_RIGHT|BF_LEFT):
|
||||||
case (BF_DIAGONAL|BF_RIGHT|BF_LEFT|BF_BOTTOM):
|
case (BF_DIAGONAL|BF_RIGHT|BF_LEFT|BF_BOTTOM):
|
||||||
MoveToEx(hdc, spx, spy, NULL);
|
MoveToEx(hdc, spx, spy, NULL);
|
||||||
LineTo(hdc, epx-1, epy+1);
|
LineTo(hdc, epx-1, epy+1);
|
||||||
Points[0].x = spx;
|
Points[0].x = spx;
|
||||||
Points[0].y = spy;
|
Points[0].y = spy;
|
||||||
|
@ -347,14 +345,10 @@ static BOOL IntDrawDiagEdge(HDC hdc, LPRECT rc, UINT uType, UINT uFlags)
|
||||||
/* Adjust rectangle if asked */
|
/* Adjust rectangle if asked */
|
||||||
if(uFlags & BF_ADJUST)
|
if(uFlags & BF_ADJUST)
|
||||||
{
|
{
|
||||||
if(uFlags & BF_LEFT)
|
if(uFlags & BF_LEFT) rc->left += add;
|
||||||
rc->left += add;
|
if(uFlags & BF_RIGHT) rc->right -= add;
|
||||||
if(uFlags & BF_RIGHT)
|
if(uFlags & BF_TOP) rc->top += add;
|
||||||
rc->right -= add;
|
if(uFlags & BF_BOTTOM) rc->bottom -= add;
|
||||||
if(uFlags & BF_TOP)
|
|
||||||
rc->top += add;
|
|
||||||
if(uFlags & BF_BOTTOM)
|
|
||||||
rc->bottom -= add;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Cleanup */
|
/* Cleanup */
|
||||||
|
@ -368,6 +362,7 @@ static BOOL IntDrawDiagEdge(HDC hdc, LPRECT rc, UINT uType, UINT uFlags)
|
||||||
/* Same as DrawEdge invoked without BF_DIAGONAL
|
/* Same as DrawEdge invoked without BF_DIAGONAL
|
||||||
*
|
*
|
||||||
* 23-Nov-1997: Changed by Bertho Stultiens
|
* 23-Nov-1997: Changed by Bertho Stultiens
|
||||||
|
* The width parameter sets the width of each outer and inner edge.
|
||||||
*
|
*
|
||||||
* Well, I started testing this and found out that there are a few things
|
* Well, I started testing this and found out that there are a few things
|
||||||
* that weren't quite as win95. The following rewrite should reproduce
|
* that weren't quite as win95. The following rewrite should reproduce
|
||||||
|
@ -434,25 +429,18 @@ static BOOL IntDrawDiagEdge(HDC hdc, LPRECT rc, UINT uType, UINT uFlags)
|
||||||
* 21 = COLOR_3DDKSHADOW
|
* 21 = COLOR_3DDKSHADOW
|
||||||
* 22 = COLOR_3DLIGHT
|
* 22 = COLOR_3DLIGHT
|
||||||
*/
|
*/
|
||||||
static BOOL IntDrawRectEdge(HDC hdc, LPRECT rc, UINT uType, UINT uFlags)
|
static BOOL IntDrawRectEdge(HDC hdc, LPRECT rc, UINT uType, UINT uFlags, UINT width)
|
||||||
{
|
{
|
||||||
signed char LTInnerI, LTOuterI;
|
signed char LTInnerI, LTOuterI;
|
||||||
signed char RBInnerI, RBOuterI;
|
signed char RBInnerI, RBOuterI;
|
||||||
HPEN LTInnerPen, LTOuterPen;
|
HBRUSH lti_brush, lto_brush, rbi_brush, rbo_brush;
|
||||||
HPEN RBInnerPen, RBOuterPen;
|
RECT InnerRect = *rc, fill_rect;
|
||||||
RECT InnerRect = *rc;
|
int lbi_offset = 0, lti_offset = 0, rti_offset = 0, rbi_offset = 0;
|
||||||
POINT SavePoint;
|
|
||||||
HPEN SavePen;
|
|
||||||
int LBpenplus = 0;
|
|
||||||
int LTpenplus = 0;
|
|
||||||
int RTpenplus = 0;
|
|
||||||
int RBpenplus = 0;
|
|
||||||
BOOL retval = !( ((uType & BDR_INNER) == BDR_INNER
|
BOOL retval = !( ((uType & BDR_INNER) == BDR_INNER
|
||||||
|| (uType & BDR_OUTER) == BDR_OUTER)
|
|| (uType & BDR_OUTER) == BDR_OUTER)
|
||||||
&& !(uFlags & (BF_FLAT|BF_MONO)) );
|
&& !(uFlags & (BF_FLAT|BF_MONO)) );
|
||||||
/* Init some vars */
|
|
||||||
LTInnerPen = LTOuterPen = RBInnerPen = RBOuterPen = (HPEN)GetStockObject(NULL_PEN);
|
lti_brush = lto_brush = rbi_brush = rbo_brush = GetStockObject(NULL_BRUSH);
|
||||||
SavePen = (HPEN)SelectObject(hdc, LTInnerPen);
|
|
||||||
|
|
||||||
/* Determine the colors of the edges */
|
/* Determine the colors of the edges */
|
||||||
if(uFlags & BF_MONO)
|
if(uFlags & BF_MONO)
|
||||||
|
@ -472,8 +460,7 @@ static BOOL IntDrawRectEdge(HDC hdc, LPRECT rc, UINT uType, UINT uFlags)
|
||||||
* otherwise.
|
* otherwise.
|
||||||
* Dennis Björklund, 10 June, 99
|
* Dennis Björklund, 10 June, 99
|
||||||
*/
|
*/
|
||||||
if( LTInnerI != -1 )
|
if( LTInnerI != -1 ) LTInnerI = RBInnerI = COLOR_BTNFACE;
|
||||||
LTInnerI = RBInnerI = COLOR_BTNFACE;
|
|
||||||
}
|
}
|
||||||
else if(uFlags & BF_SOFT)
|
else if(uFlags & BF_SOFT)
|
||||||
{
|
{
|
||||||
|
@ -490,103 +477,88 @@ static BOOL IntDrawRectEdge(HDC hdc, LPRECT rc, UINT uType, UINT uFlags)
|
||||||
RBOuterI = RBOuterNormal[uType & (BDR_INNER|BDR_OUTER)];
|
RBOuterI = RBOuterNormal[uType & (BDR_INNER|BDR_OUTER)];
|
||||||
}
|
}
|
||||||
|
|
||||||
if((uFlags & BF_BOTTOMLEFT) == BF_BOTTOMLEFT)
|
if((uFlags & BF_BOTTOMLEFT) == BF_BOTTOMLEFT) lbi_offset = width;
|
||||||
LBpenplus = 1;
|
if((uFlags & BF_TOPRIGHT) == BF_TOPRIGHT) rti_offset = width;
|
||||||
if((uFlags & BF_TOPRIGHT) == BF_TOPRIGHT)
|
if((uFlags & BF_BOTTOMRIGHT) == BF_BOTTOMRIGHT) rbi_offset = width;
|
||||||
RTpenplus = 1;
|
if((uFlags & BF_TOPLEFT) == BF_TOPLEFT) lti_offset = width;
|
||||||
if((uFlags & BF_BOTTOMRIGHT) == BF_BOTTOMRIGHT)
|
|
||||||
RBpenplus = 1;
|
|
||||||
if((uFlags & BF_TOPLEFT) == BF_TOPLEFT)
|
|
||||||
LTpenplus = 1;
|
|
||||||
|
|
||||||
if(LTInnerI != -1)
|
if(LTInnerI != -1) lti_brush = GetSysColorBrush(LTInnerI);
|
||||||
LTInnerPen = GetStockObject(DC_PEN);
|
if(LTOuterI != -1) lto_brush = GetSysColorBrush(LTOuterI);
|
||||||
if(LTOuterI != -1)
|
if(RBInnerI != -1) rbi_brush = GetSysColorBrush(RBInnerI);
|
||||||
LTOuterPen = GetStockObject(DC_PEN);
|
if(RBOuterI != -1) rbo_brush = GetSysColorBrush(RBOuterI);
|
||||||
if(RBInnerI != -1)
|
|
||||||
RBInnerPen = GetStockObject(DC_PEN);
|
|
||||||
if(RBOuterI != -1)
|
|
||||||
RBOuterPen = GetStockObject(DC_PEN);
|
|
||||||
if((uFlags & BF_MIDDLE) && retval)
|
|
||||||
{
|
|
||||||
FillRect(hdc, &InnerRect, GetSysColorBrush(uFlags & BF_MONO ?
|
|
||||||
COLOR_WINDOW : COLOR_BTNFACE));
|
|
||||||
}
|
|
||||||
MoveToEx(hdc, 0, 0, &SavePoint);
|
|
||||||
|
|
||||||
/* Draw the outer edge */
|
/* Draw the outer edge */
|
||||||
SelectObject(hdc, LTOuterPen);
|
|
||||||
SetDCPenColor(hdc, GetSysColor(LTOuterI));
|
|
||||||
if(uFlags & BF_TOP)
|
if(uFlags & BF_TOP)
|
||||||
{
|
{
|
||||||
MoveToEx(hdc, InnerRect.left, InnerRect.top, NULL);
|
fill_rect = InnerRect;
|
||||||
LineTo(hdc, InnerRect.right, InnerRect.top);
|
fill_rect.bottom = fill_rect.top + width;
|
||||||
|
FillRect( hdc, &fill_rect, lto_brush );
|
||||||
}
|
}
|
||||||
if(uFlags & BF_LEFT)
|
if(uFlags & BF_LEFT)
|
||||||
{
|
{
|
||||||
MoveToEx(hdc, InnerRect.left, InnerRect.top, NULL);
|
fill_rect = InnerRect;
|
||||||
LineTo(hdc, InnerRect.left, InnerRect.bottom);
|
fill_rect.right = fill_rect.left + width;
|
||||||
|
FillRect( hdc, &fill_rect, lto_brush );
|
||||||
}
|
}
|
||||||
SelectObject(hdc, RBOuterPen);
|
|
||||||
SetDCPenColor(hdc, GetSysColor(RBOuterI));
|
|
||||||
if(uFlags & BF_BOTTOM)
|
if(uFlags & BF_BOTTOM)
|
||||||
{
|
{
|
||||||
MoveToEx(hdc, InnerRect.left, InnerRect.bottom-1, NULL);
|
fill_rect = InnerRect;
|
||||||
LineTo(hdc, InnerRect.right, InnerRect.bottom-1);
|
fill_rect.top = fill_rect.bottom - width;
|
||||||
|
FillRect( hdc, &fill_rect, rbo_brush );
|
||||||
}
|
}
|
||||||
if(uFlags & BF_RIGHT)
|
if(uFlags & BF_RIGHT)
|
||||||
{
|
{
|
||||||
MoveToEx(hdc, InnerRect.right-1, InnerRect.top, NULL);
|
fill_rect = InnerRect;
|
||||||
LineTo(hdc, InnerRect.right-1, InnerRect.bottom);
|
fill_rect.left = fill_rect.right - width;
|
||||||
|
FillRect( hdc, &fill_rect, rbo_brush );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Draw the inner edge */
|
/* Draw the inner edge */
|
||||||
SelectObject(hdc, LTInnerPen);
|
|
||||||
SetDCPenColor(hdc, GetSysColor(LTInnerI));
|
|
||||||
if(uFlags & BF_TOP)
|
if(uFlags & BF_TOP)
|
||||||
{
|
{
|
||||||
MoveToEx(hdc, InnerRect.left+LTpenplus, InnerRect.top+1, NULL);
|
SetRect( &fill_rect, InnerRect.left + lti_offset, InnerRect.top + width,
|
||||||
LineTo(hdc, InnerRect.right-RTpenplus, InnerRect.top+1);
|
InnerRect.right - rti_offset, InnerRect.top + 2 * width );
|
||||||
|
FillRect( hdc, &fill_rect, lti_brush );
|
||||||
}
|
}
|
||||||
if(uFlags & BF_LEFT)
|
if(uFlags & BF_LEFT)
|
||||||
{
|
{
|
||||||
MoveToEx(hdc, InnerRect.left+1, InnerRect.top+LTpenplus, NULL);
|
SetRect( &fill_rect, InnerRect.left + width, InnerRect.top + lti_offset,
|
||||||
LineTo(hdc, InnerRect.left+1, InnerRect.bottom-LBpenplus);
|
InnerRect.left + 2 * width, InnerRect.bottom - lbi_offset );
|
||||||
|
FillRect( hdc, &fill_rect, lti_brush );
|
||||||
}
|
}
|
||||||
SelectObject(hdc, RBInnerPen);
|
|
||||||
SetDCPenColor(hdc, GetSysColor(RBInnerI));
|
|
||||||
if(uFlags & BF_BOTTOM)
|
if(uFlags & BF_BOTTOM)
|
||||||
{
|
{
|
||||||
MoveToEx(hdc, InnerRect.left+LBpenplus, InnerRect.bottom-2, NULL);
|
SetRect( &fill_rect, InnerRect.left + lbi_offset, InnerRect.bottom - 2 * width,
|
||||||
LineTo(hdc, InnerRect.right-RBpenplus, InnerRect.bottom-2);
|
InnerRect.right - rbi_offset, InnerRect.bottom - width );
|
||||||
|
FillRect( hdc, &fill_rect, rbi_brush );
|
||||||
}
|
}
|
||||||
if(uFlags & BF_RIGHT)
|
if(uFlags & BF_RIGHT)
|
||||||
{
|
{
|
||||||
MoveToEx(hdc, InnerRect.right-2, InnerRect.top+RTpenplus, NULL);
|
SetRect( &fill_rect, InnerRect.right - 2 * width, InnerRect.top + rti_offset,
|
||||||
LineTo(hdc, InnerRect.right-2, InnerRect.bottom-RBpenplus);
|
InnerRect.right - width, InnerRect.bottom - rbi_offset );
|
||||||
|
FillRect( hdc, &fill_rect, rbi_brush );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ((uFlags & BF_MIDDLE) && retval) || (uFlags & BF_ADJUST) )
|
if( ((uFlags & BF_MIDDLE) && retval) || (uFlags & BF_ADJUST) )
|
||||||
{
|
{
|
||||||
int add = (LTRBInnerMono[uType & (BDR_INNER|BDR_OUTER)] != -1 ? 1 : 0)
|
int add = (LTRBInnerMono[uType & (BDR_INNER|BDR_OUTER)] != -1 ? width : 0)
|
||||||
+ (LTRBOuterMono[uType & (BDR_INNER|BDR_OUTER)] != -1 ? 1 : 0);
|
+ (LTRBOuterMono[uType & (BDR_INNER|BDR_OUTER)] != -1 ? width : 0);
|
||||||
|
|
||||||
if(uFlags & BF_LEFT)
|
if(uFlags & BF_LEFT) InnerRect.left += add;
|
||||||
InnerRect.left += add;
|
if(uFlags & BF_RIGHT) InnerRect.right -= add;
|
||||||
if(uFlags & BF_RIGHT)
|
if(uFlags & BF_TOP) InnerRect.top += add;
|
||||||
InnerRect.right -= add;
|
if(uFlags & BF_BOTTOM) InnerRect.bottom -= add;
|
||||||
if(uFlags & BF_TOP)
|
|
||||||
InnerRect.top += add;
|
|
||||||
if(uFlags & BF_BOTTOM)
|
|
||||||
InnerRect.bottom -= add;
|
|
||||||
|
|
||||||
if(uFlags & BF_ADJUST)
|
if((uFlags & BF_MIDDLE) && retval)
|
||||||
*rc = InnerRect;
|
{
|
||||||
|
FillRect(hdc, &InnerRect, GetSysColorBrush(uFlags & BF_MONO ?
|
||||||
|
COLOR_WINDOW : COLOR_BTNFACE));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(uFlags & BF_ADJUST)
|
||||||
|
*rc = InnerRect;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Cleanup */
|
|
||||||
SelectObject(hdc, SavePen);
|
|
||||||
MoveToEx(hdc, SavePoint.x, SavePoint.y, NULL);
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -659,9 +631,9 @@ static BOOL UITOOLS95_DFC_ButtonPush(HDC dc, LPRECT r, UINT uFlags)
|
||||||
if(uFlags & DFCS_CHECKED)
|
if(uFlags & DFCS_CHECKED)
|
||||||
{
|
{
|
||||||
if(uFlags & DFCS_MONO)
|
if(uFlags & DFCS_MONO)
|
||||||
IntDrawRectEdge(dc, &myr, edge, BF_MONO|BF_RECT|BF_ADJUST);
|
IntDrawRectEdge(dc, &myr, edge, BF_MONO|BF_RECT|BF_ADJUST, 1);
|
||||||
else
|
else
|
||||||
IntDrawRectEdge(dc, &myr, edge, (uFlags&DFCS_FLAT)|BF_RECT|BF_SOFT|BF_ADJUST);
|
IntDrawRectEdge(dc, &myr, edge, (uFlags&DFCS_FLAT)|BF_RECT|BF_SOFT|BF_ADJUST, 1);
|
||||||
|
|
||||||
UITOOLS_DrawCheckedRect( dc, &myr );
|
UITOOLS_DrawCheckedRect( dc, &myr );
|
||||||
}
|
}
|
||||||
|
@ -669,23 +641,18 @@ static BOOL UITOOLS95_DFC_ButtonPush(HDC dc, LPRECT r, UINT uFlags)
|
||||||
{
|
{
|
||||||
if(uFlags & DFCS_MONO)
|
if(uFlags & DFCS_MONO)
|
||||||
{
|
{
|
||||||
IntDrawRectEdge(dc, &myr, edge, BF_MONO|BF_RECT|BF_ADJUST);
|
IntDrawRectEdge(dc, &myr, edge, BF_MONO|BF_RECT|BF_ADJUST, 1);
|
||||||
FillRect(dc, &myr, GetSysColorBrush(COLOR_BTNFACE));
|
FillRect(dc, &myr, GetSysColorBrush(COLOR_BTNFACE));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
IntDrawRectEdge(dc, r, edge, (uFlags&DFCS_FLAT) | BF_MIDDLE | BF_RECT | BF_SOFT);
|
IntDrawRectEdge(dc, r, edge, (uFlags&DFCS_FLAT) | BF_MIDDLE | BF_RECT | BF_SOFT, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Adjust rectangle if asked */
|
/* Adjust rectangle if asked */
|
||||||
if(uFlags & DFCS_ADJUSTRECT)
|
if(uFlags & DFCS_ADJUSTRECT)
|
||||||
{
|
InflateRect(r, -2, -2);
|
||||||
r->left += 2;
|
|
||||||
r->right -= 2;
|
|
||||||
r->top += 2;
|
|
||||||
r->bottom -= 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -830,9 +797,10 @@ static BOOL UITOOLS95_DrawFrameCaption(HDC dc, LPRECT r, UINT uFlags)
|
||||||
Symbol = '2';
|
Symbol = '2';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
WARN("Invalid caption; flags=0x%04x\n", uFlags);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
IntDrawRectEdge(dc,r,(uFlags&DFCS_PUSHED) ? EDGE_SUNKEN : EDGE_RAISED, BF_RECT | BF_MIDDLE | BF_SOFT);
|
IntDrawRectEdge(dc,r,(uFlags&DFCS_PUSHED) ? EDGE_SUNKEN : EDGE_RAISED, BF_RECT | BF_MIDDLE | BF_SOFT, 1);
|
||||||
ZeroMemory(&lf, sizeof(LOGFONTW));
|
ZeroMemory(&lf, sizeof(LOGFONTW));
|
||||||
UITOOLS_MakeSquareRect(r, &myr);
|
UITOOLS_MakeSquareRect(r, &myr);
|
||||||
myr.left += 1;
|
myr.left += 1;
|
||||||
|
@ -932,9 +900,10 @@ static BOOL UITOOLS95_DrawFrameScroll(HDC dc, LPRECT r, UINT uFlags)
|
||||||
DeleteObject(hFont);
|
DeleteObject(hFont);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
default:
|
default:
|
||||||
|
WARN("Invalid scroll; flags=0x%04x\n", uFlags);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
IntDrawRectEdge(dc, r, (uFlags & DFCS_PUSHED) ? EDGE_SUNKEN : EDGE_RAISED, (uFlags&DFCS_FLAT) | BF_MIDDLE | BF_RECT);
|
IntDrawRectEdge(dc, r, (uFlags & DFCS_PUSHED) ? EDGE_SUNKEN : EDGE_RAISED, (uFlags&DFCS_FLAT) | BF_MIDDLE | BF_RECT, 1);
|
||||||
ZeroMemory(&lf, sizeof(LOGFONTW));
|
ZeroMemory(&lf, sizeof(LOGFONTW));
|
||||||
UITOOLS_MakeSquareRect(r, &myr);
|
UITOOLS_MakeSquareRect(r, &myr);
|
||||||
myr.left += 1;
|
myr.left += 1;
|
||||||
|
@ -1004,9 +973,7 @@ static BOOL UITOOLS95_DrawFrameMenu(HDC dc, LPRECT r, UINT uFlags)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
/*
|
WARN("Invalid menu; flags=0x%04x\n", uFlags);
|
||||||
DbgPrint("Invalid menu; flags=0x%04x\n", uFlags);
|
|
||||||
*/
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
/* acquire ressources only if valid menu */
|
/* acquire ressources only if valid menu */
|
||||||
|
@ -1290,16 +1257,11 @@ IntDrawState(HDC hdc, HBRUSH hbr, DRAWSTATEPROC func, LPARAM lp, WPARAM wp,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!cx)
|
if(!cx) cx = s.cx;
|
||||||
cx = s.cx;
|
if(!cy) cy = s.cy;
|
||||||
if(!cy)
|
|
||||||
cy = s.cy;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rc.left = x;
|
SetRect(&rc, x, y, x + cx, y + cy);
|
||||||
rc.top = y;
|
|
||||||
rc.right = x + cx;
|
|
||||||
rc.bottom = y + cy;
|
|
||||||
|
|
||||||
if(flags & DSS_RIGHT) /* This one is not documented in the win32.hlp file */
|
if(flags & DSS_RIGHT) /* This one is not documented in the win32.hlp file */
|
||||||
dtflags |= DT_RIGHT;
|
dtflags |= DT_RIGHT;
|
||||||
|
@ -1329,33 +1291,25 @@ IntDrawState(HDC hdc, HBRUSH hbr, DRAWSTATEPROC func, LPARAM lp, WPARAM wp,
|
||||||
|
|
||||||
/* From here on we must use "goto cleanup" when something goes wrong */
|
/* From here on we must use "goto cleanup" when something goes wrong */
|
||||||
hbm = CreateBitmap(cx, cy, 1, 1, NULL);
|
hbm = CreateBitmap(cx, cy, 1, 1, NULL);
|
||||||
if(!hbm)
|
if(!hbm) goto cleanup;
|
||||||
goto cleanup;
|
|
||||||
memdc = CreateCompatibleDC(hdc);
|
memdc = CreateCompatibleDC(hdc);
|
||||||
if(!memdc)
|
if(!memdc) goto cleanup;
|
||||||
goto cleanup;
|
|
||||||
hbmsave = (HBITMAP)SelectObject(memdc, hbm);
|
hbmsave = (HBITMAP)SelectObject(memdc, hbm);
|
||||||
if(!hbmsave)
|
if(!hbmsave) goto cleanup;
|
||||||
goto cleanup;
|
SetRect(&rc, 0, 0, cx, cy);
|
||||||
rc.left = rc.top = 0;
|
if(!FillRect(memdc, &rc, (HBRUSH)GetStockObject(WHITE_BRUSH))) goto cleanup;
|
||||||
rc.right = cx;
|
|
||||||
rc.bottom = cy;
|
|
||||||
if(!FillRect(memdc, &rc, (HBRUSH)GetStockObject(WHITE_BRUSH)))
|
|
||||||
goto cleanup;
|
|
||||||
SetBkColor(memdc, RGB(255, 255, 255));
|
SetBkColor(memdc, RGB(255, 255, 255));
|
||||||
SetTextColor(memdc, RGB(0, 0, 0));
|
SetTextColor(memdc, RGB(0, 0, 0));
|
||||||
hfsave = (HFONT)SelectObject(memdc, GetCurrentObject(hdc, OBJ_FONT));
|
hfsave = (HFONT)SelectObject(memdc, GetCurrentObject(hdc, OBJ_FONT));
|
||||||
|
SetLayout( memdc, GetLayout( hdc ));
|
||||||
|
|
||||||
/* DST_COMPLEX may draw text as well,
|
/* DST_COMPLEX may draw text as well,
|
||||||
* so we must be sure that correct font is selected
|
* so we must be sure that correct font is selected
|
||||||
*/
|
*/
|
||||||
if(!hfsave && (opcode <= DST_PREFIXTEXT))
|
if(!hfsave && (opcode <= DST_PREFIXTEXT)) goto cleanup;
|
||||||
goto cleanup;
|
|
||||||
tmp = PAINTING_DrawStateJam(memdc, opcode, func, lp, len, &rc, dtflags, unicode);
|
tmp = PAINTING_DrawStateJam(memdc, opcode, func, lp, len, &rc, dtflags, unicode);
|
||||||
if(hfsave)
|
if(hfsave) SelectObject(memdc, hfsave);
|
||||||
SelectObject(memdc, hfsave);
|
if(!tmp) goto cleanup;
|
||||||
if(!tmp)
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
/* This state cause the image to be dithered */
|
/* This state cause the image to be dithered */
|
||||||
if(flags & DSS_UNION)
|
if(flags & DSS_UNION)
|
||||||
|
@ -1375,21 +1329,17 @@ IntDrawState(HDC hdc, HBRUSH hbr, DRAWSTATEPROC func, LPARAM lp, WPARAM wp,
|
||||||
/* Draw light or dark shadow */
|
/* Draw light or dark shadow */
|
||||||
if (flags & (DSS_DISABLED|DSS_DEFAULT))
|
if (flags & (DSS_DISABLED|DSS_DEFAULT))
|
||||||
{
|
{
|
||||||
if(!hbrtmp)
|
if(!hbrtmp) goto cleanup;
|
||||||
goto cleanup;
|
|
||||||
hbsave = (HBRUSH)SelectObject(hdc, hbrtmp);
|
hbsave = (HBRUSH)SelectObject(hdc, hbrtmp);
|
||||||
if(!hbsave)
|
if(!hbsave) goto cleanup;
|
||||||
goto cleanup;
|
if(!BitBlt(hdc, x+1, y+1, cx, cy, memdc, 0, 0, 0x00B8074A)) goto cleanup;
|
||||||
if(!BitBlt(hdc, x+1, y+1, cx, cy, memdc, 0, 0, 0x00B8074A))
|
|
||||||
goto cleanup;
|
|
||||||
SelectObject(hdc, hbsave);
|
SelectObject(hdc, hbsave);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & DSS_DISABLED)
|
if (flags & DSS_DISABLED)
|
||||||
{
|
{
|
||||||
hbr = hbrtmp = GetSysColorBrush(COLOR_3DSHADOW);
|
hbr = hbrtmp = GetSysColorBrush(COLOR_3DSHADOW);
|
||||||
if(!hbrtmp)
|
if(!hbrtmp) goto cleanup;
|
||||||
goto cleanup;
|
|
||||||
}
|
}
|
||||||
else if (!hbr)
|
else if (!hbr)
|
||||||
{
|
{
|
||||||
|
@ -1398,8 +1348,7 @@ IntDrawState(HDC hdc, HBRUSH hbr, DRAWSTATEPROC func, LPARAM lp, WPARAM wp,
|
||||||
|
|
||||||
hbsave = (HBRUSH)SelectObject(hdc, hbr);
|
hbsave = (HBRUSH)SelectObject(hdc, hbr);
|
||||||
|
|
||||||
if(!BitBlt(hdc, x, y, cx, cy, memdc, 0, 0, 0x00B8074A))
|
if(!BitBlt(hdc, x, y, cx, cy, memdc, 0, 0, 0x00B8074A)) goto cleanup;
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
retval = TRUE; /* We succeeded */
|
retval = TRUE; /* We succeeded */
|
||||||
|
|
||||||
|
@ -1407,14 +1356,10 @@ cleanup:
|
||||||
SetTextColor(hdc, fg);
|
SetTextColor(hdc, fg);
|
||||||
SetBkColor(hdc, bg);
|
SetBkColor(hdc, bg);
|
||||||
|
|
||||||
if(hbsave)
|
if(hbsave) SelectObject(hdc, hbsave);
|
||||||
SelectObject(hdc, hbsave);
|
if(hbmsave) SelectObject(memdc, hbmsave);
|
||||||
if(hbmsave)
|
if(hbm) DeleteObject(hbm);
|
||||||
SelectObject(memdc, hbmsave);
|
if(memdc) DeleteDC(memdc);
|
||||||
if(hbm)
|
|
||||||
DeleteObject(hbm);
|
|
||||||
if(memdc)
|
|
||||||
DeleteDC(memdc);
|
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
@ -1482,7 +1427,7 @@ DrawEdge(HDC hDC, LPRECT rc, UINT edge, UINT flags)
|
||||||
if (flags & BF_DIAGONAL)
|
if (flags & BF_DIAGONAL)
|
||||||
return IntDrawDiagEdge(hDC, rc, edge, flags);
|
return IntDrawDiagEdge(hDC, rc, edge, flags);
|
||||||
else
|
else
|
||||||
return IntDrawRectEdge(hDC, rc, edge, flags);
|
return IntDrawRectEdge(hDC, rc, edge, flags, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1524,7 +1469,7 @@ FrameRect(HDC hDC, CONST RECT *lprc, HBRUSH hbr)
|
||||||
HBRUSH oldbrush;
|
HBRUSH oldbrush;
|
||||||
RECT r = *lprc;
|
RECT r = *lprc;
|
||||||
|
|
||||||
if ((r.right <= r.left) || (r.bottom <= r.top)) return 0;
|
if (IsRectEmpty(&r)) return 0;
|
||||||
if (!(oldbrush = SelectObject(hDC, hbr))) return 0;
|
if (!(oldbrush = SelectObject(hDC, hbr))) return 0;
|
||||||
|
|
||||||
PatBlt(hDC, r.left, r.top, 1, r.bottom - r.top, PATCOPY);
|
PatBlt(hDC, r.left, r.top, 1, r.bottom - r.top, PATCOPY);
|
||||||
|
|
Loading…
Reference in a new issue