Draw the appropriate taskbar mockup image in the dialog when the user clicks the checkboxes

svn path=/trunk/; revision=42165
This commit is contained in:
Ged Murphy 2009-07-23 21:35:52 +00:00
parent 77a79fb006
commit 54d58cdb65
12 changed files with 195 additions and 15 deletions

View file

@ -11,6 +11,16 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
IDI_START ICON DISCARDABLE res/start.ico
IDB_STARTMENU BITMAP DISCARDABLE res/logov.bmp
IDB_TASKBARPROP_AUTOHIDE BITMAP DISCARDABLE res/auto_hide.bmp
IDB_TASKBARPROP_LOCK_GROUP_NOQL BITMAP DISCARDABLE res/lock_group_noql.bmp
IDB_TASKBARPROP_LOCK_GROUP_QL BITMAP DISCARDABLE res/lock_group_ql.bmp
IDB_TASKBARPROP_LOCK_NOGROUP_NOQL BITMAP DISCARDABLE res/lock_nogroup_noql.bmp
IDB_TASKBARPROP_LOCK_NOGROUP_QL BITMAP DISCARDABLE res/lock_nogroup_ql.bmp
IDB_TASKBARPROP_NOLOCK_GROUP_NOQL BITMAP DISCARDABLE res/nolock_group_noql.bmp
IDB_TASKBARPROP_NOLOCK_NOGROUP_NOQL BITMAP DISCARDABLE res/nolock_nogroup_noql.bmp
IDB_TASKBARPROP_NOLOCK_NOGROUP_QL BITMAP DISCARDABLE res/nolock_nogroup_ql.bmp
IDB_TASKBARPROP_NOLOCK_GROUP_QL BITMAP DISCARDABLE res/nolock_nogroup_ql.bmp
#include "lang/bg-BG.rc"
#include "lang/cs-CZ.rc"
#include "lang/de-DE.rc"

View file

@ -59,14 +59,14 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPT
CAPTION "Taskbar"
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
GROUPBOX "Taskbar appearance", IDC_STATIC, 6,6,240,121, WS_DISABLED
CONTROL "", IDC_TASKBARPROP_TASKBARBITMAP, "Static", SS_BITMAP | SS_SUNKEN, 13,18,224,21, WS_DISABLED
AUTOCHECKBOX "&Lock the taskbar", IDC_TASKBARPROP_LOCK, 13,45,200,10, WS_DISABLED
AUTOCHECKBOX "A&uto-hide the taskbar", IDC_TASKBARPROP_HIDE, 13,58,200,10, WS_DISABLED
AUTOCHECKBOX "Keep the &taskbar on top of other windows", IDC_TASKBARPROP_ONTOP, 13,71,200,10, WS_DISABLED
AUTOCHECKBOX "&Group similar taskbar buttons", IDC_TASKBARPROP_GROUP, 13,84,200,10, WS_DISABLED
AUTOCHECKBOX "Show &Quick Launch", IDC_TASKBARPROP_SHOWQL, 13,97,200,10, WS_DISABLED
AUTOCHECKBOX "&Show window previews (thumbnails)", IDC_TASKBARPROP_WNDPREV, 13,110,200,10, WS_DISABLED
GROUPBOX "Taskbar appearance", IDC_STATIC, 6,6,240,121,
CONTROL "", IDC_TASKBARPROP_TASKBARBITMAP, "Static", SS_BITMAP | SS_SUNKEN, 13,18,224,21,
AUTOCHECKBOX "&Lock the taskbar", IDC_TASKBARPROP_LOCK, 13,45,200,10,
AUTOCHECKBOX "A&uto-hide the taskbar", IDC_TASKBARPROP_HIDE, 13,58,200,10,
AUTOCHECKBOX "Keep the &taskbar on top of other windows", IDC_TASKBARPROP_ONTOP, 13,71,200,10,
AUTOCHECKBOX "&Group similar taskbar buttons", IDC_TASKBARPROP_GROUP, 13,84,200,10,
AUTOCHECKBOX "Show &Quick Launch", IDC_TASKBARPROP_SHOWQL, 13,97,200,10,
AUTOCHECKBOX "&Show window previews (thumbnails)", IDC_TASKBARPROP_WNDPREV, 13,110,200,10,
END
IDD_TASKBARPROP_STARTMENU DIALOGEX 0, 0, 252, 218

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

View file

