ReactOS 0.4.15-dev-7924-g5949c20
draw.c File Reference
#include "uxthemep.h"
#include <stdlib.h>
Include dependency graph for draw.c:

Go to the source code of this file.

Macros

#define RBInnerSoft   RBInnerNormal /* These are the same */
 
#define RBOuterSoft   RBOuterNormal
 
#define PT_IN_RECT(lprc, x, y)
 

Typedefs

typedef int(WINAPIDRAWSHADOWTEXT) (HDC hdc, LPCWSTR pszText, UINT cch, RECT *prc, DWORD dwFlags, COLORREF crText, COLORREF crShadow, int ixOffset, int iyOffset)
 

Enumerations

enum  {
  EDGE_LIGHT , EDGE_HIGHLIGHT , EDGE_SHADOW , EDGE_DARKSHADOW ,
  EDGE_FILL , EDGE_WINDOW , EDGE_WINDOWFRAME , EDGE_NUMCOLORS
}
 

Functions

HRESULT WINAPI EnableThemeDialogTexture (HWND hwnd, DWORD dwFlags)
 
BOOL WINAPI IsThemeDialogTextureEnabled (HWND hwnd)
 
HRESULT WINAPI DrawThemeParentBackground (HWND hwnd, HDC hdc, RECT *prc)
 
HRESULT WINAPI DrawThemeBackground (HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, const RECT *pClipRect)
 
static PTHEME_PROPERTY UXTHEME_SelectImage (HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, BOOL glyph)
 
HRESULT UXTHEME_LoadImage (HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, BOOL glyph, HBITMAP *hBmp, RECT *bmpRect, BOOL *hasImageAlpha)
 
static void get_transparency (HTHEME hTheme, int iPartId, int iStateId, BOOL hasImageAlpha, INT *transparent, COLORREF *transparentcolor, BOOL glyph)
 
static HRESULT UXTHEME_DrawImageGlyph (HTHEME hTheme, HDC hdc, int iPartId, int iStateId, RECT *pRect, const DTBGOPTS *pOptions)
 
static HRESULT UXTHEME_DrawGlyph (HTHEME hTheme, HDC hdc, int iPartId, int iStateId, RECT *pRect, const DTBGOPTS *pOptions)
 
static HRESULT get_image_part_size (HTHEME hTheme, HDC hdc, int iPartId, int iStateId, RECT *prc, THEMESIZE eSize, POINT *psz)
 
static HRESULT UXTHEME_DrawImageBackground (HTHEME hTheme, HDC hdc, int iPartId, int iStateId, RECT *pRect, const DTBGOPTS *pOptions)
 
static HRESULT UXTHEME_DrawBorderRectangle (HTHEME hTheme, HDC hdc, int iPartId, int iStateId, RECT *pRect, const DTBGOPTS *pOptions)
 
static HRESULT UXTHEME_DrawBackgroundFill (HTHEME hTheme, HDC hdc, int iPartId, int iStateId, RECT *pRect, const DTBGOPTS *pOptions)
 
static HRESULT UXTHEME_DrawBorderBackground (HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, const DTBGOPTS *pOptions)
 
HRESULT WINAPI DrawThemeBackgroundEx (HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, const DTBGOPTS *pOptions)
 
static COLORREF get_edge_color (int edgeType, HTHEME theme, int part, int state)
 
static HPEN get_edge_pen (int edgeType, HTHEME theme, int part, int state)
 
static HBRUSH get_edge_brush (int edgeType, HTHEME theme, int part, int state)
 
static HRESULT draw_diag_edge (HDC hdc, HTHEME theme, int part, int state, const RECT *rc, UINT uType, UINT uFlags, LPRECT contentsRect)
 
static HRESULT draw_rect_edge (HDC hdc, HTHEME theme, int part, int state, const RECT *rc, UINT uType, UINT uFlags, LPRECT contentsRect)
 
HRESULT WINAPI DrawThemeEdge (HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pDestRect, UINT uEdge, UINT uFlags, RECT *pContentRect)
 
HRESULT WINAPI DrawThemeIcon (HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, HIMAGELIST himl, int iImageIndex)
 
HRESULT WINAPI DrawThemeText (HTHEME hTheme, HDC hdc, int iPartId, int iStateId, LPCWSTR pszText, int iCharCount, DWORD dwTextFlags, DWORD dwTextFlags2, const RECT *pRect)
 
HRESULT WINAPI GetThemeBackgroundContentRect (HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pBoundingRect, RECT *pContentRect)
 
HRESULT WINAPI GetThemeBackgroundExtent (HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pContentRect, RECT *pExtentRect)
 
static HBITMAP UXTHEME_DrawThemePartToDib (HTHEME hTheme, HDC hdc, int iPartId, int iStateId, LPCRECT pRect)
 
static HRGN UXTHEME_RegionFromDibBits (RGBQUAD *pBuffer, RGBQUAD *pclrTransparent, LPCRECT pRect)
 
HRESULT UXTHEME_GetImageBackBackgroundRegion (HTHEME hTheme, HDC hdc, int iPartId, int iStateId, LPCRECT pRect, HRGN *pRegion)
 
HRESULT WINAPI GetThemeBackgroundRegion (HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, HRGN *pRegion)
 
static HRESULT get_border_background_size (HTHEME hTheme, int iPartId, int iStateId, THEMESIZE eSize, POINT *psz)
 
HRESULT WINAPI GetThemePartSize (HTHEME hTheme, HDC hdc, int iPartId, int iStateId, RECT *prc, THEMESIZE eSize, SIZE *psz)
 
HRESULT WINAPI GetThemeTextExtent (HTHEME hTheme, HDC hdc, int iPartId, int iStateId, LPCWSTR pszText, int iCharCount, DWORD dwTextFlags, const RECT *pBoundingRect, RECT *pExtentRect)
 
HRESULT WINAPI GetThemeTextMetrics (HTHEME hTheme, HDC hdc, int iPartId, int iStateId, TEXTMETRICW *ptm)
 
BOOL WINAPI IsThemeBackgroundPartiallyTransparent (HTHEME hTheme, int iPartId, int iStateId)
 

Variables

ATOM atDialogThemeEnabled
 
struct {
   int   themeProp
 
   int   sysColor
 
EdgeColorMap [EDGE_NUMCOLORS]
 
static const signed char LTInnerNormal []
 
static const signed char LTOuterNormal []
 
static const signed char RBInnerNormal []
 
static const signed char RBOuterNormal []
 
static const signed char LTInnerSoft []
 
static const signed char LTOuterSoft []
 
static const signed char LTRBOuterMono []
 
static const signed char LTRBInnerMono []
 
static const signed char LTRBOuterFlat []
 
static const signed char LTRBInnerFlat []
 

Macro Definition Documentation

◆ PT_IN_RECT

#define PT_IN_RECT (   lprc,
  x,
  y 
)
Value:
( x >= lprc->left && x < lprc->right && \
y >= lprc->top && y < lprc->bottom)
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
_In_ int _Inout_ LPRECT lprc
Definition: winuser.h:4466

Definition at line 1607 of file draw.c.

◆ RBInnerSoft

#define RBInnerSoft   RBInnerNormal /* These are the same */

Definition at line 885 of file draw.c.

◆ RBOuterSoft

#define RBOuterSoft   RBOuterNormal

Definition at line 886 of file draw.c.

Typedef Documentation

◆ DRAWSHADOWTEXT

typedef int(WINAPI * DRAWSHADOWTEXT) (HDC hdc, LPCWSTR pszText, UINT cch, RECT *prc, DWORD dwFlags, COLORREF crText, COLORREF crShadow, int ixOffset, int iyOffset)

Definition at line 1371 of file draw.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
EDGE_LIGHT 
EDGE_HIGHLIGHT 
EDGE_SHADOW 
EDGE_DARKSHADOW 
EDGE_FILL 
EDGE_WINDOW 
EDGE_WINDOWFRAME 
EDGE_NUMCOLORS 

Definition at line 815 of file draw.c.

816{
821 EDGE_FILL,
822
825
827};
@ EDGE_NUMCOLORS
Definition: draw.c:826
@ EDGE_SHADOW
Definition: draw.c:819
@ EDGE_LIGHT
Definition: draw.c:817
@ EDGE_WINDOWFRAME
Definition: draw.c:824
@ EDGE_FILL
Definition: draw.c:821
@ EDGE_DARKSHADOW
Definition: draw.c:820
@ EDGE_HIGHLIGHT
Definition: draw.c:818
@ EDGE_WINDOW
Definition: draw.c:823

Function Documentation

◆ draw_diag_edge()

static HRESULT draw_diag_edge ( HDC  hdc,
HTHEME  theme,
int  part,
int  state,
const RECT rc,
UINT  uType,
UINT  uFlags,
LPRECT  contentsRect 
)
static

Definition at line 941 of file draw.c.

944{
945 POINT Points[4];
946 signed char InnerI, OuterI;
947 HPEN InnerPen, OuterPen;
948 POINT SavePoint;
949 HPEN SavePen;
950 int spx, spy;
951 int epx, epy;
952 int Width = rc->right - rc->left;
953 int Height= rc->bottom - rc->top;
954 int SmallDiam = Width > Height ? Height : Width;
955 HRESULT retval = (((uType & BDR_INNER) == BDR_INNER
956 || (uType & BDR_OUTER) == BDR_OUTER)
957 && !(uFlags & (BF_FLAT|BF_MONO)) ) ? E_FAIL : S_OK;
958 int add = (LTRBInnerMono[uType & (BDR_INNER|BDR_OUTER)] != -1 ? 1 : 0)
959 + (LTRBOuterMono[uType & (BDR_INNER|BDR_OUTER)] != -1 ? 1 : 0);
960
961 /* Init some vars */
962 OuterPen = InnerPen = GetStockObject(NULL_PEN);
963 SavePen = SelectObject(hdc, InnerPen);
964 spx = spy = epx = epy = 0; /* Satisfy the compiler... */
965
966 /* Determine the colors of the edges */
967 if(uFlags & BF_MONO)
968 {
969 InnerI = LTRBInnerMono[uType & (BDR_INNER|BDR_OUTER)];
970 OuterI = LTRBOuterMono[uType & (BDR_INNER|BDR_OUTER)];
971 }
972 else if(uFlags & BF_FLAT)
973 {
974 InnerI = LTRBInnerFlat[uType & (BDR_INNER|BDR_OUTER)];
975 OuterI = LTRBOuterFlat[uType & (BDR_INNER|BDR_OUTER)];
976 }
977 else if(uFlags & BF_SOFT)
978 {
979 if(uFlags & BF_BOTTOM)
980 {
981 InnerI = RBInnerSoft[uType & (BDR_INNER|BDR_OUTER)];
982 OuterI = RBOuterSoft[uType & (BDR_INNER|BDR_OUTER)];
983 }
984 else
985 {
986 InnerI = LTInnerSoft[uType & (BDR_INNER|BDR_OUTER)];
987 OuterI = LTOuterSoft[uType & (BDR_INNER|BDR_OUTER)];
988 }
989 }
990 else
991 {
992 if(uFlags & BF_BOTTOM)
993 {
994 InnerI = RBInnerNormal[uType & (BDR_INNER|BDR_OUTER)];
995 OuterI = RBOuterNormal[uType & (BDR_INNER|BDR_OUTER)];
996 }
997 else
998 {
999 InnerI = LTInnerNormal[uType & (BDR_INNER|BDR_OUTER)];
1000 OuterI = LTOuterNormal[uType & (BDR_INNER|BDR_OUTER)];
1001 }
1002 }
1003
1004 if(InnerI != -1) InnerPen = get_edge_pen (InnerI, theme, part, state);
1005 if(OuterI != -1) OuterPen = get_edge_pen (OuterI, theme, part, state);
1006
1007 MoveToEx(hdc, 0, 0, &SavePoint);
1008
1009 /* Don't ask me why, but this is what is visible... */
1010 /* This must be possible to do much simpler, but I fail to */
1011 /* see the logic in the MS implementation (sigh...). */
1012 /* So, this might look a bit brute force here (and it is), but */
1013 /* it gets the job done;) */
1014
1015 switch(uFlags & BF_RECT)
1016 {
1017 case 0:
1018 case BF_LEFT:
1019 case BF_BOTTOM:
1020 case BF_BOTTOMLEFT:
1021 /* Left bottom endpoint */
1022 epx = rc->left-1;
1023 spx = epx + SmallDiam;
1024 epy = rc->bottom;
1025 spy = epy - SmallDiam;
1026 break;
1027
1028 case BF_TOPLEFT:
1029 case BF_BOTTOMRIGHT:
1030 /* Left top endpoint */
1031 epx = rc->left-1;
1032 spx = epx + SmallDiam;
1033 epy = rc->top-1;
1034 spy = epy + SmallDiam;
1035 break;
1036
1037 case BF_TOP:
1038 case BF_RIGHT:
1039 case BF_TOPRIGHT:
1040 case BF_RIGHT|BF_LEFT:
1041 case BF_RIGHT|BF_LEFT|BF_TOP:
1042 case BF_BOTTOM|BF_TOP:
1046 case BF_RECT:
1047 /* Right top endpoint */
1048 spx = rc->left;
1049 epx = spx + SmallDiam;
1050 spy = rc->bottom-1;
1051 epy = spy - SmallDiam;
1052 break;
1053 }
1054
1055 MoveToEx(hdc, spx, spy, NULL);
1056 SelectObject(hdc, OuterPen);
1057 LineTo(hdc, epx, epy);
1058
1059 SelectObject(hdc, InnerPen);
1060
1061 switch(uFlags & (BF_RECT|BF_DIAGONAL))
1062 {
1064 case (BF_DIAGONAL|BF_BOTTOM):
1065 case BF_DIAGONAL:
1066 case (BF_DIAGONAL|BF_LEFT):
1067 MoveToEx(hdc, spx-1, spy, NULL);
1068 LineTo(hdc, epx, epy-1);
1069 Points[0].x = spx-add;
1070 Points[0].y = spy;
1071 Points[1].x = rc->left;
1072 Points[1].y = rc->top;
1073 Points[2].x = epx+1;
1074 Points[2].y = epy-1-add;
1075 Points[3] = Points[2];
1076 break;
1077
1079 MoveToEx(hdc, spx-1, spy, NULL);
1080 LineTo(hdc, epx, epy+1);
1081 Points[0].x = spx-add;
1082 Points[0].y = spy;
1083 Points[1].x = rc->left;
1084 Points[1].y = rc->bottom-1;
1085 Points[2].x = epx+1;
1086 Points[2].y = epy+1+add;
1087 Points[3] = Points[2];
1088 break;
1089
1094 MoveToEx(hdc, spx+1, spy, NULL);
1095 LineTo(hdc, epx, epy+1);
1096 Points[0].x = epx-1;
1097 Points[0].y = epy+1+add;
1098 Points[1].x = rc->right-1;
1099 Points[1].y = rc->top+add;
1100 Points[2].x = rc->right-1;
1101 Points[2].y = rc->bottom-1;
1102 Points[3].x = spx+add;
1103 Points[3].y = spy;
1104 break;
1105
1107 MoveToEx(hdc, spx, spy-1, NULL);
1108 LineTo(hdc, epx+1, epy);
1109 Points[0].x = epx+1+add;
1110 Points[0].y = epy+1;
1111 Points[1].x = rc->right-1;
1112 Points[1].y = rc->top;
1113 Points[2].x = rc->right-1;
1114 Points[2].y = rc->bottom-1-add;
1115 Points[3].x = spx;
1116 Points[3].y = spy-add;
1117 break;
1118
1119 case (BF_DIAGONAL|BF_TOP):
1122 MoveToEx(hdc, spx+1, spy-1, NULL);
1123 LineTo(hdc, epx, epy);
1124 Points[0].x = epx-1;
1125 Points[0].y = epy+1;
1126 Points[1].x = rc->right-1;
1127 Points[1].y = rc->top;
1128 Points[2].x = rc->right-1;
1129 Points[2].y = rc->bottom-1-add;
1130 Points[3].x = spx+add;
1131 Points[3].y = spy-add;
1132 break;
1133
1134 case (BF_DIAGONAL|BF_RIGHT):
1137 MoveToEx(hdc, spx, spy, NULL);
1138 LineTo(hdc, epx-1, epy+1);
1139 Points[0].x = spx;
1140 Points[0].y = spy;
1141 Points[1].x = rc->left;
1142 Points[1].y = rc->top+add;
1143 Points[2].x = epx-1-add;
1144 Points[2].y = epy+1+add;
1145 Points[3] = Points[2];
1146 break;
1147 }
1148
1149 /* Fill the interior if asked */
1150 if((uFlags & BF_MIDDLE) && retval)
1151 {
1152 HBRUSH hbsave;
1153 HBRUSH hb = get_edge_brush ((uFlags & BF_MONO) ? EDGE_WINDOW : EDGE_FILL,
1154 theme, part, state);
1155 HPEN hpsave;
1156 HPEN hp = get_edge_pen ((uFlags & BF_MONO) ? EDGE_WINDOW : EDGE_FILL,
1157 theme, part, state);
1158 hbsave = SelectObject(hdc, hb);
1159 hpsave = SelectObject(hdc, hp);
1160 Polygon(hdc, Points, 4);
1161 SelectObject(hdc, hbsave);
1162 SelectObject(hdc, hpsave);
1163 DeleteObject (hp);
1164 DeleteObject (hb);
1165 }
1166
1167 /* Adjust rectangle if asked */
1168 if(uFlags & BF_ADJUST)
1169 {
1170 *contentsRect = *rc;
1171 if(uFlags & BF_LEFT) contentsRect->left += add;
1172 if(uFlags & BF_RIGHT) contentsRect->right -= add;
1173 if(uFlags & BF_TOP) contentsRect->top += add;
1174 if(uFlags & BF_BOTTOM) contentsRect->bottom -= add;
1175 }
1176
1177 /* Cleanup */
1178 SelectObject(hdc, SavePen);
1179 MoveToEx(hdc, SavePoint.x, SavePoint.y, NULL);
1180 if(InnerI != -1) DeleteObject (InnerPen);
1181 if(OuterI != -1) DeleteObject (OuterPen);
1182
1183 return retval;
1184}
static int state
Definition: maze.c:121
#define E_FAIL
Definition: ddrawi.h:102
#define NULL
Definition: types.h:112
static const signed char LTOuterNormal[]
Definition: draw.c:23
static const signed char LTRBInnerMono[]
Definition: draw.c:51
static const signed char RBOuterNormal[]
Definition: draw.c:37
static const signed char LTRBOuterMono[]
Definition: draw.c:44
static const signed char LTInnerNormal[]
Definition: draw.c:16
static const signed char RBInnerNormal[]
Definition: draw.c:30
UINT uFlags
Definition: api.c:59
static HPEN get_edge_pen(int edgeType, HTHEME theme, int part, int state)
Definition: draw.c:926
static const signed char LTOuterSoft[]
Definition: draw.c:878
static const signed char LTRBInnerFlat[]
Definition: draw.c:909
static const signed char LTRBOuterFlat[]
Definition: draw.c:902
#define RBInnerSoft
Definition: draw.c:885
#define RBOuterSoft
Definition: draw.c:886
static HBRUSH get_edge_brush(int edgeType, HTHEME theme, int part, int state)
Definition: draw.c:931
static const signed char LTInnerSoft[]
Definition: draw.c:871
pKey DeleteObject()
#define S_OK
Definition: intsafe.h:52
HDC hdc
Definition: main.c:9
BOOL Polygon(CONST PPOINT UnsafePoints, int Count, int polyFillMode)
Definition: polytest.cpp:730
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
_In_ HFONT _Out_ PUINT _Out_ PUINT Width
Definition: font.h:89
_In_ HFONT _Out_ PUINT Height
Definition: font.h:88
HGDIOBJ WINAPI GetStockObject(_In_ int)
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
BOOL WINAPI MoveToEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
#define NULL_PEN
Definition: wingdi.h:904
BOOL WINAPI LineTo(_In_ HDC, _In_ int, _In_ int)
#define BDR_INNER
Definition: winuser.h:447
#define BF_LEFT
Definition: winuser.h:454
#define BF_DIAGONAL_ENDTOPRIGHT
Definition: winuser.h:464
#define BF_ADJUST
Definition: winuser.h:470
#define BF_MIDDLE
Definition: winuser.h:468
#define BF_BOTTOM
Definition: winuser.h:457
#define BF_FLAT
Definition: winuser.h:471
#define BF_TOP
Definition: winuser.h:455
#define BF_BOTTOMRIGHT
Definition: winuser.h:461
#define BF_RIGHT
Definition: winuser.h:456
#define BF_DIAGONAL_ENDBOTTOMLEFT
Definition: winuser.h:466
#define BF_TOPRIGHT
Definition: winuser.h:459
#define BF_DIAGONAL_ENDBOTTOMRIGHT
Definition: winuser.h:467
#define BF_TOPLEFT
Definition: winuser.h:458
#define BDR_OUTER
Definition: winuser.h:446
#define BF_MONO
Definition: winuser.h:472
#define BF_BOTTOMLEFT
Definition: winuser.h:460
#define BF_DIAGONAL
Definition: winuser.h:463
#define BF_SOFT
Definition: winuser.h:469
#define BF_RECT
Definition: winuser.h:462
#define BF_DIAGONAL_ENDTOPLEFT
Definition: winuser.h:465

Referenced by DrawThemeEdge().

◆ draw_rect_edge()

static HRESULT draw_rect_edge ( HDC  hdc,
HTHEME  theme,
int  part,
int  state,
const RECT rc,
UINT  uType,
UINT  uFlags,
LPRECT  contentsRect 
)
static

Definition at line 1191 of file draw.c.

1194{
1195 signed char LTInnerI, LTOuterI;
1196 signed char RBInnerI, RBOuterI;
1197 HPEN LTInnerPen, LTOuterPen;
1198 HPEN RBInnerPen, RBOuterPen;
1199 RECT InnerRect = *rc;
1200 POINT SavePoint;
1201 HPEN SavePen;
1202 int LBpenplus = 0;
1203 int LTpenplus = 0;
1204 int RTpenplus = 0;
1205 int RBpenplus = 0;
1206 HRESULT retval = (((uType & BDR_INNER) == BDR_INNER
1207 || (uType & BDR_OUTER) == BDR_OUTER)
1208 && !(uFlags & (BF_FLAT|BF_MONO)) ) ? E_FAIL : S_OK;
1209
1210 /* Init some vars */
1211 LTInnerPen = LTOuterPen = RBInnerPen = RBOuterPen = GetStockObject(NULL_PEN);
1212 SavePen = SelectObject(hdc, LTInnerPen);
1213
1214 /* Determine the colors of the edges */
1215 if(uFlags & BF_MONO)
1216 {
1217 LTInnerI = RBInnerI = LTRBInnerMono[uType & (BDR_INNER|BDR_OUTER)];
1218 LTOuterI = RBOuterI = LTRBOuterMono[uType & (BDR_INNER|BDR_OUTER)];
1219 }
1220 else if(uFlags & BF_FLAT)
1221 {
1222 LTInnerI = RBInnerI = LTRBInnerFlat[uType & (BDR_INNER|BDR_OUTER)];
1223 LTOuterI = RBOuterI = LTRBOuterFlat[uType & (BDR_INNER|BDR_OUTER)];
1224
1225 if( LTInnerI != -1 ) LTInnerI = RBInnerI = EDGE_FILL;
1226 }
1227 else if(uFlags & BF_SOFT)
1228 {
1229 LTInnerI = LTInnerSoft[uType & (BDR_INNER|BDR_OUTER)];
1230 LTOuterI = LTOuterSoft[uType & (BDR_INNER|BDR_OUTER)];
1231 RBInnerI = RBInnerSoft[uType & (BDR_INNER|BDR_OUTER)];
1232 RBOuterI = RBOuterSoft[uType & (BDR_INNER|BDR_OUTER)];
1233 }
1234 else
1235 {
1236 LTInnerI = LTInnerNormal[uType & (BDR_INNER|BDR_OUTER)];
1237 LTOuterI = LTOuterNormal[uType & (BDR_INNER|BDR_OUTER)];
1238 RBInnerI = RBInnerNormal[uType & (BDR_INNER|BDR_OUTER)];
1239 RBOuterI = RBOuterNormal[uType & (BDR_INNER|BDR_OUTER)];
1240 }
1241
1242 if((uFlags & BF_BOTTOMLEFT) == BF_BOTTOMLEFT) LBpenplus = 1;
1243 if((uFlags & BF_TOPRIGHT) == BF_TOPRIGHT) RTpenplus = 1;
1244 if((uFlags & BF_BOTTOMRIGHT) == BF_BOTTOMRIGHT) RBpenplus = 1;
1245 if((uFlags & BF_TOPLEFT) == BF_TOPLEFT) LTpenplus = 1;
1246
1247 if(LTInnerI != -1) LTInnerPen = get_edge_pen (LTInnerI, theme, part, state);
1248 if(LTOuterI != -1) LTOuterPen = get_edge_pen (LTOuterI, theme, part, state);
1249 if(RBInnerI != -1) RBInnerPen = get_edge_pen (RBInnerI, theme, part, state);
1250 if(RBOuterI != -1) RBOuterPen = get_edge_pen (RBOuterI, theme, part, state);
1251
1252 MoveToEx(hdc, 0, 0, &SavePoint);
1253
1254 /* Draw the outer edge */
1255 SelectObject(hdc, LTOuterPen);
1256 if(uFlags & BF_TOP)
1257 {
1258 MoveToEx(hdc, InnerRect.left, InnerRect.top, NULL);
1259 LineTo(hdc, InnerRect.right, InnerRect.top);
1260 }
1261 if(uFlags & BF_LEFT)
1262 {
1263 MoveToEx(hdc, InnerRect.left, InnerRect.top, NULL);
1264 LineTo(hdc, InnerRect.left, InnerRect.bottom);
1265 }
1266 SelectObject(hdc, RBOuterPen);
1267 if(uFlags & BF_BOTTOM)
1268 {
1269 MoveToEx(hdc, InnerRect.right-1, InnerRect.bottom-1, NULL);
1270 LineTo(hdc, InnerRect.left-1, InnerRect.bottom-1);
1271 }
1272 if(uFlags & BF_RIGHT)
1273 {
1274 MoveToEx(hdc, InnerRect.right-1, InnerRect.bottom-1, NULL);
1275 LineTo(hdc, InnerRect.right-1, InnerRect.top-1);
1276 }
1277
1278 /* Draw the inner edge */
1279 SelectObject(hdc, LTInnerPen);
1280 if(uFlags & BF_TOP)
1281 {
1282 MoveToEx(hdc, InnerRect.left+LTpenplus, InnerRect.top+1, NULL);
1283 LineTo(hdc, InnerRect.right-RTpenplus, InnerRect.top+1);
1284 }
1285 if(uFlags & BF_LEFT)
1286 {
1287 MoveToEx(hdc, InnerRect.left+1, InnerRect.top+LTpenplus, NULL);
1288 LineTo(hdc, InnerRect.left+1, InnerRect.bottom-LBpenplus);
1289 }
1290 SelectObject(hdc, RBInnerPen);
1291 if(uFlags & BF_BOTTOM)
1292 {
1293 MoveToEx(hdc, InnerRect.right-1-RBpenplus, InnerRect.bottom-2, NULL);
1294 LineTo(hdc, InnerRect.left-1+LBpenplus, InnerRect.bottom-2);
1295 }
1296 if(uFlags & BF_RIGHT)
1297 {
1298 MoveToEx(hdc, InnerRect.right-2, InnerRect.bottom-1-RBpenplus, NULL);
1299 LineTo(hdc, InnerRect.right-2, InnerRect.top-1+RTpenplus);
1300 }
1301
1302 if( ((uFlags & BF_MIDDLE) && retval) || (uFlags & BF_ADJUST) )
1303 {
1304 int add = (LTRBInnerMono[uType & (BDR_INNER|BDR_OUTER)] != -1 ? 1 : 0)
1305 + (LTRBOuterMono[uType & (BDR_INNER|BDR_OUTER)] != -1 ? 1 : 0);
1306
1307 if(uFlags & BF_LEFT) InnerRect.left += add;
1308 if(uFlags & BF_RIGHT) InnerRect.right -= add;
1309 if(uFlags & BF_TOP) InnerRect.top += add;
1310 if(uFlags & BF_BOTTOM) InnerRect.bottom -= add;
1311
1312 if((uFlags & BF_MIDDLE) && retval)
1313 {
1314 HBRUSH br = get_edge_brush ((uFlags & BF_MONO) ? EDGE_WINDOW : EDGE_FILL,
1315 theme, part, state);
1316 FillRect(hdc, &InnerRect, br);
1317 DeleteObject (br);
1318 }
1319
1320 if(uFlags & BF_ADJUST)
1321 *contentsRect = InnerRect;
1322 }
1323
1324 /* Cleanup */
1325 SelectObject(hdc, SavePen);
1326 MoveToEx(hdc, SavePoint.x, SavePoint.y, NULL);
1327 if(LTInnerI != -1) DeleteObject (LTInnerPen);
1328 if(LTOuterI != -1) DeleteObject (LTOuterPen);
1329 if(RBInnerI != -1) DeleteObject (RBInnerPen);
1330 if(RBOuterI != -1) DeleteObject (RBOuterPen);
1331 return retval;
1332}
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)

