hhctrl.ocx: Resize tab control in Child's WM_SIZE handler.
This commit is contained in:
parent
736ef403a9
commit
c6774f75f5
@ -40,6 +40,9 @@ static LRESULT Help_OnSize(HWND hWnd);
|
|||||||
#define WINTYPE_DEFAULT_HEIGHT 640
|
#define WINTYPE_DEFAULT_HEIGHT 640
|
||||||
#define WINTYPE_DEFAULT_NAVWIDTH 250
|
#define WINTYPE_DEFAULT_NAVWIDTH 250
|
||||||
|
|
||||||
|
#define TAB_TOP_PADDING 8
|
||||||
|
#define TAB_RIGHT_PADDING 4
|
||||||
|
|
||||||
static const WCHAR szEmpty[] = {0};
|
static const WCHAR szEmpty[] = {0};
|
||||||
|
|
||||||
/* Loads a string from the resource file */
|
/* Loads a string from the resource file */
|
||||||
@ -250,7 +253,7 @@ static const WCHAR szChildClass[] = {
|
|||||||
'H','H',' ','C','h','i','l','d',0
|
'H','H',' ','C','h','i','l','d',0
|
||||||
};
|
};
|
||||||
|
|
||||||
static void Child_OnPaint(HWND hWnd)
|
static LRESULT Child_OnPaint(HWND hWnd)
|
||||||
{
|
{
|
||||||
PAINTSTRUCT ps;
|
PAINTSTRUCT ps;
|
||||||
HDC hdc;
|
HDC hdc;
|
||||||
@ -278,6 +281,23 @@ static void Child_OnPaint(HWND hWnd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
EndPaint(hWnd, &ps);
|
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)
|
static LRESULT CALLBACK Child_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
@ -285,8 +305,9 @@ static LRESULT CALLBACK Child_WndProc(HWND hWnd, UINT message, WPARAM wParam, LP
|
|||||||
switch (message)
|
switch (message)
|
||||||
{
|
{
|
||||||
case WM_PAINT:
|
case WM_PAINT:
|
||||||
Child_OnPaint(hWnd);
|
return Child_OnPaint(hWnd);
|
||||||
break;
|
case WM_SIZE:
|
||||||
|
return Child_OnSize(hWnd);
|
||||||
default:
|
default:
|
||||||
return DefWindowProcW(hWnd, message, wParam, lParam);
|
return DefWindowProcW(hWnd, message, wParam, lParam);
|
||||||
}
|
}
|
||||||
@ -470,9 +491,6 @@ static BOOL HH_AddToolbar(HHInfo *pHHInfo)
|
|||||||
|
|
||||||
/* Navigation Pane */
|
/* Navigation Pane */
|
||||||
|
|
||||||
#define TAB_TOP_PADDING 8
|
|
||||||
#define TAB_RIGHT_PADDING 4
|
|
||||||
|
|
||||||
static void NP_GetNavigationRect(HHInfo *pHHInfo, RECT *rc)
|
static void NP_GetNavigationRect(HHInfo *pHHInfo, RECT *rc)
|
||||||
{
|
{
|
||||||
HWND hwndParent = pHHInfo->WinType.hwndHelp;
|
HWND hwndParent = pHHInfo->WinType.hwndHelp;
|
||||||
@ -524,6 +542,8 @@ static BOOL HH_AddNavigationPane(HHInfo *info)
|
|||||||
if (!hWnd)
|
if (!hWnd)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
SetWindowLongPtrW(hWnd, GWLP_USERDATA, (LONG_PTR)info);
|
||||||
|
|
||||||
hwndTabCtrl = CreateWindowExW(dwExStyles, WC_TABCONTROLW, szEmpty, dwStyles,
|
hwndTabCtrl = CreateWindowExW(dwExStyles, WC_TABCONTROLW, szEmpty, dwStyles,
|
||||||
0, TAB_TOP_PADDING,
|
0, TAB_TOP_PADDING,
|
||||||
rc.right - TAB_RIGHT_PADDING,
|
rc.right - TAB_RIGHT_PADDING,
|
||||||
@ -612,11 +632,6 @@ static LRESULT Help_OnSize(HWND hWnd)
|
|||||||
SetWindowPos(pHHInfo->WinType.hwndNavigation, HWND_TOP, 0, 0,
|
SetWindowPos(pHHInfo->WinType.hwndNavigation, HWND_TOP, 0, 0,
|
||||||
rc.right, rc.bottom, SWP_NOMOVE);
|
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);
|
SB_GetSizeBarRect(pHHInfo, &rc);
|
||||||
SetWindowPos(pHHInfo->hwndSizeBar, HWND_TOP, rc.left, rc.top,
|
SetWindowPos(pHHInfo->hwndSizeBar, HWND_TOP, rc.left, rc.top,
|
||||||
rc.right, rc.bottom, SWP_SHOWWINDOW);
|
rc.right, rc.bottom, SWP_SHOWWINDOW);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user