mirror of
https://github.com/reactos/reactos.git
synced 2025-04-27 09:00:27 +00:00
[EXPLORER][COMCTL32] Fix wrong title on taskbar if it has '&' in it (#7073)
The ampersand (&) a.k.a. prefix of DrawText are specially treated for adding underscores. We have to fix drawing on toolbar button with BTNS_NOPREFIX style. JIRA issue: CORE-11619 - Delete DT flags hack in taskswnd.cpp. - Add TOOLBAR_GetButtonDTFlags helper function. - Extend TOOLBAR_DrawString parameters for the button info. - Fix DrawText flags for drawing when the button has BTNS_NOPREFIX style.
This commit is contained in:
parent
8a7b99c184
commit
c536664666
2 changed files with 27 additions and 2 deletions
|
@ -287,7 +287,6 @@ public:
|
||||||
|
|
||||||
// HACK & FIXME: CORE-18016
|
// HACK & FIXME: CORE-18016
|
||||||
HWND toolbar = CToolbar::Create(hWndParent, styles);
|
HWND toolbar = CToolbar::Create(hWndParent, styles);
|
||||||
SetDrawTextFlags(DT_NOPREFIX, DT_NOPREFIX);
|
|
||||||
m_hWnd = NULL;
|
m_hWnd = NULL;
|
||||||
return SubclassWindow(toolbar);
|
return SubclassWindow(toolbar);
|
||||||
}
|
}
|
||||||
|
|
|
@ -286,6 +286,16 @@ static inline BOOL button_has_ddarrow(const TOOLBAR_INFO *infoPtr, const TBUTTON
|
||||||
(btnPtr->fsStyle & BTNS_WHOLEDROPDOWN);
|
(btnPtr->fsStyle & BTNS_WHOLEDROPDOWN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __REACTOS__
|
||||||
|
static inline DWORD TOOLBAR_GetButtonDTFlags(const TOOLBAR_INFO *infoPtr, const TBUTTON_INFO *btnPtr)
|
||||||
|
{
|
||||||
|
DWORD dwDTFlags = infoPtr->dwDTFlags;
|
||||||
|
if (btnPtr->fsStyle & BTNS_NOPREFIX)
|
||||||
|
dwDTFlags |= DT_NOPREFIX;
|
||||||
|
return dwDTFlags;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static LPWSTR
|
static LPWSTR
|
||||||
TOOLBAR_GetText(const TOOLBAR_INFO *infoPtr, const TBUTTON_INFO *btnPtr)
|
TOOLBAR_GetText(const TOOLBAR_INFO *infoPtr, const TBUTTON_INFO *btnPtr)
|
||||||
{
|
{
|
||||||
|
@ -623,6 +633,9 @@ TOOLBAR_DrawArrow (HDC hdc, INT left, INT top, COLORREF clr)
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
TOOLBAR_DrawString (const TOOLBAR_INFO *infoPtr, RECT *rcText, LPCWSTR lpText,
|
TOOLBAR_DrawString (const TOOLBAR_INFO *infoPtr, RECT *rcText, LPCWSTR lpText,
|
||||||
|
#ifdef __REACTOS__
|
||||||
|
const TBUTTON_INFO *btnPtr,
|
||||||
|
#endif
|
||||||
const NMTBCUSTOMDRAW *tbcd, DWORD dwItemCDFlag)
|
const NMTBCUSTOMDRAW *tbcd, DWORD dwItemCDFlag)
|
||||||
{
|
{
|
||||||
HDC hdc = tbcd->nmcd.hdc;
|
HDC hdc = tbcd->nmcd.hdc;
|
||||||
|
@ -633,6 +646,7 @@ TOOLBAR_DrawString (const TOOLBAR_INFO *infoPtr, RECT *rcText, LPCWSTR lpText,
|
||||||
UINT state = tbcd->nmcd.uItemState;
|
UINT state = tbcd->nmcd.uItemState;
|
||||||
#ifdef __REACTOS__
|
#ifdef __REACTOS__
|
||||||
HTHEME theme = GetWindowTheme (infoPtr->hwndSelf);
|
HTHEME theme = GetWindowTheme (infoPtr->hwndSelf);
|
||||||
|
DWORD dwDTFlags = TOOLBAR_GetButtonDTFlags(infoPtr, btnPtr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* draw text */
|
/* draw text */
|
||||||
|
@ -660,7 +674,7 @@ TOOLBAR_DrawString (const TOOLBAR_INFO *infoPtr, RECT *rcText, LPCWSTR lpText,
|
||||||
else if (state & CDIS_HOT)
|
else if (state & CDIS_HOT)
|
||||||
stateId = TS_HOT;
|
stateId = TS_HOT;
|
||||||
|
|
||||||
DrawThemeText(theme, hdc, partId, stateId, lpText, -1, infoPtr->dwDTFlags, dwDTFlags2, rcText);
|
DrawThemeText(theme, hdc, partId, stateId, lpText, -1, dwDTFlags, dwDTFlags2, rcText);
|
||||||
SelectObject (hdc, hOldFont);
|
SelectObject (hdc, hOldFont);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -672,7 +686,11 @@ TOOLBAR_DrawString (const TOOLBAR_INFO *infoPtr, RECT *rcText, LPCWSTR lpText,
|
||||||
else if (state & CDIS_DISABLED) {
|
else if (state & CDIS_DISABLED) {
|
||||||
clrOld = SetTextColor (hdc, tbcd->clrBtnHighlight);
|
clrOld = SetTextColor (hdc, tbcd->clrBtnHighlight);
|
||||||
OffsetRect (rcText, 1, 1);
|
OffsetRect (rcText, 1, 1);
|
||||||
|
#ifdef __REACTOS__
|
||||||
|
DrawTextW (hdc, lpText, -1, rcText, dwDTFlags);
|
||||||
|
#else
|
||||||
DrawTextW (hdc, lpText, -1, rcText, infoPtr->dwDTFlags);
|
DrawTextW (hdc, lpText, -1, rcText, infoPtr->dwDTFlags);
|
||||||
|
#endif
|
||||||
SetTextColor (hdc, comctl32_color.clr3dShadow);
|
SetTextColor (hdc, comctl32_color.clr3dShadow);
|
||||||
OffsetRect (rcText, -1, -1);
|
OffsetRect (rcText, -1, -1);
|
||||||
}
|
}
|
||||||
|
@ -688,7 +706,11 @@ TOOLBAR_DrawString (const TOOLBAR_INFO *infoPtr, RECT *rcText, LPCWSTR lpText,
|
||||||
clrOld = SetTextColor (hdc, tbcd->clrText);
|
clrOld = SetTextColor (hdc, tbcd->clrText);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __REACTOS__
|
||||||
|
DrawTextW (hdc, lpText, -1, rcText, dwDTFlags);
|
||||||
|
#else
|
||||||
DrawTextW (hdc, lpText, -1, rcText, infoPtr->dwDTFlags);
|
DrawTextW (hdc, lpText, -1, rcText, infoPtr->dwDTFlags);
|
||||||
|
#endif
|
||||||
SetTextColor (hdc, clrOld);
|
SetTextColor (hdc, clrOld);
|
||||||
if ((state & CDIS_MARKED) && !(dwItemCDFlag & TBCDRF_NOMARK))
|
if ((state & CDIS_MARKED) && !(dwItemCDFlag & TBCDRF_NOMARK))
|
||||||
{
|
{
|
||||||
|
@ -1197,7 +1219,11 @@ TOOLBAR_DrawButton (const TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, HDC hdc,
|
||||||
|
|
||||||
oldBkMode = SetBkMode (hdc, tbcd.nStringBkMode);
|
oldBkMode = SetBkMode (hdc, tbcd.nStringBkMode);
|
||||||
if (!(infoPtr->dwExStyle & TBSTYLE_EX_MIXEDBUTTONS) || (btnPtr->fsStyle & BTNS_SHOWTEXT))
|
if (!(infoPtr->dwExStyle & TBSTYLE_EX_MIXEDBUTTONS) || (btnPtr->fsStyle & BTNS_SHOWTEXT))
|
||||||
|
#ifdef __REACTOS__
|
||||||
|
TOOLBAR_DrawString(infoPtr, &rcText, lpText, btnPtr, &tbcd, dwItemCDFlag);
|
||||||
|
#else
|
||||||
TOOLBAR_DrawString (infoPtr, &rcText, lpText, &tbcd, dwItemCDFlag);
|
TOOLBAR_DrawString (infoPtr, &rcText, lpText, &tbcd, dwItemCDFlag);
|
||||||
|
#endif
|
||||||
SetBkMode (hdc, oldBkMode);
|
SetBkMode (hdc, oldBkMode);
|
||||||
|
|
||||||
TOOLBAR_DrawImage(infoPtr, btnPtr, rcBitmap.left, rcBitmap.top, &tbcd, dwItemCDFlag);
|
TOOLBAR_DrawImage(infoPtr, btnPtr, rcBitmap.left, rcBitmap.top, &tbcd, dwItemCDFlag);
|
||||||
|
|
Loading…
Reference in a new issue