uxtheme: Search TMT_IMAGEFILE1~7 first when drawing background for parts without glyph images.

Try TMT_IMAGEFILE first when drawing part background and the part contains glyph images.
Otherwise, search TMT_IMAGEFILE1~7 and then TMT_IMAGEFILE or TMT_GLYPHIMAGEFILE. This behavior can
be verified by drawing scroll bar arrow buttons, where TMT_IMAGEFILE is used for background despite
TMT_IMAGEFILE1 being present and TMT_IMAGEFILE1 is used for glyphs despite TMT_IMAGEFILE is present.
For parts without glyph images, TMT_IMAGEFILE1~7 are always searched first, then try TMT_IMAGEFILE
or TMT_GLYPHIMAGEFILE.

Fix the size grip on status control not being painted when using builtin Light theme. The status
gripper part uses TMT_IMAGEFILE1~7 and doesn't have TMT_IMAGEFILE. So when UXTHEME_SelectImage()
tries to query TMT_IMAGEFILE for status gripper, it falls back to using status class TMT_IMAGEFILE.

Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zhiyi Zhang 2022-01-25 16:00:17 +08:00 committed by Alexandre Julliard
parent 78ac7ae24d
commit 4311a993dd
1 changed files with 19 additions and 12 deletions

View File

@ -185,20 +185,23 @@ static int imagefile_index_to_property(int index)
static PTHEME_PROPERTY UXTHEME_SelectImage(HTHEME hTheme, int iPartId, int iStateId,
const RECT *pRect, BOOL glyph, int *imageDpi)
{
PTHEME_PROPERTY tp;
int imageselecttype = IST_NONE;
int imageselecttype = IST_NONE, glyphtype = GT_NONE;
PTHEME_PROPERTY tp = NULL;
int i;
int image;
if(glyph)
image = TMT_GLYPHIMAGEFILE;
else
image = TMT_IMAGEFILE;
if (imageDpi)
*imageDpi = 96;
if((tp=MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_FILENAME, image)))
return tp;
/* Try TMT_IMAGEFILE first when drawing part background and the part contains glyph images.
* Otherwise, search TMT_IMAGEFILE1~7 and then TMT_IMAGEFILE or TMT_GLYPHIMAGEFILE */
if (!glyph)
{
GetThemeEnumValue(hTheme, iPartId, iStateId, TMT_GLYPHTYPE, &glyphtype);
if (glyphtype == GT_IMAGEGLYPH &&
(tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_FILENAME, TMT_IMAGEFILE)))
return tp;
}
GetThemeEnumValue(hTheme, iPartId, iStateId, TMT_IMAGESELECTTYPE, &imageselecttype);
if(imageselecttype == IST_DPI) {
@ -223,7 +226,7 @@ static PTHEME_PROPERTY UXTHEME_SelectImage(HTHEME hTheme, int iPartId, int iStat
}
}
/* If an image couldn't be selected, choose the first one */
return MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_FILENAME, TMT_IMAGEFILE1);
tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_FILENAME, TMT_IMAGEFILE1);
}
else if(imageselecttype == IST_SIZE) {
POINT size = {pRect->right-pRect->left, pRect->bottom-pRect->top};
@ -270,9 +273,13 @@ static PTHEME_PROPERTY UXTHEME_SelectImage(HTHEME hTheme, int iPartId, int iStat
}
}
/* If an image couldn't be selected, choose the smallest one */
return MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_FILENAME, TMT_IMAGEFILE1);
tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_FILENAME, TMT_IMAGEFILE1);
}
return NULL;
if (!tp)
tp = MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_FILENAME,
glyph ? TMT_GLYPHIMAGEFILE : TMT_IMAGEFILE);
return tp;
}
/***********************************************************************