Skip to content

Commit fc02d38

Browse files
authored
Theme: Display disabled toolbar buttons in greyscale if theme is enabled (winsiderss#1104)
1 parent c8cee4b commit fc02d38

File tree

8 files changed

+35
-14
lines changed

8 files changed

+35
-14
lines changed

ProcessHacker/procprv.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3341,7 +3341,8 @@ VOID PhDrawProcessIcon(
33413341
hdc,
33423342
rect.left,
33433343
rect.top,
3344-
ILD_NORMAL | ILD_TRANSPARENT
3344+
ILD_NORMAL | ILD_TRANSPARENT,
3345+
FALSE
33453346
);
33463347
}
33473348
}
@@ -3355,7 +3356,8 @@ VOID PhDrawProcessIcon(
33553356
hdc,
33563357
rect.left,
33573358
rect.top,
3358-
ILD_NORMAL | ILD_TRANSPARENT
3359+
ILD_NORMAL | ILD_TRANSPARENT,
3360+
FALSE
33593361
);
33603362
}
33613363
}

ProcessHacker/runas.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2892,7 +2892,8 @@ INT_PTR CALLBACK PhpRunFileWndProc(
28922892
customDraw->hdc,
28932893
customDraw->rc.left,
28942894
customDraw->rc.top + 1, // offset
2895-
ILD_TRANSPARENT
2895+
ILD_TRANSPARENT,
2896+
FALSE
28962897
);
28972898

28982899
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, CDRF_SKIPDEFAULT);

ProcessHacker/searchbox.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,8 @@ VOID PhpSearchDrawButton(
326326
Hdc,
327327
ButtonRect.left + 1, // offset
328328
ButtonRect.top,
329-
ILD_TRANSPARENT
329+
ILD_TRANSPARENT,
330+
FALSE
330331
);
331332
}
332333
else
@@ -337,7 +338,8 @@ VOID PhpSearchDrawButton(
337338
Hdc,
338339
ButtonRect.left + 2, // offset
339340
ButtonRect.top + 1, // offset
340-
ILD_TRANSPARENT
341+
ILD_TRANSPARENT,
342+
FALSE
341343
);
342344
}
343345
}

phlib/guisup.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2377,7 +2377,8 @@ BOOLEAN PhImageListDrawIcon(
23772377
_In_ HDC Hdc,
23782378
_In_ INT x,
23792379
_In_ INT y,
2380-
_In_ UINT Style
2380+
_In_ UINT Style,
2381+
_In_ BOOLEAN Disabled
23812382
)
23822383
{
23832384
return PhImageListDrawEx(
@@ -2390,7 +2391,8 @@ BOOLEAN PhImageListDrawIcon(
23902391
0,
23912392
CLR_DEFAULT,
23922393
CLR_DEFAULT,
2393-
Style
2394+
Style,
2395+
Disabled ? ILS_SATURATE : ILS_NORMAL
23942396
);
23952397
}
23962398

@@ -2404,7 +2406,8 @@ BOOLEAN PhImageListDrawEx(
24042406
_In_ INT dy,
24052407
_In_ COLORREF BackColor,
24062408
_In_ COLORREF ForeColor,
2407-
_In_ UINT Style
2409+
_In_ UINT Style,
2410+
_In_ DWORD State
24082411
)
24092412
{
24102413
IMAGELISTDRAWPARAMS imagelistDraw;
@@ -2421,6 +2424,7 @@ BOOLEAN PhImageListDrawEx(
24212424
imagelistDraw.rgbBk = BackColor;
24222425
imagelistDraw.rgbFg = ForeColor;
24232426
imagelistDraw.fStyle = Style;
2427+
imagelistDraw.fState = State;
24242428

24252429
return SUCCEEDED(IImageList2_Draw((IImageList2*)ImageListHandle, &imagelistDraw));
24262430
}

phlib/include/guisup.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,7 +1061,8 @@ PhImageListDrawIcon(
10611061
_In_ HDC Hdc,
10621062
_In_ INT x,
10631063
_In_ INT y,
1064-
_In_ UINT Style
1064+
_In_ UINT Style,
1065+
_In_ BOOLEAN Disabled
10651066
);
10661067

10671068
PHLIBAPI
@@ -1077,7 +1078,8 @@ PhImageListDrawEx(
10771078
_In_ INT dy,
10781079
_In_ COLORREF BackColor,
10791080
_In_ COLORREF ForeColor,
1080-
_In_ UINT Style
1081+
_In_ UINT Style,
1082+
_In_ DWORD State
10811083
);
10821084

10831085
#define PH_DRAW_TIMELINE_OVERFLOW 0x1

phlib/theme.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1752,6 +1752,12 @@ LRESULT CALLBACK PhThemeWindowDrawToolbar(
17521752
DrawInfo->nmcd.dwItemSpec,
17531753
0
17541754
) == 0;
1755+
BOOLEAN isEnabled = SendMessage(
1756+
DrawInfo->nmcd.hdr.hwndFrom,
1757+
TB_ISBUTTONENABLED,
1758+
DrawInfo->nmcd.dwItemSpec,
1759+
0
1760+
) != 0;
17551761

17561762
if (SendMessage(
17571763
DrawInfo->nmcd.hdr.hwndFrom,
@@ -1878,7 +1884,8 @@ LRESULT CALLBACK PhThemeWindowDrawToolbar(
18781884
DrawInfo->nmcd.hdc,
18791885
x,
18801886
y,
1881-
ILD_NORMAL
1887+
ILD_NORMAL,
1888+
!isEnabled
18821889
);
18831890
}
18841891
}

phlib/treenew.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5704,7 +5704,8 @@ VOID PhTnpDrawCell(
57045704
SmallIconHeight,
57055705
CLR_DEFAULT,
57065706
CLR_NONE,
5707-
ILD_NORMAL | ILD_TRANSPARENT
5707+
ILD_NORMAL | ILD_TRANSPARENT,
5708+
ILS_NORMAL
57085709
);
57095710

57105711
textRect.left += SmallIconWidth + TNP_ICON_RIGHT_PADDING;

tools/peview/searchbox.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,8 @@ VOID PhpSearchDrawButton(
495495
Hdc,
496496
ButtonRect.left + 1, // offset
497497
ButtonRect.top,
498-
ILD_TRANSPARENT
498+
ILD_TRANSPARENT,
499+
FALSE
499500
);
500501
}
501502
else
@@ -506,7 +507,8 @@ VOID PhpSearchDrawButton(
506507
Hdc,
507508
ButtonRect.left + 2, // offset
508509
ButtonRect.top + 1, // offset
509-
ILD_TRANSPARENT
510+
ILD_TRANSPARENT,
511+
FALSE
510512
);
511513
}
512514
}

0 commit comments

Comments
 (0)