[EXPLORER]

- Simplify the mess with the font handling in explorer. Make it respond to changes in the system metrics and use the correct fonts.
- Make CheckTrayWndPosition resize the taskbar based on the optimal size that the rebar returns.
- Without losing my sanity (yet), I managed to make it have exactly the same size as windows explorer when I run it in windows with the classic theme.
- Themes still aren't sized perfectly. Running on ros shows lots of bugs in our common controls.

svn path=/trunk/; revision=74221
This commit is contained in:
Giannis Adamopoulos 2017-03-22 01:09:45 +00:00
parent 8f792acdab
commit fafcbebc79
4 changed files with 135 additions and 137 deletions

View file

@ -135,7 +135,6 @@ DECLARE_INTERFACE_(ITrayWindow, IUnknown)
STDMETHOD_(HWND, GetHWND) (THIS) PURE; STDMETHOD_(HWND, GetHWND) (THIS) PURE;
STDMETHOD_(BOOL, IsSpecialHWND) (THIS_ HWND hWnd) PURE; STDMETHOD_(BOOL, IsSpecialHWND) (THIS_ HWND hWnd) PURE;
STDMETHOD_(BOOL, IsHorizontal) (THIS) PURE; STDMETHOD_(BOOL, IsHorizontal) (THIS) PURE;
STDMETHOD_(HFONT, GetCaptionFonts) (THIS_ HFONT *phBoldCaption) PURE;
STDMETHOD_(HWND, DisplayProperties) (THIS) PURE; STDMETHOD_(HWND, DisplayProperties) (THIS) PURE;
STDMETHOD_(BOOL, ExecContextMenuCmd) (THIS_ UINT uiCmd) PURE; STDMETHOD_(BOOL, ExecContextMenuCmd) (THIS_ UINT uiCmd) PURE;
STDMETHOD_(BOOL, Lock) (THIS_ BOOL bLock) PURE; STDMETHOD_(BOOL, Lock) (THIS_ BOOL bLock) PURE;
@ -153,7 +152,6 @@ DECLARE_INTERFACE_(ITrayWindow, IUnknown)
#define ITrayWindow_GetHWND(p) (p)->lpVtbl->GetHWND(p) #define ITrayWindow_GetHWND(p) (p)->lpVtbl->GetHWND(p)
#define ITrayWindow_IsSpecialHWND(p,a) (p)->lpVtbl->IsSpecialHWND(p,a) #define ITrayWindow_IsSpecialHWND(p,a) (p)->lpVtbl->IsSpecialHWND(p,a)
#define ITrayWindow_IsHorizontal(p) (p)->lpVtbl->IsHorizontal(p) #define ITrayWindow_IsHorizontal(p) (p)->lpVtbl->IsHorizontal(p)
#define ITrayWindow_GetCaptionFonts(p,a) (p)->lpVtbl->GetCaptionFonts(p,a)
#define ITrayWindow_DisplayProperties(p) (p)->lpVtbl->DisplayProperties(p) #define ITrayWindow_DisplayProperties(p) (p)->lpVtbl->DisplayProperties(p)
#define ITrayWindow_ExecContextMenuCmd(p,a) (p)->lpVtbl->ExecContextMenuCmd(p,a) #define ITrayWindow_ExecContextMenuCmd(p,a) (p)->lpVtbl->ExecContextMenuCmd(p,a)
#define ITrayWindow_Lock(p,a) (p)->lpVtbl->Lock(p,a) #define ITrayWindow_Lock(p,a) (p)->lpVtbl->Lock(p,a)

View file

