hhctrl.ocx: Resize tab control in Child's WM_SIZE handler.
diff --git a/dlls/hhctrl.ocx/help.c b/dlls/hhctrl.ocx/help.c
index baedf88..c47f6dd 100644
--- a/dlls/hhctrl.ocx/help.c
+++ b/dlls/hhctrl.ocx/help.c
@@ -40,6 +40,9 @@
#define WINTYPE_DEFAULT_HEIGHT 640
#define WINTYPE_DEFAULT_NAVWIDTH 250
+#define TAB_TOP_PADDING 8
+#define TAB_RIGHT_PADDING 4
+
static const WCHAR szEmpty[] = {0};
/* Loads a string from the resource file */
@@ -250,7 +253,7 @@
'H','H',' ','C','h','i','l','d',0
};
-static void Child_OnPaint(HWND hWnd)
+static LRESULT Child_OnPaint(HWND hWnd)
{
PAINTSTRUCT ps;
HDC hdc;
@@ -278,17 +281,35 @@
}
EndPaint(hWnd, &ps);
+
+ return 0;
+}
+
+static LRESULT Child_OnSize(HWND hwnd)
+{
+ HHInfo *info = (HHInfo*)GetWindowLongPtrW(hwnd, GWLP_USERDATA);
+ RECT rect;
+
+ if(!info || hwnd != info->WinType.hwndNavigation)
+ return 0;
+
+ GetClientRect(hwnd, &rect);
+ SetWindowPos(info->hwndTabCtrl, HWND_TOP, 0, 0,
+ rect.right - TAB_RIGHT_PADDING,
+ rect.bottom - TAB_TOP_PADDING, SWP_NOMOVE);
+ return 0;
}
static LRESULT CALLBACK Child_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
- case WM_PAINT:
- Child_OnPaint(hWnd);
- break;
- default:
- return DefWindowProcW(hWnd, message, wParam, lParam);
+ case WM_PAINT:
+ return Child_OnPaint(hWnd);
+ case WM_SIZE:
+ return Child_OnSize(hWnd);
+ default:
+ return DefWindowProcW(hWnd, message, wParam, lParam);
}
return 0;
@@ -470,9 +491,6 @@
/* Navigation Pane */
-#define TAB_TOP_PADDING 8
-#define TAB_RIGHT_PADDING 4
-
static void NP_GetNavigationRect(HHInfo *pHHInfo, RECT *rc)
{
HWND hwndParent = pHHInfo->WinType.hwndHelp;
@@ -524,6 +542,8 @@
if (!hWnd)
return FALSE;
+ SetWindowLongPtrW(hWnd, GWLP_USERDATA, (LONG_PTR)info);
+
hwndTabCtrl = CreateWindowExW(dwExStyles, WC_TABCONTROLW, szEmpty, dwStyles,
0, TAB_TOP_PADDING,
rc.right - TAB_RIGHT_PADDING,
@@ -612,11 +632,6 @@
SetWindowPos(pHHInfo->WinType.hwndNavigation, HWND_TOP, 0, 0,
rc.right, rc.bottom, SWP_NOMOVE);
- GetClientRect(pHHInfo->WinType.hwndNavigation, &rc);
- SetWindowPos(pHHInfo->hwndTabCtrl, HWND_TOP, 0, 0,
- rc.right - TAB_RIGHT_PADDING,
- rc.bottom - TAB_TOP_PADDING, SWP_NOMOVE);
-
SB_GetSizeBarRect(pHHInfo, &rc);
SetWindowPos(pHHInfo->hwndSizeBar, HWND_TOP, rc.left, rc.top,
rc.right, rc.bottom, SWP_SHOWWINDOW);