hhctrl.ocx: Resize tab control in Child's WM_SIZE handler.

This commit is contained in:
Jacek Caban 2007-02-28 03:56:33 +01:00 committed by Alexandre Julliard
parent 736ef403a9
commit c6774f75f5
1 changed files with 29 additions and 14 deletions

View File

@ -40,6 +40,9 @@ static LRESULT Help_OnSize(HWND hWnd);
#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 @@ static const WCHAR szChildClass[] = {
'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 @@ static void Child_OnPaint(HWND hWnd)
}
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 @@ static BOOL HH_AddToolbar(HHInfo *pHHInfo)
/* 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 @@ static BOOL HH_AddNavigationPane(HHInfo *info)
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 @@ static LRESULT Help_OnSize(HWND hWnd)
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);