4 * Copyright David W. Metcalfe, 1993
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 * This code was audited for completeness against the documented features
23 * of Comctl32.dll version 6.0 on Oct. 4, 2004, by Dimitrie O. Paun.
25 * Unless otherwise noted, we believe this code to be complete, as per
26 * the specification mentioned above.
27 * If you discover missing features, or bugs, please note them below.
32 * - SS_REALSIZECONTROL
41 * - STM_SETIMAGE: IMAGE_CURSOR
49 #include "wine/winuser16.h"
51 #include "user_private.h"
52 #include "wine/debug.h"
54 WINE_DEFAULT_DEBUG_CHANNEL(static);
56 static void STATIC_PaintOwnerDrawfn( HWND hwnd
, HDC hdc
, DWORD style
);
57 static void STATIC_PaintTextfn( HWND hwnd
, HDC hdc
, DWORD style
);
58 static void STATIC_PaintRectfn( HWND hwnd
, HDC hdc
, DWORD style
);
59 static void STATIC_PaintIconfn( HWND hwnd
, HDC hdc
, DWORD style
);
60 static void STATIC_PaintBitmapfn( HWND hwnd
, HDC hdc
, DWORD style
);
61 static void STATIC_PaintEnhMetafn( HWND hwnd
, HDC hdc
, DWORD style
);
62 static void STATIC_PaintEtchedfn( HWND hwnd
, HDC hdc
, DWORD style
);
63 static LRESULT WINAPI
StaticWndProcA( HWND hWnd
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
);
64 static LRESULT WINAPI
StaticWndProcW( HWND hWnd
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
);
66 static COLORREF color_3dshadow
, color_3ddkshadow
, color_3dhighlight
;
68 /* offsets for GetWindowLong for static private information */
69 #define HFONT_GWL_OFFSET 0
70 #define HICON_GWL_OFFSET (sizeof(HFONT))
71 #define STATIC_EXTRA_BYTES (HICON_GWL_OFFSET + sizeof(HICON))
73 typedef void (*pfPaint
)( HWND hwnd
, HDC hdc
, DWORD style
);
75 static pfPaint staticPaintFunc
[SS_TYPEMASK
+1] =
77 STATIC_PaintTextfn
, /* SS_LEFT */
78 STATIC_PaintTextfn
, /* SS_CENTER */
79 STATIC_PaintTextfn
, /* SS_RIGHT */
80 STATIC_PaintIconfn
, /* SS_ICON */
81 STATIC_PaintRectfn
, /* SS_BLACKRECT */
82 STATIC_PaintRectfn
, /* SS_GRAYRECT */
83 STATIC_PaintRectfn
, /* SS_WHITERECT */
84 STATIC_PaintRectfn
, /* SS_BLACKFRAME */
85 STATIC_PaintRectfn
, /* SS_GRAYFRAME */
86 STATIC_PaintRectfn
, /* SS_WHITEFRAME */
87 NULL
, /* SS_USERITEM */
88 STATIC_PaintTextfn
, /* SS_SIMPLE */
89 STATIC_PaintTextfn
, /* SS_LEFTNOWORDWRAP */
90 STATIC_PaintOwnerDrawfn
, /* SS_OWNERDRAW */
91 STATIC_PaintBitmapfn
, /* SS_BITMAP */
92 STATIC_PaintEnhMetafn
, /* SS_ENHMETAFILE */
93 STATIC_PaintEtchedfn
, /* SS_ETCHEDHORZ */
94 STATIC_PaintEtchedfn
, /* SS_ETCHEDVERT */
95 STATIC_PaintEtchedfn
, /* SS_ETCHEDFRAME */
99 /*********************************************************************
100 * static class descriptor
102 const struct builtin_class_descr STATIC_builtin_class
=
105 CS_DBLCLKS
| CS_PARENTDC
, /* style */
106 StaticWndProcA
, /* procA */
107 StaticWndProcW
, /* procW */
108 STATIC_EXTRA_BYTES
, /* extra */
109 IDC_ARROW
, /* cursor */
114 /***********************************************************************
117 * Set the icon for an SS_ICON control.
119 static HICON
STATIC_SetIcon( HWND hwnd
, HICON hicon
, DWORD style
)
122 CURSORICONINFO
*info
= hicon
?(CURSORICONINFO
*) GlobalLock16(HICON_16(hicon
)):NULL
;
124 if ((style
& SS_TYPEMASK
) != SS_ICON
) return 0;
125 if (hicon
&& !info
) {
126 ERR("hicon != 0, but info == 0\n");
129 prevIcon
= (HICON
)SetWindowLongPtrW( hwnd
, HICON_GWL_OFFSET
, (LONG_PTR
)hicon
);
130 if (hicon
&& !(style
& SS_CENTERIMAGE
))
132 SetWindowPos( hwnd
, 0, 0, 0, info
->nWidth
, info
->nHeight
,
133 SWP_NOACTIVATE
| SWP_NOMOVE
| SWP_NOZORDER
);
134 GlobalUnlock16(HICON_16(hicon
));
139 /***********************************************************************
142 * Set the bitmap for an SS_BITMAP control.
144 static HBITMAP
STATIC_SetBitmap( HWND hwnd
, HBITMAP hBitmap
, DWORD style
)
148 if ((style
& SS_TYPEMASK
) != SS_BITMAP
) return 0;
149 if (hBitmap
&& GetObjectType(hBitmap
) != OBJ_BITMAP
) {
150 ERR("hBitmap != 0, but it's not a bitmap\n");
153 hOldBitmap
= (HBITMAP
)SetWindowLongPtrW( hwnd
, HICON_GWL_OFFSET
, (LONG_PTR
)hBitmap
);
154 if (hBitmap
&& !(style
& SS_CENTERIMAGE
))
157 GetObjectW(hBitmap
, sizeof(bm
), &bm
);
158 SetWindowPos( hwnd
, 0, 0, 0, bm
.bmWidth
, bm
.bmHeight
,
159 SWP_NOACTIVATE
| SWP_NOMOVE
| SWP_NOZORDER
);
164 /***********************************************************************
165 * STATIC_SetEnhMetaFile
167 * Set the enhanced metafile for an SS_ENHMETAFILE control.
169 static HENHMETAFILE
STATIC_SetEnhMetaFile( HWND hwnd
, HENHMETAFILE hEnhMetaFile
, DWORD style
)
171 if ((style
& SS_TYPEMASK
) != SS_ENHMETAFILE
) return 0;
172 if (hEnhMetaFile
&& GetObjectType(hEnhMetaFile
) != OBJ_ENHMETAFILE
) {
173 ERR("hEnhMetaFile != 0, but it's not an enhanced metafile\n");
176 return (HENHMETAFILE
)SetWindowLongPtrW( hwnd
, HICON_GWL_OFFSET
, (LONG_PTR
)hEnhMetaFile
);
179 /***********************************************************************
182 * Load the icon for an SS_ICON control.
184 static HICON
STATIC_LoadIconA( HWND hwnd
, LPCSTR name
)
186 HINSTANCE hInstance
= (HINSTANCE
)GetWindowLongPtrW( hwnd
, GWLP_HINSTANCE
);
187 HICON hicon
= LoadIconA( hInstance
, name
);
188 if (!hicon
) hicon
= LoadIconA( 0, name
);
192 /***********************************************************************
195 * Load the icon for an SS_ICON control.
197 static HICON
STATIC_LoadIconW( HWND hwnd
, LPCWSTR name
)
199 HINSTANCE hInstance
= (HINSTANCE
)GetWindowLongPtrW( hwnd
, GWLP_HINSTANCE
);
200 HICON hicon
= LoadIconW( hInstance
, name
);
201 if (!hicon
) hicon
= LoadIconW( 0, name
);
205 /***********************************************************************
208 * Load the bitmap for an SS_BITMAP control.
210 static HBITMAP
STATIC_LoadBitmapA( HWND hwnd
, LPCSTR name
)
212 HINSTANCE hInstance
= (HINSTANCE
)GetWindowLongPtrW( hwnd
, GWLP_HINSTANCE
);
213 HBITMAP hbitmap
= LoadBitmapA( hInstance
, name
);
214 if (!hbitmap
) /* Try OEM icon (FIXME: is this right?) */
215 hbitmap
= LoadBitmapA( 0, name
);
219 /***********************************************************************
222 * Load the bitmap for an SS_BITMAP control.
224 static HBITMAP
STATIC_LoadBitmapW( HWND hwnd
, LPCWSTR name
)
226 HINSTANCE hInstance
= (HINSTANCE
)GetWindowLongPtrW( hwnd
, GWLP_HINSTANCE
);
227 HBITMAP hbitmap
= LoadBitmapW( hInstance
, name
);
228 if (!hbitmap
) /* Try OEM icon (FIXME: is this right?) */
229 hbitmap
= LoadBitmapW( 0, name
);
233 /***********************************************************************
236 * Try to immediately paint the control.
238 static VOID
STATIC_TryPaintFcn(HWND hwnd
, LONG full_style
)
240 LONG style
= full_style
& SS_TYPEMASK
;
243 GetClientRect( hwnd
, &rc
);
244 if (!IsRectEmpty(&rc
) && IsWindowVisible(hwnd
) && staticPaintFunc
[style
])
248 (staticPaintFunc
[style
])( hwnd
, hdc
, full_style
);
249 ReleaseDC( hwnd
, hdc
);
253 static HBRUSH
STATIC_SendWmCtlColorStatic(HWND hwnd
, HDC hdc
)
255 HBRUSH hBrush
= (HBRUSH
) SendMessageW( GetParent(hwnd
),
256 WM_CTLCOLORSTATIC
, (WPARAM
)hdc
, (LPARAM
)hwnd
);
257 if (!hBrush
) /* did the app forget to call DefWindowProc ? */
259 /* FIXME: DefWindowProc should return different colors if a
260 manifest is present */
261 hBrush
= (HBRUSH
)DefWindowProcW(GetParent(hwnd
), WM_CTLCOLORSTATIC
,
262 (WPARAM
)hdc
, (LPARAM
)hwnd
);
267 static VOID
STATIC_InitColours(void)
269 color_3ddkshadow
= GetSysColor(COLOR_3DDKSHADOW
);
270 color_3dshadow
= GetSysColor(COLOR_3DSHADOW
);
271 color_3dhighlight
= GetSysColor(COLOR_3DHIGHLIGHT
);
274 /***********************************************************************
275 * StaticWndProc_common
277 static LRESULT
StaticWndProc_common( HWND hwnd
, UINT uMsg
, WPARAM wParam
,
278 LPARAM lParam
, BOOL unicode
)
281 LONG full_style
= GetWindowLongW( hwnd
, GWL_STYLE
);
282 LONG style
= full_style
& SS_TYPEMASK
;
287 if (style
< 0L || style
> SS_TYPEMASK
)
289 ERR("Unknown style 0x%02lx\n", style
);
292 STATIC_InitColours();
296 if (style
== SS_ICON
) {
299 * DestroyIcon32( STATIC_SetIcon( wndPtr, 0 ) );
301 * We don't want to do this yet because DestroyIcon32 is broken. If the icon
302 * had already been loaded by the application the last thing we want to do is
303 * GlobalFree16 the handle.
307 else return unicode
? DefWindowProcW(hwnd
, uMsg
, wParam
, lParam
) :
308 DefWindowProcA(hwnd
, uMsg
, wParam
, lParam
);
314 HDC hdc
= wParam
? (HDC
)wParam
: BeginPaint(hwnd
, &ps
);
315 if (staticPaintFunc
[style
])
316 (staticPaintFunc
[style
])( hwnd
, hdc
, full_style
);
317 if (!wParam
) EndPaint(hwnd
, &ps
);
322 InvalidateRect(hwnd
, NULL
, TRUE
);
325 case WM_SYSCOLORCHANGE
:
326 STATIC_InitColours();
327 InvalidateRect(hwnd
, NULL
, TRUE
);
331 if (full_style
& SS_SUNKEN
)
332 SetWindowLongW( hwnd
, GWL_EXSTYLE
,
333 GetWindowLongW( hwnd
, GWL_EXSTYLE
) | WS_EX_STATICEDGE
);
336 lParam
= (LPARAM
)(((LPCREATESTRUCTW
)lParam
)->lpszName
);
338 lParam
= (LPARAM
)(((LPCREATESTRUCTA
)lParam
)->lpszName
);
346 hIcon
= STATIC_LoadIconW(hwnd
, (LPCWSTR
)lParam
);
348 hIcon
= STATIC_LoadIconA(hwnd
, (LPCSTR
)lParam
);
349 /* FIXME : should we also return the previous hIcon here ??? */
350 STATIC_SetIcon(hwnd
, hIcon
, full_style
);
357 hBitmap
= STATIC_LoadBitmapW(hwnd
, (LPCWSTR
)lParam
);
359 hBitmap
= STATIC_LoadBitmapA(hwnd
, (LPCSTR
)lParam
);
360 STATIC_SetBitmap(hwnd
, hBitmap
, full_style
);
363 /* SS_ENHMETAFILE: Despite what MSDN says, Windows does not load
364 the enhanced metafile that was specified as the window text. */
370 case SS_LEFTNOWORDWRAP
:
375 lResult
= DefWindowProcW( hwnd
, WM_SETTEXT
, wParam
, lParam
);
377 lResult
= DefWindowProcA( hwnd
, WM_SETTEXT
, wParam
, lParam
);
379 if (uMsg
== WM_SETTEXT
)
380 STATIC_TryPaintFcn( hwnd
, full_style
);
387 lResult
= DefWindowProcW( hwnd
, WM_SETTEXT
, wParam
, lParam
);
389 lResult
= DefWindowProcA( hwnd
, WM_SETTEXT
, wParam
, lParam
);
391 if(uMsg
== WM_SETTEXT
)
392 InvalidateRect(hwnd
, NULL
, TRUE
);
394 return 1; /* success. FIXME: check text length */
397 if ((style
== SS_ICON
) || (style
== SS_BITMAP
)) return 0;
398 SetWindowLongPtrW( hwnd
, HFONT_GWL_OFFSET
, wParam
);
400 InvalidateRect( hwnd
, NULL
, TRUE
);
404 return GetWindowLongPtrW( hwnd
, HFONT_GWL_OFFSET
);
407 if (full_style
& SS_NOTIFY
)
410 return HTTRANSPARENT
;
416 case WM_NCLBUTTONDOWN
:
417 if (full_style
& SS_NOTIFY
)
418 SendMessageW( GetParent(hwnd
), WM_COMMAND
,
419 MAKEWPARAM( GetWindowLongPtrW(hwnd
,GWLP_ID
), STN_CLICKED
), (LPARAM
)hwnd
);
422 case WM_LBUTTONDBLCLK
:
423 case WM_NCLBUTTONDBLCLK
:
424 if (full_style
& SS_NOTIFY
)
425 SendMessageW( GetParent(hwnd
), WM_COMMAND
,
426 MAKEWPARAM( GetWindowLongPtrW(hwnd
,GWLP_ID
), STN_DBLCLK
), (LPARAM
)hwnd
);
430 /* FIXME: Return NULL if wParam doesn't match the control's style.
431 wParam is IMAGE_BITMAP, IMAGE_CURSOR, IMAGE_ENHMETAFILE
435 /* FIXME: Return NULL if this control doesn't show an icon */
436 return GetWindowLongPtrW( hwnd
, HICON_GWL_OFFSET
);
441 lResult
= (LRESULT
)STATIC_SetBitmap( hwnd
, (HBITMAP
)lParam
, full_style
);
444 FIXME("STM_SETIMAGE: Unhandled type IMAGE_CURSOR\n");
446 case IMAGE_ENHMETAFILE
:
447 lResult
= (LRESULT
)STATIC_SetEnhMetaFile( hwnd
, (HENHMETAFILE
)lParam
, full_style
);
450 lResult
= (LRESULT
)STATIC_SetIcon( hwnd
, (HICON
)lParam
, full_style
);
453 FIXME("STM_SETIMAGE: Unhandled type %x\n", wParam
);
456 InvalidateRect( hwnd
, NULL
, TRUE
);
461 lResult
= (LRESULT
)STATIC_SetIcon( hwnd
, (HICON
)wParam
, full_style
);
462 InvalidateRect( hwnd
, NULL
, TRUE
);
466 return unicode
? DefWindowProcW(hwnd
, uMsg
, wParam
, lParam
) :
467 DefWindowProcA(hwnd
, uMsg
, wParam
, lParam
);
472 /***********************************************************************
475 static LRESULT WINAPI
StaticWndProcA( HWND hWnd
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
477 if (!IsWindow( hWnd
)) return 0;
478 return StaticWndProc_common(hWnd
, uMsg
, wParam
, lParam
, FALSE
);
481 /***********************************************************************
484 static LRESULT WINAPI
StaticWndProcW( HWND hWnd
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
486 if (!IsWindow( hWnd
)) return 0;
487 return StaticWndProc_common(hWnd
, uMsg
, wParam
, lParam
, TRUE
);
490 static void STATIC_PaintOwnerDrawfn( HWND hwnd
, HDC hdc
, DWORD style
)
493 HFONT font
, oldFont
= NULL
;
494 UINT id
= (UINT
)GetWindowLongPtrW( hwnd
, GWLP_ID
);
496 dis
.CtlType
= ODT_STATIC
;
499 dis
.itemAction
= ODA_DRAWENTIRE
;
500 dis
.itemState
= IsWindowEnabled(hwnd
) ? 0 : ODS_DISABLED
;
504 GetClientRect( hwnd
, &dis
.rcItem
);
506 font
= (HFONT
)GetWindowLongPtrW( hwnd
, HFONT_GWL_OFFSET
);
507 if (font
) oldFont
= SelectObject( hdc
, font
);
508 SendMessageW( GetParent(hwnd
), WM_CTLCOLORSTATIC
, (WPARAM
)hdc
, (LPARAM
)hwnd
);
509 SendMessageW( GetParent(hwnd
), WM_DRAWITEM
, id
, (LPARAM
)&dis
);
510 if (font
) SelectObject( hdc
, oldFont
);
513 static void STATIC_PaintTextfn( HWND hwnd
, HDC hdc
, DWORD style
)
517 HFONT hFont
, hOldFont
= NULL
;
522 GetClientRect( hwnd
, &rc
);
524 switch (style
& SS_TYPEMASK
)
527 wFormat
= DT_LEFT
| DT_EXPANDTABS
| DT_WORDBREAK
;
531 wFormat
= DT_CENTER
| DT_EXPANDTABS
| DT_WORDBREAK
;
535 wFormat
= DT_RIGHT
| DT_EXPANDTABS
| DT_WORDBREAK
;
539 wFormat
= DT_LEFT
| DT_SINGLELINE
;
542 case SS_LEFTNOWORDWRAP
:
543 wFormat
= DT_LEFT
| DT_EXPANDTABS
;
550 if (style
& SS_NOPREFIX
)
551 wFormat
|= DT_NOPREFIX
;
553 if ((style
& SS_TYPEMASK
) != SS_SIMPLE
)
555 if (style
& SS_CENTERIMAGE
)
556 wFormat
|= DT_SINGLELINE
| DT_VCENTER
;
557 if (style
& SS_EDITCONTROL
)
558 wFormat
|= DT_EDITCONTROL
;
559 if (style
& SS_ENDELLIPSIS
)
560 wFormat
|= DT_SINGLELINE
| DT_END_ELLIPSIS
;
561 if (style
& SS_PATHELLIPSIS
)
562 wFormat
|= DT_SINGLELINE
| DT_PATH_ELLIPSIS
;
563 if (style
& SS_WORDELLIPSIS
)
564 wFormat
|= DT_SINGLELINE
| DT_WORD_ELLIPSIS
;
567 if ((hFont
= (HFONT
)GetWindowLongPtrW( hwnd
, HFONT_GWL_OFFSET
)))
568 hOldFont
= (HFONT
)SelectObject( hdc
, hFont
);
570 /* SS_SIMPLE controls: WM_CTLCOLORSTATIC is sent, but the returned
572 hBrush
= STATIC_SendWmCtlColorStatic(hwnd
, hdc
);
574 if ((style
& SS_TYPEMASK
) != SS_SIMPLE
)
576 FillRect( hdc
, &rc
, hBrush
);
577 if (!IsWindowEnabled(hwnd
)) SetTextColor(hdc
, GetSysColor(COLOR_GRAYTEXT
));
580 if (!(len
= SendMessageW( hwnd
, WM_GETTEXTLENGTH
, 0, 0 ))) return;
581 if (!(text
= HeapAlloc( GetProcessHeap(), 0, (len
+ 1) * sizeof(WCHAR
) ))) return;
582 SendMessageW( hwnd
, WM_GETTEXT
, len
+ 1, (LPARAM
)text
);
584 if (((style
& SS_TYPEMASK
) == SS_SIMPLE
) && (style
& SS_NOPREFIX
))
586 /* Windows uses the faster ExtTextOut() to draw the text and
587 to paint the whole client rectangle with the text background
588 color. Reference: "Static Controls" by Kyle Marsh, 1992 */
589 ExtTextOutW( hdc
, rc
.left
, rc
.top
, ETO_CLIPPED
| ETO_OPAQUE
,
590 &rc
, text
, len
, NULL
);
594 DrawTextW( hdc
, text
, -1, &rc
, wFormat
);
597 HeapFree( GetProcessHeap(), 0, text
);
600 SelectObject( hdc
, hOldFont
);
603 static void STATIC_PaintRectfn( HWND hwnd
, HDC hdc
, DWORD style
)
608 GetClientRect( hwnd
, &rc
);
610 switch (style
& SS_TYPEMASK
)
613 hBrush
= CreateSolidBrush(color_3ddkshadow
);
614 FillRect( hdc
, &rc
, hBrush
);
617 hBrush
= CreateSolidBrush(color_3dshadow
);
618 FillRect( hdc
, &rc
, hBrush
);
621 hBrush
= CreateSolidBrush(color_3dhighlight
);
622 FillRect( hdc
, &rc
, hBrush
);
625 hBrush
= CreateSolidBrush(color_3ddkshadow
);
626 FrameRect( hdc
, &rc
, hBrush
);
629 hBrush
= CreateSolidBrush(color_3dshadow
);
630 FrameRect( hdc
, &rc
, hBrush
);
633 hBrush
= CreateSolidBrush(color_3dhighlight
);
634 FrameRect( hdc
, &rc
, hBrush
);
639 DeleteObject( hBrush
);
643 static void STATIC_PaintIconfn( HWND hwnd
, HDC hdc
, DWORD style
)
650 GetClientRect( hwnd
, &rc
);
651 hbrush
= (HBRUSH
)SendMessageW( GetParent(hwnd
), WM_CTLCOLORSTATIC
,
652 (WPARAM
)hdc
, (LPARAM
)hwnd
);
653 FillRect( hdc
, &rc
, hbrush
);
654 hIcon
= (HICON
)GetWindowLongPtrW( hwnd
, HICON_GWL_OFFSET
);
655 if (style
& SS_CENTERIMAGE
)
657 CURSORICONINFO
*info
= hIcon
? (CURSORICONINFO
*)GlobalLock16(HICON_16(hIcon
)) : NULL
;
658 x
= (rc
.right
- rc
.left
)/2 - (info
? info
->nWidth
/2 : 0);
659 y
= (rc
.bottom
- rc
.top
)/2 - (info
? info
->nHeight
/2 : 0);
667 DrawIcon( hdc
, x
, y
, hIcon
);
670 static void STATIC_PaintBitmapfn(HWND hwnd
, HDC hdc
, DWORD style
)
673 HBITMAP hBitmap
, oldbitmap
;
675 /* message is still sent, even if the returned brush is not used */
676 SendMessageW( GetParent(hwnd
), WM_CTLCOLORSTATIC
,
677 (WPARAM
)hdc
, (LPARAM
)hwnd
);
679 if ((hBitmap
= (HBITMAP
)GetWindowLongPtrW( hwnd
, HICON_GWL_OFFSET
)))
684 if(GetObjectType(hBitmap
) != OBJ_BITMAP
) return;
685 if (!(hMemDC
= CreateCompatibleDC( hdc
))) return;
686 GetObjectW(hBitmap
, sizeof(bm
), &bm
);
687 oldbitmap
= SelectObject(hMemDC
, hBitmap
);
688 if (style
& SS_CENTERIMAGE
)
691 GetClientRect(hwnd
, &rcClient
);
692 x
= (rcClient
.right
- rcClient
.left
)/2 - bm
.bmWidth
/2;
693 y
= (rcClient
.bottom
- rcClient
.top
)/2 - bm
.bmHeight
/2;
700 BitBlt(hdc
, x
, y
, bm
.bmWidth
, bm
.bmHeight
, hMemDC
, 0, 0,
702 SelectObject(hMemDC
, oldbitmap
);
708 static void STATIC_PaintEnhMetafn(HWND hwnd
, HDC hdc
, DWORD style
)
710 HENHMETAFILE hEnhMetaFile
;
714 GetClientRect(hwnd
, &rc
);
715 hbrush
= STATIC_SendWmCtlColorStatic(hwnd
, hdc
);
716 FillRect(hdc
, &rc
, hbrush
);
717 if ((hEnhMetaFile
= (HENHMETAFILE
)GetWindowLongPtrW( hwnd
, HICON_GWL_OFFSET
)))
719 /* The control's current font is not selected into the
721 if (GetObjectType(hEnhMetaFile
) == OBJ_ENHMETAFILE
)
722 PlayEnhMetaFile(hdc
, hEnhMetaFile
, &rc
);
727 static void STATIC_PaintEtchedfn( HWND hwnd
, HDC hdc
, DWORD style
)
731 GetClientRect( hwnd
, &rc
);
732 switch (style
& SS_TYPEMASK
)
735 DrawEdge(hdc
,&rc
,EDGE_ETCHED
,BF_TOP
|BF_BOTTOM
);
738 DrawEdge(hdc
,&rc
,EDGE_ETCHED
,BF_LEFT
|BF_RIGHT
);
741 DrawEdge (hdc
, &rc
, EDGE_ETCHED
, BF_RECT
);