Referenced by DrawThemeEdge().

◆ DrawThemeBackground()

HRESULT WINAPI DrawThemeBackground ( HTHEME  hTheme,
HDC  hdc,
int  iPartId,
int  iStateId,
const RECT pRect,
const RECT pClipRect 
)

Definition at line 128 of file draw.c.

131{
132 DTBGOPTS opts;
133 opts.dwSize = sizeof(DTBGOPTS);
134 opts.dwFlags = 0;
135 if(pClipRect) {
136 opts.dwFlags |= DTBG_CLIPRECT;
137 opts.rcClip = *pClipRect;
138 }
139 return DrawThemeBackgroundEx(hTheme, hdc, iPartId, iStateId, pRect, &opts);
140}
HRESULT WINAPI DrawThemeBackgroundEx(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, const DTBGOPTS *pOptions)
Definition: draw.c:740

Referenced by CB_ThemedPaint(), COMBO_ThemedPaint(), draw_theme_bar_H(), draw_theme_bar_V(), draw_theme_bkg_H(), draw_theme_bkg_V(), DrawNCPreview(), CTrayWindow::DrawSizerWithTheme(), EDIT_WM_NCPaint(), CTrayWindow::EraseBackgroundWithTheme(), GB_ThemedPaint(), CTaskSwitchWnd::HandleItemPaint(), HEADER_FillItemFrame(), HEADER_Refresh(), IPADDRESS_Draw(), LISTBOX_NCPaint(), LISTVIEW_NCPaint(), CTrayShowDesktopButton::OnDraw(), CTrayNotifyWnd::OnEraseBackground(), paint_scrollbar(), PaintControl(), PB_ThemedPaint(), PROGRESS_Draw(), REBAR_DrawBand(), REBAR_EraseBkGnd(), SCROLL_ThemeDrawPart(), STATUSBAR_DrawPart(), STATUSBAR_DrawSizeGrip(), STATUSBAR_Refresh(), STATUSBAR_RefreshPart(), TAB_DrawBorder(), TAB_DrawItem(), Theme_Start(), ThemeDrawBorders(), ThemeDrawCaption(), ThemeDrawCaptionButton(), ThemeDrawScrollBarsGrip(), TOOLBAR_DrawButton(), TRACKBAR_DrawChannel(), TRACKBAR_DrawThumb(), TREEVIEW_DrawItemLines(), TREEVIEW_NCPaint(), UPDOWN_Draw(), UPDOWN_DrawBuddyBackground(), and UXTHEME_DrawThemePartToDib().

◆ DrawThemeBackgroundEx()

HRESULT WINAPI DrawThemeBackgroundEx ( HTHEME  hTheme,
HDC  hdc,
int  iPartId,
int  iStateId,
const RECT pRect,
const DTBGOPTS *  pOptions 
)

Definition at line 740 of file draw.c.

743{
744 HRESULT hr;
745 const DTBGOPTS defaultOpts = {sizeof(DTBGOPTS), 0, {0,0,0,0}};
746 const DTBGOPTS *opts;
747 HRGN clip = NULL;
748 int hasClip = -1;
749 int bgtype = BT_BORDERFILL;
750 RECT rt;
751
752 TRACE("(%p,%p,%d,%d,%d,%d)\n", hTheme, hdc, iPartId, iStateId,pRect->left,pRect->top);
753 if(!hTheme)
754 return E_HANDLE;
755
756 GetThemeEnumValue(hTheme, iPartId, iStateId, TMT_BGTYPE, &bgtype);
757 if (bgtype == BT_NONE) return S_OK;
758
759 /* Ensure we have a DTBGOPTS structure available, simplifies some of the code */
760 opts = pOptions;
761 if(!opts) opts = &defaultOpts;
762
763 if(opts->dwFlags & DTBG_CLIPRECT) {
764 clip = CreateRectRgn(0,0,1,1);
765 hasClip = GetClipRgn(hdc, clip);
766 if(hasClip == -1)
767 TRACE("Failed to get original clipping region\n");
768 else
769 IntersectClipRect(hdc, opts->rcClip.left, opts->rcClip.top, opts->rcClip.right, opts->rcClip.bottom);
770 }
771 rt = *pRect;
772
773 if(bgtype == BT_IMAGEFILE)
774 hr = UXTHEME_DrawImageBackground(hTheme, hdc, iPartId, iStateId, &rt, opts);
775 else if(bgtype == BT_BORDERFILL)
776 hr = UXTHEME_DrawBorderBackground(hTheme, hdc, iPartId, iStateId, pRect, opts);
777 else {
778 FIXME("Unknown background type\n");
779 /* This should never happen, and hence I don't know what to return */
780 hr = E_FAIL;
781 }
782#if 0
783 if(SUCCEEDED(hr))
784#endif
785 {
786 RECT rcGlyph = *pRect;
787 MARGINS margin;
788 hr = GetThemeMargins(hTheme, hdc, iPartId, iStateId, TMT_CONTENTMARGINS, NULL, &margin);
789 if(SUCCEEDED(hr))
790 {
791 rcGlyph.left += margin.cxLeftWidth;
792 rcGlyph.right -= margin.cxRightWidth;
793 rcGlyph.top += margin.cyTopHeight;
794 rcGlyph.bottom -= margin.cyBottomHeight;
795 }
796 hr = UXTHEME_DrawGlyph(hTheme, hdc, iPartId, iStateId, &rcGlyph, opts);
797 }
798 if(opts->dwFlags & DTBG_CLIPRECT) {
799 if(hasClip == 0)
801 else if(hasClip == 1)
802 SelectClipRgn(hdc, clip);
803 DeleteObject(clip);
804 }
805 return hr;
806}
#define FIXME(fmt,...)
Definition: debug.h:111
static HRESULT UXTHEME_DrawGlyph(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, RECT *pRect, const DTBGOPTS *pOptions)
Definition: draw.c:387
static HRESULT UXTHEME_DrawImageBackground(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, RECT *pRect, const DTBGOPTS *pOptions)
Definition: draw.c:514
static HRESULT UXTHEME_DrawBorderBackground(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, const DTBGOPTS *pOptions)
Definition: draw.c:722
HRESULT WINAPI GetThemeMargins(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, int iPropId, RECT *prc, MARGINS *pMargins)
Definition: property.c:216
HRESULT WINAPI GetThemeEnumValue(HTHEME hTheme, int iPartId, int iStateId, int iPropId, int *piVal)
Definition: property.c:63
#define SUCCEEDED(hr)
Definition: intsafe.h:50
HRESULT hr
Definition: shlfolder.c:183
#define TRACE(s)
Definition: solgame.cpp:4
Definition: misc.c:279
int cyBottomHeight
Definition: misc.c:283
int cyTopHeight
Definition: misc.c:282
int cxRightWidth
Definition: misc.c:281
int cxLeftWidth
Definition: misc.c:280
#define TMT_CONTENTMARGINS
Definition: vssym32.h:324
#define TMT_BGTYPE
Definition: vssym32.h:353
@ BT_BORDERFILL
Definition: vssym32.h:27
@ BT_NONE
Definition: vssym32.h:28
@ BT_IMAGEFILE
Definition: vssym32.h:26
#define E_HANDLE
Definition: winerror.h:2850
HRGN WINAPI CreateRectRgn(_In_ int, _In_ int, _In_ int, _In_ int)
int WINAPI IntersectClipRect(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
int WINAPI GetClipRgn(_In_ HDC, _In_ HRGN)
int WINAPI SelectClipRgn(_In_ HDC, _In_opt_ HRGN)

Referenced by DrawThemeBackground().

◆ DrawThemeEdge()

HRESULT WINAPI DrawThemeEdge ( HTHEME  hTheme,
HDC  hdc,
int  iPartId,
int  iStateId,
const RECT pDestRect,
UINT  uEdge,
UINT  uFlags,
RECT pContentRect 
)

Definition at line 1342 of file draw.c.

1345{
1346 TRACE("%d %d 0x%08x 0x%08x\n", iPartId, iStateId, uEdge, uFlags);
1347 if(!hTheme)
1348 return E_HANDLE;
1349
1350 if(uFlags & BF_DIAGONAL)
1351 return draw_diag_edge (hdc, hTheme, iPartId, iStateId, pDestRect,
1352 uEdge, uFlags, pContentRect);
1353 else
1354 return draw_rect_edge (hdc, hTheme, iPartId, iStateId, pDestRect,
1355 uEdge, uFlags, pContentRect);
1356}
static HRESULT draw_diag_edge(HDC hdc, HTHEME theme, int part, int state, const RECT *rc, UINT uType, UINT uFlags, LPRECT contentsRect)
Definition: draw.c:941
static HRESULT draw_rect_edge(HDC hdc, HTHEME theme, int part, int state, const RECT *rc, UINT uType, UINT uFlags, LPRECT contentsRect)
Definition: draw.c:1191

Referenced by REBAR_EraseBkGnd(), and REBAR_NCPaint().

◆ DrawThemeIcon()

HRESULT WINAPI DrawThemeIcon ( HTHEME  hTheme,
HDC  hdc,
int  iPartId,
int  iStateId,
const RECT pRect,
HIMAGELIST  himl,
int  iImageIndex 
)

Definition at line 1362 of file draw.c.

1364{
1365 FIXME("%d %d: stub\n", iPartId, iStateId);
1366 if(!hTheme)
1367 return E_HANDLE;
1368 return E_NOTIMPL;
1369}
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ DrawThemeParentBackground()

HRESULT WINAPI DrawThemeParentBackground ( HWND  hwnd,
HDC  hdc,
RECT prc 
)

Definition at line 72 of file draw.c.

73{
74 RECT rt;
75 POINT org;
76 HWND hParent;
77 HRGN clip = NULL;
78 int hasClip = -1;
79
80 TRACE("(%p,%p,%p)\n", hwnd, hdc, prc);
81
82 if (!IsWindow(hwnd) || !hdc)
83 return E_HANDLE;
84
85 if (prc && IsBadReadPtr (prc, sizeof(RECT)))
86 return E_POINTER;
87
88 hParent = GetParent(hwnd);
89 if(!hParent)
90 return S_OK;
91
92 if(prc) {
93 rt = *prc;
94 MapWindowPoints(hwnd, hParent, (LPPOINT)&rt, 2);
95
96 clip = CreateRectRgn(0,0,1,1);
97 hasClip = GetClipRgn(hdc, clip);
98 if(hasClip == -1)
99 TRACE("Failed to get original clipping region\n");
100 else
102 }
103 else {
104 GetClientRect(hwnd, &rt);
105 MapWindowPoints(hwnd, hParent, (LPPOINT)&rt, 2);
106 }
107
108 OffsetViewportOrgEx(hdc, -rt.left, -rt.top, &org);
109
110 SendMessageW(hParent, WM_ERASEBKGND, (WPARAM)hdc, 0);
112
114 if(prc) {
115 if(hasClip == 0)
117 else if(hasClip == 1)
118 SelectClipRgn(hdc, clip);
119 DeleteObject(clip);
120 }
121 return S_OK;
122}
BOOL WINAPI IsBadReadPtr(IN LPCVOID lp, IN UINT_PTR ucb)
Definition: except.c:805
static char org[]
Definition: encode.c:7456
_Out_ LPRECT prc
Definition: ntgdi.h:1658
#define WM_PRINTCLIENT
Definition: richedit.h:70
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
UINT_PTR WPARAM
Definition: windef.h:207
#define E_POINTER
Definition: winerror.h:2365
BOOL WINAPI OffsetViewportOrgEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
Definition: coord.c:858
BOOL WINAPI SetViewportOrgEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
Definition: coord.c:655
#define WM_ERASEBKGND
Definition: winuser.h:1625
BOOL WINAPI IsWindow(_In_opt_ HWND)
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define PRF_CLIENT
Definition: winuser.h:2525
HWND WINAPI GetParent(_In_ HWND)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by CB_ThemedPaint(), CTrayClockWnd::DrawBackground(), EDIT_WM_NCPaint(), GB_ThemedPaint(), IPADDRESS_Draw(), LISTBOX_NCPaint(), LISTVIEW_NCPaint(), CSysPagerWnd::OnEraseBackground(), CTaskSwitchWnd::OnEraseBackground(), CTrayNotifyWnd::OnEraseBackground(), PB_ThemedPaint(), PROGRESS_Draw(), REBAR_EraseBkGnd(), Test_Messages(), Test_Params(), Theme_Start(), TRACKBAR_Refresh(), and TREEVIEW_NCPaint().

◆ DrawThemeText()

HRESULT WINAPI DrawThemeText ( HTHEME  hTheme,
HDC  hdc,
int  iPartId,
int  iStateId,
LPCWSTR  pszText,
int  iCharCount,
DWORD  dwTextFlags,
DWORD  dwTextFlags2,
const RECT pRect 
)

Definition at line 1377 of file draw.c.

1380{
1381 HRESULT hr;
1382 HFONT hFont = NULL;
1383 HGDIOBJ oldFont = NULL;
1384 LOGFONTW logfont;
1385 COLORREF textColor;
1386 COLORREF oldTextColor;
1387 COLORREF shadowColor;
1388 POINT ptShadowOffset;
1389 int oldBkMode;
1390 RECT rt;
1391 int iShadowType;
1392
1393 TRACE("%d %d: stub\n", iPartId, iStateId);
1394 if(!hTheme)
1395 return E_HANDLE;
1396
1397 hr = GetThemeFont(hTheme, hdc, iPartId, iStateId, TMT_FONT, &logfont);
1398 if(SUCCEEDED(hr))
1399 {
1400 hFont = CreateFontIndirectW(&logfont);
1401 if(!hFont)
1402 {
1403 ERR("Failed to create font\n");
1404 }
1405 }
1406
1407 CopyRect(&rt, pRect);
1408 if(hFont)
1409 oldFont = SelectObject(hdc, hFont);
1410
1411 oldBkMode = SetBkMode(hdc, TRANSPARENT);
1412
1413 if(dwTextFlags2 & DTT_GRAYED)
1414 textColor = GetSysColor(COLOR_GRAYTEXT);
1415 else {
1416 if(FAILED(GetThemeColor(hTheme, iPartId, iStateId, TMT_TEXTCOLOR, &textColor)))
1417 textColor = GetTextColor(hdc);
1418 }
1419
1420 hr = GetThemeEnumValue(hTheme, iPartId, iStateId, TMT_TEXTSHADOWTYPE, &iShadowType);
1421 if (SUCCEEDED(hr))
1422 {
1423 hr = GetThemeColor(hTheme, iPartId, iStateId, TMT_TEXTSHADOWCOLOR, &shadowColor);
1424 if (FAILED(hr))
1425 {
1426 ERR("GetThemeColor failed\n");
1427 }
1428
1429 hr = GetThemePosition(hTheme, iPartId, iStateId, TMT_TEXTSHADOWOFFSET, &ptShadowOffset);
1430 if (FAILED(hr))
1431 {
1432 ERR("GetThemePosition failed\n");
1433 }
1434
1435 if (iShadowType == TST_SINGLE)
1436 {
1437 oldTextColor = SetTextColor(hdc, shadowColor);
1438 OffsetRect(&rt, ptShadowOffset.x, ptShadowOffset.y);
1439 DrawTextW(hdc, pszText, iCharCount, &rt, dwTextFlags);
1440 OffsetRect(&rt, -ptShadowOffset.x, -ptShadowOffset.y);
1441 SetTextColor(hdc, oldTextColor);
1442 }
1443 else if (iShadowType == TST_CONTINUOUS)
1444 {
1445 HANDLE hcomctl32 = GetModuleHandleW(L"comctl32.dll");
1446 DRAWSHADOWTEXT pDrawShadowText;
1447 if (!hcomctl32)
1448 {
1449 hcomctl32 = LoadLibraryW(L"comctl32.dll");
1450 if (!hcomctl32)
1451 ERR("Failed to load comctl32\n");
1452 }
1453
1454 pDrawShadowText = (DRAWSHADOWTEXT)GetProcAddress(hcomctl32, "DrawShadowText");
1455 if (pDrawShadowText)
1456 {
1457 pDrawShadowText(hdc, pszText, iCharCount, &rt, dwTextFlags, textColor, shadowColor, ptShadowOffset.x, ptShadowOffset.y);
1458 goto cleanup;
1459 }
1460 }
1461 }
1462
1463 oldTextColor = SetTextColor(hdc, textColor);
1464 DrawTextW(hdc, pszText, iCharCount, &rt, dwTextFlags);
1465 SetTextColor(hdc, oldTextColor);
1466cleanup:
1467 SetBkMode(hdc, oldBkMode);
1468
1469 if(hFont) {
1470 SelectObject(hdc, oldFont);
1472 }
1473 return S_OK;
1474}
HFONT hFont
Definition: main.c:53
#define ERR(fmt,...)
Definition: debug.h:110
#define GetProcAddress(x, y)
Definition: compat.h:753
#define LoadLibraryW(x)
Definition: compat.h:747
static void cleanup(void)
Definition: main.c:1335
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
int(WINAPI * DRAWSHADOWTEXT)(HDC hdc, LPCWSTR pszText, UINT cch, RECT *prc, DWORD dwFlags, COLORREF crText, COLORREF crShadow, int ixOffset, int iyOffset)
Definition: draw.c:1371
HRESULT WINAPI GetThemePosition(HTHEME hTheme, int iPartId, int iStateId, int iPropId, POINT *pPoint)
Definition: property.c:162
HRESULT WINAPI GetThemeFont(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, int iPropId, LOGFONTW *pFont)
Definition: property.c:108
HRESULT WINAPI GetThemeColor(HTHEME hTheme, int iPartId, int iStateId, int iPropId, COLORREF *pColor)
Definition: property.c:45
#define FAILED(hr)
Definition: intsafe.h:51
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
INT WINAPI DrawTextW(HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
Definition: defwnd.c:16
#define L(x)
Definition: ntvdm.h:50
#define TMT_TEXTSHADOWOFFSET
Definition: vssym32.h:315
#define TMT_TEXTCOLOR
Definition: vssym32.h:328
@ TST_SINGLE
Definition: vssym32.h:101
@ TST_CONTINUOUS
Definition: vssym32.h:102
#define TMT_TEXTSHADOWCOLOR
Definition: vssym32.h:343
#define TMT_FONT
Definition: vssym32.h:144
#define TMT_TEXTSHADOWTYPE
Definition: vssym32.h:362
DWORD COLORREF
Definition: windef.h:300
COLORREF WINAPI GetTextColor(_In_ HDC)
Definition: text.c:861
#define TRANSPARENT
Definition: wingdi.h:950
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1056
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:918
DWORD WINAPI GetSysColor(_In_ int)
BOOL WINAPI CopyRect(_Out_ LPRECT, _In_ LPCRECT)
#define COLOR_GRAYTEXT
Definition: winuser.h:932
BOOL WINAPI OffsetRect(_Inout_ LPRECT, _In_ int, _In_ int)

Referenced by CB_ThemedPaint(), DrawNCPreview(), GB_ThemedPaint(), HEADER_DrawItem(), IPADDRESS_Draw(), PB_ThemedPaint(), REBAR_DrawBand(), STATUSBAR_DrawPart(), TAB_DrawItemInterior(), ThemeDrawCaptionText(), and TOOLBAR_DrawString().

◆ EnableThemeDialogTexture()

HRESULT WINAPI EnableThemeDialogTexture ( HWND  hwnd,
DWORD  dwFlags 
)

Definition at line 36 of file draw.c.

37{
38 static const WCHAR szTab[] = { 'T','a','b',0 };
39 BOOL res;
40
41 TRACE("(%p,0x%08x\n", hwnd, dwFlags);
43 UlongToHandle(dwFlags|0x80000000));
44 /* 0x80000000 serves as a "flags set" flag */
45 if (!res)
48 return SetWindowTheme (hwnd, NULL, szTab);
49 else
50 return S_OK;
51}
#define UlongToHandle(ul)
Definition: basetsd.h:97
ATOM atDialogThemeEnabled
Definition: system.c:46
#define ETDT_USETABTEXTURE
Definition: dxdiag.c:29
unsigned int BOOL
Definition: ntddk_ex.h:94
GLuint res
Definition: glext.h:9613
HRESULT WINAPI SetWindowTheme(_In_ HWND hwnd, _In_ LPCWSTR pszSubAppName, _In_ LPCWSTR pszSubIdList)
Definition: uxthemesupp.c:69
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define MAKEINTATOM(i)
Definition: winbase.h:1463
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
BOOL WINAPI SetPropW(_In_ HWND, _In_ LPCWSTR, _In_opt_ HANDLE)
__wchar_t WCHAR
Definition: xmlstorage.h:180
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

◆ get_border_background_size()

static HRESULT get_border_background_size ( HTHEME  hTheme,
int  iPartId,
int  iStateId,
THEMESIZE  eSize,
POINT psz 
)
static

Definition at line 1755 of file draw.c.

1757{
1758 HRESULT hr = S_OK;
1759 int bordersize = 1;
1760
1761 if (SUCCEEDED (hr = GetThemeInt(hTheme, iPartId, iStateId, TMT_BORDERSIZE,
1762 &bordersize)))
1763 {
1764 psz->x = psz->y = 2*bordersize;
1765 if (eSize != TS_MIN)
1766 {
1767 psz->x++;
1768 psz->y++;
1769 }
1770 }
1771 return hr;
1772}
HRESULT WINAPI GetThemeInt(HTHEME hTheme, int iPartId, int iStateId, int iPropId, int *piVal)
Definition: property.c:126
#define TMT_BORDERSIZE
Definition: vssym32.h:274

Referenced by GetThemePartSize().

◆ get_edge_brush()

static HBRUSH get_edge_brush ( int  edgeType,
HTHEME  theme,
int  part,
int  state 
)
inlinestatic

Definition at line 931 of file draw.c.

932{
933 return CreateSolidBrush (get_edge_color (edgeType, theme, part, state));
934}
static COLORREF get_edge_color(int edgeType, HTHEME theme, int part, int state)
Definition: draw.c:916
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)

Referenced by draw_diag_edge(), and draw_rect_edge().

◆ get_edge_color()

static COLORREF get_edge_color ( int  edgeType,
HTHEME  theme,
int  part,
int  state 
)
static

Definition at line 916 of file draw.c.

917{
918 COLORREF col;
919 if ((EdgeColorMap[edgeType].themeProp == -1)
920 || FAILED (GetThemeColor (theme, part, state,
921 EdgeColorMap[edgeType].themeProp, &col)))
922 col = GetSysColor (EdgeColorMap[edgeType].sysColor);
923 return col;
924}
int themeProp
Definition: draw.c:831
int sysColor
Definition: draw.c:832
static const struct @571 EdgeColorMap[EDGE_NUMCOLORS]

Referenced by get_edge_brush(), and get_edge_pen().

◆ get_edge_pen()

static HPEN get_edge_pen ( int  edgeType,
HTHEME  theme,
int  part,
int  state 
)
inlinestatic

Definition at line 926 of file draw.c.

927{
928 return CreatePen (PS_SOLID, 1, get_edge_color (edgeType, theme, part, state));
929}
HPEN WINAPI CreatePen(_In_ int, _In_ int, _In_ COLORREF)
#define PS_SOLID
Definition: wingdi.h:586

Referenced by draw_diag_edge(), and draw_rect_edge().

◆ get_image_part_size()

static HRESULT get_image_part_size ( HTHEME  hTheme,
HDC  hdc,
int  iPartId,
int  iStateId,
RECT prc,
THEMESIZE  eSize,
POINT psz 
)
static

Definition at line 410 of file draw.c.

413{
414 HRESULT hr = S_OK;
415 HBITMAP bmpSrc;
416 RECT rcSrc;
417 BOOL hasAlpha;
418
419 hr = UXTHEME_LoadImage(hTheme, hdc, iPartId, iStateId, prc, FALSE,
420 &bmpSrc, &rcSrc, &hasAlpha);
421 if (FAILED(hr)) return hr;
422
423 switch (eSize)
424 {
425 case TS_DRAW:
426 if (prc != NULL)
427 {
428 RECT rcDst;
429 POINT dstSize;
430 POINT srcSize;
431 int sizingtype = ST_STRETCH;
432 BOOL uniformsizing = FALSE;
433
434 rcDst = *prc;
435
436 dstSize.x = rcDst.right-rcDst.left;
437 dstSize.y = rcDst.bottom-rcDst.top;
438 srcSize.x = rcSrc.right-rcSrc.left;
439 srcSize.y = rcSrc.bottom-rcSrc.top;
440
441 GetThemeBool(hTheme, iPartId, iStateId, TMT_UNIFORMSIZING, &uniformsizing);
442 if(uniformsizing) {
443 /* Scale height and width equally */
444 if (dstSize.x*srcSize.y < dstSize.y*srcSize.x)
445 {
446 dstSize.y = MulDiv (srcSize.y, dstSize.x, srcSize.x);
447 rcDst.bottom = rcDst.top + dstSize.y;
448 }
449 else
450 {
451 dstSize.x = MulDiv (srcSize.x, dstSize.y, srcSize.y);
452 rcDst.right = rcDst.left + dstSize.x;
453 }
454 }
455
456 GetThemeEnumValue(hTheme, iPartId, iStateId, TMT_SIZINGTYPE, &sizingtype);
457 if(sizingtype == ST_TRUESIZE) {
458 int truesizestretchmark = 100;
459
460 if(dstSize.x < 0 || dstSize.y < 0) {
461 BOOL mirrorimage = TRUE;
462 GetThemeBool(hTheme, iPartId, iStateId, TMT_MIRRORIMAGE, &mirrorimage);
463 if(mirrorimage) {
464 if(dstSize.x < 0) {
465 rcDst.left += dstSize.x;
466 rcDst.right += dstSize.x;
467 }
468 if(dstSize.y < 0) {
469 rcDst.top += dstSize.y;
470 rcDst.bottom += dstSize.y;
471 }
472 }
473 }
474 /* Whatever TrueSizeStretchMark does - it does not seem to
475 * be what's outlined below. It appears as if native
476 * uxtheme always stretches if dest is smaller than source
477 * (ie as if TrueSizeStretchMark==100 with the code below) */
478#if 0
479 /* Only stretch when target exceeds source by truesizestretchmark percent */
480 GetThemeInt(hTheme, iPartId, iStateId, TMT_TRUESIZESTRETCHMARK, &truesizestretchmark);
481#endif
482 if(dstSize.x < 0 || dstSize.y < 0 ||
483 (MulDiv(srcSize.x, 100, dstSize.x) > truesizestretchmark &&
484 MulDiv(srcSize.y, 100, dstSize.y) > truesizestretchmark)) {
485 memcpy (psz, &dstSize, sizeof (SIZE));
486 }
487 else {
488 memcpy (psz, &srcSize, sizeof (SIZE));
489 }
490 }
491 else
492 {
493 psz->x = abs(dstSize.x);
494 psz->y = abs(dstSize.y);
495 }
496 break;
497 }
498 /* else fall through */
499 case TS_MIN:
500 /* FIXME: couldn't figure how native uxtheme computes min size */
501 case TS_TRUE:
502 psz->x = rcSrc.right - rcSrc.left;
503 psz->y = rcSrc.bottom - rcSrc.top;
504 break;
505 }
506 return hr;
507}
@ TS_TRUE
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
HRESULT UXTHEME_LoadImage(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, BOOL glyph, HBITMAP *hBmp, RECT *bmpRect, BOOL *hasImageAlpha)
Definition: draw.c:230
HRESULT WINAPI GetThemeBool(HTHEME hTheme, int iPartId, int iStateId, int iPropId, BOOL *pfVal)
Definition: property.c:26
#define abs(i)
Definition: fconv.c:206
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static HBITMAP
Definition: button.c:44
INT WINAPI MulDiv(INT nNumber, INT nNumerator, INT nDenominator)
Definition: muldiv.c:25
#define TMT_MIRRORIMAGE
Definition: vssym32.h:260
#define TMT_TRUESIZESTRETCHMARK
Definition: vssym32.h:290
@ ST_TRUESIZE
Definition: vssym32.h:51
@ ST_STRETCH
Definition: vssym32.h:52
#define TMT_UNIFORMSIZING
Definition: vssym32.h:261
#define TMT_SIZINGTYPE
Definition: vssym32.h:356

