- Use the style returned in custom draw structure to draw the button,
as apps may modify the style this way. - Disabled buttons can become hot. - Retrieve image list for drawing after getting image list ID (in I_IMAGECALLBACK case).
This commit is contained in:
parent
62ddeb9da5
commit
90f3057b41
|
@ -176,6 +176,12 @@ typedef struct
|
||||||
WCHAR text[64];
|
WCHAR text[64];
|
||||||
} CUSTOMBUTTON, *PCUSTOMBUTTON;
|
} CUSTOMBUTTON, *PCUSTOMBUTTON;
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
IMAGE_LIST_DEFAULT,
|
||||||
|
IMAGE_LIST_HOT,
|
||||||
|
IMAGE_LIST_DISABLED
|
||||||
|
} IMAGE_LIST_TYPE;
|
||||||
|
|
||||||
#define SEPARATOR_WIDTH 8
|
#define SEPARATOR_WIDTH 8
|
||||||
#define TOP_BORDER 2
|
#define TOP_BORDER 2
|
||||||
|
@ -364,12 +370,11 @@ TOOLBAR_IsValidBitmapIndex(TOOLBAR_INFO *infoPtr, INT index)
|
||||||
* function. It returns TRUE if the image was drawn, FALSE otherwise.
|
* function. It returns TRUE if the image was drawn, FALSE otherwise.
|
||||||
*/
|
*/
|
||||||
static BOOL
|
static BOOL
|
||||||
TOOLBAR_DrawImageList (TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, HIMAGELIST himl,
|
TOOLBAR_DrawImageList (TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, IMAGE_LIST_TYPE imagelist,
|
||||||
HDC hdc, UINT left, UINT top, UINT draw_flags)
|
HDC hdc, UINT left, UINT top, UINT draw_flags)
|
||||||
{
|
{
|
||||||
INT index;
|
INT index;
|
||||||
|
HIMAGELIST himl;
|
||||||
if (!himl) return FALSE;
|
|
||||||
|
|
||||||
if (!TOOLBAR_IsValidBitmapIndex(infoPtr,btnPtr->iBitmap)) {
|
if (!TOOLBAR_IsValidBitmapIndex(infoPtr,btnPtr->iBitmap)) {
|
||||||
if (btnPtr->iBitmap == I_IMAGENONE) return FALSE;
|
if (btnPtr->iBitmap == I_IMAGENONE) return FALSE;
|
||||||
|
@ -385,6 +390,29 @@ TOOLBAR_DrawImageList (TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, HIMAGELIST h
|
||||||
index);
|
index);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch(imagelist)
|
||||||
|
{
|
||||||
|
case IMAGE_LIST_DEFAULT:
|
||||||
|
himl = GETDEFIMAGELIST(infoPtr, GETHIMLID(infoPtr, btnPtr->iBitmap));
|
||||||
|
break;
|
||||||
|
case IMAGE_LIST_HOT:
|
||||||
|
himl = GETHOTIMAGELIST(infoPtr, GETHIMLID(infoPtr, btnPtr->iBitmap));
|
||||||
|
break;
|
||||||
|
case IMAGE_LIST_DISABLED:
|
||||||
|
himl = GETDISIMAGELIST(infoPtr, GETHIMLID(infoPtr, btnPtr->iBitmap));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
himl = NULL;
|
||||||
|
FIXME("Shouldn't reach here\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!himl)
|
||||||
|
{
|
||||||
|
TRACE("no image list, returning FALSE\n");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
TRACE("drawing index=%d, himl=%p, left=%d, top=%d, flags=%08x\n",
|
TRACE("drawing index=%d, himl=%p, left=%d, top=%d, flags=%08x\n",
|
||||||
index, himl, left, top, draw_flags);
|
index, himl, left, top, draw_flags);
|
||||||
|
|
||||||
|
@ -524,31 +552,32 @@ TOOLBAR_DrawArrow (HDC hdc, INT left, INT top, INT colorRef)
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
TOOLBAR_DrawString (TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr,
|
TOOLBAR_DrawString (TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr,
|
||||||
HDC hdc, INT nState, DWORD dwStyle,
|
HDC hdc, DWORD dwStyle,
|
||||||
RECT *rcText, LPWSTR lpText, 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;
|
||||||
|
|
||||||
/* draw text */
|
/* draw text */
|
||||||
if (lpText) {
|
if (lpText) {
|
||||||
TRACE("string rect=(%ld,%ld)-(%ld,%ld)\n",
|
TRACE("string=%s rect=(%ld,%ld)-(%ld,%ld)\n", debugstr_w(lpText),
|
||||||
rcText->left, rcText->top, rcText->right, rcText->bottom);
|
rcText->left, rcText->top, rcText->right, rcText->bottom);
|
||||||
|
|
||||||
hOldFont = SelectObject (hdc, infoPtr->hFont);
|
hOldFont = SelectObject (hdc, infoPtr->hFont);
|
||||||
if (!(nState & TBSTATE_ENABLED)) {
|
if ((state & CDIS_HOT) && (infoPtr->dwItemCDFlag & TBCDRF_HILITEHOTTRACK )) {
|
||||||
|
clrOld = SetTextColor (hdc, tbcd->clrTextHighlight);
|
||||||
|
}
|
||||||
|
else if (state & CDIS_DISABLED) {
|
||||||
clrOld = SetTextColor (hdc, tbcd->clrBtnHighlight);
|
clrOld = SetTextColor (hdc, tbcd->clrBtnHighlight);
|
||||||
OffsetRect (rcText, 1, 1);
|
OffsetRect (rcText, 1, 1);
|
||||||
DrawTextW (hdc, lpText, -1, rcText, infoPtr->dwDTFlags);
|
DrawTextW (hdc, lpText, -1, rcText, infoPtr->dwDTFlags);
|
||||||
SetTextColor (hdc, comctl32_color.clr3dShadow);
|
SetTextColor (hdc, comctl32_color.clr3dShadow);
|
||||||
OffsetRect (rcText, -1, -1);
|
OffsetRect (rcText, -1, -1);
|
||||||
}
|
}
|
||||||
else if (nState & TBSTATE_INDETERMINATE) {
|
else if (state & CDIS_INDETERMINATE) {
|
||||||
clrOld = SetTextColor (hdc, comctl32_color.clr3dShadow);
|
clrOld = SetTextColor (hdc, comctl32_color.clr3dShadow);
|
||||||
}
|
}
|
||||||
else if (btnPtr->bHot && (infoPtr->dwItemCDFlag & TBCDRF_HILITEHOTTRACK )) {
|
|
||||||
clrOld = SetTextColor (hdc, tbcd->clrTextHighlight);
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
clrOld = SetTextColor (hdc, tbcd->clrText);
|
clrOld = SetTextColor (hdc, tbcd->clrText);
|
||||||
}
|
}
|
||||||
|
@ -636,7 +665,6 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc)
|
||||||
NMTBCUSTOMDRAW tbcd;
|
NMTBCUSTOMDRAW tbcd;
|
||||||
DWORD ntfret;
|
DWORD ntfret;
|
||||||
INT offset;
|
INT offset;
|
||||||
HIMAGELIST himlDef;
|
|
||||||
|
|
||||||
if (btnPtr->fsState & TBSTATE_HIDDEN)
|
if (btnPtr->fsState & TBSTATE_HIDDEN)
|
||||||
return;
|
return;
|
||||||
|
@ -734,6 +762,10 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc)
|
||||||
tbcd.rcText.top = 0;
|
tbcd.rcText.top = 0;
|
||||||
tbcd.rcText.right = rcText.right - rc.left;
|
tbcd.rcText.right = rcText.right - rc.left;
|
||||||
tbcd.rcText.bottom = rcText.bottom - rc.top;
|
tbcd.rcText.bottom = rcText.bottom - rc.top;
|
||||||
|
/* we use this state later on to decide how to draw the buttons */
|
||||||
|
/* NOTE: applications can and do alter this to customize their */
|
||||||
|
/* toolbars */
|
||||||
|
tbcd.nmcd.uItemState = TOOLBAR_TranslateState(btnPtr);
|
||||||
|
|
||||||
/* FIXME: what should these be set to ????? */
|
/* FIXME: what should these be set to ????? */
|
||||||
tbcd.hbrMonoDither = 0;
|
tbcd.hbrMonoDither = 0;
|
||||||
|
@ -749,7 +781,6 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc)
|
||||||
tbcd.nmcd.hdc = hdc;
|
tbcd.nmcd.hdc = hdc;
|
||||||
tbcd.nmcd.rc = rc;
|
tbcd.nmcd.rc = rc;
|
||||||
tbcd.nmcd.dwItemSpec = btnPtr->idCommand;
|
tbcd.nmcd.dwItemSpec = btnPtr->idCommand;
|
||||||
tbcd.nmcd.uItemState = TOOLBAR_TranslateState(btnPtr);
|
|
||||||
tbcd.nmcd.lItemlParam = btnPtr->dwData;
|
tbcd.nmcd.lItemlParam = btnPtr->dwData;
|
||||||
ntfret = TOOLBAR_SendNotify ((NMHDR *)&tbcd, infoPtr, NM_CUSTOMDRAW);
|
ntfret = TOOLBAR_SendNotify ((NMHDR *)&tbcd, infoPtr, NM_CUSTOMDRAW);
|
||||||
infoPtr->dwItemCustDraw = ntfret & 0xffff;
|
infoPtr->dwItemCustDraw = ntfret & 0xffff;
|
||||||
|
@ -784,12 +815,31 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc)
|
||||||
goto FINALNOTIFY;
|
goto FINALNOTIFY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Determine index of image list */
|
if ((dwStyle & TBSTYLE_FLAT) && (tbcd.nmcd.uItemState & CDIS_HOT))
|
||||||
himlDef = GETDEFIMAGELIST(infoPtr, GETHIMLID(infoPtr, btnPtr->iBitmap));
|
{
|
||||||
|
if ( infoPtr->dwItemCDFlag & TBCDRF_HILITEHOTTRACK )
|
||||||
|
{
|
||||||
|
COLORREF oldclr;
|
||||||
|
|
||||||
|
oldclr = SetBkColor(hdc, tbcd.clrHighlightHotTrack);
|
||||||
|
ExtTextOutA(hdc, 0, 0, ETO_OPAQUE, &rc, NULL, 0, 0);
|
||||||
|
if (hasDropDownArrow)
|
||||||
|
ExtTextOutA(hdc, 0, 0, ETO_OPAQUE, &rcArrow, NULL, 0, 0);
|
||||||
|
SetBkColor(hdc, oldclr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!(tbcd.nmcd.uItemState & CDIS_DISABLED) && !(infoPtr->dwItemCDFlag & TBCDRF_NOEDGES))
|
||||||
|
{
|
||||||
|
DrawEdge (hdc, &rc, BDR_RAISEDINNER, BF_RECT);
|
||||||
|
if (hasDropDownArrow)
|
||||||
|
DrawEdge (hdc, &rcArrow, BDR_RAISEDINNER, BF_RECT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* disabled */
|
/* disabled */
|
||||||
if (!(btnPtr->fsState & TBSTATE_ENABLED)) {
|
if (tbcd.nmcd.uItemState & CDIS_DISABLED) {
|
||||||
HIMAGELIST himlDis = GETDISIMAGELIST(infoPtr, GETHIMLID(infoPtr, btnPtr->iBitmap));
|
|
||||||
if (!(dwStyle & TBSTYLE_FLAT) && !(infoPtr->dwItemCDFlag & TBCDRF_NOEDGES))
|
if (!(dwStyle & TBSTYLE_FLAT) && !(infoPtr->dwItemCDFlag & TBCDRF_NOEDGES))
|
||||||
{
|
{
|
||||||
DrawEdge (hdc, &rc, EDGE_RAISED,
|
DrawEdge (hdc, &rc, EDGE_RAISED,
|
||||||
|
@ -805,17 +855,17 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc)
|
||||||
TOOLBAR_DrawArrow(hdc, rcArrow.left, rcArrow.top + (rcArrow.bottom - rcArrow.top - ARROW_HEIGHT) / 2, COLOR_3DSHADOW);
|
TOOLBAR_DrawArrow(hdc, rcArrow.left, rcArrow.top + (rcArrow.bottom - rcArrow.top - ARROW_HEIGHT) / 2, COLOR_3DSHADOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!TOOLBAR_DrawImageList (infoPtr, btnPtr, himlDis,
|
if (!TOOLBAR_DrawImageList (infoPtr, btnPtr, IMAGE_LIST_DISABLED,
|
||||||
hdc, rcBitmap.left, rcBitmap.top,
|
hdc, rcBitmap.left, rcBitmap.top,
|
||||||
ILD_NORMAL))
|
ILD_NORMAL))
|
||||||
TOOLBAR_DrawMasked (infoPtr, btnPtr, hdc, rcBitmap.left, rcBitmap.top);
|
TOOLBAR_DrawMasked (infoPtr, btnPtr, hdc, rcBitmap.left, rcBitmap.top);
|
||||||
|
|
||||||
TOOLBAR_DrawString (infoPtr, btnPtr, hdc, btnPtr->fsState, dwStyle, &rcText, lpText, &tbcd);
|
TOOLBAR_DrawString (infoPtr, btnPtr, hdc, dwStyle, &rcText, lpText, &tbcd);
|
||||||
goto FINALNOTIFY;
|
goto FINALNOTIFY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* pressed TBSTYLE_BUTTON */
|
/* pressed TBSTYLE_BUTTON */
|
||||||
if (btnPtr->fsState & TBSTATE_PRESSED) {
|
if (tbcd.nmcd.uItemState & CDIS_SELECTED) {
|
||||||
offset = (infoPtr->dwItemCDFlag & TBCDRF_NOOFFSET) ? 0 : 1;
|
offset = (infoPtr->dwItemCDFlag & TBCDRF_NOOFFSET) ? 0 : 1;
|
||||||
if (!(infoPtr->dwItemCDFlag & TBCDRF_NOEDGES))
|
if (!(infoPtr->dwItemCDFlag & TBCDRF_NOEDGES))
|
||||||
{
|
{
|
||||||
|
@ -836,17 +886,17 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc)
|
||||||
if (hasDropDownArrow)
|
if (hasDropDownArrow)
|
||||||
TOOLBAR_DrawArrow(hdc, rcArrow.left, rcArrow.top + (rcArrow.bottom - rcArrow.top - ARROW_HEIGHT) / 2, COLOR_WINDOWFRAME);
|
TOOLBAR_DrawArrow(hdc, rcArrow.left, rcArrow.top + (rcArrow.bottom - rcArrow.top - ARROW_HEIGHT) / 2, COLOR_WINDOWFRAME);
|
||||||
|
|
||||||
TOOLBAR_DrawImageList (infoPtr, btnPtr, himlDef,
|
TOOLBAR_DrawImageList (infoPtr, btnPtr, IMAGE_LIST_DEFAULT,
|
||||||
hdc, rcBitmap.left+offset, rcBitmap.top+offset,
|
hdc, rcBitmap.left+offset, rcBitmap.top+offset,
|
||||||
ILD_NORMAL);
|
ILD_NORMAL);
|
||||||
|
|
||||||
TOOLBAR_DrawString (infoPtr, btnPtr, hdc, btnPtr->fsState, dwStyle, &rcText, lpText, &tbcd);
|
TOOLBAR_DrawString (infoPtr, btnPtr, hdc, dwStyle, &rcText, lpText, &tbcd);
|
||||||
goto FINALNOTIFY;
|
goto FINALNOTIFY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* checked TBSTYLE_CHECK */
|
/* checked TBSTYLE_CHECK */
|
||||||
if ((btnPtr->fsStyle & TBSTYLE_CHECK) &&
|
if ((tbcd.nmcd.uItemState & CDIS_CHECKED) &&
|
||||||
(btnPtr->fsState & TBSTATE_CHECKED)) {
|
(btnPtr->fsStyle & TBSTYLE_CHECK)) {
|
||||||
if (!(infoPtr->dwItemCDFlag & TBCDRF_NOEDGES))
|
if (!(infoPtr->dwItemCDFlag & TBCDRF_NOEDGES))
|
||||||
{
|
{
|
||||||
if (dwStyle & TBSTYLE_FLAT)
|
if (dwStyle & TBSTYLE_FLAT)
|
||||||
|
@ -859,80 +909,45 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc)
|
||||||
|
|
||||||
TOOLBAR_DrawPattern (hdc, &rc);
|
TOOLBAR_DrawPattern (hdc, &rc);
|
||||||
|
|
||||||
TOOLBAR_DrawImageList (infoPtr, btnPtr, himlDef,
|
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);
|
||||||
|
|
||||||
TOOLBAR_DrawString (infoPtr, btnPtr, hdc, btnPtr->fsState, dwStyle, &rcText, lpText, &tbcd);
|
TOOLBAR_DrawString (infoPtr, btnPtr, hdc, dwStyle, &rcText, lpText, &tbcd);
|
||||||
goto FINALNOTIFY;
|
goto FINALNOTIFY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* indeterminate */
|
/* indeterminate */
|
||||||
if (btnPtr->fsState & TBSTATE_INDETERMINATE) {
|
if (tbcd.nmcd.uItemState & CDIS_INDETERMINATE) {
|
||||||
if (!(infoPtr->dwItemCDFlag & TBCDRF_NOEDGES))
|
if (!(infoPtr->dwItemCDFlag & TBCDRF_NOEDGES))
|
||||||
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 (hdc, &rc);
|
||||||
TOOLBAR_DrawMasked (infoPtr, btnPtr, hdc, rcBitmap.left, rcBitmap.top);
|
TOOLBAR_DrawMasked (infoPtr, btnPtr, hdc, rcBitmap.left, rcBitmap.top);
|
||||||
TOOLBAR_DrawString (infoPtr, btnPtr, hdc, btnPtr->fsState, dwStyle, &rcText, lpText, &tbcd);
|
TOOLBAR_DrawString (infoPtr, btnPtr, hdc, dwStyle, &rcText, lpText, &tbcd);
|
||||||
goto FINALNOTIFY;
|
goto FINALNOTIFY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* normal state */
|
/* normal state */
|
||||||
if (dwStyle & TBSTYLE_FLAT)
|
if (dwStyle & TBSTYLE_FLAT)
|
||||||
{
|
{
|
||||||
if (btnPtr->bHot)
|
|
||||||
{
|
|
||||||
if ( infoPtr->dwItemCDFlag & TBCDRF_HILITEHOTTRACK )
|
|
||||||
{
|
|
||||||
COLORREF oldclr;
|
|
||||||
|
|
||||||
oldclr = SetBkColor(hdc, tbcd.clrHighlightHotTrack);
|
|
||||||
ExtTextOutA(hdc, 0, 0, ETO_OPAQUE, &rc, NULL, 0, 0);
|
|
||||||
if (hasDropDownArrow)
|
|
||||||
ExtTextOutA(hdc, 0, 0, ETO_OPAQUE, &rcArrow, NULL, 0, 0);
|
|
||||||
SetBkColor(hdc, oldclr);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!(infoPtr->dwItemCDFlag & TBCDRF_NOEDGES))
|
|
||||||
{
|
|
||||||
DrawEdge (hdc, &rc, BDR_RAISEDINNER, BF_RECT);
|
|
||||||
if (hasDropDownArrow)
|
|
||||||
DrawEdge (hdc, &rcArrow, BDR_RAISEDINNER, BF_RECT);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#if 1
|
|
||||||
else /* The following code needs to be removed after
|
|
||||||
* "hot item" support has been implemented for the
|
|
||||||
* case where it is being de-selected.
|
|
||||||
*/
|
|
||||||
{
|
|
||||||
FrameRect(hdc, &rc, GetSysColorBrush(COLOR_BTNFACE));
|
|
||||||
if (hasDropDownArrow)
|
|
||||||
FrameRect(hdc, &rcArrow, GetSysColorBrush(COLOR_BTNFACE));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (hasDropDownArrow)
|
if (hasDropDownArrow)
|
||||||
TOOLBAR_DrawArrow(hdc, rcArrow.left+1, rcArrow.top + (rcArrow.bottom - rcArrow.top - ARROW_HEIGHT) / 2, COLOR_WINDOWFRAME);
|
TOOLBAR_DrawArrow(hdc, rcArrow.left+1, rcArrow.top + (rcArrow.bottom - rcArrow.top - ARROW_HEIGHT) / 2, COLOR_WINDOWFRAME);
|
||||||
|
|
||||||
if (btnPtr->bHot) {
|
if (tbcd.nmcd.uItemState & CDIS_HOT) {
|
||||||
HIMAGELIST himlHot = GETHOTIMAGELIST(infoPtr,
|
/* if hot, attempt to draw with hot image list, if fails,
|
||||||
GETHIMLID(infoPtr, btnPtr->iBitmap));
|
use default image list */
|
||||||
/* if hot, attempt to draw with himlHot, if fails, use himlDef */
|
|
||||||
if (!TOOLBAR_DrawImageList (infoPtr, btnPtr,
|
if (!TOOLBAR_DrawImageList (infoPtr, btnPtr,
|
||||||
himlHot,
|
IMAGE_LIST_HOT,
|
||||||
hdc, rcBitmap.left,
|
hdc, rcBitmap.left,
|
||||||
rcBitmap.top, ILD_NORMAL))
|
rcBitmap.top, ILD_NORMAL))
|
||||||
TOOLBAR_DrawImageList (infoPtr, btnPtr, himlDef,
|
TOOLBAR_DrawImageList (infoPtr, btnPtr, IMAGE_LIST_DEFAULT,
|
||||||
hdc, rcBitmap.left, rcBitmap.top,
|
hdc, rcBitmap.left, rcBitmap.top,
|
||||||
ILD_NORMAL);
|
ILD_NORMAL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
TOOLBAR_DrawImageList (infoPtr, btnPtr, himlDef,
|
TOOLBAR_DrawImageList (infoPtr, btnPtr, IMAGE_LIST_DEFAULT,
|
||||||
hdc, rcBitmap.left, rcBitmap.top,
|
hdc, rcBitmap.left, rcBitmap.top,
|
||||||
ILD_NORMAL);
|
ILD_NORMAL);
|
||||||
}
|
}
|
||||||
|
@ -950,12 +965,13 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc)
|
||||||
TOOLBAR_DrawArrow(hdc, rcArrow.left, rcArrow.top + (rcArrow.bottom - rcArrow.top - ARROW_HEIGHT) / 2, COLOR_WINDOWFRAME);
|
TOOLBAR_DrawArrow(hdc, rcArrow.left, rcArrow.top + (rcArrow.bottom - rcArrow.top - ARROW_HEIGHT) / 2, COLOR_WINDOWFRAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
TOOLBAR_DrawImageList (infoPtr, btnPtr, himlDef,
|
TOOLBAR_DrawImageList (infoPtr, btnPtr, IMAGE_LIST_DEFAULT,
|
||||||
hdc, rcBitmap.left, rcBitmap.top,
|
hdc, rcBitmap.left, rcBitmap.top,
|
||||||
ILD_NORMAL);}
|
ILD_NORMAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
TOOLBAR_DrawString (infoPtr, btnPtr, hdc, btnPtr->fsState, dwStyle, &rcText, lpText, &tbcd);
|
TOOLBAR_DrawString (infoPtr, btnPtr, hdc, dwStyle, &rcText, lpText, &tbcd);
|
||||||
|
|
||||||
FINALNOTIFY:
|
FINALNOTIFY:
|
||||||
if (infoPtr->dwItemCustDraw & CDRF_NOTIFYPOSTPAINT)
|
if (infoPtr->dwItemCustDraw & CDRF_NOTIFYPOSTPAINT)
|
||||||
|
@ -2780,6 +2796,8 @@ TOOLBAR_ChangeBitmap (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
TBUTTON_INFO *btnPtr;
|
TBUTTON_INFO *btnPtr;
|
||||||
INT nIndex;
|
INT nIndex;
|
||||||
|
|
||||||
|
TRACE("button %d, iBitmap now %d\n", wParam, LOWORD(lParam));
|
||||||
|
|
||||||
nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, FALSE);
|
nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, FALSE);
|
||||||
if (nIndex == -1)
|
if (nIndex == -1)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -4227,6 +4245,8 @@ TOOLBAR_SetHotImageList (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
if (infoPtr->iVersion >= 5)
|
if (infoPtr->iVersion >= 5)
|
||||||
id = wParam;
|
id = wParam;
|
||||||
|
|
||||||
|
TRACE("hwnd = %p, himl = %p, id = %d\n", hwnd, himl, id);
|
||||||
|
|
||||||
himlTemp = TOOLBAR_InsertImageList(&infoPtr->himlHot,
|
himlTemp = TOOLBAR_InsertImageList(&infoPtr->himlHot,
|
||||||
&infoPtr->cimlHot, himl, id);
|
&infoPtr->cimlHot, himl, id);
|
||||||
|
|
||||||
|
@ -5170,10 +5190,9 @@ TOOLBAR_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
|
|
||||||
if (infoPtr->nOldHit != nHit)
|
if (infoPtr->nOldHit != nHit)
|
||||||
{
|
{
|
||||||
/* Remove the effect of an old hot button if the button was enabled and was
|
/* Remove the effect of an old hot button if the button was
|
||||||
drawn with the hot button effect */
|
drawn with the hot button effect */
|
||||||
if(infoPtr->nOldHit >= 0 && infoPtr->nOldHit == infoPtr->nHotItem &&
|
if(infoPtr->nOldHit >= 0 && infoPtr->nOldHit == infoPtr->nHotItem)
|
||||||
(infoPtr->buttons[infoPtr->nOldHit].fsState & TBSTATE_ENABLED))
|
|
||||||
{
|
{
|
||||||
oldBtnPtr = &infoPtr->buttons[infoPtr->nOldHit];
|
oldBtnPtr = &infoPtr->buttons[infoPtr->nOldHit];
|
||||||
oldBtnPtr->bHot = FALSE;
|
oldBtnPtr->bHot = FALSE;
|
||||||
|
@ -5186,12 +5205,8 @@ TOOLBAR_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
|
|
||||||
infoPtr->nHotItem = nHit;
|
infoPtr->nHotItem = nHit;
|
||||||
|
|
||||||
/* only enabled buttons show hot effect */
|
|
||||||
if(infoPtr->buttons[nHit].fsState & TBSTATE_ENABLED)
|
|
||||||
{
|
|
||||||
btnPtr->bHot = TRUE;
|
btnPtr->bHot = TRUE;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
nmhotitem.dwFlags = HICF_MOUSE;
|
nmhotitem.dwFlags = HICF_MOUSE;
|
||||||
if (oldBtnPtr)
|
if (oldBtnPtr)
|
||||||
|
@ -5208,7 +5223,7 @@ TOOLBAR_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
if (oldBtnPtr)
|
if (oldBtnPtr)
|
||||||
InvalidateRect (hwnd, &oldBtnPtr->rect,
|
InvalidateRect (hwnd, &oldBtnPtr->rect,
|
||||||
TOOLBAR_HasText(infoPtr, oldBtnPtr));
|
TOOLBAR_HasText(infoPtr, oldBtnPtr));
|
||||||
if (btnPtr && (btnPtr->fsState & TBSTATE_ENABLED))
|
if (btnPtr)
|
||||||
InvalidateRect(hwnd, &btnPtr->rect,
|
InvalidateRect(hwnd, &btnPtr->rect,
|
||||||
TOOLBAR_HasText(infoPtr, btnPtr));
|
TOOLBAR_HasText(infoPtr, btnPtr));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue