[EXPLORER] Add Show Desktop button to taskbar customization preview (#7727)

Use a 4D lookup table for the notification area settings preview, instead of many if cases.

CORE-19738
This commit is contained in:
Miguel Almeida
2025-03-02 19:56:30 +00:00
committed by GitHub
parent afb96acfdd
commit 6988b4e2c4
9 changed files with 51 additions and 26 deletions

View File

@@ -230,13 +230,14 @@ class CNotifySettingsPage : public CPropertyPageImpl<CNotifySettingsPage>
private:
HBITMAP m_hbmpTray;
HWND m_hwndTaskbar;
static const WORD wImageIdLookupTable[2][2][2][2];
void _UpdateDialog()
{
BOOL bShowClock = IsDlgButtonChecked(IDC_TASKBARPROP_CLOCK);
BOOL bShowSeconds = IsDlgButtonChecked(IDC_TASKBARPROP_SECONDS);
BOOL bHideInactive = IsDlgButtonChecked(IDC_TASKBARPROP_HIDEICONS);
UINT uImageId;
BOOL bShowDesktopButton = IsDlgButtonChecked(IDC_TASKBARPROP_DESKTOP);
HWND hwndCustomizeNotifyButton = GetDlgItem(IDC_TASKBARPROP_ICONCUST);
HWND hwndSeconds = GetDlgItem(IDC_TASKBARPROP_SECONDS);
@@ -246,19 +247,7 @@ private:
::EnableWindow(hwndSeconds, bShowClock);
if (!bShowSeconds)
CheckDlgButton(IDC_TASKBARPROP_SECONDS, BST_UNCHECKED);
if (bHideInactive && bShowClock && bShowSeconds)
uImageId = IDB_SYSTRAYPROP_HIDE_SECONDS;
else if (bHideInactive && bShowClock && !bShowSeconds)
uImageId = IDB_SYSTRAYPROP_HIDE_CLOCK;
else if (bHideInactive && !bShowClock)
uImageId = IDB_SYSTRAYPROP_HIDE_NOCLOCK;
else if (!bHideInactive && bShowClock && bShowSeconds)
uImageId = IDB_SYSTRAYPROP_SHOW_SECONDS;
else if (!bHideInactive && bShowClock && !bShowSeconds)
uImageId = IDB_SYSTRAYPROP_SHOW_CLOCK;
else if (!bHideInactive && !bShowClock)
uImageId = IDB_SYSTRAYPROP_SHOW_NOCLOCK;
UINT uImageId = wImageIdLookupTable[bShowClock][bShowSeconds][bHideInactive][bShowDesktopButton];
SetBitmap(hwndTrayBitmap, &m_hbmpTray, uImageId);
}
@@ -324,6 +313,30 @@ public:
}
};
const WORD CNotifySettingsPage::wImageIdLookupTable[2][2][2][2] =
{
{
{
{IDB_SYSTRAYPROP_SHOW_NOCLOCK_NODESK, IDB_SYSTRAYPROP_SHOW_NOCLOCK_DESK},
{IDB_SYSTRAYPROP_HIDE_NOCLOCK_NODESK, IDB_SYSTRAYPROP_HIDE_NOCLOCK_DESK}
},
{
{IDB_SYSTRAYPROP_SHOW_NOCLOCK_NODESK, IDB_SYSTRAYPROP_SHOW_NOCLOCK_DESK},
{IDB_SYSTRAYPROP_HIDE_NOCLOCK_NODESK, IDB_SYSTRAYPROP_HIDE_NOCLOCK_DESK}
}
},
{
{
{IDB_SYSTRAYPROP_SHOW_CLOCK_NODESK, IDB_SYSTRAYPROP_SHOW_CLOCK_DESK},
{IDB_SYSTRAYPROP_HIDE_CLOCK_NODESK, IDB_SYSTRAYPROP_HIDE_CLOCK_DESK}
},
{
{IDB_SYSTRAYPROP_SHOW_SECONDS_NODESK, IDB_SYSTRAYPROP_SHOW_SECONDS_DESK},
{IDB_SYSTRAYPROP_HIDE_SECONDS_NODESK, IDB_SYSTRAYPROP_HIDE_SECONDS_DESK}
}
}
};
static int CALLBACK
PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam)
{