Commit 4ac8db78 authored by Pierre Mageau's avatar Pierre Mageau Committed by Alexandre Julliard

Changed CopyImage to accept desiredX, desiredY and LR_COPYFROMRESOURCE.

CURSORICON_FindBestIcon changed to find the correct icon. ImageList_ReplaceIcon now calls CopyImage internally. Assign a value for the hIconSm CLASS member (using CopyImage).
parent 749a2c6c
...@@ -2104,6 +2104,7 @@ ImageList_ReplaceIcon (HIMAGELIST himl, INT i, HICON hIcon) ...@@ -2104,6 +2104,7 @@ ImageList_ReplaceIcon (HIMAGELIST himl, INT i, HICON hIcon)
{ {
HDC hdcImageList, hdcImage; HDC hdcImageList, hdcImage;
INT nIndex; INT nIndex;
HICON hBestFitIcon;
HBITMAP hbmOldSrc, hbmOldDst; HBITMAP hbmOldSrc, hbmOldDst;
ICONINFO ii; ICONINFO ii;
BITMAP bmp; BITMAP bmp;
...@@ -2115,7 +2116,12 @@ ImageList_ReplaceIcon (HIMAGELIST himl, INT i, HICON hIcon) ...@@ -2115,7 +2116,12 @@ ImageList_ReplaceIcon (HIMAGELIST himl, INT i, HICON hIcon)
if ((i >= himl->cCurImage) || (i < -1)) if ((i >= himl->cCurImage) || (i < -1))
return -1; return -1;
GetIconInfo (hIcon, &ii); hBestFitIcon = CopyImage(
hIcon, IMAGE_ICON,
himl->cx, himl->cy,
LR_COPYFROMRESOURCE);
GetIconInfo (hBestFitIcon, &ii);
if (ii.hbmMask == 0) if (ii.hbmMask == 0)
ERR("no mask!\n"); ERR("no mask!\n");
if (ii.hbmColor == 0) if (ii.hbmColor == 0)
...@@ -2159,6 +2165,8 @@ ImageList_ReplaceIcon (HIMAGELIST himl, INT i, HICON hIcon) ...@@ -2159,6 +2165,8 @@ ImageList_ReplaceIcon (HIMAGELIST himl, INT i, HICON hIcon)
SelectObject (hdcImage, hbmOldSrc); SelectObject (hdcImage, hbmOldSrc);
SelectObject (hdcImageList, hbmOldDst); SelectObject (hdcImageList, hbmOldDst);
if(hBestFitIcon)
DestroyIcon(hBestFitIcon);
if (hdcImageList) if (hdcImageList)
DeleteDC (hdcImageList); DeleteDC (hdcImageList);
if (hdcImage) if (hdcImage)
......
...@@ -79,6 +79,10 @@ extern HGLOBAL CURSORICON_Load( HINSTANCE hInstance, LPCWSTR name, ...@@ -79,6 +79,10 @@ extern HGLOBAL CURSORICON_Load( HINSTANCE hInstance, LPCWSTR name,
int width, int height, int colors, int width, int height, int colors,
BOOL fCursor, UINT loadflags); BOOL fCursor, UINT loadflags);
extern HGLOBAL CURSORICON_ExtCopy(HGLOBAL handle, UINT type,
INT desiredx, INT desiredy,
UINT flags);
extern WORD WINAPI CURSORICON_Destroy( HGLOBAL16 handle, UINT16 flags ); extern WORD WINAPI CURSORICON_Destroy( HGLOBAL16 handle, UINT16 flags );
extern void CURSORICON_FreeModuleIcons( HMODULE hModule ); extern void CURSORICON_FreeModuleIcons( HMODULE hModule );
......
...@@ -238,6 +238,9 @@ BOOL WINAPI MAIN_UserInit(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserve ...@@ -238,6 +238,9 @@ BOOL WINAPI MAIN_UserInit(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserve
/* Initialize window procedures */ /* Initialize window procedures */
if (!WINPROC_Init()) return FALSE; if (!WINPROC_Init()) return FALSE;
/* Initialize cursor/icons */
CURSORICON_Init();
/* Initialize built-in window classes */ /* Initialize built-in window classes */
if (!WIDGETS_Init()) return FALSE; if (!WIDGETS_Init()) return FALSE;
...@@ -247,9 +250,6 @@ BOOL WINAPI MAIN_UserInit(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserve ...@@ -247,9 +250,6 @@ BOOL WINAPI MAIN_UserInit(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserve
/* Initialize menus */ /* Initialize menus */
if (!MENU_Init()) return FALSE; if (!MENU_Init()) return FALSE;
/* Initialize cursor/icons */
CURSORICON_Init();
/* Initialize message spying */ /* Initialize message spying */
if (!SPY_Init()) return FALSE; if (!SPY_Init()) return FALSE;
......
...@@ -527,8 +527,11 @@ HICON WINAPI CopyImage( HANDLE hnd, UINT type, INT desiredx, ...@@ -527,8 +527,11 @@ HICON WINAPI CopyImage( HANDLE hnd, UINT type, INT desiredx,
case IMAGE_BITMAP: case IMAGE_BITMAP:
return BITMAP_CopyBitmap(hnd); return BITMAP_CopyBitmap(hnd);
case IMAGE_ICON: case IMAGE_ICON:
return CopyIcon(hnd); return CURSORICON_ExtCopy(hnd,type, desiredx, desiredy, flags);
case IMAGE_CURSOR: case IMAGE_CURSOR:
/* Should call CURSORICON_ExtCopy but more testing
* needs to be done before we change this
*/
return CopyCursor(hnd); return CopyCursor(hnd);
} }
return 0; return 0;
......
...@@ -412,6 +412,7 @@ ATOM WINAPI RegisterClass16( const WNDCLASS16 *wc ) ...@@ -412,6 +412,7 @@ ATOM WINAPI RegisterClass16( const WNDCLASS16 *wc )
{ {
ATOM atom; ATOM atom;
CLASS *classPtr; CLASS *classPtr;
int iSmIconWidth, iSmIconHeight;
HINSTANCE16 hInstance=GetExePtr(wc->hInstance); HINSTANCE16 hInstance=GetExePtr(wc->hInstance);
if (!(atom = GlobalAddAtom16( wc->lpszClassName ))) return 0; if (!(atom = GlobalAddAtom16( wc->lpszClassName ))) return 0;
...@@ -431,8 +432,13 @@ ATOM WINAPI RegisterClass16( const WNDCLASS16 *wc ) ...@@ -431,8 +432,13 @@ ATOM WINAPI RegisterClass16( const WNDCLASS16 *wc )
HIWORD(wc->lpszClassName) ? HIWORD(wc->lpszClassName) ?
(char *)PTR_SEG_TO_LIN(wc->lpszClassName) : "" ); (char *)PTR_SEG_TO_LIN(wc->lpszClassName) : "" );
iSmIconWidth = GetSystemMetrics(SM_CXSMICON);
iSmIconHeight = GetSystemMetrics(SM_CYSMICON);
classPtr->hIcon = wc->hIcon; classPtr->hIcon = wc->hIcon;
classPtr->hIconSm = 0; classPtr->hIconSm = CopyImage(wc->hIcon, IMAGE_ICON,
iSmIconWidth, iSmIconHeight,
LR_COPYFROMRESOURCE);
classPtr->hCursor = wc->hCursor; classPtr->hCursor = wc->hCursor;
classPtr->hbrBackground = wc->hbrBackground; classPtr->hbrBackground = wc->hbrBackground;
...@@ -455,6 +461,7 @@ ATOM WINAPI RegisterClassA( ...@@ -455,6 +461,7 @@ ATOM WINAPI RegisterClassA(
const WNDCLASSA* wc /* Address of structure with class data */ const WNDCLASSA* wc /* Address of structure with class data */
) { ) {
ATOM atom; ATOM atom;
int iSmIconWidth, iSmIconHeight;
CLASS *classPtr; CLASS *classPtr;
if (!(atom = GlobalAddAtomA( wc->lpszClassName ))) if (!(atom = GlobalAddAtomA( wc->lpszClassName )))
...@@ -477,8 +484,13 @@ ATOM WINAPI RegisterClassA( ...@@ -477,8 +484,13 @@ ATOM WINAPI RegisterClassA(
wc->cbWndExtra, classPtr, wc->cbWndExtra, classPtr,
HIWORD(wc->lpszClassName) ? wc->lpszClassName : "" ); HIWORD(wc->lpszClassName) ? wc->lpszClassName : "" );
classPtr->hIcon = (HICON16)wc->hIcon; iSmIconWidth = GetSystemMetrics(SM_CXSMICON);
classPtr->hIconSm = 0; iSmIconHeight = GetSystemMetrics(SM_CYSMICON);
classPtr->hIcon = wc->hIcon;
classPtr->hIconSm = CopyImage(wc->hIcon, IMAGE_ICON,
iSmIconWidth, iSmIconHeight,
LR_COPYFROMRESOURCE);
classPtr->hCursor = (HCURSOR16)wc->hCursor; classPtr->hCursor = (HCURSOR16)wc->hCursor;
classPtr->hbrBackground = (HBRUSH16)wc->hbrBackground; classPtr->hbrBackground = (HBRUSH16)wc->hbrBackground;
...@@ -494,6 +506,7 @@ ATOM WINAPI RegisterClassA( ...@@ -494,6 +506,7 @@ ATOM WINAPI RegisterClassA(
ATOM WINAPI RegisterClassW( const WNDCLASSW* wc ) ATOM WINAPI RegisterClassW( const WNDCLASSW* wc )
{ {
ATOM atom; ATOM atom;
int iSmIconWidth, iSmIconHeight;
CLASS *classPtr; CLASS *classPtr;
if (!(atom = GlobalAddAtomW( wc->lpszClassName ))) if (!(atom = GlobalAddAtomW( wc->lpszClassName )))
...@@ -516,8 +529,13 @@ ATOM WINAPI RegisterClassW( const WNDCLASSW* wc ) ...@@ -516,8 +529,13 @@ ATOM WINAPI RegisterClassW( const WNDCLASSW* wc )
wc->hbrBackground, wc->style, wc->cbClsExtra, wc->hbrBackground, wc->style, wc->cbClsExtra,
wc->cbWndExtra, classPtr ); wc->cbWndExtra, classPtr );
classPtr->hIcon = (HICON16)wc->hIcon; iSmIconWidth = GetSystemMetrics(SM_CXSMICON);
classPtr->hIconSm = 0; iSmIconHeight = GetSystemMetrics(SM_CYSMICON);
classPtr->hIcon = wc->hIcon;
classPtr->hIconSm = CopyImage(wc->hIcon, IMAGE_ICON,
iSmIconWidth, iSmIconHeight,
LR_COPYFROMRESOURCE);
classPtr->hCursor = (HCURSOR16)wc->hCursor; classPtr->hCursor = (HCURSOR16)wc->hCursor;
classPtr->hbrBackground = (HBRUSH16)wc->hbrBackground; classPtr->hbrBackground = (HBRUSH16)wc->hbrBackground;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment