2007-06-10 08:09:42 +00:00
|
|
|
/*
|
|
|
|
* ReactOS Explorer
|
|
|
|
*
|
|
|
|
* Copyright 2006 - 2007 Thomas Weidenmueller <w3seek@reactos.org>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2009-10-27 10:34:16 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
2007-06-10 08:09:42 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <precomp.h>
|
|
|
|
|
2009-07-23 21:35:52 +00:00
|
|
|
typedef struct _PROPSHEET_INFO
|
|
|
|
{
|
|
|
|
HWND hTaskbarWnd;
|
|
|
|
HWND hStartWnd;
|
|
|
|
HWND hNotiWnd;
|
|
|
|
HWND hToolWnd;
|
|
|
|
|
|
|
|
HBITMAP hTaskbarBitmap;
|
|
|
|
} 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;
|
2009-07-23 22:11:06 +00:00
|
|
|
BOOL bRet = FALSE;
|
2009-07-23 21:35:52 +00:00
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
if (hwndLock && hwndHide && hwndGroup && hwndShowQL)
|
|
|
|
{
|
|
|
|
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);
|
|
|
|
|
|
|
|
if (bHide)
|
|
|
|
lpImageName = MAKEINTRESOURCE(IDB_TASKBARPROP_AUTOHIDE);
|
|
|
|
else if (bLock && bGroup && bShowQL)
|
|
|
|
lpImageName = MAKEINTRESOURCE(IDB_TASKBARPROP_LOCK_GROUP_QL);
|
|
|
|
else if (bLock && !bGroup && !bShowQL)
|
|
|
|
lpImageName = MAKEINTRESOURCE(IDB_TASKBARPROP_LOCK_NOGROUP_NOQL);
|
|
|
|
else if (bLock && bGroup && !bShowQL)
|
|
|
|
lpImageName = MAKEINTRESOURCE(IDB_TASKBARPROP_LOCK_GROUP_NOQL);
|
|
|
|
else if (bLock && !bGroup && bShowQL)
|
|
|
|
lpImageName = MAKEINTRESOURCE(IDB_TASKBARPROP_LOCK_NOGROUP_QL);
|
|
|
|
else if (!bLock && !bGroup && !bShowQL)
|
|
|
|
lpImageName = MAKEINTRESOURCE(IDB_TASKBARPROP_NOLOCK_NOGROUP_NOQL);
|
|
|
|
else if (!bLock && bGroup && !bShowQL)
|
|
|
|
lpImageName = MAKEINTRESOURCE(IDB_TASKBARPROP_NOLOCK_GROUP_NOQL);
|
|
|
|
else if (!bLock && !bGroup && bShowQL)
|
|
|
|
lpImageName = MAKEINTRESOURCE(IDB_TASKBARPROP_NOLOCK_NOGROUP_QL);
|
|
|
|
else if (!bLock && bGroup && bShowQL)
|
|
|
|
lpImageName = MAKEINTRESOURCE(IDB_TASKBARPROP_NOLOCK_GROUP_QL);
|
|
|
|
|
|
|
|
if (lpImageName)
|
|
|
|
{
|
|
|
|
if (pPropInfo->hTaskbarBitmap)
|
|
|
|
{
|
|
|
|
DeleteObject(pPropInfo->hTaskbarBitmap);
|
|
|
|
}
|
|
|
|
|
|
|
|
pPropInfo->hTaskbarBitmap = LoadImage(hExplorerInstance,
|
|
|
|
lpImageName,
|
|
|
|
IMAGE_BITMAP,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
LR_DEFAULTCOLOR);
|
|
|
|
if (pPropInfo->hTaskbarBitmap)
|
|
|
|
{
|
|
|
|
hwndBitmap = GetDlgItem(pPropInfo->hTaskbarWnd,
|
|
|
|
IDC_TASKBARPROP_TASKBARBITMAP);
|
|
|
|
if (hwndBitmap)
|
|
|
|
{
|
|
|
|
SendMessage(hwndBitmap,
|
|
|
|
STM_SETIMAGE,
|
|
|
|
IMAGE_BITMAP,
|
|
|
|
(LPARAM)pPropInfo->hTaskbarBitmap);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
static VOID
|
|
|
|
OnCreateTaskbarPage(HWND hwnd,
|
|
|
|
PPROPSHEET_INFO pPropInfo)
|
|
|
|
{
|
|
|
|
SetWindowLongPtr(hwnd,
|
|
|
|
GWLP_USERDATA,
|
|
|
|
(LONG_PTR)pPropInfo);
|
|
|
|
|
|
|
|
pPropInfo->hTaskbarWnd = hwnd;
|
|
|
|
|
|
|
|
// FIXME: check buttons
|
|
|
|
|
|
|
|
UpdateTaskbarBitmap(pPropInfo);
|
|
|
|
}
|
|
|
|
|
2009-07-10 17:10:20 +00:00
|
|
|
INT_PTR CALLBACK
|
|
|
|
TaskbarPageProc(HWND hwndDlg,
|
|
|
|
UINT uMsg,
|
|
|
|
WPARAM wParam,
|
|
|
|
LPARAM lParam)
|
|
|
|
{
|
2009-07-23 21:35:52 +00:00
|
|
|
PPROPSHEET_INFO pPropInfo;
|
|
|
|
|
|
|
|
/* Get the window context */
|
|
|
|
pPropInfo = (PPROPSHEET_INFO)GetWindowLongPtrW(hwndDlg,
|
|
|
|
GWLP_USERDATA);
|
|
|
|
if (pPropInfo == NULL && uMsg != WM_INITDIALOG)
|
|
|
|
{
|
|
|
|
goto HandleDefaultMessage;
|
|
|
|
}
|
|
|
|
|
2009-07-10 17:10:20 +00:00
|
|
|
switch (uMsg)
|
|
|
|
{
|
|
|
|
case WM_INITDIALOG:
|
2009-07-23 21:35:52 +00:00
|
|
|
OnCreateTaskbarPage(hwndDlg, (PPROPSHEET_INFO)lParam);
|
2009-07-10 17:10:20 +00:00
|
|
|
break;
|
|
|
|
|
2009-07-23 21:35:52 +00:00
|
|
|
case WM_COMMAND:
|
|
|
|
switch(LOWORD(wParam))
|
|
|
|
{
|
|
|
|
case IDC_TASKBARPROP_LOCK:
|
|
|
|
case IDC_TASKBARPROP_HIDE:
|
|
|
|
case IDC_TASKBARPROP_GROUP:
|
|
|
|
case IDC_TASKBARPROP_SHOWQL:
|
|
|
|
if (HIWORD(wParam) == BN_CLICKED)
|
|
|
|
{
|
|
|
|
UpdateTaskbarBitmap(pPropInfo);
|
|
|
|
|
|
|
|
/* Enable the 'Apply' button */
|
|
|
|
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2009-07-10 17:10:20 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WM_NOTIFY:
|
|
|
|
{
|
|
|
|
LPNMHDR pnmh = (LPNMHDR)lParam;
|
|
|
|
|
|
|
|
switch(pnmh->code)
|
|
|
|
{
|
|
|
|
case PSN_SETACTIVE:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PSN_APPLY:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2009-07-23 21:35:52 +00:00
|
|
|
|
|
|
|
case WM_DESTROY:
|
|
|
|
if (pPropInfo->hTaskbarBitmap)
|
|
|
|
{
|
|
|
|
DeleteObject(pPropInfo->hTaskbarBitmap);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
HandleDefaultMessage:
|
|
|
|
default:
|
|
|
|
return FALSE;
|
2009-07-10 17:10:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
INT_PTR CALLBACK
|
|
|
|
StartMenuPageProc(HWND hwndDlg,
|
|
|
|
UINT uMsg,
|
|
|
|
WPARAM wParam,
|
|
|
|
LPARAM lParam)
|
|
|
|
{
|
|
|
|
switch (uMsg)
|
|
|
|
{
|
|
|
|
case WM_INITDIALOG:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WM_DESTROY:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WM_NOTIFY:
|
|
|
|
{
|
|
|
|
LPNMHDR pnmh = (LPNMHDR)lParam;
|
|
|
|
|
|
|
|
switch(pnmh->code)
|
|
|
|
{
|
|
|
|
case PSN_SETACTIVE:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PSN_APPLY:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
INT_PTR CALLBACK
|
|
|
|
NotificationPageProc(HWND hwndDlg,
|
|
|
|
UINT uMsg,
|
|
|
|
WPARAM wParam,
|
|
|
|
LPARAM lParam)
|
|
|
|
{
|
|
|
|
switch (uMsg)
|
|
|
|
{
|
|
|
|
case WM_INITDIALOG:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WM_DESTROY:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WM_NOTIFY:
|
|
|
|
{
|
|
|
|
LPNMHDR pnmh = (LPNMHDR)lParam;
|
|
|
|
|
|
|
|
switch(pnmh->code)
|
|
|
|
{
|
|
|
|
case PSN_SETACTIVE:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PSN_APPLY:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
INT_PTR CALLBACK
|
|
|
|
ToolbarsPageProc(HWND hwndDlg,
|
|
|
|
UINT uMsg,
|
|
|
|
WPARAM wParam,
|
|
|
|
LPARAM lParam)
|
|
|
|
{
|
|
|
|
switch (uMsg)
|
|
|
|
{
|
|
|
|
case WM_INITDIALOG:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WM_DESTROY:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WM_NOTIFY:
|
|
|
|
{
|
|
|
|
LPNMHDR pnmh = (LPNMHDR)lParam;
|
|
|
|
|
|
|
|
switch(pnmh->code)
|
|
|
|
{
|
|
|
|
case PSN_SETACTIVE:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PSN_APPLY:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static VOID
|
2009-07-23 21:35:52 +00:00
|
|
|
InitPropSheetPage(PROPSHEETPAGE *psp,
|
|
|
|
WORD idDlg,
|
|
|
|
DLGPROC DlgProc,
|
|
|
|
LPARAM lParam)
|
2009-07-10 17:10:20 +00:00
|
|
|
{
|
|
|
|
ZeroMemory(psp, sizeof(PROPSHEETPAGE));
|
|
|
|
psp->dwSize = sizeof(PROPSHEETPAGE);
|
|
|
|
psp->dwFlags = PSP_DEFAULT;
|
|
|
|
psp->hInstance = hExplorerInstance;
|
|
|
|
psp->pszTemplate = MAKEINTRESOURCE(idDlg);
|
2009-07-23 21:35:52 +00:00
|
|
|
psp->lParam = lParam;
|
2009-07-10 17:10:20 +00:00
|
|
|
psp->pfnDlgProc = DlgProc;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-06-10 08:09:42 +00:00
|
|
|
HWND
|
|
|
|
DisplayTrayProperties(ITrayWindow *Tray)
|
|
|
|
{
|
2009-07-23 21:35:52 +00:00
|
|
|
PPROPSHEET_INFO pPropInfo;
|
2009-07-10 17:10:20 +00:00
|
|
|
PROPSHEETHEADER psh;
|
|
|
|
PROPSHEETPAGE psp[4];
|
|
|
|
TCHAR szCaption[256];
|
2009-07-23 21:35:52 +00:00
|
|
|
|
|
|
|
pPropInfo = (PPROPSHEET_INFO)HeapAlloc(hProcessHeap,
|
|
|
|
HEAP_ZERO_MEMORY,
|
|
|
|
sizeof(PROPSHEET_INFO));
|
|
|
|
if (!pPropInfo)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
2009-07-13 21:31:56 +00:00
|
|
|
|
2009-07-10 17:10:20 +00:00
|
|
|
if (!LoadString(hExplorerInstance,
|
|
|
|
IDS_TASKBAR_STARTMENU_PROP_CAPTION,
|
|
|
|
szCaption,
|
|
|
|
sizeof(szCaption) / sizeof(szCaption[0])))
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
|
|
|
|
psh.dwSize = sizeof(PROPSHEETHEADER);
|
|
|
|
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_PROPTITLE;
|
|
|
|
psh.hwndParent = NULL;
|
|
|
|
psh.hInstance = hExplorerInstance;
|
|
|
|
psh.hIcon = NULL;
|
|
|
|
psh.pszCaption = szCaption;
|
|
|
|
psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);
|
|
|
|
psh.nStartPage = 0;
|
|
|
|
psh.ppsp = psp;
|
|
|
|
|
2009-07-23 21:35:52 +00:00
|
|
|
InitPropSheetPage(&psp[0], IDD_TASKBARPROP_TASKBAR, (DLGPROC)TaskbarPageProc, (LPARAM)pPropInfo);
|
|
|
|
InitPropSheetPage(&psp[1], IDD_TASKBARPROP_STARTMENU, (DLGPROC)StartMenuPageProc, (LPARAM)pPropInfo);
|
|
|
|
InitPropSheetPage(&psp[2], IDD_TASKBARPROP_NOTIFICATION, (DLGPROC)NotificationPageProc, (LPARAM)pPropInfo);
|
|
|
|
InitPropSheetPage(&psp[3], IDD_TASKBARPROP_TOOLBARS, (DLGPROC)ToolbarsPageProc, (LPARAM)pPropInfo);
|
|
|
|
|
|
|
|
PropertySheet(&psh);
|
|
|
|
|
|
|
|
HeapFree(hProcessHeap,
|
|
|
|
0,
|
|
|
|
pPropInfo);
|
2009-07-10 17:10:20 +00:00
|
|
|
|
2009-07-23 21:35:52 +00:00
|
|
|
// FIXME: return the HWND
|
|
|
|
return NULL;
|
2007-06-10 08:09:42 +00:00
|
|
|
}
|