@ -241,8 +241,6 @@ public:
} }
virtual ~CTaskSwitchWnd() { } virtual ~CTaskSwitchWnd() { }
VOID TaskSwitchWnd_UpdateButtonsSize(IN BOOL bRedrawDisabled);
INT GetWndTextFromTaskItem(IN PTASK_ITEM TaskItem, LPWSTR szBuf, DWORD cchBuf) INT GetWndTextFromTaskItem(IN PTASK_ITEM TaskItem, LPWSTR szBuf, DWORD cchBuf)
{ {
/* Get the window text without sending a message so we don't hang if an /* Get the window text without sending a message so we don't hang if an
@ -1147,6 +1145,10 @@ public:
LONG NewBtnSize; LONG NewBtnSize;
BOOL Horizontal; BOOL Horizontal;
int cx = GetSystemMetrics(SM_CXMINIMIZED);
int cy = m_ButtonSize.cy = GetSystemMetrics(SM_CYSIZE) + (2 * GetSystemMetrics(SM_CYEDGE));
m_TaskBar.SetButtonSize(cx, cy);
if (GetClientRect(&rcClient) && !IsRectEmpty(&rcClient)) if (GetClientRect(&rcClient) && !IsRectEmpty(&rcClient))
{ {
if (m_ButtonCount > 0) if (m_ButtonCount > 0)
@ -1314,12 +1316,6 @@ public:
m_ImageList = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 0, 1000); m_ImageList = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 0, 1000);
m_TaskBar.SetImageList(m_ImageList); m_TaskBar.SetImageList(m_ImageList);
/* Calculate the default button size. Don't save this in m_ButtonSize.cx so that
the actual button width gets updated correctly on the first recalculation */
int cx = GetSystemMetrics(SM_CXMINIMIZED);
int cy = m_ButtonSize.cy = GetSystemMetrics(SM_CYSIZE) + (2 * GetSystemMetrics(SM_CYEDGE));
m_TaskBar.SetButtonSize(cx, cy);
/* Set proper spacing between buttons */ /* Set proper spacing between buttons */
m_TaskBar.UpdateTbButtonSpacing(m_Tray->IsHorizontal(), m_Theme != NULL); m_TaskBar.UpdateTbButtonSpacing(m_Tray->IsHorizontal(), m_Theme != NULL);
@ -1813,6 +1809,22 @@ public:
return TRUE; return TRUE;
} }
LRESULT OnSetFont(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
return m_TaskBar.SendMessageW(uMsg, wParam, lParam);
}
LRESULT OnSettingChanged(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
if (wParam == SPI_SETNONCLIENTMETRICS)
{
/* Don't update the font, this will be done when we get a WM_SETFONT from our parent */
UpdateButtonsSize(FALSE);
}
return 0;
}
DECLARE_WND_CLASS_EX(szTaskSwitchWndClass, CS_DBLCLKS, COLOR_3DFACE) DECLARE_WND_CLASS_EX(szTaskSwitchWndClass, CS_DBLCLKS, COLOR_3DFACE)
BEGIN_MSG_MAP(CTaskSwitchWnd) BEGIN_MSG_MAP(CTaskSwitchWnd)
@ -1828,6 +1840,8 @@ public:
MESSAGE_HANDLER(TSWM_UPDATETASKBARPOS, OnUpdateTaskbarPos) MESSAGE_HANDLER(TSWM_UPDATETASKBARPOS, OnUpdateTaskbarPos)
MESSAGE_HANDLER(WM_CONTEXTMENU, OnContextMenu) MESSAGE_HANDLER(WM_CONTEXTMENU, OnContextMenu)
MESSAGE_HANDLER(WM_TIMER, OnTimer) MESSAGE_HANDLER(WM_TIMER, OnTimer)
MESSAGE_HANDLER(WM_SETFONT, OnSetFont)
MESSAGE_HANDLER(WM_SETTINGCHANGE, OnSettingChanged)
MESSAGE_HANDLER(m_ShellHookMsg, HandleShellHookMsg) MESSAGE_HANDLER(m_ShellHookMsg, HandleShellHookMsg)
END_MSG_MAP() END_MSG_MAP()

View file

@ -1208,6 +1208,7 @@ public:
MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint) MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint)
MESSAGE_HANDLER(WM_TIMER, OnTimer) MESSAGE_HANDLER(WM_TIMER, OnTimer)
MESSAGE_HANDLER(WM_NCHITTEST, OnNcHitTest) MESSAGE_HANDLER(WM_NCHITTEST, OnNcHitTest)
MESSAGE_HANDLER(WM_SETFONT, OnSetFont)
MESSAGE_HANDLER(TCWM_GETMINIMUMSIZE, OnGetMinimumSize) MESSAGE_HANDLER(TCWM_GETMINIMUMSIZE, OnGetMinimumSize)
MESSAGE_HANDLER(TCWM_UPDATETIME, OnUpdateTime) MESSAGE_HANDLER(TCWM_UPDATETIME, OnUpdateTime)