Referenced by GetThemePartSize(), and UXTHEME_DrawImageBackground().

◆ get_transparency()

static void get_transparency ( HTHEME  hTheme,
int  iPartId,
int  iStateId,
BOOL  hasImageAlpha,
INT transparent,
COLORREF transparentcolor,
BOOL  glyph 
)
inlinestatic

Definition at line 285 of file draw.c.

288{
289 if (hasImageAlpha)
290 {
291 *transparent = ALPHABLEND_FULL;
292 *transparentcolor = RGB (255, 0, 255);
293 }
294 else
295 {
296 BOOL trans = FALSE;
297 GetThemeBool(hTheme, iPartId, iStateId,
298 glyph ? TMT_GLYPHTRANSPARENT : TMT_TRANSPARENT, &trans);
299 if(trans) {
300 *transparent = ALPHABLEND_BINARY;
301 if(FAILED(GetThemeColor(hTheme, iPartId, iStateId,
303 transparentcolor))) {
304 /* If image is transparent, but no color was specified, use magenta */
305 *transparentcolor = RGB(255, 0, 255);
306 }
307 }
308 else
309 *transparent = ALPHABLEND_NONE;
310 }
311}
#define RGB(r, g, b)
Definition: precomp.h:71
#define ALPHABLEND_FULL
Definition: uxthemep.h:287
#define ALPHABLEND_NONE
Definition: uxthemep.h:283
#define ALPHABLEND_BINARY
Definition: uxthemep.h:285
#define TMT_TRANSPARENT
Definition: vssym32.h:252
#define TMT_TRANSPARENTCOLOR
Definition: vssym32.h:334
#define TMT_GLYPHTRANSPARENT
Definition: vssym32.h:257
#define TMT_GLYPHTRANSPARENTCOLOR
Definition: vssym32.h:345

Referenced by IsThemeBackgroundPartiallyTransparent(), UXTHEME_DrawImageBackground(), and UXTHEME_DrawImageGlyph().

◆ GetThemeBackgroundContentRect()

HRESULT WINAPI GetThemeBackgroundContentRect ( HTHEME  hTheme,
HDC  hdc,
int  iPartId,
int  iStateId,
const RECT pBoundingRect,
RECT pContentRect 
)

Definition at line 1479 of file draw.c.

1483{
1484 MARGINS margin;
1485 HRESULT hr;
1486
1487 TRACE("(%d,%d)\n", iPartId, iStateId);
1488 if(!hTheme)
1489 return E_HANDLE;
1490
1491 /* try content margins property... */
1492 hr = GetThemeMargins(hTheme, hdc, iPartId, iStateId, TMT_CONTENTMARGINS, NULL, &margin);
1493 if(SUCCEEDED(hr)) {
1494 pContentRect->left = pBoundingRect->left + margin.cxLeftWidth;
1495 pContentRect->top = pBoundingRect->top + margin.cyTopHeight;
1496 pContentRect->right = pBoundingRect->right - margin.cxRightWidth;
1497 pContentRect->bottom = pBoundingRect->bottom - margin.cyBottomHeight;
1498 } else {
1499 /* otherwise, try to determine content rect from the background type and props */
1500 int bgtype = BT_BORDERFILL;
1501 *pContentRect = *pBoundingRect;
1502
1503 GetThemeEnumValue(hTheme, iPartId, iStateId, TMT_BGTYPE, &bgtype);
1504 if(bgtype == BT_BORDERFILL) {
1505 int bordersize = 1;
1506
1507 GetThemeInt(hTheme, iPartId, iStateId, TMT_BORDERSIZE, &bordersize);
1508 InflateRect(pContentRect, -bordersize, -bordersize);
1509 } else if ((bgtype == BT_IMAGEFILE)
1510 && (SUCCEEDED(hr = GetThemeMargins(hTheme, hdc, iPartId, iStateId,
1511 TMT_SIZINGMARGINS, NULL, &margin)))) {
1512 pContentRect->left = pBoundingRect->left + margin.cxLeftWidth;
1513 pContentRect->top = pBoundingRect->top + margin.cyTopHeight;
1514 pContentRect->right = pBoundingRect->right - margin.cxRightWidth;
1515 pContentRect->bottom = pBoundingRect->bottom - margin.cyBottomHeight;
1516 }
1517 /* If nothing was found, leave unchanged */
1518 }
1519
1520 TRACE("%s\n", wine_dbgstr_rect(pContentRect));
1521
1522 return S_OK;
1523}
static const char * wine_dbgstr_rect(const RECT *prc)
Definition: atltest.h:160
#define TMT_SIZINGMARGINS
Definition: vssym32.h:323
BOOL WINAPI InflateRect(_Inout_ LPRECT, _In_ int, _In_ int)

Referenced by CB_ThemedPaint(), GB_ThemedPaint(), get_client_rect(), HEADER_FillItemFrame(), PB_ThemedPaint(), PROGRESS_Draw(), and TAB_DrawItem().

◆ GetThemeBackgroundExtent()

HRESULT WINAPI GetThemeBackgroundExtent ( HTHEME  hTheme,
HDC  hdc,
int  iPartId,
int  iStateId,
const RECT pContentRect,
RECT pExtentRect 
)

Definition at line 1528 of file draw.c.

1531{
1532 MARGINS margin;
1533 HRESULT hr;
1534
1535 TRACE("(%d,%d)\n", iPartId, iStateId);
1536 if(!hTheme)
1537 return E_HANDLE;
1538
1539 /* try content margins property... */
1540 hr = GetThemeMargins(hTheme, hdc, iPartId, iStateId, TMT_CONTENTMARGINS, NULL, &margin);
1541 if(SUCCEEDED(hr)) {
1542 pExtentRect->left = pContentRect->left - margin.cxLeftWidth;
1543 pExtentRect->top = pContentRect->top - margin.cyTopHeight;
1544 pExtentRect->right = pContentRect->right + margin.cxRightWidth;
1545 pExtentRect->bottom = pContentRect->bottom + margin.cyBottomHeight;
1546 } else {
1547 /* otherwise, try to determine content rect from the background type and props */
1548 int bgtype = BT_BORDERFILL;
1549 *pExtentRect = *pContentRect;
1550
1551 GetThemeEnumValue(hTheme, iPartId, iStateId, TMT_BGTYPE, &bgtype);
1552 if(bgtype == BT_BORDERFILL) {
1553 int bordersize = 1;
1554
1555 GetThemeInt(hTheme, iPartId, iStateId, TMT_BORDERSIZE, &bordersize);
1556 InflateRect(pExtentRect, bordersize, bordersize);
1557 } else if ((bgtype == BT_IMAGEFILE)
1558 && (SUCCEEDED(hr = GetThemeMargins(hTheme, hdc, iPartId, iStateId,
1559 TMT_SIZINGMARGINS, NULL, &margin)))) {
1560 pExtentRect->left = pContentRect->left - margin.cxLeftWidth;
1561 pExtentRect->top = pContentRect->top - margin.cyTopHeight;
1562 pExtentRect->right = pContentRect->right + margin.cxRightWidth;
1563 pExtentRect->bottom = pContentRect->bottom + margin.cyBottomHeight;
1564 }
1565 /* If nothing was found, leave unchanged */
1566 }
1567
1568 TRACE("%s\n", wine_dbgstr_rect(pExtentRect));
1569
1570 return S_OK;
1571}

Referenced by REBAR_DrawBand(), and STATUSBAR_ComputeHeight().

◆ GetThemeBackgroundRegion()

HRESULT WINAPI GetThemeBackgroundRegion ( HTHEME  hTheme,
HDC  hdc,
int  iPartId,
int  iStateId,
const RECT pRect,
HRGN *  pRegion 
)

Definition at line 1724 of file draw.c.

1727{
1728 HRESULT hr = S_OK;
1729 int bgtype = BT_BORDERFILL;
1730
1731 TRACE("(%p,%p,%d,%d)\n", hTheme, hdc, iPartId, iStateId);
1732 if(!hTheme)
1733 return E_HANDLE;
1734 if(!pRect || !pRegion)
1735 return E_POINTER;
1736
1737 GetThemeEnumValue(hTheme, iPartId, iStateId, TMT_BGTYPE, &bgtype);
1738 if(bgtype == BT_IMAGEFILE) {
1739 hr = UXTHEME_GetImageBackBackgroundRegion(hTheme, hdc, iPartId, iStateId, pRect, pRegion);
1740 }
1741 else if(bgtype == BT_BORDERFILL) {
1742 *pRegion = CreateRectRgn(pRect->left, pRect->top, pRect->right, pRect->bottom);
1743 if(!*pRegion)
1745 }
1746 else {
1747 FIXME("Unknown background type\n");
1748 /* This should never happen, and hence I don't know what to return */
1749 hr = E_FAIL;
1750 }
1751 return hr;
1752}
HRESULT UXTHEME_GetImageBackBackgroundRegion(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, LPCRECT pRect, HRGN *pRegion)
Definition: draw.c:1697

Referenced by SetThemeRegion().

◆ GetThemePartSize()

HRESULT WINAPI GetThemePartSize ( HTHEME  hTheme,
HDC  hdc,
int  iPartId,
int  iStateId,
RECT prc,
THEMESIZE  eSize,
SIZE psz 
)

Definition at line 1777 of file draw.c.

1780{
1781 int bgtype = BT_BORDERFILL;
1782 HRESULT hr = S_OK;
1783 POINT size = {1, 1};
1784
1785 if(!hTheme)
1786 return E_HANDLE;
1787
1788 GetThemeEnumValue(hTheme, iPartId, iStateId, TMT_BGTYPE, &bgtype);
1789 if (bgtype == BT_NONE)
1790 /* do nothing */;
1791 else if(bgtype == BT_IMAGEFILE)
1792 hr = get_image_part_size (hTheme, hdc, iPartId, iStateId, prc, eSize, &size);
1793 else if(bgtype == BT_BORDERFILL)
1794 hr = get_border_background_size (hTheme, iPartId, iStateId, eSize, &size);
1795 else {
1796 FIXME("Unknown background type\n");
1797 /* This should never happen, and hence I don't know what to return */
1798 hr = E_FAIL;
1799 }
1800 psz->cx = size.x;
1801 psz->cy = size.y;
1802 return hr;
1803}
static HRESULT get_border_background_size(HTHEME hTheme, int iPartId, int iStateId, THEMESIZE eSize, POINT *psz)
Definition: draw.c:1755
static HRESULT get_image_part_size(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, RECT *prc, THEMESIZE eSize, POINT *psz)
Definition: draw.c:410
GLsizeiptr size
Definition: glext.h:5919
LONG cx
Definition: kdterminal.h:27
LONG cy
Definition: kdterminal.h:28

Referenced by CTrayWindow::AdjustSizerRect(), CB_ThemedPaint(), CTrayWindow::DrawSizerWithTheme(), hit_test(), paint_scrollbar(), redraw_part(), STATUSBAR_DrawSizeGrip(), and ThemeCalculateCaptionButtonsPosEx().

◆ GetThemeTextExtent()

HRESULT WINAPI GetThemeTextExtent ( HTHEME  hTheme,
HDC  hdc,
int  iPartId,
int  iStateId,
LPCWSTR  pszText,
int  iCharCount,
DWORD  dwTextFlags,
const RECT pBoundingRect,
RECT pExtentRect 
)

Definition at line 1809 of file draw.c.

1813{
1814 HRESULT hr;
1815 HFONT hFont = NULL;
1816 HGDIOBJ oldFont = NULL;
1817 LOGFONTW logfont;
1818 RECT rt = {0,0,0xFFFF,0xFFFF};
1819
1820 TRACE("%d %d: stub\n", iPartId, iStateId);
1821 if(!hTheme)
1822 return E_HANDLE;
1823
1824 if(pBoundingRect)
1825 rt = *pBoundingRect;
1826
1827 hr = GetThemeFont(hTheme, hdc, iPartId, iStateId, TMT_FONT, &logfont);
1828 if(SUCCEEDED(hr)) {
1829 hFont = CreateFontIndirectW(&logfont);
1830 if(!hFont)
1831 TRACE("Failed to create font\n");
1832 }
1833 if(hFont)
1834 oldFont = SelectObject(hdc, hFont);
1835
1836 DrawTextW(hdc, pszText, iCharCount, &rt, dwTextFlags|DT_CALCRECT);
1837 *pExtentRect = rt;
1838
1839 if(hFont) {
1840 SelectObject(hdc, oldFont);
1842 }
1843 return S_OK;
1844}
#define DT_CALCRECT
Definition: winuser.h:526

