Index: base/shell/explorer-new/CMakeLists.txt
===================================================================
--- base/shell/explorer-new/CMakeLists.txt (revision 56428)
+++ base/shell/explorer-new/CMakeLists.txt (working copy)
@@ -26,6 +26,7 @@
advapi32
gdi32
user32
+ uxtheme
comctl32
ole32
oleaut32
Index: base/shell/explorer-new/explorer.c
===================================================================
--- base/shell/explorer-new/explorer.c (revision 56428)
+++ base/shell/explorer-new/explorer.c (working copy)
@@ -347,6 +347,19 @@
return bRet;
}
+static void HideMinimizedWindows(BOOL hide)
+{
+ MINIMIZEDMETRICS mm;
+ mm.cbSize = sizeof(MINIMIZEDMETRICS);
+ SystemParametersInfo(SPI_GETMINIMIZEDMETRICS, sizeof(MINIMIZEDMETRICS), &mm, FALSE);
+ if(hide)
+ mm.iArrange |= ARW_HIDE;
+ else
+ mm.iArrange &= ~ARW_HIDE;
+ SystemParametersInfo(SPI_SETMINIMIZEDMETRICS, sizeof(MINIMIZEDMETRICS), &mm, FALSE);
+}
+
+
INT WINAPI
_tWinMain(IN HINSTANCE hInstance,
IN HINSTANCE hPrevInstance,
@@ -390,7 +403,9 @@
if (RegisterTrayWindowClass() && RegisterTaskSwitchWndClass())
{
Tray = CreateTrayWindow();
-
+
+ HideMinimizedWindows(TRUE);
+
if (Tray != NULL)
hShellDesktop = DesktopCreateWindow(Tray);
}
Index: base/shell/explorer-new/explorer.exe.manifest
===================================================================
--- base/shell/explorer-new/explorer.exe.manifest (revision 0)
+++ base/shell/explorer-new/explorer.exe.manifest (working copy)
@@ -0,0 +1,22 @@
+
+
+
+This is ReactOS Explorer
+
+
+
+
+
+
Index: base/shell/explorer-new/explorer.rc
===================================================================
--- base/shell/explorer-new/explorer.rc (revision 56428)
+++ base/shell/explorer-new/explorer.rc (working copy)
@@ -20,6 +20,7 @@
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_group_ql.bmp
+CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "explorer.exe.manifest"
// UTF-8
#pragma code_page(65001)
Index: base/shell/explorer-new/precomp.h
===================================================================
--- base/shell/explorer-new/precomp.h (revision 56428)
+++ base/shell/explorer-new/precomp.h (working copy)
@@ -17,7 +17,9 @@
#include
#include
#include
+#include
+#include "tmschema.h"
#include "resource.h"
#include "comcsup.h"
#include "todo.h"
Index: base/shell/explorer-new/taskswnd.c
===================================================================
--- base/shell/explorer-new/taskswnd.c (revision 56428)
+++ base/shell/explorer-new/taskswnd.c (working copy)
@@ -20,10 +20,6 @@
#include
-/* 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 @@
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,27 +53,16 @@
HWND hWnd;
PTASK_GROUP Group;
INT Index;
+ INT IconIndex;
-#if !(TASK_USE_DRAWCAPTIONTEMP != 0)
- INT IconIndex;
-#endif
-
union
{
DWORD dwFlags;
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,12 @@
PTASK_ITEM TaskItems;
PTASK_ITEM ActiveTaskItem;
+ HTHEME TaskBandTheme;
HWND hWndToolbar;
UINT TbButtonsPerLine;
WORD ToolbarBtnCount;
+
+ HIMAGELIST TaskIcons;
union
{
@@ -139,12 +119,6 @@
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 +135,6 @@
return NULL;
}
-#endif
#if DUMP_TASKS != 0
static VOID
@@ -408,16 +381,38 @@
/* 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;
@@ -432,7 +427,15 @@
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,
@@ -441,11 +444,45 @@
TaskItem->Index = -1;
return -1;
}
-
+ InvalidateRect(This->hWndToolbar, 0, TRUE);
DbgPrint("Updated button %d for hwnd 0x%p\n", TaskItem->Index, TaskItem->hWnd);
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,
+ (WPARAM)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 +578,7 @@
{
TBBUTTON tbBtn;
INT iIndex;
+ HICON icon;
if (TaskItem->Index >= 0)
{
@@ -556,7 +594,13 @@
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 +656,8 @@
{
TaskSwitchWnd_BeginUpdate(This);
+ TaskSwitchWnd_RemoveIcon(This,TaskItem);
+
iIndex = TaskItem->Index;
if (SendMessage(This->hWndToolbar,
TB_DELETEBUTTON,
@@ -1107,7 +1153,10 @@
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 +1200,7 @@
else if (TaskItem->Index >= 0)
{
UpdateTaskItem:
+ TaskItem->RenderFlashed=0;
TaskSwitchWnd_UpdateTaskItemButton(This,
TaskItem);
}
@@ -1410,11 +1460,18 @@
HMODULE hShell32;
SIZE BtnSize;
+
+ SetWindowTheme(This->hWndToolbar, L"TaskBand", NULL);
+ This->TaskBandTheme = OpenThemeData(This->hWnd, L"TaskBand");
+
/* 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 */
@@ -1456,7 +1513,7 @@
3); /* 1 if no NT! We're targeting NT so we don't care! */
}
}
-
+
/* Add all windows to the toolbar */
EnumWindows(TaskSwitchWnd_EnumWindowsProc,
(LPARAM)This);
@@ -1497,6 +1554,8 @@
}
}
+ CloseThemeData(This->TaskBandTheme);
+
TaskSwitchWnd_DeleteAllTasks(This);
}
@@ -1778,16 +1837,10 @@
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,96 +1851,28 @@
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)
+ if (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));
+ Ret=TBCDRF_NOBACKGROUND;
+ if(!This->TaskBandTheme){
+ 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{
+ DrawThemeBackground(This->TaskBandTheme, nmtbcd->nmcd.hdc, TDP_FLASHBUTTON, 0, &nmtbcd->nmcd.rc, 0);
+ }
+
+ nmtbcd->clrText = GetSysColor(COLOR_HIGHLIGHTTEXT);
+
+ return Ret;
- /* 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)
- {
- 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;
- }
- else
- Ret |= TBCDRF_NOMARK;
- }
-
- /* 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 +1892,7 @@
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 +1912,13 @@
return Ret;
}
+static void TaskSwitchWnd_drawBackground(HWND wnd, HDC dc)
+{
+ RECT rect;
+ GetClientRect(wnd, &rect);
+ DrawThemeParentBackground(wnd, dc, &rect);
+}
+
static LRESULT CALLBACK
TaskSwitchWndProc(IN HWND hwnd,
IN UINT uMsg,
@@ -1961,10 +1938,18 @@
{
switch (uMsg)
{
+ case WM_THEMECHANGED:
+ if(This->TaskBandTheme)
+ CloseThemeData(This->TaskBandTheme);
+ This->TaskBandTheme = OpenThemeData(This->hWnd, L"TaskBand");
+ return 0;
+ case WM_ERASEBKGND:
+ TaskSwitchWnd_drawBackground(hwnd,(HDC)wParam);
+ return 0;
case WM_SIZE:
{
SIZE szClient;
-
+ InvalidateRect(hwnd, NULL, TRUE);
szClient.cx = LOWORD(lParam);
szClient.cy = HIWORD(lParam);
if (This->hWndToolbar != NULL)
Index: base/shell/explorer-new/trayntfy.c
===================================================================
--- base/shell/explorer-new/trayntfy.c (revision 56428)
+++ base/shell/explorer-new/trayntfy.c (working copy)
@@ -44,42 +44,42 @@
HRESULT RegGetDWord(HKEY hKey, LPCTSTR szValueName, DWORD * lpdwResult)
{
- LONG lResult;
- DWORD dwDataSize = sizeof(DWORD);
- DWORD dwType = 0;
+ LONG lResult;
+ DWORD dwDataSize = sizeof(DWORD);
+ DWORD dwType = 0;
- // Check input parameters...
- if (hKey == NULL || lpdwResult == NULL) return E_INVALIDARG;
+ // Check input parameters...
+ if (hKey == NULL || lpdwResult == NULL) return E_INVALIDARG;
- // Get dword value from the registry...
- lResult = RegQueryValueEx(hKey, szValueName, 0, &dwType, (LPBYTE) lpdwResult, &dwDataSize );
+ // Get dword value from the registry...
+ lResult = RegQueryValueEx(hKey, szValueName, 0, &dwType, (LPBYTE) lpdwResult, &dwDataSize );
- // Check result and make sure the registry value is a DWORD(REG_DWORD)...
- if (lResult != ERROR_SUCCESS) return HRESULT_FROM_WIN32(lResult);
- else if (dwType != REG_DWORD) return DISP_E_TYPEMISMATCH;
+ // Check result and make sure the registry value is a DWORD(REG_DWORD)...
+ if (lResult != ERROR_SUCCESS) return HRESULT_FROM_WIN32(lResult);
+ else if (dwType != REG_DWORD) return DISP_E_TYPEMISMATCH;
- return NOERROR;
+ return NOERROR;
}
void LoadSettings(void)
{
- HKEY hKey = NULL;
- DWORD dwValue;
+ HKEY hKey = NULL;
+ DWORD dwValue;
- if (RegOpenKey(HKEY_CURRENT_USER, s_szRegistryKey, &hKey) == ERROR_SUCCESS)
- {
- RegGetDWord(hKey, TEXT("blShowSeconds"), &dwValue);
- if (dwValue == 1)
- {
- blShowSeconds = TRUE;
- }
- else
- {
- blShowSeconds = FALSE;
- }
+ if (RegOpenKey(HKEY_CURRENT_USER, s_szRegistryKey, &hKey) == ERROR_SUCCESS)
+ {
+ RegGetDWord(hKey, TEXT("blShowSeconds"), &dwValue);
+ if (dwValue == 1)
+ {
+ blShowSeconds = TRUE;
+ }
+ else
+ {
+ blShowSeconds = FALSE;
+ }
- RegCloseKey(hKey);
- }
+ RegCloseKey(hKey);
+ }
}
#define CLOCKWND_FORMAT_COUNT (sizeof(ClockWndFormats) / sizeof(ClockWndFormats[0]))
@@ -92,9 +92,10 @@
HWND hWnd;
HWND hWndNotify;
HFONT hFont;
+ COLORREF textColor;
RECT rcText;
SYSTEMTIME LocalTime;
-
+
union
{
DWORD dwFlags;
@@ -113,6 +114,55 @@
TCHAR szLines[CLOCKWND_FORMAT_COUNT][48];
} TRAY_CLOCK_WND_DATA, *PTRAY_CLOCK_WND_DATA;
+static VOID
+TrayClockWnd_SetFont(IN OUT PTRAY_CLOCK_WND_DATA This,
+ IN HFONT hNewFont,
+ IN BOOL bRedraw);
+
+static void TrayClockWnd_UpdateStyle(PTRAY_CLOCK_WND_DATA This)
+{
+ LOGFONTW clockFont;
+ HTHEME clockTheme;
+ HFONT hFont;
+
+ clockTheme = OpenThemeData(This->hWnd, L"Clock");
+
+
+ if(clockTheme){
+
+ GetThemeFont(
+ clockTheme,
+ NULL,
+ CLP_TIME,
+ 0,
+ TMT_FONT,
+ &clockFont);
+
+ hFont = CreateFontIndirect(&clockFont);
+
+
+ TrayClockWnd_SetFont(This,
+ hFont,
+ FALSE);
+
+ GetThemeColor(
+ clockTheme,
+ CLP_TIME,
+ 0,
+ TMT_TEXTCOLOR,
+ &This->textColor);
+
+
+ }else
+ {
+ This->textColor=RGB(0,0,0);
+ }
+
+
+ CloseThemeData(clockTheme);
+
+}
+
static BOOL
TrayClockWnd_MeasureLines(IN OUT PTRAY_CLOCK_WND_DATA This)
{
@@ -276,11 +326,11 @@
if (iRet != 0 && i == 0)
{
- if (blShowSeconds == FALSE)
- {
- (This->szLines[0][5] = '\0');
- };
-
+ if (blShowSeconds == FALSE)
+ {
+ (This->szLines[0][5] = '\0');
+ };
+
/* Set the window text to the time only */
SetWindowText(This->hWnd,
This->szLines[i]);
@@ -344,10 +394,10 @@
/* Calculate the due time */
GetLocalTime(&This->LocalTime);
uiDueTime = 1000 - (UINT)This->LocalTime.wMilliseconds;
- if (blShowSeconds == TRUE)
- uiDueTime += ( (UINT)This->LocalTime.wSecond) * 100;
- else
- uiDueTime += (59 - (UINT)This->LocalTime.wSecond) * 1000;
+ if (blShowSeconds == TRUE)
+ uiDueTime += ( (UINT)This->LocalTime.wSecond) * 100;
+ else
+ uiDueTime += (59 - (UINT)This->LocalTime.wSecond) * 1000;
if (uiDueTime < USER_TIMER_MINIMUM || uiDueTime > USER_TIMER_MAXIMUM)
uiDueTime = 1000;
@@ -401,7 +451,7 @@
{
UINT uiDueTime;
BOOL Ret;
- int intWait1, intWait2;
+ int intWait1, intWait2;
/* Kill the initialization timer */
KillTimer(This->hWnd,
@@ -409,17 +459,17 @@
This->IsInitTimerEnabled = FALSE;
uiDueTime = TrayClockWnd_CalculateDueTime(This);
-
- if (blShowSeconds == TRUE)
- {
- intWait1 = 1000-200;
- intWait2 = 1000;
- }
- else
- {
- intWait1 = 60*1000-200;
- intWait2 = 60*1000;
- }
+
+ if (blShowSeconds == TRUE)
+ {
+ intWait1 = 1000-200;
+ intWait2 = 1000;
+ }
+ else
+ {
+ intWait1 = 60*1000-200;
+ intWait2 = 60*1000;
+ }
if (uiDueTime > intWait1)
{
@@ -428,7 +478,7 @@
intWait2. */
Ret = SetTimer(This->hWnd,
ID_TRAYCLOCK_TIMER,
- intWait2,
+ intWait2,
NULL) != 0;
This->IsTimerEnabled = Ret;
@@ -482,6 +532,8 @@
{
iPrevBkMode = SetBkMode(hDC,
TRANSPARENT);
+
+ SetTextColor(hDC,This->textColor);
hPrevFont = SelectObject(hDC,
This->hFont);
@@ -532,6 +584,13 @@
}
}
+static void TrayClockWnd_drawBackground(HWND wnd, HDC dc)
+{
+ RECT rect;
+ GetClientRect(wnd, &rect);
+ DrawThemeParentBackground(wnd, dc, &rect);
+}
+
static LRESULT CALLBACK
TrayClockWndProc(IN HWND hwnd,
IN UINT uMsg,
@@ -551,6 +610,12 @@
{
switch (uMsg)
{
+ case WM_THEMECHANGED:
+ TrayClockWnd_UpdateStyle(This);
+ return 0;
+ case WM_ERASEBKGND:
+ TrayClockWnd_drawBackground(hwnd,(HDC)wParam);
+ return 0;
case WM_PAINT:
case WM_PRINTCLIENT:
{
@@ -617,10 +682,14 @@
This = (PTRAY_CLOCK_WND_DATA)CreateStruct->lpCreateParams;
This->hWnd = hwnd;
This->hWndNotify = CreateStruct->hwndParent;
+
SetWindowLongPtr(hwnd,
0,
(LONG_PTR)This);
+
+
+ TrayClockWnd_UpdateStyle(This);
return TRUE;
}
@@ -677,7 +746,7 @@
PTRAY_CLOCK_WND_DATA TcData;
DWORD dwStyle;
HWND hWnd = NULL;
- LoadSettings();
+ LoadSettings();
TcData = HeapAlloc(hProcessHeap,
0,
@@ -714,6 +783,8 @@
TcData);
}
}
+
+ SetWindowTheme(hWnd, L"TrayNotify", NULL);
return hWnd;
@@ -760,9 +831,11 @@
HWND hWnd;
HWND hWndTrayClock;
HWND hWndNotify;
+ HTHEME TrayTheme;
SIZE szTrayClockMin;
- SIZE szNonClient;
+ MARGINS ContentMargin;
ITrayWindow *TrayWindow;
+ HFONT hFontClock;
union
{
DWORD dwFlags;
@@ -774,31 +847,58 @@
};
} TRAY_NOTIFY_WND_DATA, *PTRAY_NOTIFY_WND_DATA;
-static VOID
-TrayNotifyWnd_UpdateStyle(IN OUT PTRAY_NOTIFY_WND_DATA This)
+static void TrayNotifyWnd_UpdateStyle(PTRAY_NOTIFY_WND_DATA This)
{
- RECT rcClient = { 0, 0, 0, 0 };
+ LONG_PTR style;
- if (AdjustWindowRectEx(&rcClient,
- GetWindowLongPtr(This->hWnd,
- GWL_STYLE),
- FALSE,
- GetWindowLongPtr(This->hWnd,
- GWL_EXSTYLE)))
- {
- This->szNonClient.cx = rcClient.right - rcClient.left;
- This->szNonClient.cy = rcClient.bottom - rcClient.top;
+ if(This->TrayTheme)
+ CloseThemeData(This->TrayTheme);
+ This->TrayTheme = OpenThemeData(This->hWnd, L"TrayNotify");
+
+
+
+
+ if(This->TrayTheme){
+ style = GetWindowLongPtr(
+ This->hWnd,
+ GWL_EXSTYLE);
+ style = style & ~WS_EX_STATICEDGE;
+ SetWindowLongPtr(
+ This->hWnd,
+ GWL_EXSTYLE,
+ style);
+
+
+ GetThemeMargins(
+ This->TrayTheme,
+ NULL,
+ TNP_BACKGROUND,
+ 0,
+ TMT_CONTENTMARGINS,
+ NULL,
+ &This->ContentMargin);
+
+ }else{
+ style = GetWindowLongPtr(
+ This->hWnd,
+ GWL_EXSTYLE);
+ style = style | WS_EX_STATICEDGE;
+ SetWindowLongPtr(
+ This->hWnd,
+ GWL_EXSTYLE,
+ style);
+
+ This->ContentMargin.cxLeftWidth=This->ContentMargin.cxRightWidth=This->ContentMargin.cyTopHeight=This->ContentMargin.cyBottomHeight=0;
}
- else
- This->szNonClient.cx = This->szNonClient.cy = 0;
+
}
+
static VOID
TrayNotifyWnd_Create(IN OUT PTRAY_NOTIFY_WND_DATA This)
{
This->hWndTrayClock = CreateTrayClockWnd(This->hWnd,
!This->HideClock);
-
TrayNotifyWnd_UpdateStyle(This);
}
@@ -818,21 +918,24 @@
IN BOOL Horizontal,
IN OUT PSIZE pSize)
{
+ SIZE szClock = { 0, 0 };
This->IsHorizontal = Horizontal;
+ if(This->IsHorizontal)
+ SetWindowTheme(This->hWnd, L"TrayNotifyHoriz", NULL);
+ else
+ SetWindowTheme(This->hWnd, L"TrayNotifyVert", NULL);
if (!This->HideClock)
{
- SIZE szClock = { 0, 0 };
-
if (Horizontal)
{
- szClock.cy = pSize->cy - This->szNonClient.cy - (2 * TRAY_NOTIFY_WND_SPACING_Y);
+ szClock.cy = pSize->cy - (2 * TRAY_NOTIFY_WND_SPACING_Y);
if (szClock.cy <= 0)
goto NoClock;
}
else
{
- szClock.cx = pSize->cx - This->szNonClient.cx - (2 * TRAY_NOTIFY_WND_SPACING_X);
+ szClock.cx = pSize->cx - (2 * TRAY_NOTIFY_WND_SPACING_X);
if (szClock.cx <= 0)
goto NoClock;
}
@@ -843,25 +946,32 @@
(LPARAM)&szClock);
This->szTrayClockMin = szClock;
+
+
+
+
}
else
NoClock:
- This->szTrayClockMin = This->szNonClient;
+ This->szTrayClockMin = szClock;
if (Horizontal)
{
- pSize->cx = This->szNonClient.cx + (2 * TRAY_NOTIFY_WND_SPACING_X);
+ pSize->cx = (2 * TRAY_NOTIFY_WND_SPACING_X);
if (!This->HideClock)
pSize->cx += TRAY_NOTIFY_WND_SPACING_X + This->szTrayClockMin.cx;
}
else
{
- pSize->cy = This->szNonClient.cy + (2 * TRAY_NOTIFY_WND_SPACING_Y);
+ pSize->cy = (2 * TRAY_NOTIFY_WND_SPACING_Y);
if (!This->HideClock)
pSize->cy += TRAY_NOTIFY_WND_SPACING_Y + This->szTrayClockMin.cy;
}
+
+ pSize->cy+=This->ContentMargin.cyTopHeight+This->ContentMargin.cyBottomHeight;
+ pSize->cx+=This->ContentMargin.cxLeftWidth+This->ContentMargin.cxRightWidth;
return TRUE;
}
@@ -874,6 +984,10 @@
{
POINT ptClock;
SIZE szClock;
+
+ /*sprintf (buffer, "%d plus %d is %d", a, b, a+b);
+
+ MessageBox(NULL, L"I am just trying my wedding dress", NULL, NULL);*/
if (This->IsHorizontal)
{
@@ -900,6 +1014,43 @@
}
}
+static int TrayNotifyWnd_DrawBackground(IN HWND hwnd,
+ IN UINT uMsg,
+ IN WPARAM wParam,
+ IN LPARAM lParam)
+{
+ PTRAY_NOTIFY_WND_DATA This = (PTRAY_NOTIFY_WND_DATA)GetWindowLongPtr(hwnd,
+ 0);
+ int backoundPart;
+ RECT rect;
+ HDC dc=(HDC)wParam;
+
+
+
+
+
+ /*if(!This->TrayTheme)
+ return DefWindowProc(hwnd,
+ uMsg,
+ wParam,
+ lParam);*/
+
+ GetClientRect(hwnd, &rect);
+ /*if(This->IsHorizontal)
+ {*/
+ backoundPart=TNP_BACKGROUND;
+ //}
+
+ DrawThemeParentBackground(hwnd, dc, &rect);
+ DrawThemeBackground(This->TrayTheme, dc, backoundPart, 0, &rect, 0);
+
+
+
+ return 0;
+}
+
+
+
static LRESULT CALLBACK
TrayNotifyWndProc(IN HWND hwnd,
IN UINT uMsg,
@@ -919,6 +1070,14 @@
{
switch (uMsg)
{
+ case WM_THEMECHANGED:
+ TrayNotifyWnd_UpdateStyle(This);
+ return 0;
+ case WM_ERASEBKGND:
+ return TrayNotifyWnd_DrawBackground(hwnd,
+ uMsg,
+ wParam,
+ lParam);
case TNWM_GETMINIMUMSIZE:
{
Ret = (LRESULT)TrayNotifyWnd_GetMinimumSize(This,
Index: base/shell/explorer-new/traywnd.c
===================================================================
--- base/shell/explorer-new/traywnd.c (revision 56428)
+++ base/shell/explorer-new/traywnd.c (working copy)
@@ -43,6 +43,7 @@
const IShellDesktopTrayVtbl *lpVtblShellDesktopTray;
LONG Ref;
+ HTHEME TaskbarTheme;
HWND hWnd;
HWND hWndDesktop;
@@ -307,11 +308,6 @@
*pRect = *pScreen;
- /* Move the border outside of the screen */
- InflateRect(pRect,
- GetSystemMetrics(SM_CXEDGE),
- GetSystemMetrics(SM_CYEDGE));
-
ITrayWindowImpl_MakeTrayRectWithSize(Position,
pTraySize,
pRect);
@@ -1027,6 +1023,9 @@
This->TrayBandSite = NULL;
}
+ if(This->TaskbarTheme)
+ CloseThemeData(This->TaskbarTheme);
+
ITrayWindowImpl_Release(ITrayWindow_from_impl(This));
if (InterlockedDecrement(&TrayWndCount) == 0)
@@ -1113,6 +1112,8 @@
BOOL Horizontal;
HDWP dwp;
+ ITrayWindowImpl_UpdateStartButton(This,
+ NULL);
if (prcClient != NULL)
{
rcClient = *prcClient;
@@ -1193,6 +1194,7 @@
/* Resize/Move the rebar control */
if (This->hwndRebar != NULL)
{
+ RECT rcRebar;
POINT ptRebar = { 0, 0 };
SIZE szRebar;
@@ -1221,6 +1223,13 @@
szRebar.cx,
szRebar.cy,
SWP_NOZORDER | SWP_NOACTIVATE);
+
+ rcRebar.left=0;
+ rcRebar.top=0;
+ rcRebar.right=szRebar.cx-ptRebar.x;
+ rcRebar.bottom=szRebar.cy-ptRebar.y;
+
+ SendMessage(This->hwndRebar, RB_SIZETORECT, 0, (LPARAM)&rcRebar);
}
if (dwp != NULL)
@@ -1406,6 +1415,10 @@
{
TCHAR szStartCaption[32];
+
+ SetWindowTheme(This->hWnd,L"TaskBar", NULL);
+ This->TaskbarTheme = OpenThemeData(This->hWnd, L"Taskbar");
+
InterlockedIncrement(&TrayWndCount);
if (!LoadString(hExplorerInstance,
@@ -1447,7 +1460,7 @@
WC_BUTTON,
szStartCaption,
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS |
- BS_PUSHBUTTON | BS_CENTER | BS_VCENTER | BS_BITMAP,
+ BS_PUSHBUTTON | BS_TEXT | BS_LEFT | BS_TOP | BS_BOTTOM,
0,
0,
0,
@@ -1458,6 +1471,7 @@
NULL);
if (This->hwndStart)
{
+ SetWindowTheme(This->hwndStart, L"Start", NULL);
SendMessage(This->hwndStart,
WM_SETFONT,
(WPARAM)This->hStartBtnFont,
@@ -1538,6 +1552,7 @@
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),
@@ -1655,7 +1670,7 @@
szTrayWndClass,
NULL,
WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN |
- WS_BORDER | WS_THICKFRAME,
+ WS_BORDER | WS_THICKFRAME | CS_HREDRAW | CS_VREDRAW,
rcWnd.left,
rcWnd.top,
rcWnd.right - rcWnd.left,
@@ -1664,6 +1679,7 @@
NULL,
hExplorerInstance,
This);
+
if (hWnd == NULL)
Ret = E_FAIL;
}
@@ -1883,6 +1899,160 @@
ITrayWindowImpl_Lock
};
+static int ITrayWindowImpl_DrawBackground(IN HWND hwnd,
+ IN UINT uMsg,
+ IN WPARAM wParam,
+ IN LPARAM lParam)
+{
+ ITrayWindowImpl *This = (ITrayWindowImpl*)GetWindowLongPtr(hwnd,
+ 0);
+ int backoundPart;
+ RECT rect;
+ HDC dc=(HDC)wParam;
+
+
+
+
+
+ if(!This->TaskbarTheme)
+ return DefWindowProc(hwnd,
+ uMsg,
+ wParam,
+ lParam);
+
+ GetClientRect(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 HWND hwnd,
+ IN UINT uMsg,
+ IN WPARAM wParam,
+ IN LPARAM lParam)
+{
+ ITrayWindowImpl *This = (ITrayWindowImpl*)GetWindowLongPtr(hwnd,
+ 0);
+ HDC hdc;
+ RECT rect;
+ int backoundPart;
+
+ GetWindowRect (hwnd, &rect);
+ OffsetRect (&rect, -rect.left, -rect.top);
+
+
+ if(hwnd==NULL)
+ MessageBox(hwnd,L"hwnd==NULL",L"hwnd==NULL",MB_OK);
+
+ hdc = GetDCEx(hwnd, (HRGN)wParam, DCX_WINDOW|DCX_INTERSECTRGN|DCX_PARENTCLIP);
+
+ if(hdc==NULL)
+ MessageBox(hwnd,L"hdc==NULL",L"hdc==NULL",MB_OK);
+
+ if(!This->TaskbarTheme)
+ return DefWindowProc(hwnd,
+ uMsg,
+ wParam,
+ lParam);
+
+
+ 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(hwnd, hdc);
+ return 0;
+}
+static int ITrayWindowImpl_NCCalcSize(HWND hwnd,WPARAM wParam, LPARAM lParam)
+{
+ ITrayWindowImpl *This = (ITrayWindowImpl*)GetWindowLongPtr(hwnd,
+ 0);
+ if(wParam==TRUE){
+ NCCALCSIZE_PARAMS *calcsizeParams;
+ RECT *prcClientNew;
+ RECT *prcValidDst;
+ RECT *prcValidSrc;
+ calcsizeParams=(NCCALCSIZE_PARAMS*)lParam;
+ prcClientNew = &calcsizeParams->rgrc[0];//the first rectangle contains the new coordinates of a window that has been moved or resized, that is, it is the proposed new window coordinates
+ prcValidDst = &calcsizeParams->rgrc[1];//The second contains the coordinates of the window before it was moved or resized
+ prcValidSrc = &calcsizeParams->rgrc[2];//The third contains the coordinates of the window's client area before the window was moved or resized.
+ if(!This->Locked || This->AutoHide)
+ {
+ switch (This->Position)
+ {
+ case ABE_LEFT:
+
+ prcClientNew->right -= GetSystemMetrics(SM_CXSIZEFRAME);
+ break;
+ case ABE_TOP:
+ prcClientNew->bottom -= GetSystemMetrics(SM_CYSIZEFRAME);
+ break;
+ case ABE_RIGHT:
+ prcClientNew->left += GetSystemMetrics(SM_CXSIZEFRAME);
+ break;
+ case ABE_BOTTOM:
+ default:
+ prcClientNew->top += GetSystemMetrics(SM_CYSIZEFRAME);
+ break;
+ }
+ }
+
+
+ //*prcValidDst = *prcClientNew;
+
+ return 0;
+ //return DefWindowProcW (hwnd, WM_NCCALCSIZE, wParam, lParam);
+ }else{
+ //((LPRECT)lParam)->top -=10;
+ return DefWindowProcW (hwnd, WM_NCCALCSIZE, wParam, lParam);
+ }
+}
+static int ITrayWindowImpl_drawButtonBackground(HWND wnd, HDC dc)
+{
+ /*RECT rect;
+ GetClientRect(wnd, &rect);
+ DrawThemeParentBackground(wnd, dc, &rect);*/
+ SetBkMode(dc, TRANSPARENT);
+ return (int)GetStockObject(HOLLOW_BRUSH);
+}
+
static LRESULT CALLBACK
TrayWndProc(IN HWND hwnd,
IN UINT uMsg,
@@ -1923,6 +2093,31 @@
switch (uMsg)
{
+ case WM_SYNCPAINT:
+ /*This is a temporary fix to change align controls after theme change */
+ ITrayWindowImpl_AlignControls(This,NULL);
+ return 0;
+ case WM_THEMECHANGED:
+ if(This->TaskbarTheme)
+ CloseThemeData(This->TaskbarTheme);
+ This->TaskbarTheme = OpenThemeData(hwnd, L"Taskbar");
+
+ return 0;
+ case WM_NCPAINT:
+ return ITrayWindowImpl_DrawSizer(hwnd,
+ uMsg,
+ wParam,
+ lParam);
+ case WM_NCCALCSIZE:
+ return ITrayWindowImpl_NCCalcSize(hwnd,wParam,lParam);
+ case WM_ERASEBKGND:
+ return ITrayWindowImpl_DrawBackground(hwnd,
+ uMsg,
+ wParam,
+ lParam);
+ case WM_CTLCOLORBTN:
+ return ITrayWindowImpl_drawButtonBackground((HWND)lParam, (HDC)wParam);
+ break;
case WM_NCHITTEST:
{
RECT rcClient;
@@ -1935,13 +2130,16 @@
clicks on the border. */
return HTBORDER;
}
-
+
+ /* 0 is a possible valid response for MapWindowPoints.
+ While the default error code is 0. An extra check needs to be done */
+ SetLastError(-1);
if (GetClientRect(hwnd,
&rcClient) &&
- MapWindowPoints(hwnd,
+ (MapWindowPoints(hwnd,
NULL,
(LPPOINT)&rcClient,
- 2) != 0)
+ 2) != 0 || GetLastError()!=0))
{
pt.x = (SHORT)LOWORD(lParam);
pt.y = (SHORT)HIWORD(lParam);
@@ -2037,7 +2235,7 @@
case WM_SIZE:
{
RECT rcClient;
-
+ InvalidateRect(This->hWnd, NULL, TRUE);
if (wParam == SIZE_RESTORED && lParam == 0)
{
ITrayWindowImpl_ResizeWorkArea(This);