Commit 6f4977d9 authored by James Hawkins's avatar James Hawkins Committed by Alexandre Julliard

- Store the HHInfo struct in the SizeBar hwnd.

- Set the default navigation pane width if no width provided. - Handle dragging of the SizeBar.
parent ba096924
...@@ -34,6 +34,8 @@ ...@@ -34,6 +34,8 @@
#include "chm.h" #include "chm.h"
#include "webbrowser.h" #include "webbrowser.h"
static void Help_OnSize(HWND hWnd);
/* Window type defaults */ /* Window type defaults */
#define WINTYPE_DEFAULT_X 280 #define WINTYPE_DEFAULT_X 280
...@@ -122,10 +124,43 @@ static void SB_OnPaint(HWND hWnd) ...@@ -122,10 +124,43 @@ static void SB_OnPaint(HWND hWnd)
EndPaint(hWnd, &ps); 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) LRESULT CALLBACK SizeBar_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{ {
switch (message) 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: case WM_PAINT:
SB_OnPaint(hWnd); SB_OnPaint(hWnd);
break; break;
...@@ -186,6 +221,9 @@ static BOOL HH_AddSizeBar(HHInfo *pHHInfo) ...@@ -186,6 +221,9 @@ static BOOL HH_AddSizeBar(HHInfo *pHHInfo)
if (!hWnd) if (!hWnd)
return FALSE; return FALSE;
/* store the pointer to the HH info struct */
SetWindowLongPtrW(hWnd, GWLP_USERDATA, (LONG_PTR)pHHInfo);
pHHInfo->hwndSizeBar = hWnd; pHHInfo->hwndSizeBar = hWnd;
return TRUE; return TRUE;
} }
...@@ -437,10 +475,13 @@ static void NP_GetNavigationRect(HHInfo *pHHInfo, RECT *rc) ...@@ -437,10 +475,13 @@ static void NP_GetNavigationRect(HHInfo *pHHInfo, RECT *rc)
rc->top = rectTB.bottom; rc->top = rectTB.bottom;
rc->bottom = rectWND.bottom - rectTB.bottom; rc->bottom = rectWND.bottom - rectTB.bottom;
if (pHHInfo->pHHWinType->fsValidMembers & HHWIN_PARAM_NAV_WIDTH) if (!(pHHInfo->pHHWinType->fsValidMembers & HHWIN_PARAM_NAV_WIDTH) &&
rc->right = pHHInfo->pHHWinType->iNavWidth; pHHInfo->pHHWinType->iNavWidth == 0)
else {
rc->right = WINTYPE_DEFAULT_NAVWIDTH; pHHInfo->pHHWinType->iNavWidth = WINTYPE_DEFAULT_NAVWIDTH;
}
rc->right = pHHInfo->pHHWinType->iNavWidth;
} }
static void NP_CreateTab(HINSTANCE hInstance, HWND hwndTabCtrl, DWORD dwStrID, DWORD dwIndex) static void NP_CreateTab(HINSTANCE hInstance, HWND hwndTabCtrl, DWORD dwStrID, DWORD dwIndex)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment