static control: Better STM_GETIMAGE.
STM_GETIMAGE returns NULL if the given image type doesn't match the control's style.
This commit is contained in:
parent
46d007cedb
commit
2b8cda7162
|
@ -200,6 +200,32 @@ static HENHMETAFILE STATIC_SetEnhMetaFile( HWND hwnd, HENHMETAFILE hEnhMetaFile,
|
||||||
return (HENHMETAFILE)SetWindowLongPtrW( hwnd, HICON_GWL_OFFSET, (LONG_PTR)hEnhMetaFile );
|
return (HENHMETAFILE)SetWindowLongPtrW( hwnd, HICON_GWL_OFFSET, (LONG_PTR)hEnhMetaFile );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* STATIC_GetImage
|
||||||
|
*
|
||||||
|
* Gets the bitmap for an SS_BITMAP control, the icon/cursor for an
|
||||||
|
* SS_ICON control or the enhanced metafile for an SS_ENHMETAFILE control.
|
||||||
|
*/
|
||||||
|
static HANDLE STATIC_GetImage( HWND hwnd, WPARAM wParam, DWORD style )
|
||||||
|
{
|
||||||
|
switch(style & SS_TYPEMASK)
|
||||||
|
{
|
||||||
|
case SS_ICON:
|
||||||
|
if ((wParam != IMAGE_ICON) &&
|
||||||
|
(wParam != IMAGE_CURSOR)) return NULL;
|
||||||
|
break;
|
||||||
|
case SS_BITMAP:
|
||||||
|
if (wParam != IMAGE_BITMAP) return NULL;
|
||||||
|
break;
|
||||||
|
case SS_ENHMETAFILE:
|
||||||
|
if (wParam != IMAGE_ENHMETAFILE) return NULL;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
return (HANDLE)GetWindowLongPtrW( hwnd, HICON_GWL_OFFSET );
|
||||||
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* STATIC_LoadIconA
|
* STATIC_LoadIconA
|
||||||
*
|
*
|
||||||
|
@ -473,13 +499,11 @@ static LRESULT StaticWndProc_common( HWND hwnd, UINT uMsg, WPARAM wParam,
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case STM_GETIMAGE:
|
case STM_GETIMAGE:
|
||||||
/* FIXME: Return NULL if wParam doesn't match the control's style.
|
return (LRESULT)STATIC_GetImage( hwnd, wParam, full_style );
|
||||||
wParam is IMAGE_BITMAP, IMAGE_CURSOR, IMAGE_ENHMETAFILE
|
|
||||||
or IMAGE_ICON */
|
|
||||||
case STM_GETICON16:
|
case STM_GETICON16:
|
||||||
case STM_GETICON:
|
case STM_GETICON:
|
||||||
/* FIXME: Return NULL if this control doesn't show an icon */
|
return (LRESULT)STATIC_GetImage( hwnd, IMAGE_ICON, full_style );
|
||||||
return GetWindowLongPtrW( hwnd, HICON_GWL_OFFSET );
|
|
||||||
|
|
||||||
case STM_SETIMAGE:
|
case STM_SETIMAGE:
|
||||||
switch(wParam) {
|
switch(wParam) {
|
||||||
|
|
Loading…
Reference in New Issue