mirror of
https://github.com/reactos/reactos.git
synced 2025-06-06 01:40:36 +00:00
implemented NtUserDrawCaptionTemp (doesn't support all flags yet but enough to get the desk.cpl working)
svn path=/trunk/; revision=26378
This commit is contained in:
parent
ee9ffb6236
commit
da377e0f0b
4 changed files with 97 additions and 61 deletions
|
@ -1116,7 +1116,9 @@ DrawCaptionTempW(
|
||||||
UINT uFlags
|
UINT uFlags
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return NtUserDrawCaptionTemp(hWnd, hDC, rect, hFont, hIcon, str, uFlags);
|
UNICODE_STRING Text = {0};
|
||||||
|
RtlInitUnicodeString(&Text, str);
|
||||||
|
return NtUserDrawCaptionTemp(hWnd, hDC, rect, hFont, hIcon, &Text, uFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -721,10 +721,10 @@ STDCALL
|
||||||
NtUserDrawCaptionTemp(
|
NtUserDrawCaptionTemp(
|
||||||
HWND hWnd,
|
HWND hWnd,
|
||||||
HDC hDC,
|
HDC hDC,
|
||||||
const RECT *rect,
|
LPCRECT lpRc,
|
||||||
HFONT hFont,
|
HFONT hFont,
|
||||||
HICON hIcon,
|
HICON hIcon,
|
||||||
LPCWSTR str,
|
const PUNICODE_STRING str,
|
||||||
UINT uFlags);
|
UINT uFlags);
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
|
|
|
@ -180,21 +180,6 @@ NtUserDrawAnimatedRects(
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL
|
|
||||||
STDCALL
|
|
||||||
NtUserDrawCaptionTemp(
|
|
||||||
HWND hWnd,
|
|
||||||
HDC hDC,
|
|
||||||
const RECT *rect,
|
|
||||||
HFONT hFont,
|
|
||||||
HICON hIcon,
|
|
||||||
LPCWSTR str,
|
|
||||||
UINT uFlags)
|
|
||||||
{
|
|
||||||
UNIMPLEMENTED
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
STDCALL
|
STDCALL
|
||||||
NtUserEnumDisplayDevices (
|
NtUserEnumDisplayDevices (
|
||||||
|
|
|
@ -1492,6 +1492,9 @@ BOOL UserDrawCaption(
|
||||||
PWINDOW_OBJECT pWnd,
|
PWINDOW_OBJECT pWnd,
|
||||||
HDC hDc,
|
HDC hDc,
|
||||||
LPCRECT lpRc,
|
LPCRECT lpRc,
|
||||||
|
HFONT hFont,
|
||||||
|
HICON hIcon,
|
||||||
|
const PUNICODE_STRING str,
|
||||||
UINT uFlags)
|
UINT uFlags)
|
||||||
{
|
{
|
||||||
BOOL Ret = FALSE;
|
BOOL Ret = FALSE;
|
||||||
|
@ -1504,7 +1507,7 @@ BOOL UserDrawCaption(
|
||||||
LONG ButtonWidth, IconWidth;
|
LONG ButtonWidth, IconWidth;
|
||||||
BOOL HasIcon;
|
BOOL HasIcon;
|
||||||
|
|
||||||
ASSERT(pWnd != NULL);
|
//ASSERT(pWnd != NULL);
|
||||||
|
|
||||||
hMemBmp = NtGdiCreateCompatibleBitmap(hDc,
|
hMemBmp = NtGdiCreateCompatibleBitmap(hDc,
|
||||||
lpRc->right - lpRc->left,
|
lpRc->right - lpRc->left,
|
||||||
|
@ -1533,9 +1536,16 @@ BOOL UserDrawCaption(
|
||||||
Height = UserGetSystemMetrics(SM_CYCAPTION) - 1;
|
Height = UserGetSystemMetrics(SM_CYCAPTION) - 1;
|
||||||
VCenter = (lpRc->bottom - lpRc->top) / 2;
|
VCenter = (lpRc->bottom - lpRc->top) / 2;
|
||||||
Padding = VCenter - (Height / 2);
|
Padding = VCenter - (Height / 2);
|
||||||
HasIcon = (uFlags & DC_ICON) && (pWnd->Style & WS_SYSMENU)
|
|
||||||
&& !(uFlags & DC_SMALLCAP) && !(pWnd->ExStyle & WS_EX_DLGMODALFRAME)
|
if ((!hIcon) && (pWnd != NULL))
|
||||||
&& !(pWnd->ExStyle & WS_EX_TOOLWINDOW);
|
{
|
||||||
|
HasIcon = (uFlags & DC_ICON) && (pWnd->Style & WS_SYSMENU)
|
||||||
|
&& !(uFlags & DC_SMALLCAP) && !(pWnd->ExStyle & WS_EX_DLGMODALFRAME)
|
||||||
|
&& !(pWnd->ExStyle & WS_EX_TOOLWINDOW);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
HasIcon = (BOOL) hIcon;
|
||||||
|
|
||||||
IconWidth = UserGetSystemMetrics(SM_CXSIZE) + Padding;
|
IconWidth = UserGetSystemMetrics(SM_CXSIZE) + Padding;
|
||||||
|
|
||||||
r.left = Padding;
|
r.left = Padding;
|
||||||
|
@ -1607,33 +1617,36 @@ BOOL UserDrawCaption(
|
||||||
COLORREF Colors[2];
|
COLORREF Colors[2];
|
||||||
PDC pMemDc;
|
PDC pMemDc;
|
||||||
|
|
||||||
if(pWnd->Style & WS_SYSMENU)
|
if (pWnd != NULL)
|
||||||
{
|
{
|
||||||
r.right -= 3 + ButtonWidth;
|
if(pWnd->Style & WS_SYSMENU)
|
||||||
if(!(uFlags & DC_SMALLCAP))
|
{
|
||||||
{
|
r.right -= 3 + ButtonWidth;
|
||||||
if(pWnd->Style & (WS_MAXIMIZEBOX | WS_MINIMIZEBOX))
|
if(!(uFlags & DC_SMALLCAP))
|
||||||
r.right -= 2 + 2 * ButtonWidth;
|
{
|
||||||
else r.right -= 2;
|
if(pWnd->Style & (WS_MAXIMIZEBOX | WS_MINIMIZEBOX))
|
||||||
r.right -= 2;
|
r.right -= 2 + 2 * ButtonWidth;
|
||||||
}
|
else r.right -= 2;
|
||||||
|
r.right -= 2;
|
||||||
//Draw buttons background
|
}
|
||||||
if(!NtGdiSelectObject(hMemDc,
|
|
||||||
IntGetSysColorBrush(uFlags & DC_ACTIVE ?
|
//Draw buttons background
|
||||||
COLOR_GRADIENTACTIVECAPTION:COLOR_GRADIENTINACTIVECAPTION)))
|
if(!NtGdiSelectObject(hMemDc,
|
||||||
{
|
IntGetSysColorBrush(uFlags & DC_ACTIVE ?
|
||||||
DPRINT1("%s: NtGdiSelectObject() failed!\n", __FUNCTION__);
|
COLOR_GRADIENTACTIVECAPTION:COLOR_GRADIENTINACTIVECAPTION)))
|
||||||
goto cleanup;
|
{
|
||||||
}
|
DPRINT1("%s: NtGdiSelectObject() failed!\n", __FUNCTION__);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
NtGdiPatBlt(hMemDc,
|
NtGdiPatBlt(hMemDc,
|
||||||
r.right,
|
r.right,
|
||||||
0,
|
0,
|
||||||
lpRc->right - lpRc->left - r.right,
|
lpRc->right - lpRc->left - r.right,
|
||||||
lpRc->bottom - lpRc->top,
|
lpRc->bottom - lpRc->top,
|
||||||
PATCOPY);
|
PATCOPY);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Colors[0] = IntGetSysColor((uFlags & DC_ACTIVE) ?
|
Colors[0] = IntGetSysColor((uFlags & DC_ACTIVE) ?
|
||||||
COLOR_ACTIVECAPTION : COLOR_INACTIVECAPTION);
|
COLOR_ACTIVECAPTION : COLOR_INACTIVECAPTION);
|
||||||
|
@ -1676,7 +1689,9 @@ BOOL UserDrawCaption(
|
||||||
{
|
{
|
||||||
r.top ++;
|
r.top ++;
|
||||||
r.left -= --IconWidth;
|
r.left -= --IconWidth;
|
||||||
UserDrawSysMenuButton(pWnd, hMemDc, &r, FALSE);
|
/* FIXME: Draw the Icon when pWnd == NULL but hIcon is valid */
|
||||||
|
if (pWnd != NULL)
|
||||||
|
UserDrawSysMenuButton(pWnd, hMemDc, &r, FALSE);
|
||||||
r.left += IconWidth;
|
r.left += IconWidth;
|
||||||
r.top --;
|
r.top --;
|
||||||
}
|
}
|
||||||
|
@ -1686,7 +1701,7 @@ BOOL UserDrawCaption(
|
||||||
|
|
||||||
r.bottom = r.top + Height;
|
r.bottom = r.top + Height;
|
||||||
|
|
||||||
if((uFlags & DC_TEXT) && pWnd->WindowName.Length)
|
if((uFlags & DC_TEXT))
|
||||||
{
|
{
|
||||||
if(!(uFlags & DC_GRADIENT))
|
if(!(uFlags & DC_GRADIENT))
|
||||||
{
|
{
|
||||||
|
@ -1709,7 +1724,11 @@ BOOL UserDrawCaption(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UserDrawCaptionText(hMemDc, &pWnd->WindowName, &r, uFlags);
|
/* FIXME: hFont isn't handled */
|
||||||
|
if (str)
|
||||||
|
UserDrawCaptionText(hMemDc, str, &r, uFlags);
|
||||||
|
else if (pWnd != NULL)
|
||||||
|
UserDrawCaptionText(hMemDc, &pWnd->WindowName, &r, uFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!NtGdiBitBlt(hDc, lpRc->left, lpRc->top,
|
if(!NtGdiBitBlt(hDc, lpRc->left, lpRc->top,
|
||||||
|
@ -1732,30 +1751,50 @@ cleanup:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
STDCALL
|
STDCALL
|
||||||
NtUserDrawCaption(HWND hWnd,
|
NtUserDrawCaptionTemp(
|
||||||
HDC hDc,
|
HWND hWnd,
|
||||||
|
HDC hDC,
|
||||||
LPCRECT lpRc,
|
LPCRECT lpRc,
|
||||||
|
HFONT hFont,
|
||||||
|
HICON hIcon,
|
||||||
|
const PUNICODE_STRING str,
|
||||||
UINT uFlags)
|
UINT uFlags)
|
||||||
{
|
{
|
||||||
PWINDOW_OBJECT pWnd;
|
PWINDOW_OBJECT pWnd = NULL;
|
||||||
RECT SafeRect;
|
RECT SafeRect;
|
||||||
|
UNICODE_STRING SafeStr = {0};
|
||||||
BOOL Ret = FALSE;
|
BOOL Ret = FALSE;
|
||||||
|
|
||||||
UserEnterExclusive();
|
UserEnterExclusive();
|
||||||
|
|
||||||
if(!(pWnd = UserGetWindowObject(hWnd)))
|
if (hWnd != NULL)
|
||||||
{
|
{
|
||||||
UserLeave();
|
if(!(pWnd = UserGetWindowObject(hWnd)))
|
||||||
return FALSE;
|
{
|
||||||
|
UserLeave();
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_SEH_TRY
|
_SEH_TRY
|
||||||
{
|
{
|
||||||
ProbeForRead(lpRc, sizeof(RECT), sizeof(ULONG));
|
ProbeForRead(lpRc, sizeof(RECT), sizeof(ULONG));
|
||||||
RtlCopyMemory(&SafeRect, lpRc, sizeof(RECT));
|
RtlCopyMemory(&SafeRect, lpRc, sizeof(RECT));
|
||||||
Ret = UserDrawCaption(pWnd, hDc, &SafeRect, uFlags);
|
if (str != NULL)
|
||||||
|
{
|
||||||
|
SafeStr = ProbeForReadUnicodeString(str);
|
||||||
|
if (SafeStr.Length != 0)
|
||||||
|
{
|
||||||
|
ProbeForRead(SafeStr.Buffer,
|
||||||
|
SafeStr.Length,
|
||||||
|
sizeof(WCHAR));
|
||||||
|
}
|
||||||
|
Ret = UserDrawCaption(pWnd, hDC, &SafeRect, hFont, hIcon, &SafeStr, uFlags);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Ret = UserDrawCaption(pWnd, hDC, &SafeRect, hFont, hIcon, NULL, uFlags);
|
||||||
}
|
}
|
||||||
_SEH_HANDLE
|
_SEH_HANDLE
|
||||||
{
|
{
|
||||||
|
@ -1767,4 +1806,14 @@ NtUserDrawCaption(HWND hWnd,
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
STDCALL
|
||||||
|
NtUserDrawCaption(HWND hWnd,
|
||||||
|
HDC hDC,
|
||||||
|
LPCRECT lpRc,
|
||||||
|
UINT uFlags)
|
||||||
|
{
|
||||||
|
return NtUserDrawCaptionTemp(hWnd, hDC, lpRc, 0, 0, NULL, uFlags);
|
||||||
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
Loading…
Reference in a new issue