ReactOS  0.4.15-dev-1201-gb2cf5a4
static.c
Go to the documentation of this file.
1 /*
2  * Static control
3  *
4  * Copyright David W. Metcalfe, 1993
5  *
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.
10  *
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.
15  *
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  *
20  * Notes:
21  * - Windows XP introduced new behavior: The background of centered
22  * icons and bitmaps is painted differently. This is only done if
23  * a manifest is present.
24  * Because it has not yet been decided how to implement the two
25  * different modes in Wine, only the Windows XP mode is implemented.
26  * - Controls with SS_SIMPLE but without SS_NOPREFIX:
27  * The text should not be changed. Windows doesn't clear the
28  * client rectangle, so the new text must be larger than the old one.
29  * - The SS_RIGHTJUST style is currently not implemented by Windows
30  * (or it does something different than documented).
31  *
32  * TODO:
33  * - Animated cursors
34  */
35 
36 #include <stdarg.h>
37 
38 #include "windef.h"
39 #include "winbase.h"
40 #include "wingdi.h"
41 #include "winuser.h"
42 #include "commctrl.h"
43 
44 #include "wine/debug.h"
45 
46 #include "comctl32.h"
47 
49 
51 static void STATIC_PaintTextfn( HWND hwnd, HDC hdc, DWORD style );
52 static void STATIC_PaintRectfn( HWND hwnd, HDC hdc, DWORD style );
53 static void STATIC_PaintIconfn( HWND hwnd, HDC hdc, DWORD style );
57 
58 /* offsets for GetWindowLong for static private information */
59 #define HFONT_GWL_OFFSET 0
60 #define HICON_GWL_OFFSET (sizeof(HFONT))
61 #define STATIC_EXTRA_BYTES (HICON_GWL_OFFSET + sizeof(HICON))
62 
63 typedef void (*pfPaint)( HWND hwnd, HDC hdc, DWORD style );
64 
66 {
67  STATIC_PaintTextfn, /* SS_LEFT */
68  STATIC_PaintTextfn, /* SS_CENTER */
69  STATIC_PaintTextfn, /* SS_RIGHT */
70  STATIC_PaintIconfn, /* SS_ICON */
71  STATIC_PaintRectfn, /* SS_BLACKRECT */
72  STATIC_PaintRectfn, /* SS_GRAYRECT */
73  STATIC_PaintRectfn, /* SS_WHITERECT */
74  STATIC_PaintRectfn, /* SS_BLACKFRAME */
75  STATIC_PaintRectfn, /* SS_GRAYFRAME */
76  STATIC_PaintRectfn, /* SS_WHITEFRAME */
77  NULL, /* SS_USERITEM */
78  STATIC_PaintTextfn, /* SS_SIMPLE */
79  STATIC_PaintTextfn, /* SS_LEFTNOWORDWRAP */
80  STATIC_PaintOwnerDrawfn, /* SS_OWNERDRAW */
81  STATIC_PaintBitmapfn, /* SS_BITMAP */
82  STATIC_PaintEnhMetafn, /* SS_ENHMETAFILE */
83  STATIC_PaintEtchedfn, /* SS_ETCHEDHORZ */
84  STATIC_PaintEtchedfn, /* SS_ETCHEDVERT */
85  STATIC_PaintEtchedfn, /* SS_ETCHEDFRAME */
86 };
87 
89 {
90  ICONINFO info;
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 }
122 
123 /***********************************************************************
124  * STATIC_SetIcon
125  *
126  * Set the icon for an SS_ICON control.
127  */
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 }
158 
159 /***********************************************************************
160  * STATIC_SetBitmap
161  *
162  * Set the bitmap for an SS_BITMAP control.
163  */
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 }
196 
197 /***********************************************************************
198  * STATIC_SetEnhMetaFile
199  *
200  * Set the enhanced metafile for an SS_ENHMETAFILE control.
201  */
202 static HENHMETAFILE STATIC_SetEnhMetaFile( HWND hwnd, HENHMETAFILE hEnhMetaFile, DWORD style )
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 }
212 
213 /***********************************************************************
214  * STATIC_GetImage
215  *
216  * Gets the bitmap for an SS_BITMAP control, the icon/cursor for an
217  * SS_ICON control or the enhanced metafile for an SS_ENHMETAFILE control.
218  */
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 }
238 
239 /***********************************************************************
240  * STATIC_LoadIconW
241  *
242  * Load the icon for an SS_ICON control.
243  */
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 }
264 
265 /***********************************************************************
266  * STATIC_TryPaintFcn
267  *
268  * Try to immediately paint the control.
269  */
270 static VOID STATIC_TryPaintFcn(HWND hwnd, LONG full_style)
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 );
284  SelectClipRgn( hdc, hrgn );
285  if (hrgn) DeleteObject( hrgn );
286  ReleaseDC( hwnd, hdc );
287  }
288 }
289 
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 */
301  hBrush = (HBRUSH)DefWindowProcW( parent, WM_CTLCOLORSTATIC, (WPARAM)hdc, (LPARAM)hwnd);
302  }
303  return hBrush;
304 }
305 
306 /***********************************************************************
307  * hasTextStyle
308  *
309  * Tests if the control displays text.
310  */
312 {
313  switch (style & SS_TYPEMASK)
314  {
315  case SS_SIMPLE:
316  case SS_LEFT:
317  case SS_LEFTNOWORDWRAP:
318  case SS_CENTER:
319  case SS_RIGHT:
320  case SS_OWNERDRAW:
321  return TRUE;
322  }
323 
324  return FALSE;
325 }
326 
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);
371  GetClientRect( hwnd, &rect );
372  if (staticPaintFunc[style])
373  {
374  HRGN hrgn = set_control_clipping( hdc, &rect );
375  (staticPaintFunc[style])( hwnd, hdc, full_style );
376  SelectClipRgn( hdc, hrgn );
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 
396  case WM_SYSCOLORCHANGE:
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:
470  case WM_NCLBUTTONDBLCLK:
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;
488  case IMAGE_ENHMETAFILE:
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 }
512 
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 );
532  SendMessageW( GetParent(hwnd), WM_DRAWITEM, id, (LPARAM)&dis );
533  if (font) SelectObject( hdc, oldFont );
534 }
535 
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 
565  case SS_LEFTNOWORDWRAP:
567  break;
568 
569  default:
570  return;
571  }
572 
574  format = DT_RIGHT | (format & ~(DT_LEFT | DT_CENTER));
575 
576  if (style & SS_NOPREFIX)
577  format |= DT_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)
587  if (style & SS_PATHELLIPSIS)
589  if (style & SS_WORDELLIPSIS)
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 
632 no_TextOut:
633  HeapFree( GetProcessHeap(), 0, text );
634 
635  if (hFont)
636  SelectObject( hdc, hOldFont );
637 }
638 
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 }
678 
679 
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 }
710 
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 }
754 
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 }
772 
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 }
792 
793 void STATIC_Register(void)
794 {
795  WNDCLASSW wndClass;
796 
797  memset(&wndClass, 0, sizeof(wndClass));
799  wndClass.lpfnWndProc = STATIC_WindowProc;
800  wndClass.cbClsExtra = 0;
801  wndClass.cbWndExtra = STATIC_EXTRA_BYTES;
802  wndClass.hCursor = LoadCursorW(0, (LPWSTR)IDC_ARROW);
803  wndClass.hbrBackground = NULL;
804  wndClass.lpszClassName = WC_STATICW;
805  RegisterClassW(&wndClass);
806 }
807 
808 #ifdef __REACTOS__
809 void STATIC_Unregister(void)
810 {
812 }
813 #endif
#define WM_NCLBUTTONDOWN
Definition: winuser.h:1674
static HBITMAP STATIC_SetBitmap(HWND hwnd, HBITMAP hBitmap, DWORD style)
Definition: static.c:164
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 DT_EXPANDTABS
Definition: winuser.h:532
#define SS_ENHMETAFILE
Definition: winuser.h:341
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define STM_SETICON
Definition: winuser.h:2074
BOOL WINAPI RedrawWindow(_In_opt_ HWND, _In_opt_ LPCRECT, _In_opt_ HRGN, _In_ UINT)
#define WM_SYSCOLORCHANGE
Definition: winuser.h:1608
static HICON
Definition: imagelist.c:84
#define HTTRANSPARENT
Definition: winuser.h:2448
#define MAKEWPARAM(l, h)
Definition: winuser.h:3984
#define LR_SHARED
Definition: winuser.h:1090
static HANDLE STATIC_GetImage(HWND hwnd, WPARAM wParam, DWORD style)
Definition: static.c:219
#define IMAGE_ICON
Definition: winuser.h:212
static HBRUSH hbrush
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
int WINAPI SelectClipRgn(_In_ HDC, _In_opt_ HRGN)
UINT style
Definition: winuser.h:3151
#define WM_GETDLGCODE
Definition: winuser.h:1671
#define WM_LBUTTONDOWN
Definition: winuser.h:1758
static void STATIC_PaintEnhMetafn(HWND hwnd, HDC hdc, DWORD style)
Definition: static.c:755
BOOL WINAPI UnregisterClassW(_In_ LPCWSTR, HINSTANCE)
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
BOOL WINAPI IsWindow(_In_opt_ HWND)
UINT lbStyle
Definition: wingdi.h:1746
COLORREF clr3dShadow
Definition: comctl32.h:166
HDC WINAPI GetDC(_In_opt_ HWND)
Definition: mk_font.cpp:20
#define TRUE
Definition: types.h:120
#define STN_ENABLE
Definition: winuser.h:2079
#define SS_BLACKRECT
Definition: pedump.c:696
const WCHAR * text
Definition: package.c:1827
#define SS_OWNERDRAW
Definition: winuser.h:352
#define WM_CTLCOLORSTATIC
Definition: winuser.h:1754
#define IMAGE_CURSOR
Definition: winuser.h:213
#define DT_WORDBREAK
Definition: winuser.h:544
#define WARN(fmt,...)
Definition: debug.h:112
#define SS_TYPEMASK
Definition: winuser.h:362
#define HICON_GWL_OFFSET
Definition: static.c:60
static HDC
Definition: imagelist.c:92
#define CALLBACK
Definition: compat.h:35
#define SS_ETCHEDFRAME
Definition: winuser.h:342
#define BF_BOTTOM
Definition: winuser.h:457
#define SS_ENDELLIPSIS
Definition: statst2.c:8
LONG top
Definition: windef.h:307
ULONG_PTR itemData
Definition: winuser.h:3068
static const pfPaint staticPaintFunc[SS_TYPEMASK+1]
Definition: static.c:65
void STATIC_Register(void)
Definition: static.c:793
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1499
static void STATIC_PaintEtchedfn(HWND hwnd, HDC hdc, DWORD style)
Definition: static.c:773
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
#define GWL_EXSTYLE
Definition: winuser.h:845
int cbClsExtra
Definition: winuser.h:3153
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
#define WM_NCHITTEST
Definition: winuser.h:1668
COLORREF clr3dHilight
Definition: comctl32.h:165
UINT_PTR WPARAM
Definition: windef.h:207
#define DT_RIGHT
Definition: winuser.h:538
#define GetWindowLongPtrW
Definition: winuser.h:4804
LONG left
Definition: windef.h:306
#define SWP_NOZORDER
Definition: winuser.h:1232
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
LONG right
Definition: windef.h:308
#define DT_NOPREFIX
Definition: winuser.h:537
#define WS_EX_RIGHT
Definition: winuser.h:400
#define WM_NCCREATE
Definition: winuser.h:1665
static void STATIC_PaintBitmapfn(HWND hwnd, HDC hdc, DWORD style)
Definition: static.c:711
HRGN set_control_clipping(HDC hdc, const RECT *rect)
Definition: button.c:239
int32_t INT
Definition: typedefs.h:58
BOOL WINAPI GetIconInfo(_In_ HICON, _Out_ PICONINFO)
Definition: cursoricon.c:2014
DWORD WINAPI GetSysColor(_In_ int)
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 HFONT_GWL_OFFSET
Definition: static.c:59
& rect
Definition: startmenu.cpp:1413
WPARAM wParam
Definition: combotst.c:138
#define SS_RIGHT
Definition: pedump.c:694
HFONT hFont
Definition: main.c:53
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
#define WM_ENABLE
Definition: winuser.h:1597
#define WM_PRINTCLIENT
Definition: richedit.h:70
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static VOID STATIC_TryPaintFcn(HWND hwnd, LONG full_style)
Definition: static.c:270
struct _test_info info[]
Definition: SetCursorPos.c:19
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define STN_DBLCLK
Definition: winuser.h:2077
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:977
#define DT_PATH_ELLIPSIS
Definition: winuser.h:530
#define SS_BITMAP
Definition: pedump.c:704
ATOM WINAPI RegisterClassW(_In_ CONST WNDCLASSW *)
#define BF_RECT
Definition: winuser.h:462
#define SS_WORDELLIPSIS
Definition: winuser.h:365
uint32_t cs
Definition: isohybrid.c:75
HINSTANCE hInstance
Definition: charmap.c:20
#define OBJ_ENHMETAFILE
Definition: objidl.idl:1421
#define FALSE
Definition: types.h:117
#define ETO_OPAQUE
Definition: wingdi.h:646
#define DT_LEFT
Definition: winuser.h:534
unsigned int BOOL
Definition: ntddk_ex.h:94
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:2172
long LONG
Definition: pedump.c:60
COLORREF clr3dDkShadow
Definition: comctl32.h:167
LONG WINAPI SetWindowLongW(_In_ HWND, _In_ int, _In_ LONG)
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
BOOL WINAPI DrawEdge(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
#define IMAGE_ENHMETAFILE
Definition: winuser.h:214
static void STATIC_PaintTextfn(HWND hwnd, HDC hdc, DWORD style)
Definition: static.c:536
WNDPROC lpfnWndProc
Definition: winuser.h:3152
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define FIXME(fmt,...)
Definition: debug.h:111
#define SS_LEFT
Definition: pedump.c:692
#define SS_GRAYRECT
Definition: pedump.c:697
BOOL WINAPI IsRectEmpty(_In_ LPCRECT)
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
#define DT_END_ELLIPSIS
Definition: winuser.h:529
smooth NULL
Definition: ftsmooth.c:416
static HENHMETAFILE STATIC_SetEnhMetaFile(HWND hwnd, HENHMETAFILE hEnhMetaFile, DWORD style)
Definition: static.c:202
#define WM_GETFONT
Definition: winuser.h:1633
LPCWSTR lpszClassName
Definition: winuser.h:3160
LONG_PTR LPARAM
Definition: windef.h:208
#define SS_REALSIZECONTROL
Definition: winuser.h:353
BOOL WINAPI IsWindowEnabled(_In_ HWND)
#define ETO_CLIPPED
Definition: wingdi.h:647
static void STATIC_PaintRectfn(HWND hwnd, HDC hdc, DWORD style)
Definition: static.c:639
#define DT_VCENTER
Definition: winuser.h:543
#define WM_SETTEXT
Definition: winuser.h:1599
#define SS_GRAYFRAME
Definition: pedump.c:700
static LRESULT CALLBACK STATIC_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: static.c:327
static HBRUSH STATIC_SendWmCtlColorStatic(HWND hwnd, HDC hdc)
Definition: static.c:290
#define DT_WORD_ELLIPSIS
Definition: winuser.h:531
#define ODA_DRAWENTIRE
Definition: winuser.h:2517
#define SS_PATHELLIPSIS
Definition: winuser.h:364
static BOOL get_icon_size(HICON handle, SIZE *size)
Definition: static.c:88
#define SS_ETCHEDHORZ
Definition: winuser.h:343
#define SS_EDITCONTROL
Definition: winuser.h:340
#define SS_CENTER
Definition: pedump.c:693
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:595
#define SS_NOTIFY
Definition: winuser.h:351
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define STN_CLICKED
Definition: winuser.h:2076
r parent
Definition: btrfs.c:2944
int cbWndExtra
Definition: winuser.h:3154
__wchar_t WCHAR
Definition: xmlstorage.h:180
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
#define ODS_DISABLED
Definition: winuser.h:2522
#define BF_RIGHT
Definition: winuser.h:456
#define SWP_NOACTIVATE
Definition: winuser.h:1227
#define RDW_ERASE
Definition: winuser.h:1197
BOOL WINAPI PlayEnhMetaFile(_In_ HDC, _In_ HENHMETAFILE, _In_ LPCRECT)
#define CS_GLOBALCLASS
Definition: winuser.h:647
#define WM_NCDESTROY
Definition: winuser.h:1666
#define ODT_STATIC
Definition: winuser.h:2516
COLORREF lbColor
Definition: wingdi.h:1747
unsigned long DWORD
Definition: ntddk_ex.h:95
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2074
static void STATIC_PaintIconfn(HWND hwnd, HDC hdc, DWORD style)
Definition: static.c:680
#define STN_DISABLE
Definition: winuser.h:2078
#define STM_GETICON
Definition: winuser.h:2072
#define EDGE_ETCHED
Definition: winuser.h:452
COMCTL32_SysColor comctl32_color
Definition: commctrl.c:82
BITMAP bmp
Definition: alphablend.c:62
#define WM_PAINT
Definition: winuser.h:1602
static BOOL hasTextStyle(DWORD style)
Definition: static.c:311
#define SS_REALSIZEIMAGE
Definition: winuser.h:354
int ret
#define COLOR_GRAYTEXT
Definition: winuser.h:922
HDC hdc
Definition: main.c:9
static HRGN hrgn
Definition: win.c:55
WINE_DEFAULT_DEBUG_CHANNEL(static)
#define DI_NORMAL
Definition: wingdi.h:72
GLenum GLsizei len
Definition: glext.h:6722
#define WM_LBUTTONDBLCLK
Definition: winuser.h:1760
#define SS_NOPREFIX
Definition: winuser.h:350
#define LRESULT
Definition: ole.h:14
#define CS_DBLCLKS
Definition: winuser.h:646
#define WM_COMMAND
Definition: winuser.h:1722
#define SS_BLACKFRAME
Definition: pedump.c:699
#define SS_CENTERIMAGE
Definition: winuser.h:339
HCURSOR hCursor
Definition: winuser.h:3157
#define ERR(fmt,...)
Definition: debug.h:110
#define GWL_STYLE
Definition: winuser.h:846
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:888
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define DT_SINGLELINE
Definition: winuser.h:540
HWND WINAPI GetParent(_In_ HWND)
#define SS_SIMPLE
Definition: pedump.c:702
BOOL WINAPI DeleteDC(_In_ HDC)
INT WINAPI InternalGetWindowText(_In_ HWND hWnd, _Out_writes_to_(cchMaxCount, return+1) LPWSTR pString, _In_ int cchMaxCount)
HICON hIcon
Definition: msconfig.c:44
HBITMAP WINAPI LoadBitmapW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2132
#define RDW_ALLCHILDREN
Definition: winuser.h:1207
#define STATIC_EXTRA_BYTES
Definition: static.c:61
HBRUSH hbrBackground
Definition: winuser.h:3158
#define BF_TOP
Definition: winuser.h:455
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
Definition: bl.h:1331
#define HeapReAlloc
Definition: compat.h:593
#define STM_GETIMAGE
Definition: winuser.h:2073
#define SS_SUNKEN
Definition: winuser.h:358
#define SS_ETCHEDVERT
Definition: winuser.h:344
static HICON STATIC_LoadIconW(HINSTANCE hInstance, LPCWSTR name, DWORD style)
Definition: static.c:244
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
unsigned int UINT
Definition: ndis.h:50
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
void(* pfPaint)(HWND hwnd, HDC hdc, DWORD style)
Definition: static.c:63
#define IMAGE_BITMAP
Definition: winuser.h:211
static POBJECT_TYPE GetObjectType(IN PCWSTR TypeName)
Definition: ObTypes.c:15
#define STM_SETIMAGE
Definition: winuser.h:2075
#define WM_SETFONT
Definition: winuser.h:1632
#define WC_STATICW
Definition: commctrl.h:4676
#define WM_DRAWITEM
Definition: winuser.h:1627
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
#define RDW_UPDATENOW
Definition: winuser.h:1206
#define IDC_ARROW
Definition: winuser.h:682
Definition: name.c:38
#define WM_CREATE
Definition: winuser.h:1590
GLenum GLuint id
Definition: glext.h:5579
static HICON STATIC_SetIcon(HWND hwnd, HICON hicon, DWORD style)
Definition: static.c:128
BOOL WINAPI IsWindowVisible(_In_ HWND)
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2044
LONG bottom
Definition: windef.h:309
#define DT_CENTER
Definition: winuser.h:527
#define SWP_NOMOVE
Definition: winuser.h:1229
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define SetWindowLongPtrW
Definition: winuser.h:5321
#define BS_SOLID
Definition: wingdi.h:1085
static HBITMAP
Definition: button.c:44
#define SS_WHITEFRAME
Definition: pedump.c:701
#define WM_ERASEBKGND
Definition: winuser.h:1607
#define HTCLIENT
Definition: winuser.h:2450
WCHAR * LPWSTR
Definition: xmlstorage.h:184
LONG_PTR LRESULT
Definition: windef.h:209
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
Arabic default style
Definition: afstyles.h:93
#define memset(x, y, z)
Definition: compat.h:39
#define SS_ICON
Definition: pedump.c:695
#define SS_WHITERECT
Definition: pedump.c:698
#define WS_EX_STATICEDGE
Definition: winuser.h:403
static HBITMAP hBitmap
Definition: timezone.c:26
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
VOID COMCTL32_RefreshSysColors(void) DECLSPEC_HIDDEN
Definition: commctrl.c:1586
#define OBJ_BITMAP
Definition: objidl.idl:1415
#define HeapFree(x, y, z)
Definition: compat.h:594
#define GWLP_ID
Definition: winuser.h:854
#define SRCCOPY
Definition: wingdi.h:332
#define DLGC_STATIC
Definition: winuser.h:2594
#define SS_LEFTNOWORDWRAP
Definition: pedump.c:703
#define CS_PARENTDC
Definition: winuser.h:651
#define DT_EDITCONTROL
Definition: winuser.h:528
#define RDW_INVALIDATE
Definition: winuser.h:1200
int WINAPI FrameRect(_In_ HDC, _In_ LPCRECT, _In_ HBRUSH)
#define WM_NCLBUTTONDBLCLK
Definition: winuser.h:1676
#define BF_LEFT
Definition: winuser.h:454
INT WINAPI DrawTextW(HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
Definition: defwnd.c:17
static void STATIC_PaintOwnerDrawfn(HWND hwnd, HDC hdc, DWORD style)
Definition: static.c:513