Index: dll/win32/browseui/toolsband.cpp =================================================================== --- dll/win32/browseui/toolsband.cpp (revision 65654) +++ dll/win32/browseui/toolsband.cpp (working copy) @@ -1,7 +1,8 @@ /* * ReactOS Explorer * - * Copyright 2009 Andrew Hill + * Copyright 2009 Andrew Hill + * Copyright 2014 Ismael Ferreras Morezuelas * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -23,6 +24,7 @@ */ #include "precomp.h" +#include "../shell32/shresdef.h" /* FIXME, I can't include windowsx because it conflicts with some #defines */ #define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp)) @@ -301,14 +303,19 @@ HINSTANCE shell32Instance = GetModuleHandle(_T("shell32.dll")); HBITMAP imgNormal = reinterpret_cast( - LoadImage(shell32Instance, MAKEINTRESOURCE(214), + LoadImage(shell32Instance, MAKEINTRESOURCE(IDB_SHELL_EXPLORER_LG), IMAGE_BITMAP, 0, 0, LR_DEFAULTSIZE | LR_CREATEDIBSECTION)); HBITMAP imgHot = reinterpret_cast( - LoadImage(shell32Instance, MAKEINTRESOURCE(215), + LoadImage(shell32Instance, MAKEINTRESOURCE(IDB_SHELL_EXPLORER_LG_HOT), IMAGE_BITMAP, 0, 0, LR_DEFAULTSIZE | LR_CREATEDIBSECTION)); - if (imgNormal && imgHot) + /* FIXME: workaround? wine's comctl toolbar (synced) does not create an internal disabled + version of the imagelist by itself, use a custom one for the time being */ + + HBITMAP imgDisabled = reinterpret_cast(CopyImage(imgNormal, IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION)); + + if (imgNormal && imgHot && imgDisabled) { BITMAP bitmapInfo; GetObjectW(imgNormal, sizeof(bitmapInfo), &bitmapInfo); @@ -319,6 +326,43 @@ HIMAGELIST himlHot = ImageList_Create(bitmapInfo.bmHeight, bitmapInfo.bmHeight, ILC_COLOR32, 4, 4); ImageList_Add(himlHot, imgHot, NULL); + GetObjectW(imgDisabled, sizeof(bitmapInfo), &bitmapInfo); + + /* allocate a temp surface for editing the bitmap during the desaturation */ + DWORD *bmpBuffer = reinterpret_cast(HeapAlloc(GetProcessHeap(), 0, bitmapInfo.bmWidthBytes * bitmapInfo.bmHeight)); + + if (bmpBuffer) + { + GetBitmapBits(imgDisabled, bitmapInfo.bmWidthBytes * bitmapInfo.bmHeight, bmpBuffer); + + /* programmatically desaturate the bitmap used for disabled buttons, which is created from the normal one */ + for (int y=0; y */ + BYTE mixed_color = (GetRValue(orig_color) * .30 + + GetGValue(orig_color) * .59 + + GetBValue(orig_color) * .11); + + bmpBuffer[y * bitmapInfo.bmWidth + x] = RGBA(mixed_color, mixed_color, mixed_color, GetAValue(orig_color)); + } + } + + /* save the modified bits, now in grayscale, into the original bitmap and deallocate the temp buffer */ + SetBitmapBits(imgDisabled, bitmapInfo.bmWidthBytes * bitmapInfo.bmHeight, bmpBuffer); + HeapFree(GetProcessHeap(), 0, bmpBuffer); + + /* use the modified bitmap as imagelist for the disabled toolbar buttons */ + HIMAGELIST himlDisabled = ImageList_Create(bitmapInfo.bmHeight, bitmapInfo.bmHeight, ILC_COLOR32, 4, 4); + ImageList_Add(himlDisabled, imgDisabled, NULL); + + SendMessage(TB_SETDISABLEDIMAGELIST, 0, (LPARAM) himlDisabled); + } + SendMessage(TB_SETIMAGELIST, 0, (LPARAM) himlNormal); SendMessage(TB_SETHOTIMAGELIST, 0, (LPARAM) himlHot); } @@ -329,7 +373,9 @@ DeleteObject(imgNormal); if (imgHot) DeleteObject(imgHot); - + if (imgDisabled) + DeleteObject(imgDisabled); + return hResult; } Index: include/psdk/wingdi.h =================================================================== --- include/psdk/wingdi.h (revision 65654) +++ include/psdk/wingdi.h (working copy) @@ -2897,8 +2897,10 @@ #define GetRValue(rgb) ((BYTE)(rgb)) #define GetGValue(rgb) ((BYTE)(((WORD)(rgb)) >> 8)) #define GetBValue(rgb) ((BYTE)((rgb)>>16)) +#define GetAValue(rgb) ((BYTE)((rgb)>>24)) #define RGB(r,g,b) ((COLORREF)(((BYTE)(r)|((WORD)((BYTE)(g))<<8))|(((DWORD)(BYTE)(b))<<16))) +#define RGBA(r,g,b,a) ((COLORREF)((((DWORD)(BYTE)(a))<<24) | RGB(r,g,b))) #define PALETTERGB(r,g,b) (0x02000000 | RGB(r,g,b)) #define PALETTEINDEX(i) ((COLORREF)(0x01000000 | (DWORD)(WORD)(i)))