user32: Add internal class small icons.
This commit is contained in:
parent
06d284cabb
commit
3d4db9f28f
@ -56,6 +56,7 @@ typedef struct tagCLASS
|
|||||||
HINSTANCE hInstance; /* Module that created the task */
|
HINSTANCE hInstance; /* Module that created the task */
|
||||||
HICON hIcon; /* Default icon */
|
HICON hIcon; /* Default icon */
|
||||||
HICON hIconSm; /* Default small icon */
|
HICON hIconSm; /* Default small icon */
|
||||||
|
HICON hIconSmIntern; /* Internal small icon, derived from hIcon */
|
||||||
HCURSOR hCursor; /* Default cursor */
|
HCURSOR hCursor; /* Default cursor */
|
||||||
HBRUSH hbrBackground; /* Default background */
|
HBRUSH hbrBackground; /* Default background */
|
||||||
ATOM atomName; /* Name of the class */
|
ATOM atomName; /* Name of the class */
|
||||||
@ -518,6 +519,10 @@ ATOM WINAPI RegisterClassExA( const WNDCLASSEXA* wc )
|
|||||||
|
|
||||||
classPtr->hIcon = wc->hIcon;
|
classPtr->hIcon = wc->hIcon;
|
||||||
classPtr->hIconSm = wc->hIconSm;
|
classPtr->hIconSm = wc->hIconSm;
|
||||||
|
classPtr->hIconSmIntern = wc->hIcon && !wc->hIconSm ?
|
||||||
|
CopyImage( wc->hIcon, IMAGE_ICON,
|
||||||
|
GetSystemMetrics( SM_CXSMICON ),
|
||||||
|
GetSystemMetrics( SM_CYSMICON ), 0 ) : NULL;
|
||||||
classPtr->hCursor = wc->hCursor;
|
classPtr->hCursor = wc->hCursor;
|
||||||
classPtr->hbrBackground = wc->hbrBackground;
|
classPtr->hbrBackground = wc->hbrBackground;
|
||||||
classPtr->winproc = WINPROC_AllocProc( wc->lpfnWndProc, FALSE );
|
classPtr->winproc = WINPROC_AllocProc( wc->lpfnWndProc, FALSE );
|
||||||
@ -556,6 +561,10 @@ ATOM WINAPI RegisterClassExW( const WNDCLASSEXW* wc )
|
|||||||
|
|
||||||
classPtr->hIcon = wc->hIcon;
|
classPtr->hIcon = wc->hIcon;
|
||||||
classPtr->hIconSm = wc->hIconSm;
|
classPtr->hIconSm = wc->hIconSm;
|
||||||
|
classPtr->hIconSmIntern = wc->hIcon && !wc->hIconSm ?
|
||||||
|
CopyImage( wc->hIcon, IMAGE_ICON,
|
||||||
|
GetSystemMetrics( SM_CXSMICON ),
|
||||||
|
GetSystemMetrics( SM_CYSMICON ), 0 ) : NULL;
|
||||||
classPtr->hCursor = wc->hCursor;
|
classPtr->hCursor = wc->hCursor;
|
||||||
classPtr->hbrBackground = wc->hbrBackground;
|
classPtr->hbrBackground = wc->hbrBackground;
|
||||||
classPtr->winproc = WINPROC_AllocProc( wc->lpfnWndProc, TRUE );
|
classPtr->winproc = WINPROC_AllocProc( wc->lpfnWndProc, TRUE );
|
||||||
@ -741,7 +750,7 @@ static ULONG_PTR CLASS_GetClassLong( HWND hwnd, INT offset, UINT size,
|
|||||||
retvalue = (ULONG_PTR)class->hIcon;
|
retvalue = (ULONG_PTR)class->hIcon;
|
||||||
break;
|
break;
|
||||||
case GCLP_HICONSM:
|
case GCLP_HICONSM:
|
||||||
retvalue = (ULONG_PTR)class->hIconSm;
|
retvalue = (ULONG_PTR)(class->hIconSm ? class->hIconSm : class->hIconSmIntern);
|
||||||
break;
|
break;
|
||||||
case GCL_STYLE:
|
case GCL_STYLE:
|
||||||
retvalue = class->style;
|
retvalue = class->style;
|
||||||
@ -884,10 +893,27 @@ static ULONG_PTR CLASS_SetClassLong( HWND hwnd, INT offset, LONG_PTR newval,
|
|||||||
break;
|
break;
|
||||||
case GCLP_HICON:
|
case GCLP_HICON:
|
||||||
retval = (ULONG_PTR)class->hIcon;
|
retval = (ULONG_PTR)class->hIcon;
|
||||||
|
if (retval && class->hIconSmIntern)
|
||||||
|
{
|
||||||
|
DestroyIcon(class->hIconSmIntern);
|
||||||
|
class->hIconSmIntern = NULL;
|
||||||
|
}
|
||||||
|
if (newval && !class->hIconSm)
|
||||||
|
class->hIconSmIntern = CopyImage( (HICON)newval, IMAGE_ICON,
|
||||||
|
GetSystemMetrics( SM_CXSMICON ), GetSystemMetrics( SM_CYSMICON ), 0 );
|
||||||
class->hIcon = (HICON)newval;
|
class->hIcon = (HICON)newval;
|
||||||
break;
|
break;
|
||||||
case GCLP_HICONSM:
|
case GCLP_HICONSM:
|
||||||
retval = (ULONG_PTR)class->hIconSm;
|
retval = (ULONG_PTR)class->hIconSm;
|
||||||
|
if (retval && !newval)
|
||||||
|
class->hIconSmIntern = class->hIcon ? CopyImage( class->hIcon, IMAGE_ICON,
|
||||||
|
GetSystemMetrics( SM_CXSMICON ),
|
||||||
|
GetSystemMetrics( SM_CYSMICON ), 0 ) : NULL;
|
||||||
|
else if (!retval && newval && class->hIconSmIntern)
|
||||||
|
{
|
||||||
|
DestroyIcon(class->hIconSmIntern);
|
||||||
|
class->hIconSmIntern = NULL;
|
||||||
|
}
|
||||||
class->hIconSm = (HICON)newval;
|
class->hIconSm = (HICON)newval;
|
||||||
break;
|
break;
|
||||||
case GCL_STYLE:
|
case GCL_STYLE:
|
||||||
@ -1099,7 +1125,7 @@ BOOL WINAPI GetClassInfoExA( HINSTANCE hInstance, LPCSTR name, WNDCLASSEXA *wc )
|
|||||||
wc->cbWndExtra = classPtr->cbWndExtra;
|
wc->cbWndExtra = classPtr->cbWndExtra;
|
||||||
wc->hInstance = (hInstance == user32_module) ? 0 : hInstance;
|
wc->hInstance = (hInstance == user32_module) ? 0 : hInstance;
|
||||||
wc->hIcon = classPtr->hIcon;
|
wc->hIcon = classPtr->hIcon;
|
||||||
wc->hIconSm = classPtr->hIconSm;
|
wc->hIconSm = classPtr->hIconSm ? classPtr->hIconSm : classPtr->hIconSmIntern;
|
||||||
wc->hCursor = classPtr->hCursor;
|
wc->hCursor = classPtr->hCursor;
|
||||||
wc->hbrBackground = classPtr->hbrBackground;
|
wc->hbrBackground = classPtr->hbrBackground;
|
||||||
wc->lpszMenuName = CLASS_GetMenuNameA( classPtr );
|
wc->lpszMenuName = CLASS_GetMenuNameA( classPtr );
|
||||||
@ -1141,7 +1167,7 @@ BOOL WINAPI GetClassInfoExW( HINSTANCE hInstance, LPCWSTR name, WNDCLASSEXW *wc
|
|||||||
wc->cbWndExtra = classPtr->cbWndExtra;
|
wc->cbWndExtra = classPtr->cbWndExtra;
|
||||||
wc->hInstance = (hInstance == user32_module) ? 0 : hInstance;
|
wc->hInstance = (hInstance == user32_module) ? 0 : hInstance;
|
||||||
wc->hIcon = classPtr->hIcon;
|
wc->hIcon = classPtr->hIcon;
|
||||||
wc->hIconSm = classPtr->hIconSm;
|
wc->hIconSm = classPtr->hIconSm ? classPtr->hIconSm : classPtr->hIconSmIntern;
|
||||||
wc->hCursor = classPtr->hCursor;
|
wc->hCursor = classPtr->hCursor;
|
||||||
wc->hbrBackground = classPtr->hbrBackground;
|
wc->hbrBackground = classPtr->hbrBackground;
|
||||||
wc->lpszMenuName = CLASS_GetMenuNameW( classPtr );
|
wc->lpszMenuName = CLASS_GetMenuNameW( classPtr );
|
||||||
|
@ -999,11 +999,9 @@ static void test_icons(void)
|
|||||||
|
|
||||||
ok(GetClassInfoExW(hinst, cls_name, &ret_wcex), "Class info was not retrieved\n");
|
ok(GetClassInfoExW(hinst, cls_name, &ret_wcex), "Class info was not retrieved\n");
|
||||||
ok(wcex.hIcon == ret_wcex.hIcon, "Icons don't match\n");
|
ok(wcex.hIcon == ret_wcex.hIcon, "Icons don't match\n");
|
||||||
todo_wine
|
|
||||||
ok(ret_wcex.hIconSm != NULL, "hIconSm should be non-zero handle\n");
|
ok(ret_wcex.hIconSm != NULL, "hIconSm should be non-zero handle\n");
|
||||||
|
|
||||||
hsmicon = (HICON)GetClassLongPtrW(hwnd, GCLP_HICONSM);
|
hsmicon = (HICON)GetClassLongPtrW(hwnd, GCLP_HICONSM);
|
||||||
todo_wine
|
|
||||||
ok(hsmicon != NULL, "GetClassLong should return non-zero handle\n");
|
ok(hsmicon != NULL, "GetClassLong should return non-zero handle\n");
|
||||||
|
|
||||||
hsmallnew = CopyImage(wcex.hIcon, IMAGE_ICON, GetSystemMetrics(SM_CXSMICON),
|
hsmallnew = CopyImage(wcex.hIcon, IMAGE_ICON, GetSystemMetrics(SM_CXSMICON),
|
||||||
@ -1016,7 +1014,6 @@ todo_wine
|
|||||||
|
|
||||||
SetClassLongPtrW(hwnd, GCLP_HICONSM, 0);
|
SetClassLongPtrW(hwnd, GCLP_HICONSM, 0);
|
||||||
hsmicon = (HICON)GetClassLongPtrW(hwnd, GCLP_HICONSM);
|
hsmicon = (HICON)GetClassLongPtrW(hwnd, GCLP_HICONSM);
|
||||||
todo_wine
|
|
||||||
ok( hsmicon != NULL, "GetClassLong should return non-zero handle\n");
|
ok( hsmicon != NULL, "GetClassLong should return non-zero handle\n");
|
||||||
|
|
||||||
SetClassLongPtrW(hwnd, GCLP_HICON, 0);
|
SetClassLongPtrW(hwnd, GCLP_HICON, 0);
|
||||||
@ -1024,10 +1021,8 @@ todo_wine
|
|||||||
|
|
||||||
SetClassLongPtrW(hwnd, GCLP_HICON, (LONG_PTR)LoadIconW(NULL, (LPCWSTR)IDI_QUESTION));
|
SetClassLongPtrW(hwnd, GCLP_HICON, (LONG_PTR)LoadIconW(NULL, (LPCWSTR)IDI_QUESTION));
|
||||||
hsmicon = (HICON)GetClassLongPtrW(hwnd, GCLP_HICONSM);
|
hsmicon = (HICON)GetClassLongPtrW(hwnd, GCLP_HICONSM);
|
||||||
todo_wine
|
|
||||||
ok(hsmicon != NULL, "GetClassLong should return non-zero handle\n");
|
ok(hsmicon != NULL, "GetClassLong should return non-zero handle\n");
|
||||||
UnregisterClassW(cls_name, hinst);
|
UnregisterClassW(cls_name, hinst);
|
||||||
todo_wine
|
|
||||||
ok(GetIconInfo(hsmicon, &icinf), "Icon should NOT be destroyed\n");
|
ok(GetIconInfo(hsmicon, &icinf), "Icon should NOT be destroyed\n");
|
||||||
|
|
||||||
DestroyIcon(hsmallnew);
|
DestroyIcon(hsmallnew);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user