if (m_hWnd != NULL)
{
+ HWND hwndToolbar = ::GetWindow(m_hWnd, GW_CHILD);
+
/* The task band never has a title */
pdbi->dwMask &= ~DBIM_TITLE;
}
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 */
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))
{
return EnumWindows(s_EnumWindowsProc, (LPARAM)this);
}
- LRESULT OnThemeChanged()
+ LRESULT OnThemeChanged(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
TRACE("OmThemeChanged\n");
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 */
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;
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;
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;
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)
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;
}
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()
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);
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 */
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)