Index: base/shell/explorer-new/taskswnd.c =================================================================== --- base/shell/explorer-new/taskswnd.c (revision 51333) +++ 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; - -#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,97 +1851,29 @@ 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/explorer.rbuild =================================================================== --- base/shell/explorer-new/explorer.rbuild (revision 51333) +++ base/shell/explorer-new/explorer.rbuild (working copy) @@ -13,6 +13,7 @@ shlwapi uuid version + uxtheme precomp.h desktop.c dragdrop.c Index: base/shell/explorer-new/explorer.c =================================================================== --- base/shell/explorer-new/explorer.c (revision 51333) +++ base/shell/explorer-new/explorer.c (working copy) @@ -350,6 +350,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, @@ -393,7 +406,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 (revision 0) @@ -0,0 +1,22 @@ + + + +This is ReactOS Explorer + + + + + + \ No newline at end of file Index: base/shell/explorer-new/precomp.h =================================================================== --- base/shell/explorer-new/precomp.h (revision 51333) +++ 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/trayntfy.c =================================================================== --- base/shell/explorer-new/trayntfy.c (revision 51333) +++ base/shell/explorer-new/trayntfy.c (working copy) @@ -92,6 +92,7 @@ HWND hWnd; HWND hWndNotify; HFONT hFont; + COLORREF textColor; RECT rcText; SYSTEMTIME LocalTime; @@ -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) { @@ -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; } @@ -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; - } - else - This->szNonClient.cx = This->szNonClient.cy = 0; + 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; + } + } + 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/explorer.rc =================================================================== --- base/shell/explorer-new/explorer.rc (revision 51333) +++ 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" #include "lang/bg-BG.rc" #include "lang/cs-CZ.rc" Index: base/shell/explorer-new/traywnd.c =================================================================== --- base/shell/explorer-new/traywnd.c (revision 51333) +++ base/shell/explorer-new/traywnd.c (working copy) @@ -43,6 +43,7 @@ const IShellDesktopTrayVtbl *lpVtblShellDesktopTray; LONG Ref; + HTHEME TaskbarTheme; HWND hWnd; HWND hWndDesktop; @@ -299,11 +300,6 @@ *pRect = *pScreen; - /* Move the border outside of the screen */ - InflateRect(pRect, - GetSystemMetrics(SM_CXEDGE), - GetSystemMetrics(SM_CYEDGE)); - ITrayWindowImpl_MakeTrayRectWithSize(Position, pTraySize, pRect); @@ -1019,6 +1015,9 @@ This->TrayBandSite = NULL; } + if(This->TaskbarTheme) + CloseThemeData(This->TaskbarTheme); + ITrayWindowImpl_Release(ITrayWindow_from_impl(This)); if (InterlockedDecrement(&TrayWndCount) == 0) @@ -1105,6 +1104,8 @@ BOOL Horizontal; HDWP dwp; + ITrayWindowImpl_UpdateStartButton(This, + NULL); if (prcClient != NULL) { rcClient = *prcClient; @@ -1185,6 +1186,7 @@ /* Resize/Move the rebar control */ if (This->hwndRebar != NULL) { + RECT rcRebar; POINT ptRebar = { 0, 0 }; SIZE szRebar; @@ -1213,6 +1215,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) @@ -1398,6 +1407,10 @@ { TCHAR szStartCaption[32]; + + SetWindowTheme(This->hWnd,L"TaskBar", NULL); + This->TaskbarTheme = OpenThemeData(This->hWnd, L"Taskbar"); + InterlockedIncrement(&TrayWndCount); if (!LoadString(hExplorerInstance, @@ -1439,7 +1452,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, @@ -1450,6 +1463,7 @@ NULL); if (This->hwndStart) { + SetWindowTheme(This->hwndStart, L"Start", NULL); SendMessage(This->hwndStart, WM_SETFONT, (WPARAM)This->hStartBtnFont, @@ -1530,6 +1544,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), @@ -1647,7 +1662,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, @@ -1656,6 +1671,7 @@ NULL, hExplorerInstance, This); + if (hWnd == NULL) Ret = E_FAIL; } @@ -1851,6 +1867,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, @@ -1891,6 +2061,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; @@ -1903,13 +2098,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); @@ -2005,7 +2203,7 @@ case WM_SIZE: { RECT rcClient; - + InvalidateRect(This->hWnd, NULL, TRUE); if (wParam == SIZE_RESTORED && lParam == 0) { ITrayWindowImpl_ResizeWorkArea(This);