ReactOS 0.4.15-dev-5669-g09dde2c
static.c File Reference
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "commctrl.h"
#include "wine/debug.h"
#include "comctl32.h"
Include dependency graph for static.c:

Go to the source code of this file.

Macros

#define HFONT_GWL_OFFSET   0
 
#define HICON_GWL_OFFSET   (sizeof(HFONT))
 
#define STATIC_EXTRA_BYTES   (HICON_GWL_OFFSET + sizeof(HICON))
 

Typedefs

typedef void(* pfPaint) (HWND hwnd, HDC hdc, DWORD style)
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (static)
 
static void STATIC_PaintOwnerDrawfn (HWND hwnd, HDC hdc, DWORD style)
 
static void STATIC_PaintTextfn (HWND hwnd, HDC hdc, DWORD style)
 
static void STATIC_PaintRectfn (HWND hwnd, HDC hdc, DWORD style)
 
static void STATIC_PaintIconfn (HWND hwnd, HDC hdc, DWORD style)
 
static void STATIC_PaintBitmapfn (HWND hwnd, HDC hdc, DWORD style)
 
static void STATIC_PaintEnhMetafn (HWND hwnd, HDC hdc, DWORD style)
 
static void STATIC_PaintEtchedfn (HWND hwnd, HDC hdc, DWORD style)
 
static BOOL get_icon_size (HICON handle, SIZE *size)
 
static HICON STATIC_SetIcon (HWND hwnd, HICON hicon, DWORD style)
 
static HBITMAP STATIC_SetBitmap (HWND hwnd, HBITMAP hBitmap, DWORD style)
 
static HENHMETAFILE STATIC_SetEnhMetaFile (HWND hwnd, HENHMETAFILE hEnhMetaFile, DWORD style)
 
static HANDLE STATIC_GetImage (HWND hwnd, WPARAM wParam, DWORD style)
 
static HICON STATIC_LoadIconW (HINSTANCE hInstance, LPCWSTR name, DWORD style)
 
static VOID STATIC_TryPaintFcn (HWND hwnd, LONG full_style)
 
static HBRUSH STATIC_SendWmCtlColorStatic (HWND hwnd, HDC hdc)
 
static BOOL hasTextStyle (DWORD style)
 
static LRESULT CALLBACK STATIC_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
void STATIC_Register (void)
 

Variables

static const pfPaint staticPaintFunc [SS_TYPEMASK+1]
 

Macro Definition Documentation

◆ HFONT_GWL_OFFSET

#define HFONT_GWL_OFFSET   0

Definition at line 59 of file static.c.

◆ HICON_GWL_OFFSET

#define HICON_GWL_OFFSET   (sizeof(HFONT))

Definition at line 60 of file static.c.

◆ STATIC_EXTRA_BYTES

#define STATIC_EXTRA_BYTES   (HICON_GWL_OFFSET + sizeof(HICON))

Definition at line 61 of file static.c.

Typedef Documentation

◆ pfPaint

typedef void(* pfPaint) (HWND hwnd, HDC hdc, DWORD style)

Definition at line 63 of file static.c.

Function Documentation

◆ get_icon_size()

static BOOL get_icon_size ( HICON  handle,
SIZE size 
)
static

Definition at line 88 of file static.c.

89{
91 BITMAP bmp;
92 int ret;
93
94 if (!GetIconInfo(handle, &info))
95 return FALSE;
96
97#ifdef __REACTOS__
98 ret = GetObjectW(info.hbmMask, sizeof(bmp), &bmp);
99#else
100 ret = GetObjectW(info.hbmColor, sizeof(bmp), &bmp);
101#endif
102 if (ret)
103 {
104 size->cx = bmp.bmWidth;
105 size->cy = bmp.bmHeight;
106#ifdef __REACTOS__
107 /*
108 If this structure defines a black and white icon, this bitmask is formatted
109 so that the upper half is the icon AND bitmask and the lower half is
110 the icon XOR bitmask.
111 */
112 if (!info.hbmColor)
113 size->cy /= 2;
114#endif
115 }
116
117 DeleteObject(info.hbmMask);
118 DeleteObject(info.hbmColor);
119
120 return !!ret;
121}
#define FALSE
Definition: types.h:117
pKey DeleteObject()
GLsizeiptr size
Definition: glext.h:5919
BITMAP bmp
Definition: alphablend.c:62
Definition: bl.h:1331
int ret
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
BOOL WINAPI GetIconInfo(_In_ HICON, _Out_ PICONINFO)
Definition: cursoricon.c:2014

Referenced by IntDrawState(), STATIC_PaintIconfn(), and STATIC_SetIcon().

◆ hasTextStyle()

static BOOL hasTextStyle ( DWORD  style)
static

Definition at line 311 of file static.c.

312{
313 switch (style & SS_TYPEMASK)
314 {
315 case SS_SIMPLE:
316 case SS_LEFT:
318 case SS_CENTER:
319 case SS_RIGHT:
320 case SS_OWNERDRAW:
321 return TRUE;
322 }
323
324 return FALSE;
325}
Arabic default style
Definition: afstyles.h:94
#define TRUE
Definition: types.h:120
#define SS_RIGHT
Definition: pedump.c:694
#define SS_SIMPLE
Definition: pedump.c:702
#define SS_LEFTNOWORDWRAP
Definition: pedump.c:703
#define SS_CENTER
Definition: pedump.c:693
#define SS_LEFT
Definition: pedump.c:692
#define SS_OWNERDRAW
Definition: winuser.h:352
#define SS_TYPEMASK
Definition: winuser.h:362

