From 6f4977d96fced31eb913368392cb316d294dfa7e Mon Sep 17 00:00:00 2001 From: James Hawkins Date: Wed, 28 Sep 2005 10:16:02 +0000 Subject: [PATCH] - Store the HHInfo struct in the SizeBar hwnd. - Set the default navigation pane width if no width provided. - Handle dragging of the SizeBar. --- dlls/hhctrl.ocx/help.c | 49 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 45 insertions(+), 4 deletions(-) diff --git a/dlls/hhctrl.ocx/help.c b/dlls/hhctrl.ocx/help.c index d8217e72e0f..b60e83d3725 100644 --- a/dlls/hhctrl.ocx/help.c +++ b/dlls/hhctrl.ocx/help.c @@ -34,6 +34,8 @@ #include "chm.h" #include "webbrowser.h" +static void Help_OnSize(HWND hWnd); + /* Window type defaults */ #define WINTYPE_DEFAULT_X 280 @@ -122,10 +124,43 @@ static void SB_OnPaint(HWND hWnd) EndPaint(hWnd, &ps); } +static void SB_OnLButtonDown(HWND hWnd, WPARAM wParam, LPARAM lParam) +{ + SetCapture(hWnd); +} + +static void SB_OnLButtonUp(HWND hWnd, WPARAM wParam, LPARAM lParam) +{ + HHInfo *pHHInfo = (HHInfo *)GetWindowLongPtrW(hWnd, GWLP_USERDATA); + POINTS pt = MAKEPOINTS(lParam); + + /* update the window sizes */ + pHHInfo->pHHWinType->iNavWidth += pt.x; + Help_OnSize(hWnd); + + ReleaseCapture(); +} + +static void SB_OnMouseMove(HWND hWnd, WPARAM wParam, LPARAM lParam) +{ + /* ignore WM_MOUSEMOVE if not dragging the SizeBar */ + if (!(wParam & MK_LBUTTON)) + return; +} + LRESULT CALLBACK SizeBar_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { + case WM_LBUTTONDOWN: + SB_OnLButtonDown(hWnd, wParam, lParam); + break; + case WM_LBUTTONUP: + SB_OnLButtonUp(hWnd, wParam, lParam); + break; + case WM_MOUSEMOVE: + SB_OnMouseMove(hWnd, wParam, lParam); + break; case WM_PAINT: SB_OnPaint(hWnd); break; @@ -186,6 +221,9 @@ static BOOL HH_AddSizeBar(HHInfo *pHHInfo) if (!hWnd) return FALSE; + /* store the pointer to the HH info struct */ + SetWindowLongPtrW(hWnd, GWLP_USERDATA, (LONG_PTR)pHHInfo); + pHHInfo->hwndSizeBar = hWnd; return TRUE; } @@ -437,10 +475,13 @@ static void NP_GetNavigationRect(HHInfo *pHHInfo, RECT *rc) rc->top = rectTB.bottom; rc->bottom = rectWND.bottom - rectTB.bottom; - if (pHHInfo->pHHWinType->fsValidMembers & HHWIN_PARAM_NAV_WIDTH) - rc->right = pHHInfo->pHHWinType->iNavWidth; - else - rc->right = WINTYPE_DEFAULT_NAVWIDTH; + if (!(pHHInfo->pHHWinType->fsValidMembers & HHWIN_PARAM_NAV_WIDTH) && + pHHInfo->pHHWinType->iNavWidth == 0) + { + pHHInfo->pHHWinType->iNavWidth = WINTYPE_DEFAULT_NAVWIDTH; + } + + rc->right = pHHInfo->pHHWinType->iNavWidth; } static void NP_CreateTab(HINSTANCE hInstance, HWND hwndTabCtrl, DWORD dwStrID, DWORD dwIndex)