From b59d06fa1d874ed4a4bdd6fe756b5636f0f93f29 Mon Sep 17 00:00:00 2001 From: Robert Naumann Date: Tue, 24 Nov 2015 21:43:07 +0000 Subject: [PATCH] [EXPLORER] -Fix a parameter of OnCreateTaskbarPage(). Fix by Mark Jansen -Implement showing the notification area preview images. CORE-10560 svn path=/trunk/; revision=70102 --- reactos/base/shell/explorer/trayprop.cpp | 122 +++++++++++++++++++---- 1 file changed, 100 insertions(+), 22 deletions(-) diff --git a/reactos/base/shell/explorer/trayprop.cpp b/reactos/base/shell/explorer/trayprop.cpp index 70fb175a18a..19738a08586 100644 --- a/reactos/base/shell/explorer/trayprop.cpp +++ b/reactos/base/shell/explorer/trayprop.cpp @@ -2,6 +2,7 @@ * ReactOS Explorer * * Copyright 2006 - 2007 Thomas Weidenmueller + * 2015 Robert Naumann * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -24,54 +25,62 @@ typedef struct _PROPSHEET_INFO { HWND hTaskbarWnd; HWND hStartWnd; - HWND hNotiWnd; - HWND hToolWnd; HBITMAP hTaskbarBitmap; + HBITMAP hTrayBitmap; } PROPSHEET_INFO, *PPROPSHEET_INFO; static BOOL UpdateTaskbarBitmap(PPROPSHEET_INFO pPropInfo) { - HWND hwndLock, hwndHide, hwndGroup, hwndShowQL; - HWND hwndBitmap; - BOOL bLock, bHide, bGroup, bShowQL; - LPTSTR lpImageName = NULL; + HWND hwndLock, hwndHide, hwndGroup, hwndShowQL, hwndClock, hwndSeconds, hwndHideInactive; + HWND hwndTaskbarBitmap, hwndTrayBitmap; + BOOL bLock, bHide, bGroup, bShowQL, bShowClock, bShowSeconds, bHideInactive; + LPTSTR lpTaskBarImageName = NULL, lpTrayImageName = NULL; BOOL bRet = FALSE; hwndLock = GetDlgItem(pPropInfo->hTaskbarWnd, IDC_TASKBARPROP_LOCK); hwndHide = GetDlgItem(pPropInfo->hTaskbarWnd, IDC_TASKBARPROP_HIDE); hwndGroup = GetDlgItem(pPropInfo->hTaskbarWnd, IDC_TASKBARPROP_GROUP); hwndShowQL = GetDlgItem(pPropInfo->hTaskbarWnd, IDC_TASKBARPROP_SHOWQL); + + hwndClock = GetDlgItem(pPropInfo->hTaskbarWnd, IDC_TASKBARPROP_CLOCK); + hwndSeconds = GetDlgItem(pPropInfo->hTaskbarWnd, IDC_TASKBARPROP_SECONDS); + hwndHideInactive = GetDlgItem(pPropInfo->hTaskbarWnd, IDC_TASKBARPROP_HIDEICONS); - if (hwndLock && hwndHide && hwndGroup && hwndShowQL) + if (hwndLock && hwndHide && hwndGroup && hwndShowQL && hwndClock && hwndSeconds && hwndHideInactive) { bLock = (SendMessage(hwndLock, BM_GETCHECK, 0, 0) == BST_CHECKED); bHide = (SendMessage(hwndHide, BM_GETCHECK, 0, 0) == BST_CHECKED); bGroup = (SendMessage(hwndGroup, BM_GETCHECK, 0, 0) == BST_CHECKED); bShowQL = (SendMessage(hwndShowQL, BM_GETCHECK, 0, 0) == BST_CHECKED); + + bShowClock = (SendMessage(hwndClock, BM_GETCHECK, 0, 0) == BST_CHECKED); + bShowSeconds = (SendMessage(hwndSeconds, BM_GETCHECK, 0, 0) == BST_CHECKED); + bHideInactive = (SendMessage(hwndHideInactive, BM_GETCHECK, 0, 0) == BST_CHECKED); if (bHide) - lpImageName = MAKEINTRESOURCE(IDB_TASKBARPROP_AUTOHIDE); + lpTaskBarImageName = MAKEINTRESOURCE(IDB_TASKBARPROP_AUTOHIDE); else if (bLock && bGroup && bShowQL) - lpImageName = MAKEINTRESOURCE(IDB_TASKBARPROP_LOCK_GROUP_QL); + lpTaskBarImageName = MAKEINTRESOURCE(IDB_TASKBARPROP_LOCK_GROUP_QL); else if (bLock && !bGroup && !bShowQL) - lpImageName = MAKEINTRESOURCE(IDB_TASKBARPROP_LOCK_NOGROUP_NOQL); + lpTaskBarImageName = MAKEINTRESOURCE(IDB_TASKBARPROP_LOCK_NOGROUP_NOQL); else if (bLock && bGroup && !bShowQL) - lpImageName = MAKEINTRESOURCE(IDB_TASKBARPROP_LOCK_GROUP_NOQL); + lpTaskBarImageName = MAKEINTRESOURCE(IDB_TASKBARPROP_LOCK_GROUP_NOQL); else if (bLock && !bGroup && bShowQL) - lpImageName = MAKEINTRESOURCE(IDB_TASKBARPROP_LOCK_NOGROUP_QL); + lpTaskBarImageName = MAKEINTRESOURCE(IDB_TASKBARPROP_LOCK_NOGROUP_QL); else if (!bLock && !bGroup && !bShowQL) - lpImageName = MAKEINTRESOURCE(IDB_TASKBARPROP_NOLOCK_NOGROUP_NOQL); + lpTaskBarImageName = MAKEINTRESOURCE(IDB_TASKBARPROP_NOLOCK_NOGROUP_NOQL); else if (!bLock && bGroup && !bShowQL) - lpImageName = MAKEINTRESOURCE(IDB_TASKBARPROP_NOLOCK_GROUP_NOQL); + lpTaskBarImageName = MAKEINTRESOURCE(IDB_TASKBARPROP_NOLOCK_GROUP_NOQL); else if (!bLock && !bGroup && bShowQL) - lpImageName = MAKEINTRESOURCE(IDB_TASKBARPROP_NOLOCK_NOGROUP_QL); + lpTaskBarImageName = MAKEINTRESOURCE(IDB_TASKBARPROP_NOLOCK_NOGROUP_QL); else if (!bLock && bGroup && bShowQL) - lpImageName = MAKEINTRESOURCE(IDB_TASKBARPROP_NOLOCK_GROUP_QL); + lpTaskBarImageName = MAKEINTRESOURCE(IDB_TASKBARPROP_NOLOCK_GROUP_QL); - if (lpImageName) + + if (lpTaskBarImageName) { if (pPropInfo->hTaskbarBitmap) { @@ -79,24 +88,86 @@ UpdateTaskbarBitmap(PPROPSHEET_INFO pPropInfo) } pPropInfo->hTaskbarBitmap = (HBITMAP)LoadImage(hExplorerInstance, - lpImageName, + lpTaskBarImageName, IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR); if (pPropInfo->hTaskbarBitmap) { - hwndBitmap = GetDlgItem(pPropInfo->hTaskbarWnd, + hwndTaskbarBitmap = GetDlgItem(pPropInfo->hTaskbarWnd, IDC_TASKBARPROP_TASKBARBITMAP); - if (hwndBitmap) + if (hwndTaskbarBitmap) { - SendMessage(hwndBitmap, + SendMessage(hwndTaskbarBitmap, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)pPropInfo->hTaskbarBitmap); } } } + + if (bHideInactive) + { + /* FIXME: when the customize button is disabled, enable it. */ + if(bShowClock) + { + /* FIXME: when the seconds checkbox is disabled, enable it. */ + if(bShowSeconds) + lpTrayImageName = MAKEINTRESOURCE(IDB_SYSTRAYPROP_HIDE_SECONDS); + else + lpTrayImageName = MAKEINTRESOURCE(IDB_SYSTRAYPROP_HIDE_CLOCK); + } + else + { + /* FIXME: when the seconds checkbox is enabled, disable it it. */ + lpTrayImageName = MAKEINTRESOURCE(IDB_SYSTRAYPROP_HIDE_NOCLOCK); + } + } + else + { + /* FIXME: when the customize button is enabled, disable it. */ + if(bShowClock) + { + /* FIXME: when the seconds checkbox is disabled, enable it. */ + if(bShowSeconds) + lpTrayImageName = MAKEINTRESOURCE(IDB_SYSTRAYPROP_SHOW_SECONDS); + else + lpTrayImageName = MAKEINTRESOURCE(IDB_SYSTRAYPROP_SHOW_CLOCK); + } + else + { + /* FIXME: when the seconds checkbox is enabled, disable it it. */ + lpTrayImageName = MAKEINTRESOURCE(IDB_SYSTRAYPROP_SHOW_NOCLOCK); + } + } + + if(lpTrayImageName) + { + if (pPropInfo->hTrayBitmap) + { + DeleteObject(pPropInfo->hTrayBitmap); + } + + pPropInfo->hTrayBitmap = (HBITMAP)LoadImage(hExplorerInstance, + lpTrayImageName, + IMAGE_BITMAP, + 0, + 0, + LR_DEFAULTCOLOR); + if (pPropInfo->hTrayBitmap) + { + hwndTrayBitmap = GetDlgItem(pPropInfo->hTaskbarWnd, + IDC_TASKBARPROP_NOTIFICATIONBITMAP); + if (hwndTrayBitmap) + { + SendMessage(hwndTrayBitmap, + STM_SETIMAGE, + IMAGE_BITMAP, + (LPARAM)pPropInfo->hTrayBitmap); + } + } + } } return bRet; @@ -136,7 +207,7 @@ TaskbarPageProc(HWND hwndDlg, switch (uMsg) { case WM_INITDIALOG: - OnCreateTaskbarPage(hwndDlg, (PPROPSHEET_INFO)lParam); + OnCreateTaskbarPage(hwndDlg, (PPROPSHEET_INFO)((LPPROPSHEETPAGE)lParam)->lParam); break; case WM_COMMAND: @@ -146,6 +217,9 @@ TaskbarPageProc(HWND hwndDlg, case IDC_TASKBARPROP_HIDE: case IDC_TASKBARPROP_GROUP: case IDC_TASKBARPROP_SHOWQL: + case IDC_TASKBARPROP_HIDEICONS: + case IDC_TASKBARPROP_CLOCK: + case IDC_TASKBARPROP_SECONDS: if (HIWORD(wParam) == BN_CLICKED) { UpdateTaskbarBitmap(pPropInfo); @@ -178,6 +252,10 @@ TaskbarPageProc(HWND hwndDlg, { DeleteObject(pPropInfo->hTaskbarBitmap); } + if (pPropInfo->hTrayBitmap) + { + DeleteObject(pPropInfo->hTrayBitmap); + } break; HandleDefaultMessage: -- 2.17.1