- Support custom check background.
- Reduce number of parameters needed for DrawString function.
This commit is contained in:
parent
bea0b25554
commit
cc08578577
|
@ -566,13 +566,13 @@ TOOLBAR_DrawArrow (HDC hdc, INT left, INT top, INT colorRef)
|
||||||
* an image list
|
* an image list
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
TOOLBAR_DrawString (TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr,
|
TOOLBAR_DrawString (TOOLBAR_INFO *infoPtr, RECT *rcText, LPWSTR lpText,
|
||||||
HDC hdc, DWORD dwStyle,
|
NMTBCUSTOMDRAW *tbcd)
|
||||||
RECT *rcText, LPWSTR lpText, NMTBCUSTOMDRAW *tbcd)
|
|
||||||
{
|
{
|
||||||
HFONT hOldFont = 0;
|
HFONT hOldFont = 0;
|
||||||
COLORREF clrOld = 0;
|
COLORREF clrOld = 0;
|
||||||
UINT state = tbcd->nmcd.uItemState;
|
UINT state = tbcd->nmcd.uItemState;
|
||||||
|
HDC hdc = tbcd->nmcd.hdc;
|
||||||
|
|
||||||
/* draw text */
|
/* draw text */
|
||||||
if (lpText) {
|
if (lpText) {
|
||||||
|
@ -605,12 +605,15 @@ TOOLBAR_DrawString (TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr,
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
TOOLBAR_DrawPattern (HDC hdc, LPRECT lpRect)
|
TOOLBAR_DrawPattern (LPRECT lpRect, NMTBCUSTOMDRAW *tbcd)
|
||||||
{
|
{
|
||||||
|
HDC hdc = tbcd->nmcd.hdc;
|
||||||
HBRUSH hbr = SelectObject (hdc, COMCTL32_hPattern55AABrush);
|
HBRUSH hbr = SelectObject (hdc, COMCTL32_hPattern55AABrush);
|
||||||
INT cx = lpRect->right - lpRect->left;
|
INT cx = lpRect->right - lpRect->left;
|
||||||
INT cy = lpRect->bottom - lpRect->top;
|
INT cy = lpRect->bottom - lpRect->top;
|
||||||
PatBlt (hdc, lpRect->left, lpRect->top, cx, cy, 0x00FA0089);
|
SetTextColor(hdc, tbcd->clrBtnHighlight);
|
||||||
|
SetBkColor(hdc, tbcd->clrBtnFace);
|
||||||
|
PatBlt (hdc, lpRect->left, lpRect->top, cx, cy, PATCOPY);
|
||||||
SelectObject (hdc, hbr);
|
SelectObject (hdc, hbr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -802,9 +805,10 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc)
|
||||||
/* NOTE: applications can and do alter this to customize their */
|
/* NOTE: applications can and do alter this to customize their */
|
||||||
/* toolbars */
|
/* toolbars */
|
||||||
tbcd.nmcd.uItemState = TOOLBAR_TranslateState(btnPtr);
|
tbcd.nmcd.uItemState = TOOLBAR_TranslateState(btnPtr);
|
||||||
|
tbcd.nmcd.hdc = hdc;
|
||||||
|
tbcd.hbrMonoDither = COMCTL32_hPattern55AABrush;
|
||||||
|
|
||||||
/* FIXME: what should these be set to ????? */
|
/* FIXME: what should these be set to ????? */
|
||||||
tbcd.hbrMonoDither = 0;
|
|
||||||
tbcd.hbrLines = 0;
|
tbcd.hbrLines = 0;
|
||||||
tbcd.hpenLines = 0;
|
tbcd.hpenLines = 0;
|
||||||
|
|
||||||
|
@ -814,7 +818,6 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc)
|
||||||
if (infoPtr->dwBaseCustDraw & CDRF_NOTIFYITEMDRAW)
|
if (infoPtr->dwBaseCustDraw & CDRF_NOTIFYITEMDRAW)
|
||||||
{
|
{
|
||||||
tbcd.nmcd.dwDrawStage = CDDS_ITEMPREPAINT;
|
tbcd.nmcd.dwDrawStage = CDDS_ITEMPREPAINT;
|
||||||
tbcd.nmcd.hdc = hdc;
|
|
||||||
tbcd.nmcd.rc = rc;
|
tbcd.nmcd.rc = rc;
|
||||||
tbcd.nmcd.dwItemSpec = btnPtr->idCommand;
|
tbcd.nmcd.dwItemSpec = btnPtr->idCommand;
|
||||||
tbcd.nmcd.lItemlParam = btnPtr->dwData;
|
tbcd.nmcd.lItemlParam = btnPtr->dwData;
|
||||||
|
@ -897,7 +900,7 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc)
|
||||||
TOOLBAR_DrawMasked (infoPtr, btnPtr, hdc, rcBitmap.left, rcBitmap.top);
|
TOOLBAR_DrawMasked (infoPtr, btnPtr, hdc, rcBitmap.left, rcBitmap.top);
|
||||||
|
|
||||||
if (!(infoPtr->dwExStyle & TBSTYLE_EX_MIXEDBUTTONS) || (btnPtr->fsStyle & BTNS_SHOWTEXT))
|
if (!(infoPtr->dwExStyle & TBSTYLE_EX_MIXEDBUTTONS) || (btnPtr->fsStyle & BTNS_SHOWTEXT))
|
||||||
TOOLBAR_DrawString (infoPtr, btnPtr, hdc, dwStyle, &rcText, lpText, &tbcd);
|
TOOLBAR_DrawString (infoPtr, &rcText, lpText, &tbcd);
|
||||||
goto FINALNOTIFY;
|
goto FINALNOTIFY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -928,7 +931,7 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc)
|
||||||
ILD_NORMAL);
|
ILD_NORMAL);
|
||||||
|
|
||||||
if (!(infoPtr->dwExStyle & TBSTYLE_EX_MIXEDBUTTONS) || (btnPtr->fsStyle & BTNS_SHOWTEXT))
|
if (!(infoPtr->dwExStyle & TBSTYLE_EX_MIXEDBUTTONS) || (btnPtr->fsStyle & BTNS_SHOWTEXT))
|
||||||
TOOLBAR_DrawString (infoPtr, btnPtr, hdc, dwStyle, &rcText, lpText, &tbcd);
|
TOOLBAR_DrawString (infoPtr, &rcText, lpText, &tbcd);
|
||||||
goto FINALNOTIFY;
|
goto FINALNOTIFY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -945,14 +948,14 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc)
|
||||||
BF_RECT | BF_MIDDLE | BF_ADJUST);
|
BF_RECT | BF_MIDDLE | BF_ADJUST);
|
||||||
}
|
}
|
||||||
|
|
||||||
TOOLBAR_DrawPattern (hdc, &rc);
|
TOOLBAR_DrawPattern (&rc, &tbcd);
|
||||||
|
|
||||||
TOOLBAR_DrawImageList (infoPtr, btnPtr, IMAGE_LIST_DEFAULT,
|
TOOLBAR_DrawImageList (infoPtr, btnPtr, IMAGE_LIST_DEFAULT,
|
||||||
hdc, rcBitmap.left+1, rcBitmap.top+1,
|
hdc, rcBitmap.left+1, rcBitmap.top+1,
|
||||||
ILD_NORMAL);
|
ILD_NORMAL);
|
||||||
|
|
||||||
if (!(infoPtr->dwExStyle & TBSTYLE_EX_MIXEDBUTTONS) || (btnPtr->fsStyle & BTNS_SHOWTEXT))
|
if (!(infoPtr->dwExStyle & TBSTYLE_EX_MIXEDBUTTONS) || (btnPtr->fsStyle & BTNS_SHOWTEXT))
|
||||||
TOOLBAR_DrawString (infoPtr, btnPtr, hdc, dwStyle, &rcText, lpText, &tbcd);
|
TOOLBAR_DrawString (infoPtr, &rcText, lpText, &tbcd);
|
||||||
goto FINALNOTIFY;
|
goto FINALNOTIFY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -962,10 +965,10 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc)
|
||||||
DrawEdge (hdc, &rc, EDGE_RAISED,
|
DrawEdge (hdc, &rc, EDGE_RAISED,
|
||||||
BF_SOFT | BF_RECT | BF_MIDDLE | BF_ADJUST);
|
BF_SOFT | BF_RECT | BF_MIDDLE | BF_ADJUST);
|
||||||
|
|
||||||
TOOLBAR_DrawPattern (hdc, &rc);
|
TOOLBAR_DrawPattern (&rc, &tbcd);
|
||||||
TOOLBAR_DrawMasked (infoPtr, btnPtr, hdc, rcBitmap.left, rcBitmap.top);
|
TOOLBAR_DrawMasked (infoPtr, btnPtr, hdc, rcBitmap.left, rcBitmap.top);
|
||||||
if (!(infoPtr->dwExStyle & TBSTYLE_EX_MIXEDBUTTONS) || (btnPtr->fsStyle & BTNS_SHOWTEXT))
|
if (!(infoPtr->dwExStyle & TBSTYLE_EX_MIXEDBUTTONS) || (btnPtr->fsStyle & BTNS_SHOWTEXT))
|
||||||
TOOLBAR_DrawString (infoPtr, btnPtr, hdc, dwStyle, &rcText, lpText, &tbcd);
|
TOOLBAR_DrawString (infoPtr, &rcText, lpText, &tbcd);
|
||||||
goto FINALNOTIFY;
|
goto FINALNOTIFY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1012,7 +1015,7 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc)
|
||||||
|
|
||||||
|
|
||||||
if (!(infoPtr->dwExStyle & TBSTYLE_EX_MIXEDBUTTONS) || (btnPtr->fsStyle & BTNS_SHOWTEXT))
|
if (!(infoPtr->dwExStyle & TBSTYLE_EX_MIXEDBUTTONS) || (btnPtr->fsStyle & BTNS_SHOWTEXT))
|
||||||
TOOLBAR_DrawString (infoPtr, btnPtr, hdc, dwStyle, &rcText, lpText, &tbcd);
|
TOOLBAR_DrawString (infoPtr, &rcText, lpText, &tbcd);
|
||||||
|
|
||||||
FINALNOTIFY:
|
FINALNOTIFY:
|
||||||
if (infoPtr->dwItemCustDraw & CDRF_NOTIFYPOSTPAINT)
|
if (infoPtr->dwItemCustDraw & CDRF_NOTIFYPOSTPAINT)
|
||||||
|
|
Loading…
Reference in New Issue