Referenced by CTipbarThread::GetTextSize(), and HEADER_DrawItem().

◆ GetThemeTextMetrics()

HRESULT WINAPI GetThemeTextMetrics ( HTHEME  hTheme,
HDC  hdc,
int  iPartId,
int  iStateId,
TEXTMETRICW ptm 
)

Definition at line 1849 of file draw.c.

1851{
1852 HRESULT hr;
1853 HFONT hFont = NULL;
1854 HGDIOBJ oldFont = NULL;
1855 LOGFONTW logfont;
1856
1857 TRACE("(%p, %p, %d, %d)\n", hTheme, hdc, iPartId, iStateId);
1858 if(!hTheme)
1859 return E_HANDLE;
1860
1861 hr = GetThemeFont(hTheme, hdc, iPartId, iStateId, TMT_FONT, &logfont);
1862 if(SUCCEEDED(hr)) {
1863 hFont = CreateFontIndirectW(&logfont);
1864 if(!hFont)
1865 TRACE("Failed to create font\n");
1866 }
1867 if(hFont)
1868 oldFont = SelectObject(hdc, hFont);
1869
1870 if(!GetTextMetricsW(hdc, ptm))
1872
1873 if(hFont) {
1874 SelectObject(hdc, oldFont);
1876 }
1877 return hr;
1878}
BOOL WINAPI GetTextMetricsW(_In_ HDC, _Out_ LPTEXTMETRICW)
Definition: text.c:221

◆ IsThemeBackgroundPartiallyTransparent()

BOOL WINAPI IsThemeBackgroundPartiallyTransparent ( HTHEME  hTheme,
int  iPartId,
int  iStateId 
)

Definition at line 1883 of file draw.c.

1885{
1886 int bgtype = BT_BORDERFILL;
1887 RECT rect = {0, 0, 0, 0};
1888 HBITMAP bmpSrc;
1889 RECT rcSrc;
1890 BOOL hasAlpha;
1891 INT transparent;
1892 COLORREF transparentcolor;
1893
1894 TRACE("(%d,%d)\n", iPartId, iStateId);
1895
1896 if(!hTheme)
1897 return FALSE;
1898
1899 GetThemeEnumValue(hTheme, iPartId, iStateId, TMT_BGTYPE, &bgtype);
1900
1901#ifdef __REACTOS__
1902 if (bgtype == BT_NONE) return TRUE;
1903#endif
1904 if (bgtype != BT_IMAGEFILE) return FALSE;
1905
1906 if(FAILED (UXTHEME_LoadImage (hTheme, 0, iPartId, iStateId, &rect, FALSE,
1907 &bmpSrc, &rcSrc, &hasAlpha)))
1908 return FALSE;
1909
1910 get_transparency (hTheme, iPartId, iStateId, hasAlpha, &transparent,
1911 &transparentcolor, FALSE);
1912 return (transparent != ALPHABLEND_NONE);
1913}
static void get_transparency(HTHEME hTheme, int iPartId, int iStateId, BOOL hasImageAlpha, INT *transparent, COLORREF *transparentcolor, BOOL glyph)
Definition: draw.c:285
& rect
Definition: startmenu.cpp:1413
int32_t INT
Definition: typedefs.h:58

Referenced by EDIT_WM_NCPaint(), GB_ThemedPaint(), IPADDRESS_Draw(), LISTBOX_NCPaint(), LISTVIEW_NCPaint(), CTrayNotifyWnd::OnEraseBackground(), PB_ThemedPaint(), PROGRESS_Draw(), REBAR_EraseBkGnd(), Theme_Start(), TREEVIEW_NCPaint(), and UPDOWN_Draw().

◆ IsThemeDialogTextureEnabled()

BOOL WINAPI IsThemeDialogTextureEnabled ( HWND  hwnd)

Definition at line 56 of file draw.c.

57{
58 DWORD dwDialogTextureFlags;
59 TRACE("(%p)\n", hwnd);
60
62 if (dwDialogTextureFlags == 0)
63 /* Means EnableThemeDialogTexture wasn't called for this dialog */
64 return FALSE;
65
66 return (dwDialogTextureFlags & ETDT_ENABLE) && !(dwDialogTextureFlags & ETDT_DISABLE);
67}
#define HandleToUlong(h)
Definition: basetsd.h:79
#define ETDT_DISABLE
Definition: dxdiag.c:27
#define ETDT_ENABLE
Definition: dxdiag.c:28
unsigned long DWORD
Definition: ntddk_ex.h:95
HANDLE WINAPI GetPropW(_In_ HWND, _In_ LPCWSTR)

Referenced by ThemeDlgPostWindowProc().

◆ UXTHEME_DrawBackgroundFill()

static HRESULT UXTHEME_DrawBackgroundFill ( HTHEME  hTheme,
HDC  hdc,
int  iPartId,
int  iStateId,
RECT pRect,
const DTBGOPTS *  pOptions 
)
static

Definition at line 647 of file draw.c.

650{
651 HRESULT hr = S_OK;
652 int filltype = FT_SOLID;
653
654 TRACE("(%d,%d,%d)\n", iPartId, iStateId, pOptions->dwFlags);
655
656 if(pOptions->dwFlags & DTBG_OMITCONTENT)
657 return S_OK;
658
659 GetThemeEnumValue(hTheme, iPartId, iStateId, TMT_FILLTYPE, &filltype);
660
661 if(filltype == FT_SOLID) {
662 HBRUSH hBrush;
663 COLORREF fillcolor = RGB(255,255,255);
664
665 GetThemeColor(hTheme, iPartId, iStateId, TMT_FILLCOLOR, &fillcolor);
666 hBrush = CreateSolidBrush(fillcolor);
667 if(!FillRect(hdc, pRect, hBrush))
669 DeleteObject(hBrush);
670 }
671 else if(filltype == FT_VERTGRADIENT || filltype == FT_HORZGRADIENT) {
672 /* FIXME: This only accounts for 2 gradient colors (out of 5) and ignores
673 the gradient ratios (no idea how those work)
674 Few themes use this, and the ones I've seen only use 2 colors with
675 a gradient ratio of 0 and 255 respectively
676 */
677
678 COLORREF gradient1 = RGB(0,0,0);
679 COLORREF gradient2 = RGB(255,255,255);
680 TRIVERTEX vert[2];
681 GRADIENT_RECT gRect;
682
683 FIXME("Gradient implementation not complete\n");
684
685 GetThemeColor(hTheme, iPartId, iStateId, TMT_GRADIENTCOLOR1, &gradient1);
686 GetThemeColor(hTheme, iPartId, iStateId, TMT_GRADIENTCOLOR2, &gradient2);
687
688 vert[0].x = pRect->left;
689 vert[0].y = pRect->top;
690 vert[0].Red = GetRValue(gradient1) << 8;
691 vert[0].Green = GetGValue(gradient1) << 8;
692 vert[0].Blue = GetBValue(gradient1) << 8;
693 vert[0].Alpha = 0xff00;
694
695 vert[1].x = pRect->right;
696 vert[1].y = pRect->bottom;
697 vert[1].Red = GetRValue(gradient2) << 8;
698 vert[1].Green = GetGValue(gradient2) << 8;
699 vert[1].Blue = GetBValue(gradient2) << 8;
700 vert[1].Alpha = 0xff00;
701
702 gRect.UpperLeft = 0;
703 gRect.LowerRight = 1;
704 GradientFill(hdc,vert,2,&gRect,1,filltype==FT_HORZGRADIENT?GRADIENT_FILL_RECT_H:GRADIENT_FILL_RECT_V);
705 }
706 else if(filltype == FT_RADIALGRADIENT) {
707 /* I've never seen this used in a theme */
708 FIXME("Radial gradient\n");
709 }
710 else if(filltype == FT_TILEIMAGE) {
711 /* I've never seen this used in a theme */
712 FIXME("Tile image\n");
713 }
714 return hr;
715}
#define GetBValue(quad)
Definition: precomp.h:75
#define GetGValue(quad)
Definition: precomp.h:74
#define GetRValue(quad)
Definition: precomp.h:73
ULONG LowerRight
Definition: wingdi.h:2806
ULONG UpperLeft
Definition: wingdi.h:2805
COLOR16 Red
Definition: wingdi.h:2786
LONG y
Definition: wingdi.h:2785
COLOR16 Green
Definition: wingdi.h:2787
COLOR16 Alpha
Definition: wingdi.h:2789
COLOR16 Blue
Definition: wingdi.h:2788
LONG x
Definition: wingdi.h:2784
#define TMT_GRADIENTCOLOR1
Definition: vssym32.h:335
@ FT_VERTGRADIENT
Definition: vssym32.h:44
@ FT_TILEIMAGE
Definition: vssym32.h:47
@ FT_SOLID
Definition: vssym32.h:43
@ FT_RADIALGRADIENT
Definition: vssym32.h:46
@ FT_HORZGRADIENT
Definition: vssym32.h:45
#define TMT_GRADIENTCOLOR2
Definition: vssym32.h:336
#define TMT_FILLCOLOR
Definition: vssym32.h:327
#define TMT_FILLTYPE
Definition: vssym32.h:355

Referenced by UXTHEME_DrawBorderBackground().

◆ UXTHEME_DrawBorderBackground()

static HRESULT UXTHEME_DrawBorderBackground ( HTHEME  hTheme,
HDC  hdc,
int  iPartId,
int  iStateId,
const RECT pRect,
const DTBGOPTS *  pOptions 
)
static

Definition at line 722 of file draw.c.

725{
726 HRESULT hr;
727 RECT rt;
728
729 rt = *pRect;
730
731 hr = UXTHEME_DrawBorderRectangle(hTheme, hdc, iPartId, iStateId, &rt, pOptions);
732 if(FAILED(hr))
733 return hr;
734 return UXTHEME_DrawBackgroundFill(hTheme, hdc, iPartId, iStateId, &rt, pOptions);
735}
static HRESULT UXTHEME_DrawBorderRectangle(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, RECT *pRect, const DTBGOPTS *pOptions)
Definition: draw.c:600
static HRESULT UXTHEME_DrawBackgroundFill(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, RECT *pRect, const DTBGOPTS *pOptions)
Definition: draw.c:647

Referenced by DrawThemeBackgroundEx().

◆ UXTHEME_DrawBorderRectangle()

static HRESULT UXTHEME_DrawBorderRectangle ( HTHEME  hTheme,
HDC  hdc,
int  iPartId,
int  iStateId,
RECT pRect,
const DTBGOPTS *  pOptions 
)
static

Definition at line 600 of file draw.c.

603{
604 HRESULT hr = S_OK;
605 HPEN hPen;
606 HGDIOBJ oldPen;
607 COLORREF bordercolor = RGB(0,0,0);
608 int bordersize = 1;
609
610 GetThemeInt(hTheme, iPartId, iStateId, TMT_BORDERSIZE, &bordersize);
611 if(bordersize > 0) {
612 POINT ptCorners[5];
613 ptCorners[0].x = pRect->left;
614 ptCorners[0].y = pRect->top;
615 ptCorners[1].x = pRect->right-1;
616 ptCorners[1].y = pRect->top;
617 ptCorners[2].x = pRect->right-1;
618 ptCorners[2].y = pRect->bottom-1;
619 ptCorners[3].x = pRect->left;
620 ptCorners[3].y = pRect->bottom-1;
621 ptCorners[4].x = pRect->left;
622 ptCorners[4].y = pRect->top;
623
624 InflateRect(pRect, -bordersize, -bordersize);
625 if(pOptions->dwFlags & DTBG_OMITBORDER)
626 return S_OK;
627 GetThemeColor(hTheme, iPartId, iStateId, TMT_BORDERCOLOR, &bordercolor);
628 hPen = CreatePen(PS_SOLID, bordersize, bordercolor);
629 if(!hPen)
631 oldPen = SelectObject(hdc, hPen);
632
633 if(!Polyline(hdc, ptCorners, 5))
635
636 SelectObject(hdc, oldPen);
637 DeleteObject(hPen);
638 }
639 return hr;
640}
#define TMT_BORDERCOLOR
Definition: vssym32.h:326
BOOL WINAPI Polyline(_In_ HDC hdc, _In_reads_(cpt) const POINT *apt, _In_ int cpt)

Referenced by UXTHEME_DrawBorderBackground().

◆ UXTHEME_DrawGlyph()

static HRESULT UXTHEME_DrawGlyph ( HTHEME  hTheme,
HDC  hdc,
int  iPartId,
int  iStateId,
RECT pRect,
const DTBGOPTS *  pOptions 
)
static

Definition at line 387 of file draw.c.

390{
391 int glyphtype = GT_NONE;
392
393 GetThemeEnumValue(hTheme, iPartId, iStateId, TMT_GLYPHTYPE, &glyphtype);
394
395 if(glyphtype == GT_IMAGEGLYPH) {
396 return UXTHEME_DrawImageGlyph(hTheme, hdc, iPartId, iStateId, pRect, pOptions);
397 }
398 else if(glyphtype == GT_FONTGLYPH) {
399 /* I don't know what a font glyph is, I've never seen it used in any themes */
400 FIXME("Font glyph\n");
401 }
402 return S_OK;
403}
static HRESULT UXTHEME_DrawImageGlyph(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, RECT *pRect, const DTBGOPTS *pOptions)
Definition: draw.c:318
#define TMT_GLYPHTYPE
Definition: vssym32.h:364
@ GT_FONTGLYPH
Definition: vssym32.h:108
@ GT_NONE
Definition: vssym32.h:106
@ GT_IMAGEGLYPH
Definition: vssym32.h:107

Referenced by DrawThemeBackgroundEx().

◆ UXTHEME_DrawImageBackground()