@ -54,6 +54,7 @@
#define IDD_NOTIFICATIONPAGE 2002
#define IDD_TOOLBARSPAGE 2003
/* Taskbar properties, taskbar */
#define IDD_TASKBARPROP_TASKBAR 2000
#define IDC_TASKBARPROP_TASKBARBITMAP 2001
#define IDC_TASKBARPROP_LOCK 2002
@ -63,6 +64,17 @@
#define IDC_TASKBARPROP_SHOWQL 2006
#define IDC_TASKBARPROP_WNDPREV 2007
#define IDB_TASKBARPROP_AUTOHIDE 2050
#define IDB_TASKBARPROP_LOCK_GROUP_NOQL 2051
#define IDB_TASKBARPROP_LOCK_GROUP_QL 2052
#define IDB_TASKBARPROP_LOCK_NOGROUP_NOQL 2053
#define IDB_TASKBARPROP_LOCK_NOGROUP_QL 2054
#define IDB_TASKBARPROP_NOLOCK_GROUP_NOQL 2055
#define IDB_TASKBARPROP_NOLOCK_NOGROUP_NOQL 2056
#define IDB_TASKBARPROP_NOLOCK_NOGROUP_QL 2057
#define IDB_TASKBARPROP_NOLOCK_GROUP_QL 2058
/* Taskbar properties, startmenu*/
#define IDD_TASKBARPROP_STARTMENU 2100
#define IDC_TASKBARPROP_STARTMENU 2101
#define IDC_TASKBARPROP_STARTMENUCUST 2102
@ -71,6 +83,7 @@
#define IDC_TASKBARPROP_RECENTFILES 2105
#define IDC_TASKBARPROP_RECENTFOLDERS 2106
/* Taskbar properties, notification */
#define IDD_TASKBARPROP_NOTIFICATION 2200
#define IDC_TASKBARPROP_NOTIFICATIONBITMAP 2201
#define IDC_TASKBARPROP_HIDEICONS 2202
@ -80,6 +93,7 @@
#define IDC_TASKBARPROP_NETWORK 2206
#define IDC_TASKBARPROP_POWER 2207
/* Taskbar properties, toolbars */
#define IDD_TASKBARPROP_TOOLBARS 2300
#define IDC_TASKBARPROP_DESKBANDLIST 2301

View file

@ -20,18 +20,142 @@
#include <precomp.h>
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;
RECT BitmapRect;
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);
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);
}
INT_PTR CALLBACK
TaskbarPageProc(HWND hwndDlg,
UINT uMsg,
WPARAM wParam,
LPARAM lParam)
{
PPROPSHEET_INFO pPropInfo;
/* Get the window context */
pPropInfo = (PPROPSHEET_INFO)GetWindowLongPtrW(hwndDlg,
GWLP_USERDATA);
if (pPropInfo == NULL && uMsg != WM_INITDIALOG)
{
goto HandleDefaultMessage;
}
switch (uMsg)
{
case WM_INITDIALOG:
OnCreateTaskbarPage(hwndDlg, (PPROPSHEET_INFO)lParam);
break;
case WM_DESTROY:
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;
}
break;
case WM_NOTIFY:
@ -49,6 +173,17 @@ TaskbarPageProc(HWND hwndDlg,
break;
}
case WM_DESTROY:
if (pPropInfo->hTaskbarBitmap)
{
DeleteObject(pPropInfo->hTaskbarBitmap);
}
break;
HandleDefaultMessage:
default:
return FALSE;
}
return FALSE;
@ -161,13 +296,17 @@ ToolbarsPageProc(HWND hwndDlg,
static VOID
InitPropSheetPage(PROPSHEETPAGE *psp, WORD idDlg, DLGPROC DlgProc)
InitPropSheetPage(PROPSHEETPAGE *psp,
WORD idDlg,
DLGPROC DlgProc,
LPARAM lParam)
{
ZeroMemory(psp, sizeof(PROPSHEETPAGE));
psp->dwSize = sizeof(PROPSHEETPAGE);
psp->dwFlags = PSP_DEFAULT;
psp->hInstance = hExplorerInstance;
psp->pszTemplate = MAKEINTRESOURCE(idDlg);
psp->lParam = lParam;
psp->pfnDlgProc = DlgProc;
}
@ -175,9 +314,19 @@ InitPropSheetPage(PROPSHEETPAGE *psp, WORD idDlg, DLGPROC DlgProc)
HWND
DisplayTrayProperties(ITrayWindow *Tray)
{
PPROPSHEET_INFO pPropInfo;
PROPSHEETHEADER psh;
PROPSHEETPAGE psp[4];
TCHAR szCaption[256];
HWND hwnd = 0;
pPropInfo = (PPROPSHEET_INFO)HeapAlloc(hProcessHeap,
HEAP_ZERO_MEMORY,
sizeof(PROPSHEET_INFO));
if (!pPropInfo)
{
return NULL;
}
if (!LoadString(hExplorerInstance,
IDS_TASKBAR_STARTMENU_PROP_CAPTION,
@ -198,10 +347,17 @@ DisplayTrayProperties(ITrayWindow *Tray)
psh.nStartPage = 0;
psh.ppsp = psp;
InitPropSheetPage(&psp[0], IDD_TASKBARPROP_TASKBAR, (DLGPROC)TaskbarPageProc);
InitPropSheetPage(&psp[1], IDD_TASKBARPROP_STARTMENU, (DLGPROC)StartMenuPageProc);
InitPropSheetPage(&psp[2], IDD_TASKBARPROP_NOTIFICATION, (DLGPROC)NotificationPageProc);
InitPropSheetPage(&psp[3], IDD_TASKBARPROP_TOOLBARS, (DLGPROC)ToolbarsPageProc);
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);
return (HWND)PropertySheet(&psh);
PropertySheet(&psh);
HeapFree(hProcessHeap,
0,
pPropInfo);
// FIXME: return the HWND
return NULL;
}