diff --git a/reactos/base/shell/explorer/taskband.cpp b/reactos/base/shell/explorer/taskband.cpp index 1186367e279..b079478ced7 100644 --- a/reactos/base/shell/explorer/taskband.cpp +++ b/reactos/base/shell/explorer/taskband.cpp @@ -104,6 +104,8 @@ public: if (m_hWnd != NULL) { + HWND hwndToolbar = ::GetWindow(m_hWnd, GW_CHILD); + /* The task band never has a title */ pdbi->dwMask &= ~DBIM_TITLE; @@ -125,13 +127,11 @@ public: } else { - /* When the band is horizontal its minimum height is the height of the start button */ - RECT rcButton; - GetWindowRect(m_hWndStartButton, &rcButton); - pdbi->ptMinSize.y = rcButton.bottom - rcButton.top; - pdbi->ptIntegral.y = pdbi->ptMinSize.y + (3 * GetSystemMetrics(SM_CYEDGE) / 2); /* FIXME: Query metrics */ - /* We're not going to allow task bands where not even the minimum button size fits into the band */ - pdbi->ptMinSize.x = pdbi->ptIntegral.y; + /* Obtain the button size, to be used as the integral size */ + DWORD size = SendMessageW(hwndToolbar, TB_GETBUTTONSIZE, 0, 0); + pdbi->ptIntegral.x = 0; + pdbi->ptIntegral.y = GET_Y_LPARAM(size); + pdbi->ptMinSize = pdbi->ptIntegral; } /* Ignored: pdbi->ptMaxSize.x */ diff --git a/reactos/base/shell/explorer/taskswnd.cpp b/reactos/base/shell/explorer/taskswnd.cpp index b673482443c..94ee9260386 100644 --- a/reactos/base/shell/explorer/taskswnd.cpp +++ b/reactos/base/shell/explorer/taskswnd.cpp @@ -1142,9 +1142,25 @@ public: LONG NewBtnSize; BOOL Horizontal; - int cx = GetSystemMetrics(SM_CXMINIMIZED); - int cy = m_ButtonSize.cy = GetSystemMetrics(SM_CYSIZE); - m_TaskBar.SetButtonSize(cx, cy); + /* Update the size of the image list if needed */ + int cx, cy; + ImageList_GetIconSize(m_ImageList, &cx, &cy); + if (cx != GetSystemMetrics(SM_CXSMICON) || cy != GetSystemMetrics(SM_CYSMICON)) + { + ImageList_SetIconSize(m_ImageList, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON)); + + /* SetIconSize removes all icons so we have to reinsert them */ + PTASK_ITEM TaskItem = m_TaskItems; + PTASK_ITEM LastTaskItem = m_TaskItems + m_TaskItemCount; + while (TaskItem != LastTaskItem) + { + TaskItem->IconIndex = -1; + UpdateTaskItemButton(TaskItem); + + TaskItem++; + } + m_TaskBar.SetImageList(m_ImageList); + } if (GetClientRect(&rcClient) && !IsRectEmpty(&rcClient)) { @@ -1286,7 +1302,7 @@ public: return EnumWindows(s_EnumWindowsProc, (LPARAM)this); } - LRESULT OnThemeChanged() + LRESULT OnThemeChanged(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { TRACE("OmThemeChanged\n"); @@ -1301,20 +1317,14 @@ public: return TRUE; } - LRESULT OnThemeChanged(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) - { - return OnThemeChanged(); - } - LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { if (!m_TaskBar.Initialize(m_hWnd)) return FALSE; SetWindowTheme(m_TaskBar.m_hWnd, L"TaskBand", NULL); - OnThemeChanged(); - m_ImageList = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 0, 1000); + m_ImageList = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, 0, 1000); m_TaskBar.SetImageList(m_ImageList); /* Set proper spacing between buttons */ @@ -1371,7 +1381,7 @@ public: return Ret; } - LRESULT HandleShellHookMsg(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) + LRESULT OnShellHook(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { BOOL Ret = FALSE; @@ -1449,14 +1459,6 @@ public: return Ret; } - VOID EnableGrouping(IN BOOL bEnable) - { - m_IsGroupingEnabled = bEnable; - - /* Collapse or expand groups if necessary */ - UpdateButtonsSize(FALSE); - } - VOID HandleTaskItemClick(IN OUT PTASK_ITEM TaskItem) { BOOL bIsMinimized; @@ -1648,16 +1650,6 @@ public: return Ret; } - LRESULT DrawBackground(HDC hdc) - { - RECT rect; - - GetClientRect(&rect); - DrawThemeParentBackground(m_hWnd, hdc, &rect); - - return TRUE; - } - LRESULT OnEraseBackground(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { HDC hdc = (HDC) wParam; @@ -1668,7 +1660,11 @@ public: return 0; } - return DrawBackground(hdc); + RECT rect; + GetClientRect(&rect); + DrawThemeParentBackground(m_hWnd, hdc, &rect); + + return TRUE; } LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) @@ -1724,7 +1720,10 @@ public: LRESULT Ret = m_IsGroupingEnabled; if ((BOOL)wParam != m_IsGroupingEnabled) { - EnableGrouping((BOOL) wParam); + m_IsGroupingEnabled = (BOOL)wParam; + + /* Collapse or expand groups if necessary */ + UpdateButtonsSize(FALSE); } return Ret; } @@ -1833,7 +1832,7 @@ public: MESSAGE_HANDLER(WM_TIMER, OnTimer) MESSAGE_HANDLER(WM_SETFONT, OnSetFont) MESSAGE_HANDLER(WM_SETTINGCHANGE, OnSettingChanged) - MESSAGE_HANDLER(m_ShellHookMsg, HandleShellHookMsg) + MESSAGE_HANDLER(m_ShellHookMsg, OnShellHook) MESSAGE_HANDLER(WM_MOUSEACTIVATE, OnMouseActivate) MESSAGE_HANDLER(WM_KLUDGEMINRECT, OnKludgeItemRect) END_MSG_MAP() diff --git a/reactos/base/shell/explorer/traywnd.cpp b/reactos/base/shell/explorer/traywnd.cpp index d22369d68d6..36a09e5f2cb 100644 --- a/reactos/base/shell/explorer/traywnd.cpp +++ b/reactos/base/shell/explorer/traywnd.cpp @@ -1532,6 +1532,13 @@ ChangePos: Horizontal = IsPosHorizontal(); + IUnknown_Exec(m_TrayBandSite, + IID_IDeskBand, + DBID_BANDINFOCHANGED, + 0, + NULL, + NULL); + /* We're about to resize/move the start button, the rebar control and the tray notification control */ dwp = BeginDeferWindowPos(3); @@ -1546,6 +1553,16 @@ ChangePos: if (StartSize.cx > rcClient.right) StartSize.cx = rcClient.right; + if (!m_Theme) + { + HWND hwndTaskToolbar = ::GetWindow(m_TaskSwitch, GW_CHILD); + if (hwndTaskToolbar) + { + DWORD size = SendMessageW(hwndTaskToolbar, TB_GETBUTTONSIZE, 0, 0); + StartSize.cy = HIWORD(size); + } + } + if (m_StartButton.m_hWnd != NULL) { /* Resize and reposition the button */ @@ -1646,15 +1663,16 @@ ChangePos: void FitToRebar(PRECT pRect) { /* Get the rect of the rebar */ - RECT rebarRect, taskbarRect; + RECT rebarRect, taskbarRect, clientRect; ::GetWindowRect(m_Rebar, &rebarRect); ::GetWindowRect(m_hWnd, &taskbarRect); + ::GetClientRect(m_hWnd, &clientRect); OffsetRect(&rebarRect, -taskbarRect.left, -taskbarRect.top); /* Calculate the difference of size of the taskbar and the rebar */ SIZE margins; - margins.cx = taskbarRect.right - taskbarRect.left - rebarRect.right + rebarRect.left; - margins.cy = taskbarRect.bottom - taskbarRect.top - rebarRect.bottom + rebarRect.top; + margins.cx = taskbarRect.right - taskbarRect.left - clientRect.right + clientRect.left; + margins.cy = taskbarRect.bottom - taskbarRect.top - clientRect.bottom + clientRect.top; /* Calculate the new size of the rebar and make it resize, then change the new taskbar size */ switch (m_Position) diff --git a/reactos/dll/win32/browseui/shellbars/CBandSite.cpp b/reactos/dll/win32/browseui/shellbars/CBandSite.cpp index 04611510114..aaac501a29b 100644 --- a/reactos/dll/win32/browseui/shellbars/CBandSite.cpp +++ b/reactos/dll/win32/browseui/shellbars/CBandSite.cpp @@ -763,7 +763,7 @@ HRESULT STDMETHODCALLTYPE CBandSiteBase::SetDeskBarSite(IUnknown *pUnk) return E_FAIL; style = WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | RBS_VARHEIGHT | RBS_AUTOSIZE | - RBS_BANDBORDERS | CCS_NODIVIDER | CCS_NORESIZE | CCS_NOPARENTALIGN; + RBS_BANDBORDERS | CCS_NODIVIDER | /*CCS_NORESIZE |*/ CCS_NOPARENTALIGN; fRebarWindow = CreateWindowExW(WS_EX_TOOLWINDOW, REBARCLASSNAMEW,