static HRESULT UXTHEME_DrawImageBackground ( HTHEME  hTheme,
HDC  hdc,
int  iPartId,
int  iStateId,
RECT pRect,
const DTBGOPTS *  pOptions 
)
static

Definition at line 514 of file draw.c.

517{
518 HRESULT hr = S_OK;
519 HBITMAP bmpSrc;
520 RECT rcSrc;
521 RECT rcDst;
522 POINT dstSize;
523 POINT drawSize;
524 int sizingtype = ST_STRETCH;
525 INT transparent;
526 COLORREF transparentcolor = 0;
527 BOOL hasAlpha;
528 MARGINS sm;
529 GDI_DRAW_STREAM DrawStream;
530
531 hr = UXTHEME_LoadImage(hTheme, hdc, iPartId, iStateId, pRect, FALSE, &bmpSrc, &rcSrc, &hasAlpha);
532 if(FAILED(hr))
533 return hr;
534 get_transparency (hTheme, iPartId, iStateId, hasAlpha, &transparent, &transparentcolor, FALSE);
535
536 rcDst = *pRect;
537 dstSize.x = rcDst.right-rcDst.left;
538 dstSize.y = rcDst.bottom-rcDst.top;
539
540 GetThemeMargins(hTheme, hdc, iPartId, iStateId, TMT_SIZINGMARGINS, NULL, &sm);
541 GetThemeEnumValue(hTheme, iPartId, iStateId, TMT_SIZINGTYPE, &sizingtype);
542
543 /*FIXME: Is this ever used? */
544 /*GetThemeBool(hTheme, iPartId, iStateId, TMT_BORDERONLY, &borderonly);*/
545
546 if(sizingtype == ST_TRUESIZE) {
547 int valign = VA_CENTER, halign = HA_CENTER;
548
549 get_image_part_size (hTheme, hdc, iPartId, iStateId, pRect, TS_DRAW, &drawSize);
550 GetThemeEnumValue(hTheme, iPartId, iStateId, TMT_VALIGN, &valign);
551 GetThemeEnumValue(hTheme, iPartId, iStateId, TMT_HALIGN, &halign);
552
553 if (halign == HA_CENTER)
554 rcDst.left += (dstSize.x/2)-(drawSize.x/2);
555 else if (halign == HA_RIGHT)
556 rcDst.left = rcDst.right - drawSize.x;
557 if (valign == VA_CENTER)
558 rcDst.top += (dstSize.y/2)-(drawSize.y/2);
559 else if (valign == VA_BOTTOM)
560 rcDst.top = rcDst.bottom - drawSize.y;
561 rcDst.right = rcDst.left + drawSize.x;
562 rcDst.bottom = rcDst.top + drawSize.y;
563 *pRect = rcDst;
564 }
565
566 DrawStream.signature = 0x44727753;
567 DrawStream.reserved = 0;
568 DrawStream.unknown1 = 1;
569 DrawStream.unknown2 = 9;
570 DrawStream.hDC = hdc;
571 DrawStream.hImage = bmpSrc;
572 DrawStream.crTransparent = transparentcolor;
573 DrawStream.rcSrc = rcSrc;
574 DrawStream.rcDest = rcDst;
575 DrawStream.leftSizingMargin = sm.cxLeftWidth;
576 DrawStream.rightSizingMargin = sm.cxRightWidth;
577 DrawStream.topSizingMargin = sm.cyTopHeight;
578 DrawStream.bottomSizingMargin = sm.cyBottomHeight;
579 DrawStream.drawOption = 0;
580
581 if (transparent == ALPHABLEND_FULL)
582 DrawStream.drawOption |= DS_TRANSPARENTALPHA;
583 else if (transparent == ALPHABLEND_BINARY)
584 DrawStream.drawOption |= DS_TRANSPARENTCLR;
585
586 if (sizingtype == ST_TILE)
587 DrawStream.drawOption |= DS_TILE;
588 else if (sizingtype == ST_TRUESIZE)
589 DrawStream.drawOption |= DS_TRUESIZE;
590
591 GdiDrawStream(hdc, sizeof(DrawStream), &DrawStream);
593}
DWORD leftSizingMargin
Definition: undocgdi.h:26
DWORD rightSizingMargin
Definition: undocgdi.h:27
DWORD topSizingMargin
Definition: undocgdi.h:28
DWORD bottomSizingMargin
Definition: undocgdi.h:29
#define DS_TRUESIZE
Definition: undocgdi.h:12
#define DS_TRANSPARENTCLR
Definition: undocgdi.h:11
BOOL WINAPI GdiDrawStream(HDC dc, ULONG l, PGDI_DRAW_STREAM pDS)
Definition: misc.c:644
#define DS_TRANSPARENTALPHA
Definition: undocgdi.h:10
#define DS_TILE
Definition: undocgdi.h:9
@ VA_CENTER
Definition: vssym32.h:70
@ VA_BOTTOM
Definition: vssym32.h:71
@ HA_CENTER
Definition: vssym32.h:58
@ HA_RIGHT
Definition: vssym32.h:59
@ ST_TILE
Definition: vssym32.h:53
#define TMT_VALIGN
Definition: vssym32.h:359
#define TMT_HALIGN
Definition: vssym32.h:357

Referenced by DrawThemeBackgroundEx().

◆ UXTHEME_DrawImageGlyph()

static HRESULT UXTHEME_DrawImageGlyph ( HTHEME  hTheme,
HDC  hdc,
int  iPartId,
int  iStateId,
RECT pRect,
const DTBGOPTS *  pOptions 
)
static

Definition at line 318 of file draw.c.

321{
322 HRESULT hr;
323 HBITMAP bmpSrc = NULL;
324 RECT rcSrc;
325 INT transparent = 0;
326 COLORREF transparentcolor;
327 int valign = VA_CENTER;
328 int halign = HA_CENTER;
329 POINT dstSize;
330 POINT srcSize;
331 BOOL hasAlpha;
332 RECT rcDst;
333 GDI_DRAW_STREAM DrawStream;
334
335 hr = UXTHEME_LoadImage(hTheme, hdc, iPartId, iStateId, pRect, TRUE,
336 &bmpSrc, &rcSrc, &hasAlpha);
337 if(FAILED(hr)) return hr;
338
339 dstSize.x = pRect->right-pRect->left;
340 dstSize.y = pRect->bottom-pRect->top;
341 srcSize.x = rcSrc.right-rcSrc.left;
342 srcSize.y = rcSrc.bottom-rcSrc.top;
343
344 get_transparency (hTheme, iPartId, iStateId, hasAlpha, &transparent,
345 &transparentcolor, TRUE);
346 GetThemeEnumValue(hTheme, iPartId, iStateId, TMT_VALIGN, &valign);
347 GetThemeEnumValue(hTheme, iPartId, iStateId, TMT_HALIGN, &halign);
348
349 rcDst = *pRect;
350 if(halign == HA_CENTER) rcDst.left += (dstSize.x/2)-(srcSize.x/2);
351 else if(halign == HA_RIGHT) rcDst.left += dstSize.x-srcSize.x;
352 if(valign == VA_CENTER) rcDst.top += (dstSize.y/2)-(srcSize.y/2);
353 else if(valign == VA_BOTTOM) rcDst.top += dstSize.y-srcSize.y;
354
355 rcDst.right = rcDst.left + srcSize.x;
356 rcDst.bottom = rcDst.top + srcSize.y;
357
358 DrawStream.signature = 0x44727753;
359 DrawStream.reserved = 0;
360 DrawStream.unknown1 = 1;
361 DrawStream.unknown2 = 9;
362 DrawStream.hDC = hdc;
363 DrawStream.hImage = bmpSrc;
364 DrawStream.crTransparent = transparentcolor;
365 DrawStream.rcSrc = rcSrc;
366 DrawStream.rcDest = rcDst;
367 DrawStream.leftSizingMargin = 0;
368 DrawStream.rightSizingMargin = 0;
369 DrawStream.topSizingMargin = 0;
370 DrawStream.bottomSizingMargin = 0;
371 DrawStream.drawOption = DS_TRUESIZE;
372
373 if (transparent == ALPHABLEND_FULL)
374 DrawStream.drawOption |= DS_TRANSPARENTALPHA;
375 else if (transparent == ALPHABLEND_BINARY)
376 DrawStream.drawOption |= DS_TRANSPARENTCLR;
377
378 GdiDrawStream(hdc, sizeof(DrawStream), &DrawStream);
380}

Referenced by UXTHEME_DrawGlyph().

◆ UXTHEME_DrawThemePartToDib()

static HBITMAP UXTHEME_DrawThemePartToDib ( HTHEME  hTheme,
HDC  hdc,
int  iPartId,
int  iStateId,
LPCRECT  pRect 
)
static

Definition at line 1574 of file draw.c.

1575{
1576 HDC hdcMem;
1577 BITMAPINFO bmi;
1579 HBRUSH hbrBack;
1580
1582
1583 memset(&bmi, 0, sizeof(bmi));
1584 bmi.bmiHeader.biSize = sizeof(bmi.bmiHeader);
1585 bmi.bmiHeader.biWidth = pRect->right;
1586 bmi.bmiHeader.biHeight = -pRect->bottom;
1587 bmi.bmiHeader.biPlanes = 1;
1588 bmi.bmiHeader.biBitCount = 32;
1590
1592
1593 /* FIXME: use an internal function that doesn't do transparent blt */
1594 hbrBack = CreateSolidBrush(RGB(255,0,255));
1595
1596 FillRect(hdcMem, pRect, hbrBack);
1597
1598 DrawThemeBackground(hTheme, hdcMem, iPartId, iStateId, pRect, NULL);
1599
1600 DeleteObject(hbrBack);
1603
1604 return hbmp;
1605}
HBITMAP hbmp
HRESULT WINAPI DrawThemeBackground(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, const RECT *pClipRect)
Definition: draw.c:128
HANDLE hbmpOld
Definition: magnifier.c:54
static HDC
Definition: imagelist.c:92
#define memset(x, y, z)
Definition: compat.h:39
USHORT biBitCount
Definition: precomp.h:46
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1476
HDC hdcMem
Definition: welcome.c:104
HBITMAP WINAPI CreateDIBSection(HDC hDC, CONST BITMAPINFO *BitmapInfo, UINT Usage, VOID **Bits, HANDLE hSection, DWORD dwOffset)
Definition: bitmap.c:245
#define DIB_RGB_COLORS
Definition: wingdi.h:367
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)

Referenced by UXTHEME_GetImageBackBackgroundRegion().

◆ UXTHEME_GetImageBackBackgroundRegion()

HRESULT UXTHEME_GetImageBackBackgroundRegion ( HTHEME  hTheme,
HDC  hdc,
int  iPartId,
int  iStateId,
LPCRECT  pRect,
HRGN *  pRegion 
)

Definition at line 1697 of file draw.c.

1698{
1699 HBITMAP hbmp;
1701 RGBQUAD clrTransparent = {0xFF,0x0, 0xFF,0x0};
1702
1703 /* Draw the theme part to a dib */
1704 hbmp = UXTHEME_DrawThemePartToDib(hTheme, hdc, iPartId, iStateId, pRect);
1705
1706 /* Retrieve the info of the dib section */
1707 GetObjectW(hbmp, sizeof (DIBSECTION), &dib);
1708
1709 /* Convert the bits of the dib section to a region */
1710 *pRegion = UXTHEME_RegionFromDibBits((RGBQUAD*)dib.dsBm.bmBits, &clrTransparent, pRect);
1711
1712 /* Free the temp bitmap */
1714
1715 return S_OK;
1716}
static HRGN UXTHEME_RegionFromDibBits(RGBQUAD *pBuffer, RGBQUAD *pclrTransparent, LPCRECT pRect)
Definition: draw.c:1610
static HBITMAP UXTHEME_DrawThemePartToDib(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, LPCRECT pRect)
Definition: draw.c:1574
ULONG RGBQUAD
Definition: precomp.h:59
static const BYTE dib[]
Definition: ole2.c:201
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)

Referenced by GetThemeBackgroundRegion().

◆ UXTHEME_LoadImage()

HRESULT UXTHEME_LoadImage ( HTHEME  hTheme,
HDC  hdc,
int  iPartId,
int  iStateId,
const RECT pRect,
BOOL  glyph,
HBITMAP hBmp,
RECT bmpRect,
BOOL hasImageAlpha 
)

Definition at line 230 of file draw.c.

232{
233 int imagelayout = IL_HORIZONTAL;
234 int imagecount = 1;
235 int imagenum;
236 BITMAP bmp;
239 PTHEME_CLASS pClass;
240
241 pClass = ValidateHandle(hTheme);
242 if (!pClass)
243 return E_HANDLE;
244
245 tp = UXTHEME_SelectImage(hTheme, hdc, iPartId, iStateId, pRect, glyph);
246 if(!tp) {
247 FIXME("Couldn't determine image for part/state %d/%d, invalid theme?\n", iPartId, iStateId);
249 }
250 lstrcpynW(szPath, tp->lpValue, min(tp->dwValueLen+1, sizeof(szPath)/sizeof(szPath[0])));
251 *hBmp = MSSTYLES_LoadBitmap(pClass, szPath, hasImageAlpha);
252 if(!*hBmp) {
253 TRACE("Failed to load bitmap %s\n", debugstr_w(szPath));
255 }
256
257 GetThemeEnumValue(hTheme, iPartId, iStateId, TMT_IMAGELAYOUT, &imagelayout);
258 GetThemeInt(hTheme, iPartId, iStateId, TMT_IMAGECOUNT, &imagecount);
259
260 imagenum = max (min (imagecount, iStateId), 1) - 1;
261 GetObjectW(*hBmp, sizeof(bmp), &bmp);
262
263 if(imagecount < 1) imagecount = 1;
264
265 if(imagelayout == IL_VERTICAL) {
266 int height = bmp.bmHeight/imagecount;
267 bmpRect->left = 0;
268 bmpRect->right = bmp.bmWidth;
269 bmpRect->top = imagenum * height;
270 bmpRect->bottom = bmpRect->top + height;
271 }
272 else {
273 int width = bmp.bmWidth/imagecount;
274 bmpRect->left = imagenum * width;
275 bmpRect->right = bmpRect->left + width;
276 bmpRect->top = 0;
277 bmpRect->bottom = bmp.bmHeight;
278 }
279 return S_OK;
280}
#define MAX_PATH
Definition: compat.h:34
#define lstrcpynW
Definition: compat.h:738
LPVOID FASTCALL ValidateHandle(HANDLE hObject, UINT uType)
Definition: utils.c:377
static PTHEME_PROPERTY UXTHEME_SelectImage(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, BOOL glyph)
Definition: draw.c:147
_In_ uint64_t _In_ uint64_t _In_ uint64_t _In_opt_ traverse_ptr * tp
Definition: btrfs.c:2996
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
#define debugstr_w
Definition: kernel32.h:32
LPCWSTR szPath
Definition: env.c:37
BITMAP bmp
Definition: alphablend.c:62
#define min(a, b)
Definition: monoChain.cc:55
HBITMAP MSSTYLES_LoadBitmap(PTHEME_CLASS tc, LPCWSTR lpFilename, BOOL *hasAlpha)
Definition: msstyles.c:896
Definition: bl.h:1331
#define max(a, b)
Definition: svc.c:63
#define E_PROP_ID_UNSUPPORTED
Definition: vfwmsgs.h:173
#define TMT_IMAGECOUNT
Definition: vssym32.h:272
#define TMT_IMAGELAYOUT
Definition: vssym32.h:363
@ IL_VERTICAL
Definition: vssym32.h:32
@ IL_HORIZONTAL
Definition: vssym32.h:33

