mirror of
https://github.com/reactos/reactos.git
synced 2024-12-29 10:35:28 +00:00
[USER32][NTUSER] Fix menu arrow drawing (of DrawFrameControl) (#1752)
CORE-13211 user32!DrawFrameControl drawed invalid menu arrow when the width is shorter than the height. - Use the squared rectangle. - Draw it in the transparent background mode. - Save the old background mode of HDC. This PR will fix UltraISO's bug.
This commit is contained in:
parent
77d3d25ae8
commit
1e91a1690d
2 changed files with 38 additions and 20 deletions
|
@ -666,7 +666,10 @@ BOOL FASTCALL UITOOLS95_DFC_ButtonCheckRadio(HDC dc, LPRECT r, UINT uFlags, BOOL
|
||||||
HFONT hFont, hOldFont;
|
HFONT hFont, hOldFont;
|
||||||
int i;
|
int i;
|
||||||
WCHAR OutRight, OutLeft, InRight, InLeft, Center;
|
WCHAR OutRight, OutLeft, InRight, InLeft, Center;
|
||||||
|
RECT myr;
|
||||||
|
INT cxy, nBkMode;
|
||||||
|
|
||||||
|
cxy = UITOOLS_MakeSquareRect(r, &myr);
|
||||||
if (Radio)
|
if (Radio)
|
||||||
{
|
{
|
||||||
OutRight = 'j'; // Outer right
|
OutRight = 'j'; // Outer right
|
||||||
|
@ -684,7 +687,7 @@ BOOL FASTCALL UITOOLS95_DFC_ButtonCheckRadio(HDC dc, LPRECT r, UINT uFlags, BOOL
|
||||||
}
|
}
|
||||||
|
|
||||||
RtlZeroMemory(&lf, sizeof(LOGFONTW));
|
RtlZeroMemory(&lf, sizeof(LOGFONTW));
|
||||||
lf.lfHeight = r->top - r->bottom;
|
lf.lfHeight = cxy;
|
||||||
lf.lfWidth = 0;
|
lf.lfWidth = 0;
|
||||||
lf.lfWeight = FW_NORMAL;
|
lf.lfWeight = FW_NORMAL;
|
||||||
lf.lfCharSet = DEFAULT_CHARSET;
|
lf.lfCharSet = DEFAULT_CHARSET;
|
||||||
|
@ -692,16 +695,18 @@ BOOL FASTCALL UITOOLS95_DFC_ButtonCheckRadio(HDC dc, LPRECT r, UINT uFlags, BOOL
|
||||||
hFont = GreCreateFontIndirectW(&lf);
|
hFont = GreCreateFontIndirectW(&lf);
|
||||||
hOldFont = NtGdiSelectFont(dc, hFont);
|
hOldFont = NtGdiSelectFont(dc, hFont);
|
||||||
|
|
||||||
|
nBkMode = GreGetBkMode(dc);
|
||||||
|
|
||||||
if(Radio && ((uFlags & 0xff) == DFCS_BUTTONRADIOMASK))
|
if(Radio && ((uFlags & 0xff) == DFCS_BUTTONRADIOMASK))
|
||||||
{
|
{
|
||||||
IntGdiSetBkMode(dc, OPAQUE);
|
IntGdiSetBkMode(dc, OPAQUE);
|
||||||
IntGdiSetTextColor(dc, IntGetSysColor(COLOR_WINDOWFRAME));
|
IntGdiSetTextColor(dc, IntGetSysColor(COLOR_WINDOWFRAME));
|
||||||
GreTextOutW(dc, r->left, r->top, &Center, 1);
|
GreTextOutW(dc, myr.left, myr.top, &Center, 1);
|
||||||
IntGdiSetBkMode(dc, TRANSPARENT);
|
IntGdiSetBkMode(dc, TRANSPARENT);
|
||||||
IntGdiSetTextColor(dc, IntGetSysColor(COLOR_WINDOWFRAME));
|
IntGdiSetTextColor(dc, IntGetSysColor(COLOR_WINDOWFRAME));
|
||||||
GreTextOutW(dc, r->left, r->top, &OutRight, 1);
|
GreTextOutW(dc, myr.left, myr.top, &OutRight, 1);
|
||||||
IntGdiSetTextColor(dc, IntGetSysColor(COLOR_WINDOWFRAME));
|
IntGdiSetTextColor(dc, IntGetSysColor(COLOR_WINDOWFRAME));
|
||||||
GreTextOutW(dc, r->left, r->top, &OutLeft, 1);
|
GreTextOutW(dc, myr.left, myr.top, &OutLeft, 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -710,26 +715,26 @@ BOOL FASTCALL UITOOLS95_DFC_ButtonCheckRadio(HDC dc, LPRECT r, UINT uFlags, BOOL
|
||||||
/* Center section, white for active, grey for inactive */
|
/* Center section, white for active, grey for inactive */
|
||||||
i= !(uFlags & (DFCS_INACTIVE|DFCS_PUSHED)) ? COLOR_WINDOW : COLOR_BTNFACE;
|
i= !(uFlags & (DFCS_INACTIVE|DFCS_PUSHED)) ? COLOR_WINDOW : COLOR_BTNFACE;
|
||||||
IntGdiSetTextColor(dc, IntGetSysColor(i));
|
IntGdiSetTextColor(dc, IntGetSysColor(i));
|
||||||
GreTextOutW(dc, r->left, r->top, &Center, 1);
|
GreTextOutW(dc, myr.left, myr.top, &Center, 1);
|
||||||
|
|
||||||
if(uFlags & (DFCS_FLAT | DFCS_MONO))
|
if(uFlags & (DFCS_FLAT | DFCS_MONO))
|
||||||
{
|
{
|
||||||
IntGdiSetTextColor(dc, IntGetSysColor(COLOR_WINDOWFRAME));
|
IntGdiSetTextColor(dc, IntGetSysColor(COLOR_WINDOWFRAME));
|
||||||
GreTextOutW(dc, r->left, r->top, &OutRight, 1);
|
GreTextOutW(dc, myr.left, myr.top, &OutRight, 1);
|
||||||
GreTextOutW(dc, r->left, r->top, &OutLeft, 1);
|
GreTextOutW(dc, myr.left, myr.top, &OutLeft, 1);
|
||||||
GreTextOutW(dc, r->left, r->top, &InRight, 1);
|
GreTextOutW(dc, myr.left, myr.top, &InRight, 1);
|
||||||
GreTextOutW(dc, r->left, r->top, &InLeft, 1);
|
GreTextOutW(dc, myr.left, myr.top, &InLeft, 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
IntGdiSetTextColor(dc, IntGetSysColor(COLOR_BTNSHADOW));
|
IntGdiSetTextColor(dc, IntGetSysColor(COLOR_BTNSHADOW));
|
||||||
GreTextOutW(dc, r->left, r->top, &OutRight, 1);
|
GreTextOutW(dc, myr.left, myr.top, &OutRight, 1);
|
||||||
IntGdiSetTextColor(dc, IntGetSysColor(COLOR_BTNHIGHLIGHT));
|
IntGdiSetTextColor(dc, IntGetSysColor(COLOR_BTNHIGHLIGHT));
|
||||||
GreTextOutW(dc, r->left, r->top, &OutLeft, 1);
|
GreTextOutW(dc, myr.left, myr.top, &OutLeft, 1);
|
||||||
IntGdiSetTextColor(dc, IntGetSysColor(COLOR_3DDKSHADOW));
|
IntGdiSetTextColor(dc, IntGetSysColor(COLOR_3DDKSHADOW));
|
||||||
GreTextOutW(dc, r->left, r->top, &InRight, 1);
|
GreTextOutW(dc, myr.left, myr.top, &InRight, 1);
|
||||||
IntGdiSetTextColor(dc, IntGetSysColor(COLOR_3DLIGHT));
|
IntGdiSetTextColor(dc, IntGetSysColor(COLOR_3DLIGHT));
|
||||||
GreTextOutW(dc, r->left, r->top, &InLeft, 1);
|
GreTextOutW(dc, myr.left, myr.top, &InLeft, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -738,12 +743,13 @@ BOOL FASTCALL UITOOLS95_DFC_ButtonCheckRadio(HDC dc, LPRECT r, UINT uFlags, BOOL
|
||||||
WCHAR Check = (Radio) ? 'i' : 'b';
|
WCHAR Check = (Radio) ? 'i' : 'b';
|
||||||
|
|
||||||
IntGdiSetTextColor(dc, IntGetSysColor(COLOR_WINDOWTEXT));
|
IntGdiSetTextColor(dc, IntGetSysColor(COLOR_WINDOWTEXT));
|
||||||
GreTextOutW(dc, r->left, r->top, &Check, 1);
|
GreTextOutW(dc, myr.left, myr.top, &Check, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
IntGdiSetTextColor(dc, IntGetSysColor(COLOR_WINDOWTEXT));
|
IntGdiSetTextColor(dc, IntGetSysColor(COLOR_WINDOWTEXT));
|
||||||
NtGdiSelectFont(dc, hOldFont);
|
NtGdiSelectFont(dc, hOldFont);
|
||||||
GreDeleteObject(hFont);
|
GreDeleteObject(hFont);
|
||||||
|
IntGdiSetBkMode(dc, nBkMode);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -944,9 +950,13 @@ BOOL FASTCALL UITOOLS95_DrawFrameScroll(HDC dc, LPRECT r, UINT uFlags)
|
||||||
|
|
||||||
BOOL FASTCALL UITOOLS95_DrawFrameMenu(HDC dc, LPRECT r, UINT uFlags)
|
BOOL FASTCALL UITOOLS95_DrawFrameMenu(HDC dc, LPRECT r, UINT uFlags)
|
||||||
{
|
{
|
||||||
|
// TODO: DFCS_TRANSPARENT upon DFCS_MENUARROWUP or DFCS_MENUARROWDOWN
|
||||||
LOGFONTW lf;
|
LOGFONTW lf;
|
||||||
HFONT hFont, hOldFont;
|
HFONT hFont, hOldFont;
|
||||||
WCHAR Symbol;
|
WCHAR Symbol;
|
||||||
|
RECT myr;
|
||||||
|
INT cxy, nBkMode;
|
||||||
|
cxy = UITOOLS_MakeSquareRect(r, &myr);
|
||||||
switch(uFlags & 0xff)
|
switch(uFlags & 0xff)
|
||||||
{
|
{
|
||||||
case DFCS_MENUARROWUP:
|
case DFCS_MENUARROWUP:
|
||||||
|
@ -981,7 +991,7 @@ BOOL FASTCALL UITOOLS95_DrawFrameMenu(HDC dc, LPRECT r, UINT uFlags)
|
||||||
}
|
}
|
||||||
/* acquire ressources only if valid menu */
|
/* acquire ressources only if valid menu */
|
||||||
RtlZeroMemory(&lf, sizeof(LOGFONTW));
|
RtlZeroMemory(&lf, sizeof(LOGFONTW));
|
||||||
lf.lfHeight = r->bottom - r->top;
|
lf.lfHeight = cxy;
|
||||||
lf.lfWidth = 0;
|
lf.lfWidth = 0;
|
||||||
lf.lfWeight = FW_NORMAL;
|
lf.lfWeight = FW_NORMAL;
|
||||||
lf.lfCharSet = DEFAULT_CHARSET;
|
lf.lfCharSet = DEFAULT_CHARSET;
|
||||||
|
@ -998,13 +1008,15 @@ BOOL FASTCALL UITOOLS95_DrawFrameMenu(HDC dc, LPRECT r, UINT uFlags)
|
||||||
{
|
{
|
||||||
/* draw shadow */
|
/* draw shadow */
|
||||||
IntGdiSetTextColor(dc, IntGetSysColor(COLOR_BTNHIGHLIGHT));
|
IntGdiSetTextColor(dc, IntGetSysColor(COLOR_BTNHIGHLIGHT));
|
||||||
GreTextOutW(dc, r->left + 1, r->top + 1, &Symbol, 1);
|
GreTextOutW(dc, myr.left + 1, myr.top + 1, &Symbol, 1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
IntGdiSetTextColor(dc, IntGetSysColor((uFlags & DFCS_INACTIVE) ? COLOR_BTNSHADOW : COLOR_BTNTEXT));
|
IntGdiSetTextColor(dc, IntGetSysColor((uFlags & DFCS_INACTIVE) ? COLOR_BTNSHADOW : COLOR_BTNTEXT));
|
||||||
}
|
}
|
||||||
/* draw selected symbol */
|
/* draw selected symbol */
|
||||||
GreTextOutW(dc, r->left, r->top, &Symbol, 1);
|
nBkMode = IntGdiSetBkMode(dc, TRANSPARENT);
|
||||||
|
GreTextOutW(dc, myr.left, myr.top, &Symbol, 1);
|
||||||
|
IntGdiSetBkMode(dc, nBkMode);
|
||||||
/* restore previous settings */
|
/* restore previous settings */
|
||||||
NtGdiSelectFont(dc, hOldFont);
|
NtGdiSelectFont(dc, hOldFont);
|
||||||
GreDeleteObject(hFont);
|
GreDeleteObject(hFont);
|
||||||
|
|
|
@ -972,9 +972,13 @@ static BOOL UITOOLS95_DrawFrameScroll(HDC dc, LPRECT r, UINT uFlags)
|
||||||
|
|
||||||
static BOOL UITOOLS95_DrawFrameMenu(HDC dc, LPRECT r, UINT uFlags)
|
static BOOL UITOOLS95_DrawFrameMenu(HDC dc, LPRECT r, UINT uFlags)
|
||||||
{
|
{
|
||||||
|
// TODO: DFCS_TRANSPARENT upon DFCS_MENUARROWUP or DFCS_MENUARROWDOWN
|
||||||
LOGFONTW lf;
|
LOGFONTW lf;
|
||||||
HFONT hFont, hOldFont;
|
HFONT hFont, hOldFont;
|
||||||
TCHAR Symbol;
|
TCHAR Symbol;
|
||||||
|
RECT myr;
|
||||||
|
INT cxy, nBkMode;
|
||||||
|
cxy = UITOOLS_MakeSquareRect(r, &myr);
|
||||||
switch(uFlags & 0xff)
|
switch(uFlags & 0xff)
|
||||||
{
|
{
|
||||||
case DFCS_MENUARROWUP:
|
case DFCS_MENUARROWUP:
|
||||||
|
@ -1007,7 +1011,7 @@ static BOOL UITOOLS95_DrawFrameMenu(HDC dc, LPRECT r, UINT uFlags)
|
||||||
}
|
}
|
||||||
/* acquire ressources only if valid menu */
|
/* acquire ressources only if valid menu */
|
||||||
ZeroMemory(&lf, sizeof(LOGFONTW));
|
ZeroMemory(&lf, sizeof(LOGFONTW));
|
||||||
lf.lfHeight = r->bottom - r->top;
|
lf.lfHeight = cxy;
|
||||||
lf.lfWidth = 0;
|
lf.lfWidth = 0;
|
||||||
lf.lfWeight = FW_NORMAL;
|
lf.lfWeight = FW_NORMAL;
|
||||||
lf.lfCharSet = DEFAULT_CHARSET;
|
lf.lfCharSet = DEFAULT_CHARSET;
|
||||||
|
@ -1024,13 +1028,15 @@ static BOOL UITOOLS95_DrawFrameMenu(HDC dc, LPRECT r, UINT uFlags)
|
||||||
{
|
{
|
||||||
/* draw shadow */
|
/* draw shadow */
|
||||||
SetTextColor(dc, GetSysColor(COLOR_BTNHIGHLIGHT));
|
SetTextColor(dc, GetSysColor(COLOR_BTNHIGHLIGHT));
|
||||||
TextOut(dc, r->left + 1, r->top + 1, &Symbol, 1);
|
TextOut(dc, myr.left + 1, myr.top + 1, &Symbol, 1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
SetTextColor(dc, GetSysColor((uFlags & DFCS_INACTIVE) ? COLOR_BTNSHADOW : COLOR_BTNTEXT));
|
SetTextColor(dc, GetSysColor((uFlags & DFCS_INACTIVE) ? COLOR_BTNSHADOW : COLOR_BTNTEXT));
|
||||||
}
|
}
|
||||||
/* draw selected symbol */
|
/* draw selected symbol */
|
||||||
TextOut(dc, r->left, r->top, &Symbol, 1);
|
nBkMode = SetBkMode(dc, TRANSPARENT);
|
||||||
|
TextOut(dc, myr.left, myr.top, &Symbol, 1);
|
||||||
|
SetBkMode(dc, nBkMode);
|
||||||
/* restore previous settings */
|
/* restore previous settings */
|
||||||
SelectObject(dc, hOldFont);
|
SelectObject(dc, hOldFont);
|
||||||
DeleteObject(hFont);
|
DeleteObject(hFont);
|
||||||
|
|
Loading…
Reference in a new issue