- Store the HHInfo struct in the SizeBar hwnd.
- Set the default navigation pane width if no width provided.
- Handle dragging of the SizeBar.
diff --git a/dlls/hhctrl.ocx/help.c b/dlls/hhctrl.ocx/help.c
index d8217e7..b60e83d 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 @@
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 @@
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 @@
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)