[BROWSEUI][SHELL32][SHLWAPI][BOOTDATA] Implement and use IRegTreeOptions (#7255)

This commit is contained in:
Whindmar Saksit 2025-05-20 16:59:02 +02:00 committed by GitHub
parent 3842b59f75
commit 937954cf6c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 709 additions and 1000 deletions

View file

@ -83,110 +83,6 @@ HBITMAP BitmapFromIcon(HICON hIcon, INT cx, INT cy)
return hbm;
}
HBITMAP CreateCheckImage(HDC hDC, BOOL bCheck, BOOL bEnabled)
{
INT cxSmallIcon = GetSystemMetrics(SM_CXSMICON);
INT cySmallIcon = GetSystemMetrics(SM_CYSMICON);
HBITMAP hbm = Create24BppBitmap(hDC, cxSmallIcon, cySmallIcon);
if (hbm == NULL)
return NULL; // failure
RECT Rect, BoxRect;
SetRect(&Rect, 0, 0, cxSmallIcon, cySmallIcon);
BoxRect = Rect;
InflateRect(&BoxRect, -1, -1);
HGDIOBJ hbmOld = SelectObject(hDC, hbm);
{
UINT uState = DFCS_BUTTONCHECK | DFCS_FLAT | DFCS_MONO;
if (bCheck)
uState |= DFCS_CHECKED;
if (!bEnabled)
uState |= DFCS_INACTIVE;
DrawFrameControl(hDC, &BoxRect, DFC_BUTTON, uState);
}
SelectObject(hDC, hbmOld);
return hbm; // success
}
HBITMAP CreateCheckMask(HDC hDC)
{
INT cxSmallIcon = GetSystemMetrics(SM_CXSMICON);
INT cySmallIcon = GetSystemMetrics(SM_CYSMICON);
HBITMAP hbm = CreateBitmap(cxSmallIcon, cySmallIcon, 1, 1, NULL);
if (hbm == NULL)
return NULL; // failure
RECT Rect, BoxRect;
SetRect(&Rect, 0, 0, cxSmallIcon, cySmallIcon);
BoxRect = Rect;
InflateRect(&BoxRect, -1, -1);
HGDIOBJ hbmOld = SelectObject(hDC, hbm);
{
FillRect(hDC, &Rect, HBRUSH(GetStockObject(WHITE_BRUSH)));
FillRect(hDC, &BoxRect, HBRUSH(GetStockObject(BLACK_BRUSH)));
}
SelectObject(hDC, hbmOld);
return hbm; // success
}
HBITMAP CreateRadioImage(HDC hDC, BOOL bCheck, BOOL bEnabled)
{
INT cxSmallIcon = GetSystemMetrics(SM_CXSMICON);
INT cySmallIcon = GetSystemMetrics(SM_CYSMICON);
HBITMAP hbm = Create24BppBitmap(hDC, cxSmallIcon, cySmallIcon);
if (hbm == NULL)
return NULL; // failure
RECT Rect, BoxRect;
SetRect(&Rect, 0, 0, cxSmallIcon, cySmallIcon);
BoxRect = Rect;
InflateRect(&BoxRect, -1, -1);
HGDIOBJ hbmOld = SelectObject(hDC, hbm);
{
UINT uState = DFCS_BUTTONRADIOIMAGE | DFCS_FLAT | DFCS_MONO;
if (bCheck)
uState |= DFCS_CHECKED;
if (!bEnabled)
uState |= DFCS_INACTIVE;
DrawFrameControl(hDC, &BoxRect, DFC_BUTTON, uState);
}
SelectObject(hDC, hbmOld);
return hbm; // success
}
HBITMAP CreateRadioMask(HDC hDC)
{
INT cxSmallIcon = GetSystemMetrics(SM_CXSMICON);
INT cySmallIcon = GetSystemMetrics(SM_CYSMICON);
HBITMAP hbm = CreateBitmap(cxSmallIcon, cySmallIcon, 1, 1, NULL);
if (hbm == NULL)
return NULL; // failure
RECT Rect, BoxRect;
SetRect(&Rect, 0, 0, cxSmallIcon, cySmallIcon);
BoxRect = Rect;
InflateRect(&BoxRect, -1, -1);
HGDIOBJ hbmOld = SelectObject(hDC, hbm);
{
FillRect(hDC, &Rect, HBRUSH(GetStockObject(WHITE_BRUSH)));
UINT uState = DFCS_BUTTONRADIOMASK | DFCS_FLAT | DFCS_MONO;
DrawFrameControl(hDC, &BoxRect, DFC_BUTTON, uState);
}
SelectObject(hDC, hbmOld);
return hbm; // success
}
/////////////////////////////////////////////////////////////////////////////
@ -234,7 +130,7 @@ enum {
static DWORD CALLBACK
ShowFolderOptionsDialogThreadProc(LPVOID param)
{
CCoInit com; // Required when started from rundll32 (SHAutoComplete in PickIconDlg)
CCoInit com; // Required when started from rundll32 (IRegTreeOptions, SHAutoComplete (in PickIconDlg))
PROPSHEETHEADERW pinfo;
HPROPSHEETPAGE hppages[3];
HPROPSHEETPAGE hpage;