Referenced by get_image_part_size(), GetDiaogTextureBrush(), IsThemeBackgroundPartiallyTransparent(), UXTHEME_DrawImageBackground(), and UXTHEME_DrawImageGlyph().

◆ UXTHEME_RegionFromDibBits()

static HRGN UXTHEME_RegionFromDibBits ( RGBQUAD pBuffer,
RGBQUAD pclrTransparent,
LPCRECT  pRect 
)
static

Definition at line 1610 of file draw.c.

1611{
1612 int x, y, xstart;
1613 int cMaxRgnRects, cRgnDataSize, cRgnRects;
1614 RECT* prcCurrent;
1615 PRGNDATA prgnData;
1616 ULONG clrTransparent, *pclrCurrent;
1617 HRGN hrgnRet;
1618
1619 pclrCurrent = (PULONG)pBuffer;
1620 clrTransparent = *(PULONG)pclrTransparent;
1621
1622 /* Create a region and pre-allocate memory enough for 3 spaces in one row*/
1623 cRgnRects = 0;
1624 cMaxRgnRects = 4* (pRect->bottom-pRect->top);
1625 cRgnDataSize = sizeof(RGNDATA) + cMaxRgnRects * sizeof(RECT);
1626
1627 /* Allocate the region data */
1628 prgnData = (PRGNDATA)HeapAlloc(GetProcessHeap(), 0, cRgnDataSize);
1629
1630 prcCurrent = (PRECT)prgnData->Buffer;
1631
1632 /* Calculate the region rects */
1633 y=0;
1634 /* Scan each line of the bitmap */
1635 while(y<pRect->bottom)
1636 {
1637 x=0;
1638 /* Scan each pixel */
1639 while (x<pRect->right)
1640 {
1641 /* Check if the pixel is not transparent and it is in the requested rect */
1642 if(*pclrCurrent != clrTransparent && PT_IN_RECT(pRect,x,y))
1643 {
1644 xstart = x;
1645 /* Find the end of the opaque row of pixels */
1646 while (x<pRect->right)
1647 {
1648 if(*pclrCurrent == clrTransparent || !PT_IN_RECT(pRect,x,y))
1649 break;
1650 x++;
1651 pclrCurrent++;
1652 }
1653
1654 /* Add the scaned line to the region */
1655 SetRect(prcCurrent, xstart, y,x,y+1);
1656 prcCurrent++;
1657 cRgnRects++;
1658
1659 /* Increase the size of the buffer if it is full */
1660 if(cRgnRects == cMaxRgnRects)
1661 {
1662 cMaxRgnRects *=2;
1663 cRgnDataSize = sizeof(RGNDATA) + cMaxRgnRects * sizeof(RECT);
1664 prgnData = (PRGNDATA)HeapReAlloc(GetProcessHeap(),
1665 0,
1666 prgnData,
1667 cRgnDataSize);
1668 prcCurrent = (RECT*)prgnData->Buffer + cRgnRects;
1669 }
1670 }
1671 else
1672 {
1673 x++;
1674 pclrCurrent++;
1675 }
1676 }
1677 y++;
1678 }
1679
1680 /* Fill the region data header */
1681 prgnData->rdh.dwSize = sizeof(prgnData->rdh);
1682 prgnData->rdh.iType = RDH_RECTANGLES;
1683 prgnData->rdh.nCount = cRgnRects;
1684 prgnData->rdh.nRgnSize = cRgnDataSize;
1685 prgnData->rdh.rcBound = *pRect;
1686
1687 /* Create the region*/
1688 hrgnRet = ExtCreateRegion (NULL, cRgnDataSize, prgnData);
1689
1690 /* Free the region data*/
1691 HeapFree(GetProcessHeap(),0,prgnData);
1692
1693 /* return the region*/
1694 return hrgnRet;
1695}
struct _RGNDATA RGNDATA
#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
#define PT_IN_RECT(lprc, x, y)
Definition: draw.c:1607
GLdouble GLdouble right
Definition: glext.h:10859
GLint GLint bottom
Definition: glext.h:7726
PVOID pBuffer
RGNDATAHEADER rdh
Definition: axextend.idl:399
char Buffer[1]
Definition: axextend.idl:400
uint32_t * PULONG
Definition: typedefs.h:59
uint32_t ULONG
Definition: typedefs.h:59
#define PRECT
Definition: precomp.h:27
struct _RGNDATA * PRGNDATA
#define RDH_RECTANGLES
Definition: wingdi.h:669
HRGN WINAPI ExtCreateRegion(_In_opt_ const XFORM *lpx, _In_ DWORD nCount, _In_reads_bytes_(nCount) const RGNDATA *lpData)
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)

Referenced by UXTHEME_GetImageBackBackgroundRegion().

◆ UXTHEME_SelectImage()

static PTHEME_PROPERTY UXTHEME_SelectImage ( HTHEME  hTheme,
HDC  hdc,
int  iPartId,
int  iStateId,
const RECT pRect,
BOOL  glyph 
)
static

Definition at line 147 of file draw.c.

148{
149 PTHEME_CLASS pClass;
151 int imageselecttype = IST_NONE;
152 int i;
153 int image;
154
155 if(glyph)
157 else
159
160 pClass = ValidateHandle(hTheme);
161 if((tp=MSSTYLES_FindProperty(pClass, iPartId, iStateId, TMT_FILENAME, image)))
162 return tp;
163 GetThemeEnumValue(hTheme, iPartId, iStateId, TMT_IMAGESELECTTYPE, &imageselecttype);
164
165 if(imageselecttype == IST_DPI) {
166 int reqdpi = 0;
167 int screendpi = GetDeviceCaps(hdc, LOGPIXELSX);
168 for(i=4; i>=0; i--) {
169 reqdpi = 0;
170 if(SUCCEEDED(GetThemeInt(hTheme, iPartId, iStateId, i + TMT_MINDPI1, &reqdpi))) {
171 if(reqdpi != 0 && screendpi >= reqdpi) {
172 TRACE("Using %d DPI, image %d\n", reqdpi, i + TMT_IMAGEFILE1);
173 return MSSTYLES_FindProperty(pClass, iPartId, iStateId, TMT_FILENAME, i + TMT_IMAGEFILE1);
174 }
175 }
176 }
177 /* If an image couldn't be selected, choose the first one */
178 return MSSTYLES_FindProperty(pClass, iPartId, iStateId, TMT_FILENAME, TMT_IMAGEFILE1);
179 }
180 else if(imageselecttype == IST_SIZE) {
181 POINT size = {pRect->right-pRect->left, pRect->bottom-pRect->top};
182 POINT reqsize;
183 for(i=4; i>=0; i--) {
184 PTHEME_PROPERTY fileProp =
185 MSSTYLES_FindProperty(pClass, iPartId, iStateId, TMT_FILENAME, i + TMT_IMAGEFILE1);
186 if (!fileProp) continue;
187 if(FAILED(GetThemePosition(hTheme, iPartId, iStateId, i + TMT_MINSIZE1, &reqsize))) {
188 /* fall back to size of Nth image */
190 int imagelayout = IL_HORIZONTAL;
191 int imagecount = 1;
192 BITMAP bmp;
193 HBITMAP hBmp;
194 BOOL hasAlpha;
195
196 lstrcpynW(szPath, fileProp->lpValue,
197 min(fileProp->dwValueLen+1, sizeof(szPath)/sizeof(szPath[0])));
198 hBmp = MSSTYLES_LoadBitmap(pClass, szPath, &hasAlpha);
199 if(!hBmp) continue;
200
201 GetThemeEnumValue(hTheme, iPartId, iStateId, TMT_IMAGELAYOUT, &imagelayout);
202 GetThemeInt(hTheme, iPartId, iStateId, TMT_IMAGECOUNT, &imagecount);
203
204 GetObjectW(hBmp, sizeof(bmp), &bmp);
205 if(imagelayout == IL_VERTICAL) {
206 reqsize.x = bmp.bmWidth;
207 reqsize.y = bmp.bmHeight/imagecount;
208 }
209 else {
210 reqsize.x = bmp.bmWidth/imagecount;
211 reqsize.y = bmp.bmHeight;
212 }
213 }
214 if(reqsize.x <= size.x && reqsize.y <= size.y) {
215 TRACE("Using image size %dx%d, image %d\n", reqsize.x, reqsize.y, i + TMT_IMAGEFILE1);
216 return fileProp;
217 }
218 }
219 /* If an image couldn't be selected, choose the smallest one */
220 return MSSTYLES_FindProperty(pClass, iPartId, iStateId, TMT_FILENAME, TMT_IMAGEFILE1);
221 }
222 return NULL;
223}
GLeglImageOES image
Definition: gl.h:2204
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
PTHEME_PROPERTY MSSTYLES_FindProperty(PTHEME_CLASS tc, int iPartId, int iStateId, int iPropertyPrimitive, int iPropertyId)
Definition: msstyles.c:835
DWORD dwValueLen
Definition: uxthemep.h:44
LPCWSTR lpValue
Definition: uxthemep.h:43
#define TMT_GLYPHIMAGEFILE
Definition: vssym32.h:311
#define TMT_MINDPI1
Definition: vssym32.h:291
#define TMT_IMAGESELECTTYPE
Definition: vssym32.h:365
@ IST_SIZE
Definition: vssym32.h:113
@ IST_DPI
Definition: vssym32.h:114
@ IST_NONE
Definition: vssym32.h:112
#define TMT_MINSIZE1
Definition: vssym32.h:317
#define TMT_IMAGEFILE1
Definition: vssym32.h:306
#define TMT_FILENAME
Definition: vssym32.h:140
#define TMT_IMAGEFILE
Definition: vssym32.h:305
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define LOGPIXELSX
Definition: wingdi.h:718

Referenced by UXTHEME_LoadImage().

Variable Documentation

◆ atDialogThemeEnabled

ATOM atDialogThemeEnabled
extern

◆ 

const struct { ... } EdgeColorMap[EDGE_NUMCOLORS]
Initial value:
= {
{-1, COLOR_WINDOW},
}
#define TMT_EDGESHADOWCOLOR
Definition: vssym32.h:331
#define TMT_EDGELIGHTCOLOR
Definition: vssym32.h:329
#define TMT_EDGEDKSHADOWCOLOR
Definition: vssym32.h:332
#define TMT_EDGEHIGHLIGHTCOLOR
Definition: vssym32.h:330
#define TMT_EDGEFILLCOLOR
Definition: vssym32.h:333
#define COLOR_WINDOW
Definition: winuser.h:918
#define COLOR_WINDOWFRAME
Definition: winuser.h:919
#define COLOR_3DDKSHADOW
Definition: winuser.h:939
#define COLOR_BTNSHADOW
Definition: winuser.h:930
#define COLOR_BTNHIGHLIGHT
Definition: winuser.h:935
#define COLOR_BTNFACE
Definition: winuser.h:928
#define COLOR_3DLIGHT
Definition: winuser.h:940

Referenced by get_edge_color().

◆ LTInnerNormal

const signed char LTInnerNormal[]
static
Initial value:
= {
-1, -1, -1, -1,
-1, -1, -1, -1
}

Definition at line 843 of file draw.c.

◆ LTInnerSoft

const signed char LTInnerSoft[]
static
Initial value:
= {
-1, -1, -1, -1,
-1, -1, -1, -1
}

Definition at line 871 of file draw.c.

Referenced by draw_diag_edge(), draw_rect_edge(), IntDrawDiagEdge(), and IntDrawRectEdge().

◆ LTOuterNormal

const signed char LTOuterNormal[]
static
Initial value:

Definition at line 850 of file draw.c.

◆ LTOuterSoft

◆ LTRBInnerFlat

const signed char LTRBInnerFlat[]
static
Initial value:

Definition at line 909 of file draw.c.

Referenced by draw_diag_edge(), draw_rect_edge(), IntDrawDiagEdge(), and IntDrawRectEdge().

◆ LTRBInnerMono

const signed char LTRBInnerMono[]
static
Initial value:

Definition at line 895 of file draw.c.

◆ LTRBOuterFlat

◆ LTRBOuterMono

◆ RBInnerNormal

const signed char RBInnerNormal[]
static
Initial value:
= {
-1, -1, -1, -1,
-1, -1, -1, -1
}

Definition at line 857 of file draw.c.

◆ RBOuterNormal

const signed char RBOuterNormal[]
static

◆ sysColor

int sysColor

Definition at line 832 of file draw.c.

Referenced by get_edge_color().

◆ themeProp

int themeProp

Definition at line 831 of file draw.c.

Referenced by get_edge_color().