Referenced by STATIC_WindowProc(), and StaticWndProc_common().

◆ STATIC_GetImage()

static HANDLE STATIC_GetImage ( HWND  hwnd,
WPARAM  wParam,
DWORD  style 
)
static

Definition at line 219 of file static.c.

220{
221 switch (style & SS_TYPEMASK)
222 {
223 case SS_ICON:
224 if ((wParam != IMAGE_ICON) &&
225 (wParam != IMAGE_CURSOR)) return NULL;
226 break;
227 case SS_BITMAP:
228 if (wParam != IMAGE_BITMAP) return NULL;
229 break;
230 case SS_ENHMETAFILE:
231 if (wParam != IMAGE_ENHMETAFILE) return NULL;
232 break;
233 default:
234 return NULL;
235 }
237}
WPARAM wParam
Definition: combotst.c:138
#define NULL
Definition: types.h:112
#define HICON_GWL_OFFSET
Definition: static.c:60
#define SS_BITMAP
Definition: pedump.c:704
#define SS_ICON
Definition: pedump.c:695
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define IMAGE_BITMAP
Definition: winuser.h:211
#define GetWindowLongPtrW
Definition: winuser.h:4819
#define IMAGE_ICON
Definition: winuser.h:212
#define SS_ENHMETAFILE
Definition: winuser.h:341
#define IMAGE_ENHMETAFILE
Definition: winuser.h:214
#define IMAGE_CURSOR
Definition: winuser.h:213

Referenced by STATIC_WindowProc(), and StaticWndProc_common().

◆ STATIC_LoadIconW()

static HICON STATIC_LoadIconW ( HINSTANCE  hInstance,
LPCWSTR  name,
DWORD  style 
)
static

Definition at line 244 of file static.c.

245{
246 HICON hicon = 0;
247
248 if (hInstance && ((ULONG_PTR)hInstance >> 16))
249 {
250 if ((style & SS_REALSIZEIMAGE) != 0)
251 hicon = LoadImageW(hInstance, name, IMAGE_ICON, 0, 0, LR_SHARED);
252 else
253 {
254 hicon = LoadIconW( hInstance, name );
255 if (!hicon) hicon = LoadCursorW( hInstance, name );
256 }
257 }
258 if (!hicon) hicon = LoadIconW( 0, name );
259 /* Windows doesn't try to load a standard cursor,
260 probably because most IDs for standard cursors conflict
261 with the IDs for standard icons anyway */
262 return hicon;
263}
HINSTANCE hInstance
Definition: charmap.c:19
static HICON
Definition: imagelist.c:84
Definition: name.c:39
uint32_t ULONG_PTR
Definition: typedefs.h:65
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:2172
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2074
#define SS_REALSIZEIMAGE
Definition: winuser.h:354
#define LR_SHARED
Definition: winuser.h:1094
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2044

Referenced by STATIC_WindowProc(), and StaticWndProc_common().

◆ STATIC_PaintBitmapfn()

static void STATIC_PaintBitmapfn ( HWND  hwnd,
HDC  hdc,
DWORD  style 
)
static

Definition at line 711 of file static.c.

712{
713 HDC hMemDC;
714 HBITMAP hBitmap, oldbitmap;
715 HBRUSH hbrush;
716
717 /* message is still sent, even if the returned brush is not used */
719
722 && (hMemDC = CreateCompatibleDC( hdc )))
723 {
724 BITMAP bm;
725 RECT rcClient;
726 LOGBRUSH brush;
727
728 GetObjectW(hBitmap, sizeof(bm), &bm);
729 oldbitmap = SelectObject(hMemDC, hBitmap);
730
731 /* Set the background color for monochrome bitmaps
732 to the color of the background brush */
733 if (GetObjectW( hbrush, sizeof(brush), &brush ))
734 {
735 if (brush.lbStyle == BS_SOLID)
736 SetBkColor(hdc, brush.lbColor);
737 }
738 GetClientRect(hwnd, &rcClient);
739 if (style & SS_CENTERIMAGE)
740 {
741 FillRect( hdc, &rcClient, hbrush );
742 rcClient.left = (rcClient.right - rcClient.left)/2 - bm.bmWidth/2;
743 rcClient.top = (rcClient.bottom - rcClient.top)/2 - bm.bmHeight/2;
744 rcClient.right = rcClient.left + bm.bmWidth;
745 rcClient.bottom = rcClient.top + bm.bmHeight;
746 }
747 StretchBlt(hdc, rcClient.left, rcClient.top, rcClient.right - rcClient.left,
748 rcClient.bottom - rcClient.top, hMemDC,
749 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY);
750 SelectObject(hMemDC, oldbitmap);
751 DeleteDC(hMemDC);
752 }
753}
static HBRUSH hbrush
static POBJECT_TYPE GetObjectType(IN PCWSTR TypeName)
Definition: ObTypes.c:15
static HBITMAP hBitmap
Definition: timezone.c:26
static HBRUSH STATIC_SendWmCtlColorStatic(HWND hwnd, HDC hdc)
Definition: static.c:290
HDC hdc
Definition: main.c:9
static HBITMAP
Definition: button.c:44
static HDC
Definition: imagelist.c:92
#define OBJ_BITMAP
Definition: objidl.idl:1415
UINT lbStyle
Definition: wingdi.h:1747
COLORREF lbColor
Definition: wingdi.h:1748
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:999
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
BOOL WINAPI StretchBlt(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_opt_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD)
#define SRCCOPY
Definition: wingdi.h:333
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
BOOL WINAPI DeleteDC(_In_ HDC)
#define BS_SOLID
Definition: wingdi.h:1086
#define SS_CENTERIMAGE
Definition: winuser.h:339
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)

