int LTpenplus = 0;
int RTpenplus = 0;
int RBpenplus = 0;
+ HBRUSH hbr;
+
/* Init some vars */
LTInnerPen = LTOuterPen = RBInnerPen = RBOuterPen = (HPEN)GetStockObject(NULL_PEN);
SavePen = (HPEN)SelectObject(hdc, LTInnerPen);
RBInnerI = RBInnerNormal[uType & (BDR_INNER|BDR_OUTER)];
RBOuterI = RBOuterNormal[uType & (BDR_INNER|BDR_OUTER)];
- if((uFlags & BF_BOTTOMLEFT) == BF_BOTTOMLEFT)
+ if ((uFlags & BF_BOTTOMLEFT) == BF_BOTTOMLEFT)
LBpenplus = 1;
- if((uFlags & BF_TOPRIGHT) == BF_TOPRIGHT)
+ if ((uFlags & BF_TOPRIGHT) == BF_TOPRIGHT)
RTpenplus = 1;
- if((uFlags & BF_BOTTOMRIGHT) == BF_BOTTOMRIGHT)
+ if ((uFlags & BF_BOTTOMRIGHT) == BF_BOTTOMRIGHT)
RBpenplus = 1;
- if((uFlags & BF_TOPLEFT) == BF_TOPLEFT)
+ if ((uFlags & BF_TOPLEFT) == BF_TOPLEFT)
LTpenplus = 1;
- if(LTInnerI != -1)
- LTInnerPen = GetStockObject(DC_PEN);
- if(LTOuterI != -1)
- LTOuterPen = GetStockObject(DC_PEN);
- if(RBInnerI != -1)
- RBInnerPen = GetStockObject(DC_PEN);
- if(RBOuterI != -1)
- RBOuterPen = GetStockObject(DC_PEN);
- {
- HBRUSH hbr;
+ if ((uFlags & MY_BF_ACTIVEBORDER))
+ hbr = CreateSolidBrush(scheme->crColor[COLOR_ACTIVEBORDER]);
+ else
+ hbr = CreateSolidBrush(scheme->crColor[COLOR_BTNFACE]);
+
+ FillRect(hdc, &InnerRect, hbr);
+ DeleteObject(hbr);
- if((uFlags & MY_BF_ACTIVEBORDER))
- hbr = CreateSolidBrush(scheme->crColor[COLOR_ACTIVEBORDER]);
- else
- hbr = CreateSolidBrush(scheme->crColor[COLOR_BTNFACE]);
- FillRect(hdc, &InnerRect, hbr);
- DeleteObject(hbr);
- }
MoveToEx(hdc, 0, 0, &SavePoint);
/* Draw the outer edge */
- SelectObject(hdc, LTOuterPen);
- SetDCPenColor(hdc, scheme->crColor[LTOuterI]);
- if(uFlags & BF_TOP)
- {
- MoveToEx(hdc, InnerRect.left, InnerRect.top, NULL);
- LineTo(hdc, InnerRect.right, InnerRect.top);
- }
- if(uFlags & BF_LEFT)
- {
- MoveToEx(hdc, InnerRect.left, InnerRect.top, NULL);
- LineTo(hdc, InnerRect.left, InnerRect.bottom);
- }
- SelectObject(hdc, RBOuterPen);
- SetDCPenColor(hdc, scheme->crColor[RBOuterI]);
- if(uFlags & BF_BOTTOM)
+ if (LTOuterI != -1)
{
- MoveToEx(hdc, InnerRect.left, InnerRect.bottom-1, NULL);
- LineTo(hdc, InnerRect.right, InnerRect.bottom-1);
+ LTOuterPen = GetStockObject(DC_PEN);
+ SelectObject(hdc, LTOuterPen);
+ SetDCPenColor(hdc, scheme->crColor[LTOuterI]);
+ if (uFlags & BF_TOP)
+ {
+ MoveToEx(hdc, InnerRect.left, InnerRect.top, NULL);
+ LineTo(hdc, InnerRect.right, InnerRect.top);
+ }
+ if (uFlags & BF_LEFT)
+ {
+ MoveToEx(hdc, InnerRect.left, InnerRect.top, NULL);
+ LineTo(hdc, InnerRect.left, InnerRect.bottom);
+ }
}
- if(uFlags & BF_RIGHT)
+
+ if (RBOuterI != -1)
{
- MoveToEx(hdc, InnerRect.right-1, InnerRect.top, NULL);
- LineTo(hdc, InnerRect.right-1, InnerRect.bottom);
+ RBOuterPen = GetStockObject(DC_PEN);
+ SelectObject(hdc, RBOuterPen);
+ SetDCPenColor(hdc, scheme->crColor[RBOuterI]);
+ if (uFlags & BF_BOTTOM)
+ {
+ MoveToEx(hdc, InnerRect.left, InnerRect.bottom-1, NULL);
+ LineTo(hdc, InnerRect.right, InnerRect.bottom-1);
+ }
+ if (uFlags & BF_RIGHT)
+ {
+ MoveToEx(hdc, InnerRect.right-1, InnerRect.top, NULL);
+ LineTo(hdc, InnerRect.right-1, InnerRect.bottom);
+ }
}
/* Draw the inner edge */
- SelectObject(hdc, LTInnerPen);
- SetDCPenColor(hdc, scheme->crColor[LTInnerI]);
- if(uFlags & BF_TOP)
+ if (LTInnerI != -1)
{
- MoveToEx(hdc, InnerRect.left+LTpenplus, InnerRect.top+1, NULL);
- LineTo(hdc, InnerRect.right-RTpenplus, InnerRect.top+1);
- }
- if(uFlags & BF_LEFT)
- {
- MoveToEx(hdc, InnerRect.left+1, InnerRect.top+LTpenplus, NULL);
- LineTo(hdc, InnerRect.left+1, InnerRect.bottom-LBpenplus);
- }
- SelectObject(hdc, RBInnerPen);
- SetDCPenColor(hdc, scheme->crColor[RBInnerI]);
- if(uFlags & BF_BOTTOM)
- {
- MoveToEx(hdc, InnerRect.left+LBpenplus, InnerRect.bottom-2, NULL);
- LineTo(hdc, InnerRect.right-RBpenplus, InnerRect.bottom-2);
+ LTInnerPen = GetStockObject(DC_PEN);
+ SelectObject(hdc, LTInnerPen);
+ SetDCPenColor(hdc, scheme->crColor[LTInnerI]);
+ if (uFlags & BF_TOP)
+ {
+ MoveToEx(hdc, InnerRect.left+LTpenplus, InnerRect.top+1, NULL);
+ LineTo(hdc, InnerRect.right-RTpenplus, InnerRect.top+1);
+ }
+ if (uFlags & BF_LEFT)
+ {
+ MoveToEx(hdc, InnerRect.left+1, InnerRect.top+LTpenplus, NULL);
+ LineTo(hdc, InnerRect.left+1, InnerRect.bottom-LBpenplus);
+ }
}
- if(uFlags & BF_RIGHT)
+
+ if (RBInnerI != -1)
{
- MoveToEx(hdc, InnerRect.right-2, InnerRect.top+RTpenplus, NULL);
- LineTo(hdc, InnerRect.right-2, InnerRect.bottom-RBpenplus);
+ RBInnerPen = GetStockObject(DC_PEN);
+ SelectObject(hdc, RBInnerPen);
+ SetDCPenColor(hdc, scheme->crColor[RBInnerI]);
+ if (uFlags & BF_BOTTOM)
+ {
+ MoveToEx(hdc, InnerRect.left+LBpenplus, InnerRect.bottom-2, NULL);
+ LineTo(hdc, InnerRect.right-RBpenplus, InnerRect.bottom-2);
+ }
+ if (uFlags & BF_RIGHT)
+ {
+ MoveToEx(hdc, InnerRect.right-2, InnerRect.top+RTpenplus, NULL);
+ LineTo(hdc, InnerRect.right-2, InnerRect.bottom-RBpenplus);
+ }
}
if (uFlags & BF_ADJUST)
int add = (LTRBInnerMono[uType & (BDR_INNER|BDR_OUTER)] != -1 ? 1 : 0)
+ (LTRBOuterMono[uType & (BDR_INNER|BDR_OUTER)] != -1 ? 1 : 0);
- if(uFlags & BF_LEFT)
+ if (uFlags & BF_LEFT)
InnerRect.left += add;
- if(uFlags & BF_RIGHT)
+ if (uFlags & BF_RIGHT)
InnerRect.right -= add;
- if(uFlags & BF_TOP)
+ if (uFlags & BF_TOP)
InnerRect.top += add;
- if(uFlags & BF_BOTTOM)
+ if (uFlags & BF_BOTTOM)
InnerRect.bottom -= add;
- if(uFlags & BF_ADJUST)
+ if (uFlags & BF_ADJUST)
*rc = InnerRect;
}
MyDrawFrameButton(HDC hdc, LPRECT rc, UINT uState, COLOR_SCHEME *scheme)
{
UINT edge;
- if(uState & (DFCS_PUSHED | DFCS_CHECKED | DFCS_FLAT))
+ if (uState & (DFCS_PUSHED | DFCS_CHECKED | DFCS_FLAT))
edge = EDGE_SUNKEN;
else
edge = EDGE_RAISED;
dst->top += (Height-Width)/2;
dst->bottom = dst->top + SmallDiam;
}
- else if(Width > Height) /* SmallDiam == Height */
+ else if (Width > Height) /* SmallDiam == Height */
{
dst->left += (Width-Height)/2;
dst->right = dst->left + SmallDiam;
case DFCS_CAPTIONRESTORE:
Symbol = '2';
break;
+ default:
+ return FALSE;
}
MyIntDrawRectEdge(dc, r, (uFlags & DFCS_PUSHED) ? EDGE_SUNKEN : EDGE_RAISED, BF_RECT | BF_MIDDLE | BF_SOFT, scheme);
- ZeroMemory(&lf, sizeof(LOGFONT));
+ ZeroMemory(&lf, sizeof(lf));
MyMakeSquareRect(r, &myr);
myr.left += 1;
myr.top += 1;
myr.right -= 1;
myr.bottom -= 1;
- if(uFlags & DFCS_PUSHED)
+ if (uFlags & DFCS_PUSHED)
OffsetRect(&myr,1,1);
lf.lfHeight = myr.bottom - myr.top;
lf.lfWidth = 0;
bkmode = GetBkMode(dc);
/* Set color and drawing mode */
SetBkMode(dc, TRANSPARENT);
- if(uFlags & DFCS_INACTIVE)
+ if (uFlags & DFCS_INACTIVE)
{
/* Draw shadow */
SetTextColor(dc, scheme->crColor[COLOR_BTNHIGHLIGHT]);
case DFCS_SCROLLRIGHT:
Symbol = '4';
break;
+
+ default:
+ return FALSE;
}
MyIntDrawRectEdge(dc, r, (uFlags & DFCS_PUSHED) ? EDGE_SUNKEN : EDGE_RAISED, (uFlags&DFCS_FLAT) | BF_MIDDLE | BF_RECT, scheme);
- ZeroMemory(&lf, sizeof(LOGFONT));
+ ZeroMemory(&lf, sizeof(lf));
MyMakeSquareRect(r, &myr);
myr.left += 1;
myr.top += 1;
myr.right -= 1;
myr.bottom -= 1;
- if(uFlags & DFCS_PUSHED)
+ if (uFlags & DFCS_PUSHED)
OffsetRect(&myr,1,1);
lf.lfHeight = myr.bottom - myr.top;
lf.lfWidth = 0;
bkmode = GetBkMode(dc);
/* Set color and drawing mode */
SetBkMode(dc, TRANSPARENT);
- if(uFlags & DFCS_INACTIVE)
+ if (uFlags & DFCS_INACTIVE)
{
/* Draw shadow */
SetTextColor(dc, scheme->crColor[COLOR_BTNHIGHLIGHT]);
bkgnd = (flat_menu ? COLOR_MENUBAR : COLOR_MENU);
x = Rect->left;
hFontOld = SelectObject(DC, Font);
- for(i = 0; i < 3; i++)
+ for (i = 0; i < 3; i++)
{
GetMenuStringW(Menu, i, Text, 128, MF_BYPOSITION);
if (i == 1)
{
++rect.left; ++rect.top; ++rect.right; ++rect.bottom;
- SetTextColor(DC, RGB(0xff, 0xff, 0xff));
+ SetTextColor(DC, scheme->crColor[COLOR_BTNHIGHLIGHT]);
DrawTextW(DC, Text, -1, &rect, uFormat);
--rect.left; --rect.top; --rect.right; --rect.bottom;
- SetTextColor(DC, RGB(0x80, 0x80, 0x80));
+ SetTextColor(DC, scheme->crColor[COLOR_BTNSHADOW]);
}
DrawTextW(DC, Text, -1, &rect, uFormat);
}