mirror of
https://github.com/reactos/reactos.git
synced 2024-09-09 20:30:04 +00:00
- Display window icon only if there is any.
svn path=/trunk/; revision=10051
This commit is contained in:
parent
2915b7de9b
commit
a2f7e34792
|
@ -147,52 +147,38 @@ UserHasMenu(HWND hWnd, ULONG Style)
|
||||||
HICON
|
HICON
|
||||||
UserGetWindowIcon(HWND hwnd)
|
UserGetWindowIcon(HWND hwnd)
|
||||||
{
|
{
|
||||||
HICON Ret;
|
HICON hIcon = 0;
|
||||||
|
|
||||||
if(SendMessageTimeoutW(hwnd, WM_GETICON, ICON_SMALL2, 0, SMTO_ABORTIFHUNG, 1000, (LPDWORD)&Ret) && Ret)
|
SendMessageTimeout(hwnd, WM_GETICON, ICON_SMALL2, 0, SMTO_ABORTIFHUNG, 1000, (LPDWORD)&hIcon);
|
||||||
{
|
|
||||||
return Ret;
|
if (!hIcon)
|
||||||
}
|
SendMessageTimeout(hwnd, WM_GETICON, ICON_SMALL, 0, SMTO_ABORTIFHUNG, 1000, (LPDWORD)&hIcon);
|
||||||
if(SendMessageTimeoutW(hwnd, WM_GETICON, ICON_SMALL, 0, SMTO_ABORTIFHUNG, 1000, (LPDWORD)&Ret) && Ret)
|
|
||||||
{
|
if (!hIcon)
|
||||||
return Ret;
|
SendMessageTimeout(hwnd, WM_GETICON, ICON_BIG, 0, SMTO_ABORTIFHUNG, 1000, (LPDWORD)&hIcon);
|
||||||
}
|
|
||||||
if(SendMessageTimeoutW(hwnd, WM_GETICON, ICON_BIG, 0, SMTO_ABORTIFHUNG, 1000, (LPDWORD)&Ret) && Ret)
|
if (!hIcon)
|
||||||
{
|
hIcon = (HICON)GetClassLong(hwnd, GCL_HICONSM);
|
||||||
return Ret;
|
|
||||||
}
|
if (!hIcon)
|
||||||
if((Ret = (HICON)GetClassLongW(hwnd, GCL_HICONSM)))
|
hIcon = (HICON)GetClassLong(hwnd, GCL_HICON);
|
||||||
{
|
|
||||||
return Ret;
|
return hIcon;
|
||||||
}
|
|
||||||
if((Ret = (HICON)GetClassLongW(hwnd, GCL_HICON)))
|
|
||||||
{
|
|
||||||
return Ret;
|
|
||||||
}
|
|
||||||
if(SendMessageTimeoutW(hwnd, WM_QUERYDRAGICON, 0, 0, 0, 1000, (LPDWORD)&Ret) && Ret)
|
|
||||||
{
|
|
||||||
return Ret;
|
|
||||||
}
|
|
||||||
if((Ret = LoadIconW(0, IDI_APPLICATION)))
|
|
||||||
{
|
|
||||||
return Ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
UserDrawSysMenuButton(HWND hWnd, HDC hDC, LPRECT Rect, BOOL Down)
|
UserDrawSysMenuButton(HWND hWnd, HDC hDC, LPRECT Rect, BOOL Down)
|
||||||
{
|
{
|
||||||
HICON WindowIcon;
|
HICON WindowIcon;
|
||||||
|
|
||||||
if((WindowIcon = UserGetWindowIcon(hWnd)))
|
if ((WindowIcon = UserGetWindowIcon(hWnd)))
|
||||||
{
|
{
|
||||||
return DrawIconEx(hDC, Rect->left + 2, Rect->top + 2, WindowIcon,
|
return DrawIconEx(hDC, Rect->left + 2, Rect->top + 2, WindowIcon,
|
||||||
GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON),
|
GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON),
|
||||||
0, NULL, DI_NORMAL);
|
0, NULL, DI_NORMAL);
|
||||||
}
|
}
|
||||||
return FALSE;
|
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1223,11 +1209,11 @@ DrawCaption(HWND hWnd, HDC hDC, LPCRECT lprc, UINT uFlags)
|
||||||
xx = GetSystemMetrics(SM_CXSIZE) + Padding;
|
xx = GetSystemMetrics(SM_CXSIZE) + Padding;
|
||||||
/* draw icon background */
|
/* draw icon background */
|
||||||
PatBlt(MemDC, 0, 0, xx, lprc->bottom - lprc->top, PATCOPY);
|
PatBlt(MemDC, 0, 0, xx, lprc->bottom - lprc->top, PATCOPY);
|
||||||
// For some reason the icon isn't centered correctly...
|
/* For some reason the icon isn't centered correctly... */
|
||||||
r.top --;
|
r.top --;
|
||||||
UserDrawSysMenuButton(hWnd, MemDC, &r, FALSE);
|
if (UserDrawSysMenuButton(hWnd, MemDC, &r, FALSE))
|
||||||
|
r.left += xx;
|
||||||
r.top ++;
|
r.top ++;
|
||||||
r.left += xx;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
vert[0].x = r.left;
|
vert[0].x = r.left;
|
||||||
|
@ -1269,9 +1255,10 @@ DrawCaption(HWND hWnd, HDC hDC, LPCRECT lprc, UINT uFlags)
|
||||||
|
|
||||||
if ((uFlags & DC_ICON) && !(uFlags & DC_GRADIENT) && (Style & WS_SYSMENU) && !(uFlags & DC_SMALLCAP))
|
if ((uFlags & DC_ICON) && !(uFlags & DC_GRADIENT) && (Style & WS_SYSMENU) && !(uFlags & DC_SMALLCAP))
|
||||||
{
|
{
|
||||||
// For some reason the icon isn't centered correctly...
|
/* For some reason the icon isn't centered correctly... */
|
||||||
r.top --;
|
r.top --;
|
||||||
UserDrawSysMenuButton(hWnd, MemDC, &r, FALSE);
|
if (UserDrawSysMenuButton(hWnd, MemDC, &r, FALSE))
|
||||||
|
r.left += GetSystemMetrics(SM_CXSIZE) + Padding;
|
||||||
r.top ++;
|
r.top ++;
|
||||||
}
|
}
|
||||||
r.top ++;
|
r.top ++;
|
||||||
|
@ -1283,9 +1270,6 @@ DrawCaption(HWND hWnd, HDC hDC, LPCRECT lprc, UINT uFlags)
|
||||||
{
|
{
|
||||||
if(!(uFlags & DC_GRADIENT))
|
if(!(uFlags & DC_GRADIENT))
|
||||||
{
|
{
|
||||||
if (!(uFlags & DC_SMALLCAP) && ((uFlags & DC_ICON) || (uFlags & DC_INBUTTON)))
|
|
||||||
r.left += GetSystemMetrics(SM_CXSIZE) + Padding;
|
|
||||||
|
|
||||||
r.right = (lprc->right - lprc->left);
|
r.right = (lprc->right - lprc->left);
|
||||||
if (uFlags & DC_SMALLCAP)
|
if (uFlags & DC_SMALLCAP)
|
||||||
ButtonWidth = GetSystemMetrics(SM_CXSMSIZE) - 2;
|
ButtonWidth = GetSystemMetrics(SM_CXSMSIZE) - 2;
|
||||||
|
|
Loading…
Reference in a new issue