◆ STATIC_PaintEnhMetafn()

static void STATIC_PaintEnhMetafn ( HWND  hwnd,
HDC  hdc,
DWORD  style 
)
static

Definition at line 755 of file static.c.

756{
757 HENHMETAFILE hEnhMetaFile;
758 RECT rc;
759 HBRUSH hbrush;
760
761 GetClientRect(hwnd, &rc);
763 FillRect(hdc, &rc, hbrush);
764 if ((hEnhMetaFile = (HENHMETAFILE)GetWindowLongPtrW( hwnd, HICON_GWL_OFFSET )))
765 {
766 /* The control's current font is not selected into the
767 device context! */
768 if (GetObjectType(hEnhMetaFile) == OBJ_ENHMETAFILE)
769 PlayEnhMetaFile(hdc, hEnhMetaFile, &rc);
770 }
771}
#define OBJ_ENHMETAFILE
Definition: objidl.idl:1421
BOOL WINAPI PlayEnhMetaFile(_In_ HDC, _In_ HENHMETAFILE, _In_ LPCRECT)

◆ STATIC_PaintEtchedfn()

static void STATIC_PaintEtchedfn ( HWND  hwnd,
HDC  hdc,
DWORD  style 
)
static

Definition at line 773 of file static.c.

774{
775 RECT rc;
776
777 /* FIXME: sometimes (not always) sends WM_CTLCOLORSTATIC */
778 GetClientRect( hwnd, &rc );
779 switch (style & SS_TYPEMASK)
780 {
781 case SS_ETCHEDHORZ:
783 break;
784 case SS_ETCHEDVERT:
786 break;
787 case SS_ETCHEDFRAME:
789 break;
790 }
791}
#define BF_LEFT
Definition: winuser.h:454
#define SS_ETCHEDFRAME
Definition: winuser.h:342
#define EDGE_ETCHED
Definition: winuser.h:452
#define SS_ETCHEDHORZ
Definition: winuser.h:343
#define BF_BOTTOM
Definition: winuser.h:457
#define SS_ETCHEDVERT
Definition: winuser.h:344
BOOL WINAPI DrawEdge(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
#define BF_TOP
Definition: winuser.h:455
#define BF_RIGHT
Definition: winuser.h:456
#define BF_RECT
Definition: winuser.h:462

◆ STATIC_PaintIconfn()

static void STATIC_PaintIconfn ( HWND  hwnd,
HDC  hdc,
DWORD  style 
)
static

Definition at line 680 of file static.c.

681{
682 RECT rc, iconRect;
683 HBRUSH hbrush;
684 HICON hIcon;
685 SIZE size;
686
687 GetClientRect( hwnd, &rc );
690 if (!hIcon || !get_icon_size( hIcon, &size ))
691 {
692 FillRect(hdc, &rc, hbrush);
693 }
694 else
695 {
696 if (style & SS_CENTERIMAGE)
697 {
698 iconRect.left = (rc.right - rc.left) / 2 - size.cx / 2;
699 iconRect.top = (rc.bottom - rc.top) / 2 - size.cy / 2;
700 iconRect.right = iconRect.left + size.cx;
701 iconRect.bottom = iconRect.top + size.cy;
702 }
703 else
704 iconRect = rc;
705 FillRect( hdc, &rc, hbrush );
706 DrawIconEx( hdc, iconRect.left, iconRect.top, hIcon, iconRect.right - iconRect.left,
707 iconRect.bottom - iconRect.top, 0, NULL, DI_NORMAL );
708 }
709}
static BOOL get_icon_size(HICON handle, SIZE *size)
Definition: static.c:88
HICON hIcon
Definition: msconfig.c:44
#define DI_NORMAL
Definition: wingdi.h:72
BOOL WINAPI DrawIconEx(_In_ HDC, _In_ int, _In_ int, _In_ HICON, _In_ int, _In_ int, _In_ UINT, _In_opt_ HBRUSH, _In_ UINT)
Definition: cursoricon.c:1997

◆ STATIC_PaintOwnerDrawfn()

static void STATIC_PaintOwnerDrawfn ( HWND  hwnd,
HDC  hdc,
DWORD  style 
)
static

Definition at line 513 of file static.c.

514{
515 DRAWITEMSTRUCT dis;
516 HFONT font, oldFont = NULL;
518
519 dis.CtlType = ODT_STATIC;
520 dis.CtlID = id;
521 dis.itemID = 0;
524 dis.hwndItem = hwnd;
525 dis.hDC = hdc;
526 dis.itemData = 0;
527 GetClientRect( hwnd, &dis.rcItem );
528
530 if (font) oldFont = SelectObject( hdc, font );
533 if (font) SelectObject( hdc, oldFont );
534}
#define HFONT_GWL_OFFSET
Definition: static.c:59
GLuint id
Definition: glext.h:5910
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
Definition: mk_font.cpp:20
unsigned int UINT
Definition: ndis.h:50
ULONG_PTR itemData
Definition: winuser.h:3083
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WPARAM
Definition: windef.h:207
#define ODS_DISABLED
Definition: winuser.h:2537
#define WM_CTLCOLORSTATIC
Definition: winuser.h:1762
#define ODA_DRAWENTIRE
Definition: winuser.h:2532
#define WM_DRAWITEM
Definition: winuser.h:1635
BOOL WINAPI IsWindowEnabled(_In_ HWND)
HWND WINAPI GetParent(_In_ HWND)
#define GWLP_ID
Definition: winuser.h:854
#define ODT_STATIC
Definition: winuser.h:2531
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

◆ STATIC_PaintRectfn()

static void STATIC_PaintRectfn ( HWND  hwnd,
HDC  hdc,
DWORD  style 
)
static

Definition at line 639 of file static.c.

640{
641 RECT rc;
642 HBRUSH hBrush;
643
644 GetClientRect( hwnd, &rc);
645
646 /* FIXME: send WM_CTLCOLORSTATIC */
647 switch (style & SS_TYPEMASK)
648 {
649 case SS_BLACKRECT:
651 FillRect( hdc, &rc, hBrush );
652 break;
653 case SS_GRAYRECT:
655 FillRect( hdc, &rc, hBrush );
656 break;
657 case SS_WHITERECT:
659 FillRect( hdc, &rc, hBrush );
660 break;
661 case SS_BLACKFRAME:
663 FrameRect( hdc, &rc, hBrush );
664 break;
665 case SS_GRAYFRAME:
667 FrameRect( hdc, &rc, hBrush );
668 break;
669 case SS_WHITEFRAME:
671 FrameRect( hdc, &rc, hBrush );
672 break;
673 default:
674 return;
675 }
676 DeleteObject( hBrush );
677}
COMCTL32_SysColor comctl32_color
Definition: commctrl.c:82
#define SS_WHITERECT
Definition: pedump.c:698
#define SS_WHITEFRAME
Definition: pedump.c:701
#define SS_BLACKRECT
Definition: pedump.c:696
#define SS_GRAYFRAME
Definition: pedump.c:700
#define SS_GRAYRECT
Definition: pedump.c:697
#define SS_BLACKFRAME
Definition: pedump.c:699
COLORREF clr3dShadow
Definition: comctl32.h:173
COLORREF clr3dDkShadow
Definition: comctl32.h:174
COLORREF clr3dHilight
Definition: comctl32.h:172
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
int WINAPI FrameRect(_In_ HDC, _In_ LPCRECT, _In_ HBRUSH)

◆ STATIC_PaintTextfn()

static void STATIC_PaintTextfn ( HWND  hwnd,
HDC  hdc,
DWORD  style 
)
static

Definition at line 536 of file static.c.

537{
538 RECT rc;
539 HBRUSH hBrush;
540 HFONT hFont, hOldFont = NULL;
541 UINT format;
542 INT len, buf_size;
543 WCHAR *text;
544
545 GetClientRect( hwnd, &rc);
546
547 switch (style & SS_TYPEMASK)
548 {
549 case SS_LEFT:
551 break;
552
553 case SS_CENTER:
555 break;
556
557 case SS_RIGHT:
559 break;
560
561 case SS_SIMPLE:
563 break;
564
567 break;
568
569 default:
570 return;
571 }
572
575
576 if (style & SS_NOPREFIX)
578
579 if ((style & SS_TYPEMASK) != SS_SIMPLE)
580 {
581 if (style & SS_CENTERIMAGE)
583 if (style & SS_EDITCONTROL)
585 if (style & SS_ENDELLIPSIS)
591 }
592
594 hOldFont = SelectObject( hdc, hFont );
595
596 /* SS_SIMPLE controls: WM_CTLCOLORSTATIC is sent, but the returned
597 brush is not used */
599
600 if ((style & SS_TYPEMASK) != SS_SIMPLE)
601 {
602 FillRect( hdc, &rc, hBrush );
604 }
605
606 buf_size = 256;
607 if (!(text = HeapAlloc( GetProcessHeap(), 0, buf_size * sizeof(WCHAR) )))
608 goto no_TextOut;
609
610 while ((len = InternalGetWindowText( hwnd, text, buf_size )) == buf_size - 1)
611 {
612 buf_size *= 2;
613 if (!(text = HeapReAlloc( GetProcessHeap(), 0, text, buf_size * sizeof(WCHAR) )))
614 goto no_TextOut;
615 }
616
617 if (!len) goto no_TextOut;
618
619 if (((style & SS_TYPEMASK) == SS_SIMPLE) && (style & SS_NOPREFIX))
620 {
621 /* Windows uses the faster ExtTextOut() to draw the text and
622 to paint the whole client rectangle with the text background
623 color. Reference: "Static Controls" by Kyle Marsh, 1992 */
625 &rc, text, len, NULL );
626 }
627 else
628 {
629 DrawTextW( hdc, text, -1, &rc, format );
630 }
631
632no_TextOut:
634
635 if (hFont)
636 SelectObject( hdc, hOldFont );
637}
HFONT hFont
Definition: main.c:53
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapReAlloc
Definition: compat.h:734
#define HeapFree(x, y, z)
Definition: compat.h:735
const WCHAR * text
Definition: package.c:1799
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
GLenum GLsizei len
Definition: glext.h:6722
INT WINAPI DrawTextW(HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
Definition: defwnd.c:17
#define SS_ENDELLIPSIS
Definition: statst2.c:8
int32_t INT
Definition: typedefs.h:58
#define ETO_CLIPPED
Definition: wingdi.h:648
BOOL WINAPI ExtTextOutW(_In_ HDC hdc, _In_ int x, _In_ int y, _In_ UINT options, _In_opt_ const RECT *lprect, _In_reads_opt_(c) LPCWSTR lpString, _In_ UINT c, _In_reads_opt_(c) const INT *lpDx)
#define ETO_OPAQUE
Definition: wingdi.h:647
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:918
DWORD WINAPI GetSysColor(_In_ int)
#define DT_NOPREFIX
Definition: winuser.h:537
#define COLOR_GRAYTEXT
Definition: winuser.h:926
#define SS_PATHELLIPSIS
Definition: winuser.h:364
#define DT_CENTER
Definition: winuser.h:527
#define DT_END_ELLIPSIS
Definition: winuser.h:529
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
#define DT_SINGLELINE
Definition: winuser.h:540
#define SS_EDITCONTROL
Definition: winuser.h:340
#define SS_NOPREFIX
Definition: winuser.h:350
#define SS_WORDELLIPSIS
Definition: winuser.h:365
#define DT_LEFT
Definition: winuser.h:534
#define DT_WORDBREAK
Definition: winuser.h:544
#define DT_VCENTER
Definition: winuser.h:543
#define DT_WORD_ELLIPSIS
Definition: winuser.h:531
#define DT_RIGHT
Definition: winuser.h:538
#define DT_EXPANDTABS
Definition: winuser.h:532
INT WINAPI InternalGetWindowText(_In_ HWND hWnd, _Out_writes_to_(cchMaxCount, return+1) LPWSTR pString, _In_ int cchMaxCount)
#define DT_EDITCONTROL
Definition: winuser.h:528
#define DT_PATH_ELLIPSIS
Definition: winuser.h:530
#define WS_EX_RIGHT
Definition: winuser.h:400
#define GWL_EXSTYLE
Definition: winuser.h:845
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ STATIC_Register()

void STATIC_Register ( void  )

Definition at line 793 of file static.c.

794{
795 WNDCLASSW wndClass;
796
797 memset(&wndClass, 0, sizeof(wndClass));
800 wndClass.cbClsExtra = 0;
802 wndClass.hCursor = LoadCursorW(0, (LPWSTR)IDC_ARROW);
803 wndClass.hbrBackground = NULL;
804 wndClass.lpszClassName = WC_STATICW;
805 RegisterClassW(&wndClass);
806}
static LRESULT CALLBACK STATIC_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: static.c:327
#define STATIC_EXTRA_BYTES
Definition: static.c:61
#define WC_STATICW
Definition: commctrl.h:4680
#define memset(x, y, z)
Definition: compat.h:39
LPCWSTR lpszClassName
Definition: winuser.h:3175
HBRUSH hbrBackground
Definition: winuser.h:3173
int cbClsExtra
Definition: winuser.h:3168
UINT style
Definition: winuser.h:3166
WNDPROC lpfnWndProc
Definition: winuser.h:3167
int cbWndExtra
Definition: winuser.h:3169
HCURSOR hCursor
Definition: winuser.h:3172
ATOM WINAPI RegisterClassW(_In_ CONST WNDCLASSW *)
#define IDC_ARROW
Definition: winuser.h:682
#define CS_DBLCLKS
Definition: winuser.h:646
#define CS_GLOBALCLASS
Definition: winuser.h:647
#define CS_PARENTDC
Definition: winuser.h:651
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by DllMain().

◆ STATIC_SendWmCtlColorStatic()

static HBRUSH STATIC_SendWmCtlColorStatic ( HWND  hwnd,
HDC  hdc 
)
static

Definition at line 290 of file static.c.

291{
292 HBRUSH hBrush;
294
295 if (!parent) parent = hwnd;
296 hBrush = (HBRUSH) SendMessageW( parent, WM_CTLCOLORSTATIC, (WPARAM)hdc, (LPARAM)hwnd );
297 if (!hBrush) /* did the app forget to call DefWindowProc ? */
298 {
299 /* FIXME: DefWindowProc should return different colors if a
300 manifest is present */
302 }
303 return hBrush;
304}
r parent
Definition: btrfs.c:3010
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by STATIC_PaintBitmapfn(), STATIC_PaintEnhMetafn(), STATIC_PaintIconfn(), STATIC_PaintOwnerDrawfn(), STATIC_PaintRectfn(), and STATIC_PaintTextfn().

◆ STATIC_SetBitmap()

static HBITMAP STATIC_SetBitmap ( HWND  hwnd,
HBITMAP  hBitmap,
DWORD  style 
)
static

Definition at line 164 of file static.c.

165{
166 HBITMAP hOldBitmap;
167
168 if ((style & SS_TYPEMASK) != SS_BITMAP) return 0;
170 {
171 WARN("hBitmap != 0, but it's not a bitmap\n");
172 return 0;
173 }
176 {
177 BITMAP bm;
178 GetObjectW(hBitmap, sizeof(bm), &bm);
179 /* Windows currently doesn't implement SS_RIGHTJUST */
180 /*
181 if ((style & SS_RIGHTJUST) != 0)
182 {
183 RECT wr;
184 GetWindowRect(hwnd, &wr);
185 SetWindowPos( hwnd, 0, wr.right - bm.bmWidth, wr.bottom - bm.bmHeight,
186 bm.bmWidth, bm.bmHeight, SWP_NOACTIVATE | SWP_NOZORDER );
187 }
188 else */
189 {
190 SetWindowPos( hwnd, 0, 0, 0, bm.bmWidth, bm.bmHeight,
192 }
193 }
194 return hOldBitmap;
195}
#define WARN(fmt,...)
Definition: debug.h:112
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define SWP_NOACTIVATE
Definition: winuser.h:1232
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define SWP_NOMOVE
Definition: winuser.h:1234
#define SS_REALSIZECONTROL
Definition: winuser.h:353
#define SWP_NOZORDER
Definition: winuser.h:1237
#define SetWindowLongPtrW
Definition: winuser.h:5336

Referenced by STATIC_WindowProc(), and StaticWndProc_common().

◆ STATIC_SetEnhMetaFile()

static HENHMETAFILE STATIC_SetEnhMetaFile ( HWND  hwnd,
HENHMETAFILE  hEnhMetaFile,
DWORD  style 
)
static

Definition at line 202 of file static.c.

203{
204 if ((style & SS_TYPEMASK) != SS_ENHMETAFILE) return 0;
205 if (hEnhMetaFile && GetObjectType(hEnhMetaFile) != OBJ_ENHMETAFILE)
206 {
207 WARN("hEnhMetaFile != 0, but it's not an enhanced metafile\n");
208 return 0;
209 }
210 return (HENHMETAFILE)SetWindowLongPtrW( hwnd, HICON_GWL_OFFSET, (LONG_PTR)hEnhMetaFile );
211}

Referenced by STATIC_WindowProc(), and StaticWndProc_common().

◆ STATIC_SetIcon()

static HICON STATIC_SetIcon ( HWND  hwnd,
HICON  hicon,
DWORD  style 
)
static

Definition at line 128 of file static.c.

129{
130 HICON prevIcon;
131 SIZE size;
132
133 if ((style & SS_TYPEMASK) != SS_ICON) return 0;
134 if (hicon && !get_icon_size( hicon, &size ))
135 {
136 WARN("hicon != 0, but invalid\n");
137 return 0;
138 }
139 prevIcon = (HICON)SetWindowLongPtrW( hwnd, HICON_GWL_OFFSET, (LONG_PTR)hicon );
140 if (hicon && !(style & SS_CENTERIMAGE) && !(style & SS_REALSIZECONTROL))
141 {
142 /* Windows currently doesn't implement SS_RIGHTJUST */
143 /*
144 if ((style & SS_RIGHTJUST) != 0)
145 {
146 RECT wr;
147 GetWindowRect(hwnd, &wr);
148 SetWindowPos( hwnd, 0, wr.right - info->nWidth, wr.bottom - info->nHeight,
149 info->nWidth, info->nHeight, SWP_NOACTIVATE | SWP_NOZORDER );
150 }
151 else */
152 {
154 }
155 }
156 return prevIcon;
157}

Referenced by STATIC_WindowProc(), and StaticWndProc_common().

◆ STATIC_TryPaintFcn()

static VOID STATIC_TryPaintFcn ( HWND  hwnd,
LONG  full_style 
)
static

Definition at line 270 of file static.c.

271{
272 LONG style = full_style & SS_TYPEMASK;
273 RECT rc;
274
275 GetClientRect( hwnd, &rc );
277 {
278 HDC hdc;
279 HRGN hrgn;
280
281 hdc = GetDC( hwnd );
282 hrgn = set_control_clipping( hdc, &rc );
283 (staticPaintFunc[style])( hwnd, hdc, full_style );
285 if (hrgn) DeleteObject( hrgn );
286 ReleaseDC( hwnd, hdc );
287 }
288}
static HRGN hrgn
HRGN set_control_clipping(HDC hdc, const RECT *rect)
Definition: button.c:239
static const pfPaint staticPaintFunc[SS_TYPEMASK+1]
Definition: static.c:65
long LONG
Definition: pedump.c:60
int WINAPI SelectClipRgn(_In_ HDC, _In_opt_ HRGN)
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
BOOL WINAPI IsRectEmpty(_In_ LPCRECT)
HDC WINAPI GetDC(_In_opt_ HWND)
BOOL WINAPI IsWindowVisible(_In_ HWND)

Referenced by STATIC_WindowProc(), and StaticWndProc_common().

◆ STATIC_WindowProc()

static LRESULT CALLBACK STATIC_WindowProc ( HWND  hwnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 327 of file static.c.

328{
329 LRESULT lResult = 0;
330 LONG full_style = GetWindowLongW( hwnd, GWL_STYLE );
331 LONG style = full_style & SS_TYPEMASK;
332
333 if (!IsWindow( hwnd )) return 0;
334
335 switch (uMsg)
336 {
337 case WM_CREATE:
338 if (style < 0L || style > SS_TYPEMASK)
339 {
340 ERR("Unknown style 0x%02x\n", style );
341 return -1;
342 }
343 break;
344
345 case WM_NCDESTROY:
346 if (style == SS_ICON)
347 {
348/*
349 * FIXME
350 * DestroyIcon32( STATIC_SetIcon( wndPtr, 0 ) );
351 *
352 * We don't want to do this yet because DestroyIcon32 is broken. If the icon
353 * had already been loaded by the application the last thing we want to do is
354 * GlobalFree16 the handle.
355 */
356 break;
357 }
358 else
359 return DefWindowProcW(hwnd, uMsg, wParam, lParam);
360
361 case WM_ERASEBKGND:
362 /* do all painting in WM_PAINT like Windows does */
363 return 1;
364
365 case WM_PRINTCLIENT:
366 case WM_PAINT:
367 {
368 PAINTSTRUCT ps;
369 RECT rect;
370 HDC hdc = wParam ? (HDC)wParam : BeginPaint(hwnd, &ps);
373 {
374 HRGN hrgn = set_control_clipping( hdc, &rect );
375 (staticPaintFunc[style])( hwnd, hdc, full_style );
377 if (hrgn) DeleteObject( hrgn );
378 }
379 if (!wParam) EndPaint(hwnd, &ps);
380 }
381 break;
382
383 case WM_ENABLE:
384 STATIC_TryPaintFcn( hwnd, full_style );
385 if (full_style & SS_NOTIFY)
386 {
387 if (wParam)
390 else
393 }
394 break;
395
398 STATIC_TryPaintFcn( hwnd, full_style );
399 break;
400
401 case WM_NCCREATE:
402 {
404
405 if (full_style & SS_SUNKEN)
408
409 switch (style)
410 {
411 case SS_ICON:
412 {
413 HICON hIcon;
414
415 hIcon = STATIC_LoadIconW(cs->hInstance, cs->lpszName, full_style);
416 STATIC_SetIcon(hwnd, hIcon, full_style);
417 }
418 break;
419 case SS_BITMAP:
420 if ((ULONG_PTR)cs->hInstance >> 16)
421 {
423 hBitmap = LoadBitmapW(cs->hInstance, cs->lpszName);
424 STATIC_SetBitmap(hwnd, hBitmap, full_style);
425 }
426 break;
427 }
428 /* SS_ENHMETAFILE: Despite what MSDN says, Windows does not load
429 the enhanced metafile that was specified as the window text. */
430 }
431 return DefWindowProcW(hwnd, uMsg, wParam, lParam);
432
433 case WM_SETTEXT:
434 if (hasTextStyle( full_style ))
435 {
436 lResult = DefWindowProcW( hwnd, uMsg, wParam, lParam );
437 STATIC_TryPaintFcn( hwnd, full_style );
438 }
439 break;
440
441 case WM_SETFONT:
442 if (hasTextStyle( full_style ))
443 {
445 if (LOWORD(lParam))
447 }
448 break;
449
450 case WM_GETFONT:
452
453 case WM_NCHITTEST:
454 if (full_style & SS_NOTIFY)
455 return HTCLIENT;
456 else
457 return HTTRANSPARENT;
458
459 case WM_GETDLGCODE:
460 return DLGC_STATIC;
461
462 case WM_LBUTTONDOWN:
463 case WM_NCLBUTTONDOWN:
464 if (full_style & SS_NOTIFY)
467 return 0;
468
469 case WM_LBUTTONDBLCLK:
471 if (full_style & SS_NOTIFY)
474 return 0;
475
476 case STM_GETIMAGE:
477 return (LRESULT)STATIC_GetImage( hwnd, wParam, full_style );
478
479 case STM_GETICON:
480 return (LRESULT)STATIC_GetImage( hwnd, IMAGE_ICON, full_style );
481
482 case STM_SETIMAGE:
483 switch (wParam)
484 {
485 case IMAGE_BITMAP:
486 lResult = (LRESULT)STATIC_SetBitmap( hwnd, (HBITMAP)lParam, full_style );
487 break;
489 lResult = (LRESULT)STATIC_SetEnhMetaFile( hwnd, (HENHMETAFILE)lParam, full_style );
490 break;
491 case IMAGE_ICON:
492 case IMAGE_CURSOR:
493 lResult = (LRESULT)STATIC_SetIcon( hwnd, (HICON)lParam, full_style );
494 break;
495 default:
496 FIXME("STM_SETIMAGE: Unhandled type %lx\n", wParam);
497 break;
498 }
499 STATIC_TryPaintFcn( hwnd, full_style );
500 break;
501
502 case STM_SETICON:
503 lResult = (LRESULT)STATIC_SetIcon( hwnd, (HICON)wParam, full_style );
504 STATIC_TryPaintFcn( hwnd, full_style );
505 break;
506
507 default:
508 return DefWindowProcW(hwnd, uMsg, wParam, lParam);
509 }
510 return lResult;
511}
#define FIXME(fmt,...)
Definition: debug.h:111
#define ERR(fmt,...)
Definition: debug.h:110
LPARAM lParam
Definition: combotst.c:139
VOID COMCTL32_RefreshSysColors(void) DECLSPEC_HIDDEN
Definition: commctrl.c:1586
static HBITMAP STATIC_SetBitmap(HWND hwnd, HBITMAP hBitmap, DWORD style)
Definition: static.c:164
static HICON STATIC_LoadIconW(HINSTANCE hInstance, LPCWSTR name, DWORD style)
Definition: static.c:244
static HICON STATIC_SetIcon(HWND hwnd, HICON hicon, DWORD style)
Definition: static.c:128
static BOOL hasTextStyle(DWORD style)
Definition: static.c:311
static HANDLE STATIC_GetImage(HWND hwnd, WPARAM wParam, DWORD style)
Definition: static.c:219
static VOID STATIC_TryPaintFcn(HWND hwnd, LONG full_style)
Definition: static.c:270
static HENHMETAFILE STATIC_SetEnhMetaFile(HWND hwnd, HENHMETAFILE hEnhMetaFile, DWORD style)
Definition: static.c:202
#define cs
Definition: i386-dis.c:443
#define LRESULT
Definition: ole.h:14
#define LOWORD(l)
Definition: pedump.c:82
#define WM_PRINTCLIENT
Definition: richedit.h:70
& rect
Definition: startmenu.cpp:1413
LONG_PTR LRESULT
Definition: windef.h:209
#define WM_PAINT
Definition: winuser.h:1610
#define WM_ERASEBKGND
Definition: winuser.h:1615
#define MAKEWPARAM(l, h)
Definition: winuser.h:3999
#define WS_EX_STATICEDGE
Definition: winuser.h:403
BOOL WINAPI IsWindow(_In_opt_ HWND)
BOOL WINAPI RedrawWindow(_In_opt_ HWND, _In_opt_ LPCRECT, _In_opt_ HRGN, _In_ UINT)
#define WM_ENABLE
Definition: winuser.h:1605
#define STM_SETICON
Definition: winuser.h:2082
#define WM_CREATE
Definition: winuser.h:1598
LONG WINAPI SetWindowLongW(_In_ HWND, _In_ int, _In_ LONG)
#define WM_LBUTTONDBLCLK
Definition: winuser.h:1768
#define WM_COMMAND
Definition: winuser.h:1730
#define SS_NOTIFY
Definition: winuser.h:351
#define WM_NCHITTEST
Definition: winuser.h:1676
#define RDW_UPDATENOW
Definition: winuser.h:1210
#define RDW_ERASE
Definition: winuser.h:1201
#define WM_LBUTTONDOWN
Definition: winuser.h:1766
#define WM_SYSCOLORCHANGE
Definition: winuser.h:1616
#define WM_GETFONT
Definition: winuser.h:1641
#define STM_SETIMAGE
Definition: winuser.h:2083
#define WM_NCLBUTTONDBLCLK
Definition: winuser.h:1684
#define WM_NCCREATE
Definition: winuser.h:1673
#define STM_GETICON
Definition: winuser.h:2080
#define STN_DISABLE
Definition: winuser.h:2086
#define WM_SETTEXT
Definition: winuser.h:1607
#define RDW_ALLCHILDREN
Definition: winuser.h:1211
#define WM_SETFONT
Definition: winuser.h:1640
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
#define HTCLIENT
Definition: winuser.h:2465
#define DLGC_STATIC
Definition: winuser.h:2609
#define WM_NCDESTROY
Definition: winuser.h:1674
#define HTTRANSPARENT
Definition: winuser.h:2463
HBITMAP WINAPI LoadBitmapW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2132
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
#define GWL_STYLE
Definition: winuser.h:846
#define STN_DBLCLK
Definition: winuser.h:2085
#define STM_GETIMAGE
Definition: winuser.h:2081
#define SS_SUNKEN
Definition: winuser.h:358
#define STN_ENABLE
Definition: winuser.h:2087
#define WM_NCLBUTTONDOWN
Definition: winuser.h:1682
#define STN_CLICKED
Definition: winuser.h:2084
#define RDW_INVALIDATE
Definition: winuser.h:1204
#define WM_GETDLGCODE
Definition: winuser.h:1679

Referenced by STATIC_Register().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( static  )

Variable Documentation

◆ staticPaintFunc

const pfPaint staticPaintFunc[SS_TYPEMASK+1]
static
Initial value:
=
{
NULL,
}
static void STATIC_PaintEnhMetafn(HWND hwnd, HDC hdc, DWORD style)
Definition: static.c:755
static void STATIC_PaintOwnerDrawfn(HWND hwnd, HDC hdc, DWORD style)
Definition: static.c:513
static void STATIC_PaintTextfn(HWND hwnd, HDC hdc, DWORD style)
Definition: static.c:536
static void STATIC_PaintRectfn(HWND hwnd, HDC hdc, DWORD style)
Definition: static.c:639
static void STATIC_PaintBitmapfn(HWND hwnd, HDC hdc, DWORD style)
Definition: static.c:711
static void STATIC_PaintIconfn(HWND hwnd, HDC hdc, DWORD style)
Definition: static.c:680
static void STATIC_PaintEtchedfn(HWND hwnd, HDC hdc, DWORD style)
Definition: static.c:773

Definition at line 65 of file static.c.

Referenced by STATIC_TryPaintFcn(), STATIC_WindowProc(), and StaticWndProc_common().