Michael Kaufmann : static control: Support SS_REALSIZECONTROL.

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


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

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

static control: Support SS_REALSIZECONTROL.
- Support SS_REALSIZECONTROL (this flag means "don't resize the
  control to the size of the bitmap/icon").
- Always call GlobalUnlock16 after GlobalLock16.

---

 dlls/user/static.c |   55 ++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 40 insertions(+), 15 deletions(-)

diff --git a/dlls/user/static.c b/dlls/user/static.c
index a3483c6..0b8cb29 100644
--- a/dlls/user/static.c
+++ b/dlls/user/static.c
@@ -29,7 +29,6 @@
  * TODO:
  *
  *   Styles
- *   - SS_REALSIZECONTROL
  *   - SS_REALSIZEIMAGE
  *   - SS_RIGHTJUST
  *
@@ -119,20 +118,33 @@ const struct builtin_class_descr STATIC_
 static HICON STATIC_SetIcon( HWND hwnd, HICON hicon, DWORD style )
 {
     HICON prevIcon;
-    CURSORICONINFO *info = hicon?(CURSORICONINFO *) GlobalLock16(HICON_16(hicon)):NULL;
-
+    CURSORICONINFO * info;
+    
     if ((style & SS_TYPEMASK) != SS_ICON) return 0;
+    info = hicon?(CURSORICONINFO *) GlobalLock16(HICON_16(hicon)):NULL;
     if (hicon && !info) {
-	ERR("hicon != 0, but info == 0\n");
-    	return 0;
+        WARN("hicon != 0, but info == 0\n");
+        return 0;
     }
     prevIcon = (HICON)SetWindowLongPtrW( hwnd, HICON_GWL_OFFSET, (LONG_PTR)hicon );
-    if (hicon && !(style & SS_CENTERIMAGE))
+    if (hicon && !(style & SS_CENTERIMAGE) && !(style & SS_REALSIZECONTROL))
     {
-        SetWindowPos( hwnd, 0, 0, 0, info->nWidth, info->nHeight,
-                        SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER );
-        GlobalUnlock16(HICON_16(hicon));
+        /* Windows currently doesn't implement SS_RIGHTJUST */
+        /*
+        if ((style & SS_RIGHTJUST) != 0)
+        {
+            RECT wr;
+            GetWindowRect(hwnd, &wr);
+            SetWindowPos( hwnd, 0, wr.right - info->nWidth, wr.bottom - info->nHeight,
+                          info->nWidth, info->nHeight, SWP_NOACTIVATE | SWP_NOZORDER );
+        }
+        else */
+        {
+            SetWindowPos( hwnd, 0, 0, 0, info->nWidth, info->nHeight,
+                          SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER );
+        }
     }
+    if (info) GlobalUnlock16(HICON_16(hicon));
     return prevIcon;
 }
 
@@ -147,16 +159,29 @@ static HBITMAP STATIC_SetBitmap( HWND hw
 
     if ((style & SS_TYPEMASK) != SS_BITMAP) return 0;
     if (hBitmap && GetObjectType(hBitmap) != OBJ_BITMAP) {
-	ERR("hBitmap != 0, but it's not a bitmap\n");
-    	return 0;
+        WARN("hBitmap != 0, but it's not a bitmap\n");
+        return 0;
     }
     hOldBitmap = (HBITMAP)SetWindowLongPtrW( hwnd, HICON_GWL_OFFSET, (LONG_PTR)hBitmap );
-    if (hBitmap && !(style & SS_CENTERIMAGE))
+    if (hBitmap && !(style & SS_CENTERIMAGE) && !(style & SS_REALSIZECONTROL))
     {
         BITMAP bm;
         GetObjectW(hBitmap, sizeof(bm), &bm);
-        SetWindowPos( hwnd, 0, 0, 0, bm.bmWidth, bm.bmHeight,
-		      SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER );
+        /* Windows currently doesn't implement SS_RIGHTJUST */
+        /*
+        if ((style & SS_RIGHTJUST) != 0)
+        {
+            RECT wr;
+            GetWindowRect(hwnd, &wr);
+            SetWindowPos( hwnd, 0, wr.right - bm.bmWidth, wr.bottom - bm.bmHeight,
+                          bm.bmWidth, bm.bmHeight, SWP_NOACTIVATE | SWP_NOZORDER );
+        }
+        else */
+        {
+            SetWindowPos( hwnd, 0, 0, 0, bm.bmWidth, bm.bmHeight,
+                          SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER );
+        }
+	
     }
     return hOldBitmap;
 }
@@ -170,7 +195,7 @@ static HENHMETAFILE STATIC_SetEnhMetaFil
 {
     if ((style & SS_TYPEMASK) != SS_ENHMETAFILE) return 0;
     if (hEnhMetaFile && GetObjectType(hEnhMetaFile) != OBJ_ENHMETAFILE) {
-        ERR("hEnhMetaFile != 0, but it's not an enhanced metafile\n");
+        WARN("hEnhMetaFile != 0, but it's not an enhanced metafile\n");
         return 0;
     }
     return (HENHMETAFILE)SetWindowLongPtrW( hwnd, HICON_GWL_OFFSET, (LONG_PTR)hEnhMetaFile );




More information about the wine-cvs mailing list