mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-08-31 04:13:37 +00:00
[EXPLORER_NEW]
- Add support for task bar theming - Add notification area support - Add support for window flashing - Hide minimized windows - Based on Andrew Green's GSoC branch (3/3) svn path=/trunk/; revision=57978
This commit is contained in:
@@ -17,6 +17,19 @@ list(APPEND SOURCE
|
||||
add_executable(explorer_new ${SOURCE})
|
||||
target_link_libraries(explorer_new uuid)
|
||||
set_module_type(explorer_new win32gui UNICODE)
|
||||
add_importlibs(explorer_new advapi32 gdi32 user32 comctl32 ole32 oleaut32 shell32 shlwapi version msvcrt kernel32 ntdll)
|
||||
add_importlibs(explorer_new
|
||||
advapi32
|
||||
gdi32
|
||||
user32
|
||||
comctl32
|
||||
ole32
|
||||
oleaut32
|
||||
shell32
|
||||
shlwapi
|
||||
version
|
||||
uxtheme
|
||||
msvcrt
|
||||
kernel32
|
||||
ntdll)
|
||||
add_pch(explorer_new precomp.h)
|
||||
add_cd_file(TARGET explorer_new DESTINATION reactos FOR all)
|
||||
|
||||
@@ -17,7 +17,9 @@
|
||||
#include <tchar.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <uxtheme.h>
|
||||
|
||||
#include "tmschema.h"
|
||||
#include "resource.h"
|
||||
#include "comcsup.h"
|
||||
#include "todo.h"
|
||||
@@ -384,6 +386,11 @@ HWND
|
||||
CreateTrayNotifyWnd(IN OUT ITrayWindow *TrayWindow,
|
||||
IN BOOL bHideClock);
|
||||
|
||||
VOID
|
||||
TrayNotify_NotifyMsg(IN HWND hwnd,
|
||||
IN WPARAM wParam,
|
||||
IN LPARAM lParam);
|
||||
|
||||
/*
|
||||
* taskswnd.c
|
||||
*/
|
||||
|
||||
@@ -20,10 +20,6 @@
|
||||
|
||||
#include <precomp.h>
|
||||
|
||||
/* By default we don't use DrawCaptionTemp() because it causes some minimal
|
||||
drawing glitches with the toolbar custom painting code */
|
||||
#define TASK_USE_DRAWCAPTIONTEMP 1
|
||||
|
||||
/* Set DUMP_TASKS to 1 to enable a dump of the tasks and task groups every
|
||||
5 seconds */
|
||||
#define DUMP_TASKS 0
|
||||
@@ -47,14 +43,6 @@ typedef struct _TASK_GROUP
|
||||
struct
|
||||
{
|
||||
|
||||
#if TASK_USE_DRAWCAPTIONTEMP != 0
|
||||
|
||||
/* DisplayTooltip is TRUE when the group button text didn't fit into
|
||||
the button. */
|
||||
DWORD DisplayTooltip : 1;
|
||||
|
||||
#endif
|
||||
|
||||
DWORD IsCollapsed : 1;
|
||||
};
|
||||
};
|
||||
@@ -65,12 +53,9 @@ typedef struct _TASK_ITEM
|
||||
HWND hWnd;
|
||||
PTASK_GROUP Group;
|
||||
INT Index;
|
||||
|
||||
#if !(TASK_USE_DRAWCAPTIONTEMP != 0)
|
||||
|
||||
INT IconIndex;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
union
|
||||
{
|
||||
@@ -78,14 +63,6 @@ typedef struct _TASK_ITEM
|
||||
struct
|
||||
{
|
||||
|
||||
#if TASK_USE_DRAWCAPTIONTEMP != 0
|
||||
|
||||
/* DisplayTooltip is TRUE when the window text didn't fit into the
|
||||
button. */
|
||||
DWORD DisplayTooltip : 1;
|
||||
|
||||
#endif
|
||||
|
||||
/* IsFlashing is TRUE when the task bar item should be flashing. */
|
||||
DWORD IsFlashing : 1;
|
||||
|
||||
@@ -113,9 +90,11 @@ typedef struct _TASK_SWITCH_WND
|
||||
PTASK_ITEM TaskItems;
|
||||
PTASK_ITEM ActiveTaskItem;
|
||||
|
||||
HTHEME TaskBandTheme;
|
||||
HWND hWndToolbar;
|
||||
UINT TbButtonsPerLine;
|
||||
WORD ToolbarBtnCount;
|
||||
HIMAGELIST TaskIcons;
|
||||
|
||||
union
|
||||
{
|
||||
@@ -139,12 +118,6 @@ typedef struct _TASK_SWITCH_WND
|
||||
static VOID TaskSwitchWnd_UpdateButtonsSize(IN OUT PTASK_SWITCH_WND This,
|
||||
IN BOOL bRedrawDisabled);
|
||||
|
||||
#if TASK_USE_DRAWCAPTIONTEMP != 0
|
||||
|
||||
#define TaskSwitchWnd_GetWndTextFromTaskItem(a,b) NULL
|
||||
|
||||
#else /* !TASK_USE_DRAWCAPTIONTEMP */
|
||||
|
||||
static LPTSTR
|
||||
TaskSwitchWnd_GetWndTextFromTaskItem(IN OUT PTASK_SWITCH_WND This,
|
||||
IN PTASK_ITEM TaskItem)
|
||||
@@ -161,7 +134,6 @@ TaskSwitchWnd_GetWndTextFromTaskItem(IN OUT PTASK_SWITCH_WND This,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if DUMP_TASKS != 0
|
||||
static VOID
|
||||
@@ -408,20 +380,45 @@ TaskSwitchWnd_ExpandTaskGroup(IN OUT PTASK_SWITCH_WND This,
|
||||
/* FIXME: Implement */
|
||||
}
|
||||
|
||||
static HICON
|
||||
TaskSwitchWnd_GetWndIcon(HWND hwnd)
|
||||
{
|
||||
HICON hIcon = 0;
|
||||
|
||||
SendMessageTimeout(hwnd, WM_GETICON, ICON_SMALL2, 0, SMTO_ABORTIFHUNG, 1000, (PDWORD_PTR)&hIcon);
|
||||
|
||||
if (!hIcon)
|
||||
SendMessageTimeout(hwnd, WM_GETICON, ICON_SMALL, 0, SMTO_ABORTIFHUNG, 1000, (PDWORD_PTR)&hIcon);
|
||||
|
||||
if (!hIcon)
|
||||
SendMessageTimeout(hwnd, WM_GETICON, ICON_BIG, 0, SMTO_ABORTIFHUNG, 1000, (PDWORD_PTR)&hIcon);
|
||||
|
||||
if (!hIcon)
|
||||
hIcon = (HICON)GetClassLongPtr(hwnd, GCL_HICONSM);
|
||||
|
||||
if (!hIcon)
|
||||
hIcon = (HICON)GetClassLongPtr(hwnd, GCL_HICON);
|
||||
|
||||
return hIcon;
|
||||
}
|
||||
static INT
|
||||
TaskSwitchWnd_UpdateTaskItemButton(IN OUT PTASK_SWITCH_WND This,
|
||||
IN PTASK_ITEM TaskItem)
|
||||
{
|
||||
TBBUTTONINFO tbbi;
|
||||
HICON icon;
|
||||
|
||||
ASSERT(TaskItem->Index >= 0);
|
||||
|
||||
tbbi.cbSize = sizeof(tbbi);
|
||||
tbbi.dwMask = TBIF_BYINDEX | TBIF_STATE | TBIF_TEXT;
|
||||
tbbi.dwMask = TBIF_BYINDEX | TBIF_STATE | TBIF_TEXT | TBIF_IMAGE;
|
||||
tbbi.fsState = TBSTATE_ENABLED;
|
||||
if (This->ActiveTaskItem == TaskItem)
|
||||
tbbi.fsState |= TBSTATE_CHECKED;
|
||||
|
||||
if (TaskItem->RenderFlashed)
|
||||
tbbi.fsState |= TBSTATE_MARKED;
|
||||
|
||||
/* Check if we're updating a button that is the last one in the
|
||||
line. If so, we need to set the TBSTATE_WRAP flag! */
|
||||
if (This->TbButtonsPerLine != 0 &&
|
||||
@@ -433,6 +430,10 @@ TaskSwitchWnd_UpdateTaskItemButton(IN OUT PTASK_SWITCH_WND This,
|
||||
tbbi.pszText = TaskSwitchWnd_GetWndTextFromTaskItem(This,
|
||||
TaskItem);
|
||||
|
||||
icon = TaskSwitchWnd_GetWndIcon(TaskItem->hWnd);
|
||||
TaskItem->IconIndex = ImageList_ReplaceIcon(This->TaskIcons,TaskItem->IconIndex,icon);
|
||||
tbbi.iImage = TaskItem->IconIndex;
|
||||
|
||||
if (!SendMessage(This->hWndToolbar,
|
||||
TB_SETBUTTONINFO,
|
||||
(WPARAM)TaskItem->Index,
|
||||
@@ -446,6 +447,39 @@ TaskSwitchWnd_UpdateTaskItemButton(IN OUT PTASK_SWITCH_WND This,
|
||||
return TaskItem->Index;
|
||||
}
|
||||
|
||||
static VOID
|
||||
TaskSwitchWnd_RemoveIcon(IN OUT PTASK_SWITCH_WND This,
|
||||
IN PTASK_ITEM TaskItem)
|
||||
{
|
||||
TBBUTTONINFO tbbi;
|
||||
PTASK_ITEM currentTaskItem,LastItem;
|
||||
|
||||
if (TaskItem->IconIndex==-1)
|
||||
return;
|
||||
|
||||
tbbi.cbSize = sizeof(tbbi);
|
||||
tbbi.dwMask = TBIF_IMAGE;
|
||||
|
||||
currentTaskItem = This->TaskItems;
|
||||
LastItem = currentTaskItem + This->TaskItemCount;
|
||||
while (currentTaskItem != LastItem)
|
||||
{
|
||||
if (currentTaskItem->IconIndex > TaskItem->IconIndex)
|
||||
{
|
||||
currentTaskItem->IconIndex--;
|
||||
tbbi.iImage = currentTaskItem->IconIndex;
|
||||
|
||||
SendMessage(This->hWndToolbar,
|
||||
TB_SETBUTTONINFO,
|
||||
currentTaskItem->Index,
|
||||
(LPARAM)&tbbi);
|
||||
}
|
||||
currentTaskItem++;
|
||||
}
|
||||
|
||||
ImageList_Remove(This->TaskIcons, TaskItem->IconIndex);
|
||||
}
|
||||
|
||||
static PTASK_ITEM
|
||||
TaskSwitchWnd_FindLastTaskItemOfGroup(IN OUT PTASK_SWITCH_WND This,
|
||||
IN PTASK_GROUP TaskGroup OPTIONAL,
|
||||
@@ -541,6 +575,7 @@ TaskSwitchWnd_AddTaskItemButton(IN OUT PTASK_SWITCH_WND This,
|
||||
{
|
||||
TBBUTTON tbBtn;
|
||||
INT iIndex;
|
||||
HICON icon;
|
||||
|
||||
if (TaskItem->Index >= 0)
|
||||
{
|
||||
@@ -556,7 +591,10 @@ TaskSwitchWnd_AddTaskItemButton(IN OUT PTASK_SWITCH_WND This,
|
||||
TaskItem->Group);
|
||||
}
|
||||
|
||||
tbBtn.iBitmap = 0;
|
||||
icon = TaskSwitchWnd_GetWndIcon(TaskItem->hWnd);
|
||||
TaskItem->IconIndex = ImageList_AddIcon(This->TaskIcons, icon);
|
||||
|
||||
tbBtn.iBitmap = TaskItem->IconIndex;
|
||||
tbBtn.fsState = TBSTATE_ENABLED | TBSTATE_ELLIPSES;
|
||||
tbBtn.fsStyle = BTNS_CHECK | BTNS_NOPREFIX | BTNS_SHOWTEXT;
|
||||
tbBtn.dwData = TaskItem->Index;
|
||||
@@ -612,6 +650,7 @@ TaskSwitchWnd_DeleteTaskItemButton(IN OUT PTASK_SWITCH_WND This,
|
||||
{
|
||||
TaskSwitchWnd_BeginUpdate(This);
|
||||
|
||||
TaskSwitchWnd_RemoveIcon(This, TaskItem);
|
||||
iIndex = TaskItem->Index;
|
||||
if (SendMessage(This->hWndToolbar,
|
||||
TB_DELETEBUTTON,
|
||||
@@ -1107,7 +1146,9 @@ static VOID
|
||||
TaskSwitchWnd_FlashTaskItem(IN OUT PTASK_SWITCH_WND This,
|
||||
IN OUT PTASK_ITEM TaskItem)
|
||||
{
|
||||
/* FIXME: Implement */
|
||||
TaskItem->RenderFlashed = 1;
|
||||
TaskSwitchWnd_UpdateTaskItemButton(This,
|
||||
TaskItem);
|
||||
}
|
||||
|
||||
static BOOL
|
||||
@@ -1151,6 +1192,7 @@ TaskSwitchWnd_RedrawTaskItem(IN OUT PTASK_SWITCH_WND This,
|
||||
else if (TaskItem->Index >= 0)
|
||||
{
|
||||
UpdateTaskItem:
|
||||
TaskItem->RenderFlashed = 0;
|
||||
TaskSwitchWnd_UpdateTaskItemButton(This,
|
||||
TaskItem);
|
||||
}
|
||||
@@ -1386,6 +1428,18 @@ TaskSwichWnd_ToolbarSubclassedProc(IN HWND hWnd,
|
||||
return Ret;
|
||||
}
|
||||
|
||||
static VOID
|
||||
TaskSwitchWnd_UpdateTheme(IN OUT PTASK_SWITCH_WND This)
|
||||
{
|
||||
if (This->TaskBandTheme)
|
||||
CloseThemeData(This->TaskBandTheme);
|
||||
|
||||
if (IsThemeActive())
|
||||
This->TaskBandTheme = OpenThemeData(This->hWnd, L"TaskBand");
|
||||
else
|
||||
This->TaskBandTheme = NULL;
|
||||
}
|
||||
|
||||
static VOID
|
||||
TaskSwitchWnd_Create(IN OUT PTASK_SWITCH_WND This)
|
||||
{
|
||||
@@ -1410,12 +1464,17 @@ TaskSwitchWnd_Create(IN OUT PTASK_SWITCH_WND This)
|
||||
HMODULE hShell32;
|
||||
SIZE BtnSize;
|
||||
|
||||
SetWindowTheme(This->hWndToolbar, L"TaskBand", NULL);
|
||||
TaskSwitchWnd_UpdateTheme(This);
|
||||
/* Identify the version we're using */
|
||||
SendMessage(This->hWndToolbar,
|
||||
TB_BUTTONSTRUCTSIZE,
|
||||
sizeof(TBBUTTON),
|
||||
0);
|
||||
|
||||
This->TaskIcons = ImageList_Create(16, 16, ILC_COLOR32, 0, 1000);
|
||||
SendMessage(This->hWndToolbar, TB_SETIMAGELIST, 0, (LPARAM)This->TaskIcons);
|
||||
|
||||
/* Calculate the default button size. Don't save this in This->ButtonSize.cx so that
|
||||
the actual button width gets updated correctly on the first recalculation */
|
||||
BtnSize.cx = GetSystemMetrics(SM_CXMINIMIZED);
|
||||
@@ -1497,6 +1556,7 @@ TaskSwitchWnd_NCDestroy(IN OUT PTASK_SWITCH_WND This)
|
||||
}
|
||||
}
|
||||
|
||||
CloseThemeData(This->TaskBandTheme);
|
||||
TaskSwitchWnd_DeleteAllTasks(This);
|
||||
}
|
||||
|
||||
@@ -1778,16 +1838,10 @@ static LRESULT
|
||||
TaskSwichWnd_HandleItemPaint(IN OUT PTASK_SWITCH_WND This,
|
||||
IN OUT NMTBCUSTOMDRAW *nmtbcd)
|
||||
{
|
||||
HFONT hCaptionFont, hBoldCaptionFont;
|
||||
LRESULT Ret = CDRF_DODEFAULT;
|
||||
PTASK_GROUP TaskGroup;
|
||||
PTASK_ITEM TaskItem;
|
||||
|
||||
#if TASK_USE_DRAWCAPTIONTEMP != 0
|
||||
|
||||
UINT uidctFlags = DC_TEXT | DC_ICON | DC_NOSENDMSG;
|
||||
|
||||
#endif
|
||||
TaskItem = FindTaskItemByIndex(This,
|
||||
(INT)nmtbcd->nmcd.dwItemSpec);
|
||||
TaskGroup = FindTaskGroupByIndex(This,
|
||||
@@ -1798,97 +1852,32 @@ TaskSwichWnd_HandleItemPaint(IN OUT PTASK_SWITCH_WND This,
|
||||
|
||||
if (TaskItem != NULL && IsWindow(TaskItem->hWnd))
|
||||
{
|
||||
hCaptionFont = ITrayWindow_GetCaptionFonts(This->Tray,
|
||||
&hBoldCaptionFont);
|
||||
if (nmtbcd->nmcd.uItemState & CDIS_CHECKED)
|
||||
hCaptionFont = hBoldCaptionFont;
|
||||
|
||||
#if TASK_USE_DRAWCAPTIONTEMP != 0
|
||||
|
||||
/* Make sure we don't draw on the button edges */
|
||||
InflateRect(&nmtbcd->nmcd.rc,
|
||||
-GetSystemMetrics(SM_CXEDGE),
|
||||
-GetSystemMetrics(SM_CYEDGE));
|
||||
|
||||
if ((nmtbcd->nmcd.uItemState & CDIS_MARKED) && TaskItem->RenderFlashed)
|
||||
{
|
||||
/* This is a slight glitch. We have to move the rectangle so that
|
||||
the button content appears to be pressed. However, when flashing
|
||||
is enabled, we can see a light line at the top and left inner
|
||||
border. We need to fill that area with the flashing color. Note
|
||||
that since we're using DrawCaptionTemp() the flashing color is
|
||||
COLOR_ACTIVECAPTION, not COLOR_HIGHLIGHT! */
|
||||
FillRect(nmtbcd->nmcd.hdc,
|
||||
&nmtbcd->nmcd.rc,
|
||||
(HBRUSH)(COLOR_ACTIVECAPTION + 1));
|
||||
|
||||
/* Make the button content appear pressed. This however draws a bit
|
||||
into the right and bottom border of the button edge, making it
|
||||
look a bit odd. However, selecting a clipping region to prevent
|
||||
that from happening causes problems with DrawCaptionTemp()! */
|
||||
OffsetRect(&nmtbcd->nmcd.rc,
|
||||
1,
|
||||
1);
|
||||
|
||||
/* Render flashed */
|
||||
uidctFlags |= DC_ACTIVE;
|
||||
}
|
||||
else
|
||||
{
|
||||
uidctFlags |= DC_INBUTTON;
|
||||
if (nmtbcd->nmcd.uItemState & CDIS_CHECKED)
|
||||
uidctFlags |= DC_ACTIVE;
|
||||
}
|
||||
|
||||
if (DrawCapTemp != NULL)
|
||||
{
|
||||
/* Draw the button content */
|
||||
TaskItem->DisplayTooltip = !DrawCapTemp(TaskItem->hWnd,
|
||||
nmtbcd->nmcd.hdc,
|
||||
&nmtbcd->nmcd.rc,
|
||||
hCaptionFont,
|
||||
NULL,
|
||||
NULL,
|
||||
uidctFlags);
|
||||
}
|
||||
|
||||
return CDRF_SKIPDEFAULT;
|
||||
|
||||
#else /* !TASK_USE_DRAWCAPTIONTEMP */
|
||||
|
||||
/* Make the entire button flashing if neccessary */
|
||||
if (nmtbcd->nmcd.uItemState & CDIS_MARKED)
|
||||
{
|
||||
if (TaskItem->RenderFlashed)
|
||||
Ret = TBCDRF_NOBACKGROUND;
|
||||
if (!This->TaskBandTheme)
|
||||
{
|
||||
nmtbcd->hbrMonoDither = GetSysColorBrush(COLOR_HIGHLIGHT);
|
||||
nmtbcd->clrTextHighlight = GetSysColor(COLOR_HIGHLIGHTTEXT);
|
||||
nmtbcd->nHLStringBkMode = TRANSPARENT;
|
||||
|
||||
/* We don't really need to set clrMark because we set the
|
||||
background mode to TRANSPARENT! */
|
||||
nmtbcd->clrMark = GetSysColor(COLOR_HIGHLIGHT);
|
||||
|
||||
Ret |= TBCDRF_USECDCOLORS;
|
||||
SelectObject(nmtbcd->nmcd.hdc, GetSysColorBrush(COLOR_HIGHLIGHT));
|
||||
Rectangle(nmtbcd->nmcd.hdc,
|
||||
nmtbcd->nmcd.rc.left,
|
||||
nmtbcd->nmcd.rc.top,
|
||||
nmtbcd->nmcd.rc.right,
|
||||
nmtbcd->nmcd.rc.bottom);
|
||||
}
|
||||
else
|
||||
Ret |= TBCDRF_NOMARK;
|
||||
{
|
||||
DrawThemeBackground(This->TaskBandTheme, nmtbcd->nmcd.hdc, TDP_FLASHBUTTON, 0, &nmtbcd->nmcd.rc, 0);
|
||||
}
|
||||
nmtbcd->clrText = GetSysColor(COLOR_HIGHLIGHTTEXT);
|
||||
return Ret;
|
||||
}
|
||||
|
||||
/* Select the font we want to use */
|
||||
SelectObject(nmtbcd->nmcd.hdc,
|
||||
hCaptionFont);
|
||||
return Ret | CDRF_NEWFONT;
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
else if (TaskGroup != NULL)
|
||||
{
|
||||
/* FIXME: Implement painting for task groups */
|
||||
}
|
||||
|
||||
return Ret;
|
||||
}
|
||||
|
||||
@@ -1907,22 +1896,7 @@ TaskSwitchWnd_HandleToolbarNotification(IN OUT PTASK_SWITCH_WND This,
|
||||
switch (nmtbcd->nmcd.dwDrawStage)
|
||||
{
|
||||
|
||||
#if TASK_USE_DRAWCAPTIONTEMP != 0
|
||||
|
||||
case CDDS_ITEMPREPAINT:
|
||||
/* We handle drawing in the post-paint stage so that we
|
||||
don't have to draw the button edges, etc */
|
||||
Ret = CDRF_NOTIFYPOSTPAINT;
|
||||
break;
|
||||
|
||||
case CDDS_ITEMPOSTPAINT:
|
||||
|
||||
#else /* !TASK_USE_DRAWCAPTIONTEMP */
|
||||
|
||||
case CDDS_ITEMPREPAINT:
|
||||
|
||||
#endif
|
||||
|
||||
Ret = TaskSwichWnd_HandleItemPaint(This,
|
||||
nmtbcd);
|
||||
break;
|
||||
@@ -1942,6 +1916,16 @@ TaskSwitchWnd_HandleToolbarNotification(IN OUT PTASK_SWITCH_WND This,
|
||||
return Ret;
|
||||
}
|
||||
|
||||
static VOID
|
||||
TaskSwitchWnd_DrawBackground(HWND hwnd,
|
||||
HDC hdc)
|
||||
{
|
||||
RECT rect;
|
||||
|
||||
GetClientRect(hwnd, &rect);
|
||||
DrawThemeParentBackground(hwnd, hdc, &rect);
|
||||
}
|
||||
|
||||
static LRESULT CALLBACK
|
||||
TaskSwitchWndProc(IN HWND hwnd,
|
||||
IN UINT uMsg,
|
||||
@@ -1961,6 +1945,12 @@ TaskSwitchWndProc(IN HWND hwnd,
|
||||
{
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_THEMECHANGED:
|
||||
TaskSwitchWnd_UpdateTheme(This);
|
||||
break;
|
||||
case WM_ERASEBKGND:
|
||||
TaskSwitchWnd_DrawBackground(hwnd, (HDC)wParam);
|
||||
break;
|
||||
case WM_SIZE:
|
||||
{
|
||||
SIZE szClient;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -43,6 +43,7 @@ typedef struct
|
||||
const IShellDesktopTrayVtbl *lpVtblShellDesktopTray;
|
||||
LONG Ref;
|
||||
|
||||
HTHEME TaskbarTheme;
|
||||
HWND hWnd;
|
||||
HWND hWndDesktop;
|
||||
|
||||
@@ -1027,6 +1028,12 @@ ITrayWindowImpl_Destroy(ITrayWindowImpl *This)
|
||||
This->TrayBandSite = NULL;
|
||||
}
|
||||
|
||||
if (This->TaskbarTheme)
|
||||
{
|
||||
CloseThemeData(This->TaskbarTheme);
|
||||
This->TaskbarTheme = NULL;
|
||||
}
|
||||
|
||||
ITrayWindowImpl_Release(ITrayWindow_from_impl(This));
|
||||
|
||||
if (InterlockedDecrement(&TrayWndCount) == 0)
|
||||
@@ -1113,6 +1120,7 @@ ITrayWindowImpl_AlignControls(IN OUT ITrayWindowImpl *This,
|
||||
BOOL Horizontal;
|
||||
HDWP dwp;
|
||||
|
||||
ITrayWindowImpl_UpdateStartButton(This, NULL);
|
||||
if (prcClient != NULL)
|
||||
{
|
||||
rcClient = *prcClient;
|
||||
@@ -1401,11 +1409,26 @@ Cleanup:
|
||||
return hBitmap;
|
||||
}
|
||||
|
||||
static VOID
|
||||
ITrayWindowImpl_UpdateTheme(IN OUT ITrayWindowImpl *This)
|
||||
{
|
||||
if (This->TaskbarTheme)
|
||||
CloseThemeData(This->TaskbarTheme);
|
||||
|
||||
if (IsThemeActive())
|
||||
This->TaskbarTheme = OpenThemeData(This->hWnd, L"Taskbar");
|
||||
else
|
||||
This->TaskbarTheme = 0;
|
||||
}
|
||||
|
||||
static VOID
|
||||
ITrayWindowImpl_Create(IN OUT ITrayWindowImpl *This)
|
||||
{
|
||||
TCHAR szStartCaption[32];
|
||||
|
||||
SetWindowTheme(This->hWnd, L"TaskBar", NULL);
|
||||
ITrayWindowImpl_UpdateTheme(This);
|
||||
|
||||
InterlockedIncrement(&TrayWndCount);
|
||||
|
||||
if (!LoadString(hExplorerInstance,
|
||||
@@ -1458,6 +1481,7 @@ ITrayWindowImpl_Create(IN OUT ITrayWindowImpl *This)
|
||||
NULL);
|
||||
if (This->hwndStart)
|
||||
{
|
||||
SetWindowTheme(This->hwndStart, L"Start", NULL);
|
||||
SendMessage(This->hwndStart,
|
||||
WM_SETFONT,
|
||||
(WPARAM)This->hStartBtnFont,
|
||||
@@ -1538,6 +1562,7 @@ SetStartBtnImage:
|
||||
This->TrayBandSite = CreateTrayBandSite(ITrayWindow_from_impl(This),
|
||||
&This->hwndRebar,
|
||||
&This->hwndTaskSwitch);
|
||||
SetWindowTheme(This->hwndRebar, L"TaskBar", NULL);
|
||||
|
||||
/* Create the tray notification window */
|
||||
This->hwndTrayNotify = CreateTrayNotifyWnd(ITrayWindow_from_impl(This),
|
||||
@@ -1883,6 +1908,74 @@ static const ITrayWindowVtbl ITrayWindowImpl_Vtbl =
|
||||
ITrayWindowImpl_Lock
|
||||
};
|
||||
|
||||
static int
|
||||
ITrayWindowImpl_DrawBackground(IN ITrayWindowImpl *This,
|
||||
IN HDC dc)
|
||||
{
|
||||
int backoundPart;
|
||||
RECT rect;
|
||||
|
||||
GetClientRect(This->hWnd, &rect);
|
||||
switch (This->Position)
|
||||
{
|
||||
case ABE_LEFT:
|
||||
backoundPart = TBP_BACKGROUNDLEFT;
|
||||
break;
|
||||
case ABE_TOP:
|
||||
backoundPart = TBP_BACKGROUNDTOP;
|
||||
break;
|
||||
case ABE_RIGHT:
|
||||
backoundPart = TBP_BACKGROUNDRIGHT;
|
||||
break;
|
||||
case ABE_BOTTOM:
|
||||
default:
|
||||
backoundPart = TBP_BACKGROUNDBOTTOM;
|
||||
break;
|
||||
}
|
||||
DrawThemeBackground(This->TaskbarTheme, dc, backoundPart, 0, &rect, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
ITrayWindowImpl_DrawSizer(IN ITrayWindowImpl *This,
|
||||
IN HRGN hRgn)
|
||||
{
|
||||
HDC hdc;
|
||||
RECT rect;
|
||||
int backoundPart;
|
||||
|
||||
GetWindowRect(This->hWnd, &rect);
|
||||
OffsetRect(&rect, -rect.left, -rect.top);
|
||||
|
||||
hdc = GetDCEx(This->hWnd, hRgn, DCX_WINDOW | DCX_INTERSECTRGN | DCX_PARENTCLIP);
|
||||
|
||||
switch (This->Position)
|
||||
{
|
||||
case ABE_LEFT:
|
||||
backoundPart = TBP_SIZINGBARLEFT;
|
||||
rect.left = rect.right - GetSystemMetrics(SM_CXSIZEFRAME);
|
||||
break;
|
||||
case ABE_TOP:
|
||||
backoundPart = TBP_SIZINGBARTOP;
|
||||
rect.top = rect.bottom - GetSystemMetrics(SM_CYSIZEFRAME);
|
||||
break;
|
||||
case ABE_RIGHT:
|
||||
backoundPart = TBP_SIZINGBARRIGHT;
|
||||
rect.right = rect.left + GetSystemMetrics(SM_CXSIZEFRAME);
|
||||
break;
|
||||
case ABE_BOTTOM:
|
||||
default:
|
||||
backoundPart = TBP_SIZINGBARBOTTOM;
|
||||
rect.bottom = rect.top + GetSystemMetrics(SM_CYSIZEFRAME);
|
||||
break;
|
||||
}
|
||||
|
||||
DrawThemeBackground(This->TaskbarTheme, hdc, backoundPart, 0, &rect, 0);
|
||||
|
||||
ReleaseDC(This->hWnd, hdc);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static DWORD WINAPI
|
||||
RunFileDlgThread(IN OUT PVOID pParam)
|
||||
{
|
||||
@@ -1957,6 +2050,32 @@ TrayWndProc(IN HWND hwnd,
|
||||
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_COPYDATA:
|
||||
{
|
||||
if (This->hwndTrayNotify)
|
||||
{
|
||||
TrayNotify_NotifyMsg(This->hwndTrayNotify,
|
||||
wParam,
|
||||
lParam);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
case WM_THEMECHANGED:
|
||||
ITrayWindowImpl_UpdateTheme(This);
|
||||
return 0;
|
||||
case WM_NCPAINT:
|
||||
if (!This->TaskbarTheme)
|
||||
goto DefHandler;
|
||||
return ITrayWindowImpl_DrawSizer(This,
|
||||
(HRGN)wParam);
|
||||
case WM_ERASEBKGND:
|
||||
if (!This->TaskbarTheme)
|
||||
goto DefHandler;
|
||||
return ITrayWindowImpl_DrawBackground(This,
|
||||
(HDC)wParam);
|
||||
case WM_CTLCOLORBTN:
|
||||
SetBkMode((HDC)wParam, TRANSPARENT);
|
||||
return (LRESULT)GetStockObject(HOLLOW_BRUSH);
|
||||
case WM_NCHITTEST:
|
||||
{
|
||||
RECT rcClient;
|
||||
@@ -1996,30 +2115,23 @@ TrayWndProc(IN HWND hwnd,
|
||||
if (pt.y > rcClient.bottom)
|
||||
return HTBOTTOM;
|
||||
break;
|
||||
|
||||
case ABE_BOTTOM:
|
||||
if (pt.y < rcClient.top)
|
||||
return HTTOP;
|
||||
break;
|
||||
|
||||
case ABE_LEFT:
|
||||
if (pt.x > rcClient.right)
|
||||
return HTRIGHT;
|
||||
break;
|
||||
|
||||
case ABE_RIGHT:
|
||||
if (pt.x < rcClient.left)
|
||||
return HTLEFT;
|
||||
break;
|
||||
|
||||
case ABE_BOTTOM:
|
||||
default:
|
||||
if (pt.y < rcClient.top)
|
||||
return HTTOP;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return HTBORDER;
|
||||
}
|
||||
|
||||
case WM_MOVING:
|
||||
{
|
||||
POINT ptCursor;
|
||||
@@ -2072,7 +2184,7 @@ TrayWndProc(IN HWND hwnd,
|
||||
case WM_SIZE:
|
||||
{
|
||||
RECT rcClient;
|
||||
|
||||
InvalidateRect(This->hWnd, NULL, TRUE);
|
||||
if (wParam == SIZE_RESTORED && lParam == 0)
|
||||
{
|
||||
ITrayWindowImpl_ResizeWorkArea(This);
|
||||
|
||||
Reference in New Issue
Block a user