Michael Kaufmann : static control: Better STM_GETIMAGE.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Jan 17 09:29:38 CST 2006


Module: wine
Branch: refs/heads/master
Commit: 2b8cda7162263faae59e4afc5b4aca0d7c467046
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=2b8cda7162263faae59e4afc5b4aca0d7c467046

Author: Michael Kaufmann <hallo at michael-kaufmann.ch>
Date:   Tue Jan 17 16:05:25 2006 +0100

static control: Better STM_GETIMAGE.
STM_GETIMAGE returns NULL if the given image type doesn't match the
control's style.

---

 dlls/user/static.c |   34 +++++++++++++++++++++++++++++-----
 1 files changed, 29 insertions(+), 5 deletions(-)

diff --git a/dlls/user/static.c b/dlls/user/static.c
index 4281a6a..bd28668 100644
--- a/dlls/user/static.c
+++ b/dlls/user/static.c
@@ -201,6 +201,32 @@ static HENHMETAFILE STATIC_SetEnhMetaFil
 }
 
 /***********************************************************************
+ *           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
  *
  * Load the icon for an SS_ICON control.
@@ -473,13 +499,11 @@ static LRESULT StaticWndProc_common( HWN
         return 0;
 
     case STM_GETIMAGE:
-        /* FIXME: Return NULL if wParam doesn't match the control's style.
-                  wParam is IMAGE_BITMAP, IMAGE_CURSOR, IMAGE_ENHMETAFILE
-                  or IMAGE_ICON */
+        return (LRESULT)STATIC_GetImage( hwnd, wParam, full_style );
+    
     case STM_GETICON16:
     case STM_GETICON:
-        /* FIXME: Return NULL if this control doesn't show an icon */
-        return GetWindowLongPtrW( hwnd, HICON_GWL_OFFSET );
+        return (LRESULT)STATIC_GetImage( hwnd, IMAGE_ICON, full_style );
 
     case STM_SETIMAGE:
         switch(wParam) {




More information about the wine-cvs mailing list