Author: gadamopoulos
Date: Fri Jul 21 14:32:15 2017
New Revision: 75385
URL:
http://svn.reactos.org/svn/reactos?rev=75385&view=rev
Log:
[BROWSEUI]
-CBandSite: Remove CCS_NORESIZE style. This is a hack probably needed because our rebar
control is buggy.
[EXPLORER]
-CTaskBand::GetBandInfo: Use the toolbar button size as the minimum and integral size for
the band.
-CTaskSwitchWnd: Use the system small icon size for the size of the icon. Recreate the
image list if this size changes. This together with the size of the font are the only
factors for the size of the toolbar and consequently for the size of the band and if it is
the only band, the size of the taskbar. Don't use TB_SETBUTTONSIZE. Now the size of
the image list and the font dictate the size.
-CTrayWindow: In the classic theme make the start button have the same height with the
tasks toolbar button height. Improve the calculation of the size of the taskbar in
FitToRebar.
These changes should make the taskbar and the toolbar have a proper size. On top of that
the taskbar is finally resizable (however our rebar is too buggy and still fills only the
first line in the taskbar). While testing this I noticed that moving the taskbar in the
sides of the screen is buggy now. I'm not sure if this was uncovered by these changes,
if this was broken before or this was caused by these changes (looks unlikely to me) but
will be fixed in subsequent commits).
Modified:
trunk/reactos/base/shell/explorer/taskband.cpp
trunk/reactos/base/shell/explorer/taskswnd.cpp
trunk/reactos/base/shell/explorer/traywnd.cpp
trunk/reactos/dll/win32/browseui/shellbars/CBandSite.cpp
Modified: trunk/reactos/base/shell/explorer/taskband.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/taskba…
==============================================================================
--- trunk/reactos/base/shell/explorer/taskband.cpp [iso-8859-1] (original)
+++ trunk/reactos/base/shell/explorer/taskband.cpp [iso-8859-1] Fri Jul 21 14:32:15 2017
@@ -104,6 +104,8 @@
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 @@
}
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 */
Modified: trunk/reactos/base/shell/explorer/taskswnd.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/tasksw…
==============================================================================
--- trunk/reactos/base/shell/explorer/taskswnd.cpp [iso-8859-1] (original)
+++ trunk/reactos/base/shell/explorer/taskswnd.cpp [iso-8859-1] Fri Jul 21 14:32:15 2017
@@ -1142,9 +1142,25 @@
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 @@
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 @@
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 @@
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;
@@ -1447,14 +1457,6 @@
}
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)
@@ -1648,27 +1650,21 @@
return Ret;
}
- LRESULT DrawBackground(HDC hdc)
- {
+ LRESULT OnEraseBackground(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL&
bHandled)
+ {
+ HDC hdc = (HDC) wParam;
+
+ if (!IsAppThemed())
+ {
+ bHandled = FALSE;
+ return 0;
+ }
+
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;
-
- if (!IsAppThemed())
- {
- bHandled = FALSE;
- return 0;
- }
-
- return DrawBackground(hdc);
}
LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
@@ -1724,7 +1720,10 @@
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 @@
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()
Modified: trunk/reactos/base/shell/explorer/traywnd.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/traywn…
==============================================================================
--- trunk/reactos/base/shell/explorer/traywnd.cpp [iso-8859-1] (original)
+++ trunk/reactos/base/shell/explorer/traywnd.cpp [iso-8859-1] Fri Jul 21 14:32:15 2017
@@ -1532,6 +1532,13 @@
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);
@@ -1545,6 +1552,16 @@
StartSize = m_StartButton.GetSize();
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)
{
@@ -1646,15 +1663,16 @@
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)
Modified: trunk/reactos/dll/win32/browseui/shellbars/CBandSite.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/shellba…
==============================================================================
--- trunk/reactos/dll/win32/browseui/shellbars/CBandSite.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/browseui/shellbars/CBandSite.cpp [iso-8859-1] Fri Jul 21
14:32:15 2017
@@ -763,7 +763,7 @@
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,