mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 18:15:11 +00:00
[EXPLORER]: Fix most problems with the size of the taskbar. (Most problems when run in windows. Running on ros still isn't perfect.)
- CTaskSwitchWnd: Use the height of the start button as minimum height in horizontal mode. - CTrayClockWnd: Actually process WM_THEMECHANGED message. - CTaskSwitchWnd: Use SM_CYSIZE as the height of the buttons of the toolbar. - CStartButton: Simplify calculating the minimum size of the button. - CTrayWindow: Don't use IsThemeActive. Checking if OpenThemeData returned non null is enough. svn path=/trunk/; revision=74231
This commit is contained in:
parent
fec280223d
commit
3092ec5137
5 changed files with 24 additions and 23 deletions
|
@ -233,7 +233,7 @@ ShowCustomizeNotifyIcons(HINSTANCE, HWND);
|
|||
*/
|
||||
|
||||
extern const GUID CLSID_ITaskBand; /* Internal Task Band CLSID */
|
||||
HRESULT CTaskBand_CreateInstance(IN ITrayWindow *Tray, REFIID riid, void **ppv);
|
||||
HRESULT CTaskBand_CreateInstance(IN ITrayWindow *Tray, HWND hWndStartButton, REFIID riid, void **ppv);
|
||||
|
||||
/*
|
||||
* tbsite.cpp
|
||||
|
|
|
@ -40,6 +40,7 @@ class CTaskBand :
|
|||
CComPtr<IUnknown> m_Site;
|
||||
|
||||
HWND m_hWnd;
|
||||
HWND m_hWndStartButton;
|
||||
DWORD m_BandID;
|
||||
|
||||
public:
|
||||
|
@ -124,7 +125,10 @@ public:
|
|||
}
|
||||
else
|
||||
{
|
||||
pdbi->ptMinSize.y = GetSystemMetrics(SM_CYSIZE) + (2 * GetSystemMetrics(SM_CYEDGE)); /* FIXME: Query */
|
||||
/* 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;
|
||||
|
@ -327,10 +331,11 @@ public:
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
HRESULT STDMETHODCALLTYPE Initialize(IN OUT ITrayWindow *tray)
|
||||
HRESULT STDMETHODCALLTYPE Initialize(IN OUT ITrayWindow *tray, HWND hWndStartButton)
|
||||
{
|
||||
m_Tray = tray;
|
||||
m_BandID = (DWORD) -1;
|
||||
m_hWndStartButton = hWndStartButton;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -348,7 +353,7 @@ public:
|
|||
END_COM_MAP()
|
||||
};
|
||||
|
||||
HRESULT CTaskBand_CreateInstance(IN ITrayWindow *Tray, REFIID riid, void **ppv)
|
||||
HRESULT CTaskBand_CreateInstance(IN ITrayWindow *Tray, HWND hWndStartButton, REFIID riid, void **ppv)
|
||||
{
|
||||
return ShellObjectCreatorInit<CTaskBand>(Tray, riid, ppv);
|
||||
return ShellObjectCreatorInit<CTaskBand>(Tray, hWndStartButton, riid, ppv);
|
||||
}
|
||||
|
|
|
@ -1146,7 +1146,7 @@ public:
|
|||
BOOL Horizontal;
|
||||
|
||||
int cx = GetSystemMetrics(SM_CXMINIMIZED);
|
||||
int cy = m_ButtonSize.cy = GetSystemMetrics(SM_CYSIZE) + (2 * GetSystemMetrics(SM_CYEDGE));
|
||||
int cy = m_ButtonSize.cy = GetSystemMetrics(SM_CYSIZE);
|
||||
m_TaskBar.SetButtonSize(cx, cy);
|
||||
|
||||
if (GetClientRect(&rcClient) && !IsRectEmpty(&rcClient))
|
||||
|
|
|
@ -1206,6 +1206,7 @@ public:
|
|||
MESSAGE_HANDLER(WM_SIZE, OnSize)
|
||||
MESSAGE_HANDLER(WM_PAINT, OnPaint)
|
||||
MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint)
|
||||
MESSAGE_HANDLER(WM_THEMECHANGED, OnThemeChanged)
|
||||
MESSAGE_HANDLER(WM_TIMER, OnTimer)
|
||||
MESSAGE_HANDLER(WM_NCHITTEST, OnNcHitTest)
|
||||
MESSAGE_HANDLER(WM_SETFONT, OnSetFont)
|
||||
|
@ -1229,10 +1230,7 @@ public:
|
|||
Create(hWndParent, 0, NULL, dwStyle);
|
||||
|
||||
if (m_hWnd != NULL)
|
||||
{
|
||||
SetWindowTheme(m_hWnd, L"TrayNotify", NULL);
|
||||
OnThemeChanged();
|
||||
}
|
||||
|
||||
return m_hWnd;
|
||||
|
||||
|
|
|
@ -101,10 +101,7 @@ public:
|
|||
Size.cx = 2 * GetSystemMetrics(SM_CXEDGE) + GetSystemMetrics(SM_CYCAPTION) * 3;
|
||||
}
|
||||
|
||||
if (GetWindowTheme(m_hWnd))
|
||||
Size.cy = max(Size.cy, GetSystemMetrics(SM_CYCAPTION));
|
||||
else
|
||||
Size.cy = max(Size.cy, GetSystemMetrics(SM_CYSIZE) + (2 * GetSystemMetrics(SM_CYEDGE)));
|
||||
Size.cy = max(Size.cy, GetSystemMetrics(SM_CYCAPTION));
|
||||
|
||||
/* Save the size of the start button */
|
||||
m_Size = Size;
|
||||
|
@ -732,6 +729,10 @@ public:
|
|||
|
||||
void UpdateFonts()
|
||||
{
|
||||
/* There is nothing to do if themes are not enabled */
|
||||
if (m_Theme)
|
||||
return;
|
||||
|
||||
m_StartButton.UpdateFont();
|
||||
|
||||
NONCLIENTMETRICS ncm = {sizeof(ncm)};
|
||||
|
@ -902,7 +903,7 @@ GetPrimaryRect:
|
|||
|
||||
*pRect = *pScreen;
|
||||
|
||||
if(!IsThemeActive())
|
||||
if(!m_Theme)
|
||||
{
|
||||
/* Move the border outside of the screen */
|
||||
InflateRect(pRect,
|
||||
|
@ -1407,7 +1408,7 @@ ChangePos:
|
|||
entire window size, not just the client size. However, we
|
||||
use a thinner border than a standard thick border, so that
|
||||
the start button and bands are not stuck to the screen border. */
|
||||
if(!IsThemeActive())
|
||||
if(!m_Theme)
|
||||
{
|
||||
sr.Size.cx = StartBtnSize.cx + (2 * (EdgeSize.cx + DlgFrameSize.cx));
|
||||
sr.Size.cy = StartBtnSize.cy + (2 * (EdgeSize.cy + DlgFrameSize.cy));
|
||||
|
@ -1445,7 +1446,7 @@ ChangePos:
|
|||
loaded from the registry are at least. The windows explorer behaves
|
||||
the same way, it allows the user to save a zero width vertical tray
|
||||
window, but not a zero height horizontal tray window. */
|
||||
if(!IsThemeActive())
|
||||
if(!m_Theme)
|
||||
{
|
||||
WndSize.cx = 2 * (EdgeSize.cx + DlgFrameSize.cx);
|
||||
WndSize.cy = StartBtnSize.cy + (2 * (EdgeSize.cy + DlgFrameSize.cy));
|
||||
|
@ -1970,7 +1971,7 @@ ChangePos:
|
|||
dwExStyle |= WS_EX_TOPMOST;
|
||||
|
||||
DWORD dwStyle = WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN;
|
||||
if(!IsThemeActive())
|
||||
if(!m_Theme)
|
||||
{
|
||||
dwStyle |= WS_THICKFRAME | WS_BORDER;
|
||||
}
|
||||
|
@ -2098,7 +2099,7 @@ ChangePos:
|
|||
m_StartMenuPopup = CreateStartMenu(this, &m_StartMenuBand, hbmBanner, 0);
|
||||
|
||||
/* Create the task band */
|
||||
hRet = CTaskBand_CreateInstance(this, IID_PPV_ARG(IDeskBand, &m_TaskBand));
|
||||
hRet = CTaskBand_CreateInstance(this, m_StartButton.m_hWnd, IID_PPV_ARG(IDeskBand, &m_TaskBand));
|
||||
if (FAILED_UNEXPECTEDLY(hRet))
|
||||
return FALSE;
|
||||
|
||||
|
@ -2153,10 +2154,7 @@ ChangePos:
|
|||
if (m_Theme)
|
||||
CloseThemeData(m_Theme);
|
||||
|
||||
if (IsThemeActive())
|
||||
m_Theme = OpenThemeData(m_hWnd, L"TaskBar");
|
||||
else
|
||||
m_Theme = NULL;
|
||||
m_Theme = OpenThemeData(m_hWnd, L"TaskBar");
|
||||
|
||||
if (m_Theme)
|
||||
{
|
||||
|
@ -2690,7 +2688,7 @@ HandleTrayContextMenu:
|
|||
{
|
||||
RECT *rc = NULL;
|
||||
/* Ignore WM_NCCALCSIZE if we are not themed or locked */
|
||||
if(!IsThemeActive() || Locked)
|
||||
if(!m_Theme || Locked)
|
||||
{
|
||||
bHandled = FALSE;
|
||||
return 0;
|
||||
|
|
Loading…
Reference in a new issue