View file

@ -53,8 +53,6 @@ HRESULT TrayWindowCtxMenuCreator(ITrayWindow * TrayWnd, IN HWND hWndOwner, ICont
#define IDHK_DESKTOP 0x1fe #define IDHK_DESKTOP 0x1fe
#define IDHK_PAGER 0x1ff #define IDHK_PAGER 0x1ff
static LONG TrayWndCount = 0;
static const WCHAR szTrayWndClass[] = L"Shell_TrayWnd"; static const WCHAR szTrayWndClass[] = L"Shell_TrayWnd";
/* /*
@ -88,17 +86,12 @@ public:
DeleteObject(m_Font); DeleteObject(m_Font);
} }
HFONT GetFont()
{
return m_Font;
}
SIZE GetSize() SIZE GetSize()
{ {
return m_Size; return m_Size;
} }
VOID UpdateSize(IN HBITMAP hbmStart = NULL) VOID UpdateSize()
{ {
SIZE Size = { 0, 0 }; SIZE Size = { 0, 0 };
@ -106,27 +99,37 @@ public:
!SendMessageW(BCM_GETIDEALSIZE, 0, (LPARAM) &Size)) !SendMessageW(BCM_GETIDEALSIZE, 0, (LPARAM) &Size))
{ {
Size.cx = 2 * GetSystemMetrics(SM_CXEDGE) + GetSystemMetrics(SM_CYCAPTION) * 3; Size.cx = 2 * GetSystemMetrics(SM_CXEDGE) + GetSystemMetrics(SM_CYCAPTION) * 3;
Size.cy = 2 * GetSystemMetrics(SM_CYEDGE) + GetSystemMetrics(SM_CYCAPTION);
} }
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)));
/* Save the size of the start button */ /* Save the size of the start button */
m_Size = Size; m_Size = Size;
} }
VOID UpdateFont()
{
/* Get the system fonts, we use the caption font, always bold, though. */
NONCLIENTMETRICS ncm = {sizeof(ncm)};
if (!SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, FALSE))
return;
if (m_Font)
DeleteObject(m_Font);
ncm.lfCaptionFont.lfWeight = FW_BOLD;
m_Font = CreateFontIndirect(&ncm.lfCaptionFont);
SetFont(m_Font, FALSE);
}
VOID Initialize() VOID Initialize()
{ {
SetWindowTheme(m_hWnd, L"Start", NULL); SetWindowTheme(m_hWnd, L"Start", NULL);
/* Get the system fonts, we use the caption font, always bold, though. */
NONCLIENTMETRICS ncm = {sizeof(ncm)};
if (SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, FALSE))
{
ncm.lfCaptionFont.lfWeight = FW_BOLD;
m_Font = CreateFontIndirect(&ncm.lfCaptionFont);
}
SetFont(m_Font, FALSE);
m_ImageList = ImageList_LoadImageW(hExplorerInstance, m_ImageList = ImageList_LoadImageW(hExplorerInstance,
MAKEINTRESOURCEW(IDB_START), MAKEINTRESOURCEW(IDB_START),
0, 0, 0, 0, 0, 0,
@ -183,7 +186,6 @@ class CTrayWindow :
HTHEME m_Theme; HTHEME m_Theme;
HFONT m_CaptionFont;
HFONT m_Font; HFONT m_Font;
HWND m_DesktopWnd; HWND m_DesktopWnd;
@ -236,7 +238,6 @@ public:
CTrayWindow() : CTrayWindow() :
m_StartButton(), m_StartButton(),
m_Theme(NULL), m_Theme(NULL),
m_CaptionFont(NULL),
m_Font(NULL), m_Font(NULL),
m_DesktopWnd(NULL), m_DesktopWnd(NULL),
m_Rebar(NULL), m_Rebar(NULL),
@ -267,12 +268,6 @@ public:
m_ShellServices = NULL; m_ShellServices = NULL;
} }
if (m_CaptionFont != NULL)
{
DeleteObject(m_CaptionFont);
m_CaptionFont = NULL;
}
if (m_Font != NULL) if (m_Font != NULL)
{ {
DeleteObject(m_Font); DeleteObject(m_Font);
@ -285,7 +280,6 @@ public:
m_Theme = NULL; m_Theme = NULL;
} }
if (InterlockedDecrement(&TrayWndCount) == 0)
PostQuitMessage(0); PostQuitMessage(0);
} }
@ -734,29 +728,32 @@ public:
* ##### moving and sizing handling ##### * ##### moving and sizing handling #####
*/ */
BOOL UpdateNonClientMetrics() void UpdateFonts()
{ {
NONCLIENTMETRICS ncm; m_StartButton.UpdateFont();
ncm.cbSize = sizeof(ncm);
if (SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, 0)) NONCLIENTMETRICS ncm = {sizeof(ncm)};
if (!SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, FALSE))
{ {
ERR("SPI_GETNONCLIENTMETRICS failed\n");
return;
}
if (m_Font != NULL) if (m_Font != NULL)
DeleteObject(m_Font); DeleteObject(m_Font);
m_Font = CreateFontIndirect(&ncm.lfMessageFont); ncm.lfCaptionFont.lfWeight = FW_NORMAL;
return TRUE; m_Font = CreateFontIndirect(&ncm.lfCaptionFont);
if (!m_Font)
{
ERR("CreateFontIndirect failed\n");
return;
} }
return FALSE; SendMessage(m_Rebar, WM_SETFONT, (WPARAM) m_Font, TRUE);
} SendMessage(m_TaskSwitch, WM_SETFONT, (WPARAM) m_Font, TRUE);
VOID SetWindowsFont()
{
if (m_TrayNotify != NULL)
{
SendMessage(m_TrayNotify, WM_SETFONT, (WPARAM) m_Font, TRUE); SendMessage(m_TrayNotify, WM_SETFONT, (WPARAM) m_Font, TRUE);
} }
}
HMONITOR GetScreenRectFromRect( HMONITOR GetScreenRectFromRect(
IN OUT RECT *pRect, IN OUT RECT *pRect,
@ -1318,6 +1315,16 @@ ChangePos:
rcTray.bottom += m_AutoHideOffset.cy; rcTray.bottom += m_AutoHideOffset.cy;
} }
IUnknown_Exec(m_TrayBandSite,
IID_IDeskBand,
DBID_BANDINFOCHANGED,
0,
NULL,
NULL);
FitToRebar(&rcTray);
m_TrayRects[m_Position] = rcTray;
/* Move the tray window */ /* Move the tray window */
SetWindowPos(NULL, SetWindowPos(NULL,
rcTray.left, rcTray.left,
@ -1607,6 +1614,42 @@ ChangePos:
} }
} }
void FitToRebar(PRECT pRect)
{
/* Get the rect of the rebar */
RECT rebarRect, taskbarRect;
::GetWindowRect(m_Rebar, &rebarRect);
::GetWindowRect(m_hWnd, &taskbarRect);
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;
/* Calculate the new size of the rebar and make it resize, then change the new taskbar size */
switch (m_Position)
{
case ABE_TOP:
rebarRect.bottom = rebarRect.top + pRect->bottom - pRect->top - margins.cy;
::SendMessageW(m_Rebar, RB_SIZETORECT, RBSTR_CHANGERECT, (LPARAM)&rebarRect);
pRect->bottom = pRect->top + rebarRect.bottom - rebarRect.top + margins.cy;
break;
case ABE_BOTTOM:
rebarRect.top = rebarRect.bottom - (pRect->bottom - pRect->top - margins.cy);
::SendMessageW(m_Rebar, RB_SIZETORECT, RBSTR_CHANGERECT, (LPARAM)&rebarRect);
ERR("rebarRect: %d, %d, %d,%d\n", rebarRect.top, rebarRect.left, rebarRect.right, rebarRect.bottom);
pRect->top = pRect->bottom - (rebarRect.bottom - rebarRect.top + margins.cy);
break;
case ABE_LEFT:
case ABE_RIGHT:
/* FIXME: what to do here? */
break;
}
CalculateValidSize(m_Position, pRect);
}
void PopupStartMenu() void PopupStartMenu()
{ {
if (m_StartMenuPopup != NULL) if (m_StartMenuPopup != NULL)
@ -1917,13 +1960,6 @@ ChangePos:
If it was somehow destroyed just create a new tray window. */ If it was somehow destroyed just create a new tray window. */
if (m_hWnd != NULL && IsWindow()) if (m_hWnd != NULL && IsWindow())
{ {
if (!IsWindowVisible())
{
CheckTrayWndPosition();
ShowWindow(SW_SHOW);
}
return S_OK; return S_OK;
} }
@ -1944,6 +1980,12 @@ ChangePos:
if (!Create(NULL, rcWnd, NULL, dwStyle, dwExStyle)) if (!Create(NULL, rcWnd, NULL, dwStyle, dwExStyle))
return E_FAIL; return E_FAIL;
/* Align all controls on the tray window */
AlignControls(NULL);
/* Move the tray window to the right position and resize it if necessary */
CheckTrayWndPosition();
return S_OK; return S_OK;
} }
@ -1976,14 +2018,6 @@ ChangePos:
return IsPosHorizontal(); return IsPosHorizontal();
} }
HFONT STDMETHODCALLTYPE GetCaptionFonts(OUT HFONT *phBoldCaption OPTIONAL)
{
if (phBoldCaption != NULL)
*phBoldCaption = m_StartButton.GetFont();
return m_CaptionFont;
}
BOOL STDMETHODCALLTYPE Lock(IN BOOL bLock) BOOL STDMETHODCALLTYPE Lock(IN BOOL bLock)
{ {
BOOL bPrevLock = Locked; BOOL bPrevLock = Locked;
@ -2027,6 +2061,8 @@ ChangePos:
} }
} }
SetWindowPos(NULL, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOOWNERZORDER); SetWindowPos(NULL, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOOWNERZORDER);
ResizeWorkArea();
ApplyClipping(TRUE);
} }
return bPrevLock; return bPrevLock;
@ -2047,25 +2083,6 @@ ChangePos:
SetWindowTheme(m_hWnd, L"TaskBar", NULL); SetWindowTheme(m_hWnd, L"TaskBar", NULL);
InterlockedIncrement(&TrayWndCount);
if (m_CaptionFont == NULL)
{
NONCLIENTMETRICS ncm;
/* Get the system fonts, we use the caption font,
always bold, though. */
ncm.cbSize = sizeof(ncm);
if (SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, FALSE))
{
if (m_CaptionFont == NULL)
{
ncm.lfCaptionFont.lfWeight = FW_NORMAL;
m_CaptionFont = CreateFontIndirect(&ncm.lfCaptionFont);
}
}
}
/* Create the Start button */ /* Create the Start button */
m_StartButton.Create(m_hWnd); m_StartButton.Create(m_hWnd);
@ -2076,23 +2093,14 @@ ChangePos:
HBITMAP hbmBanner = LoadBitmapW(hExplorerInstance, MAKEINTRESOURCEW(IDB_STARTMENU)); HBITMAP hbmBanner = LoadBitmapW(hExplorerInstance, MAKEINTRESOURCEW(IDB_STARTMENU));
m_StartMenuPopup = CreateStartMenu(this, &m_StartMenuBand, hbmBanner, 0); m_StartMenuPopup = CreateStartMenu(this, &m_StartMenuBand, hbmBanner, 0);
/* Load the tray band site */ /* Create the tray band site and its rebar */
m_TrayBandSite = CreateTrayBandSite(this, &m_Rebar, &m_TaskSwitch); m_TrayBandSite = CreateTrayBandSite(this, &m_Rebar, &m_TaskSwitch);
SetWindowTheme(m_Rebar, L"TaskBar", NULL); SetWindowTheme(m_Rebar, L"TaskBar", NULL);
/* Create the tray notification window */ /* Create the tray notification window */
m_TrayNotify = CreateTrayNotifyWnd(this, HideClock, &m_TrayNotifyInstance); m_TrayNotify = CreateTrayNotifyWnd(this, HideClock, &m_TrayNotifyInstance);
if (UpdateNonClientMetrics()) UpdateFonts();
{
SetWindowsFont();
}
/* Move the tray window to the right position and resize it if necessary */
CheckTrayWndPosition();
/* Align all controls on the tray window */
AlignControls(NULL);
InitShellServices(&m_ShellServices); InitShellServices(&m_ShellServices);
@ -2141,6 +2149,19 @@ ChangePos:
return TRUE; return TRUE;
} }
LRESULT OnSettingChanged(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
if (wParam == SPI_SETNONCLIENTMETRICS)
{
SendMessage(m_TaskSwitch, uMsg, wParam, lParam);
UpdateFonts();
AlignControls(NULL);
CheckTrayWndPosition();
}
return 0;
}
LRESULT OnEraseBackground(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) LRESULT OnEraseBackground(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{ {
HDC hdc = (HDC) wParam; HDC hdc = (HDC) wParam;
@ -2156,15 +2177,9 @@ ChangePos:
LRESULT OnDisplayChange(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) LRESULT OnDisplayChange(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{ {
/* Load the saved tray window settings */
RegLoadSettings();
/* Move the tray window to the right position and resize it if necessary */ /* Move the tray window to the right position and resize it if necessary */
CheckTrayWndPosition(); CheckTrayWndPosition();
/* Align all controls on the tray window */
AlignControls(NULL);
return TRUE; return TRUE;
} }
@ -2285,37 +2300,7 @@ ChangePos:
if (!Locked) if (!Locked)
{ {
/* Get the rect of the rebar */ FitToRebar(pRect);
RECT rebarRect, taskbarRect;
::GetWindowRect(m_Rebar, &rebarRect);
::GetWindowRect(m_hWnd, &taskbarRect);
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;
/* Calculate the new size of the rebar and make it resize, then change the new taskbar size */
switch (m_Position)
{
case ABE_TOP:
rebarRect.bottom = rebarRect.top + pRect->bottom - pRect->top - margins.cy;
::SendMessageW(m_Rebar, RB_SIZETORECT, RBSTR_CHANGERECT, (LPARAM)&rebarRect);
pRect->bottom = pRect->top + rebarRect.bottom - rebarRect.top + margins.cy;
break;
case ABE_BOTTOM:
rebarRect.top = rebarRect.bottom - (pRect->bottom - pRect->top - margins.cy);
::SendMessageW(m_Rebar, RB_SIZETORECT, RBSTR_CHANGERECT, (LPARAM)&rebarRect);
pRect->top = pRect->bottom - (rebarRect.bottom - rebarRect.top + margins.cy);
break;
case ABE_LEFT:
case ABE_RIGHT:
/* FIXME: what to do here? */
break;
}
CalculateValidSize(m_Position, pRect);
} }
else else
{ {
@ -2341,7 +2326,6 @@ ChangePos:
LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{ {
RECT rcClient; RECT rcClient;
InvalidateRect(NULL, TRUE);
if (wParam == SIZE_RESTORED && lParam == 0) if (wParam == SIZE_RESTORED && lParam == 0)
{ {
ResizeWorkArea(); ResizeWorkArea();
@ -2782,6 +2766,7 @@ HandleTrayContextMenu:
lParam = Msg.lParam; lParam = Msg.lParam;
} }
MESSAGE_HANDLER(WM_THEMECHANGED, OnThemeChanged) MESSAGE_HANDLER(WM_THEMECHANGED, OnThemeChanged)
MESSAGE_HANDLER(WM_SETTINGCHANGE, OnSettingChanged)
NOTIFY_CODE_HANDLER(RBN_AUTOSIZE, OnRebarAutoSize) // Doesn't quite work ;P NOTIFY_CODE_HANDLER(RBN_AUTOSIZE, OnRebarAutoSize) // Doesn't quite work ;P
MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground) MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground)
MESSAGE_HANDLER(WM_SIZE, OnSize) MESSAGE_HANDLER(WM_SIZE, OnSize)