From a88c85259bd17df0fb0d0a417694a612313613c7 Mon Sep 17 00:00:00 2001 From: Katayama Hirofumi MZ Date: Thu, 25 Jan 2024 12:09:56 +0900 Subject: [PATCH] [SDK] cicuif.h: Fix CUIFMenuItem::OnPaintO10 (#6410) Supporting Language Bar... JIRA issue: CORE-19363 Implement CUIFMenuItem::OnPaintO10 method. --- sdk/include/reactos/cicero/cicuif.h | 71 ++++++++++++++++++++++++++++- 1 file changed, 69 insertions(+), 2 deletions(-) diff --git a/sdk/include/reactos/cicero/cicuif.h b/sdk/include/reactos/cicero/cicuif.h index 2a6601701c8..c1e2f337027 100644 --- a/sdk/include/reactos/cicero/cicuif.h +++ b/sdk/include/reactos/cicero/cicuif.h @@ -6210,11 +6210,78 @@ CUIFMenuItem::OnPaint(HDC hDC) OnPaintDef(hDC); } -/// unimplemented inline STDMETHODIMP_(void) CUIFMenuItem::OnPaintO10(HDC hDC) { - //FIXME + if (!m_pScheme) + return; + + HGDIOBJ hFontOld = ::SelectObject(hDC, m_hFont); + + SIZE textSize; + ::GetTextExtentPoint32W(hDC, m_pszMenuItemLeft, m_cchMenuItemLeft, &textSize); + + LONG cySpace = m_rc.bottom - m_rc.top - textSize.cy; + LONG xCheck = m_rc.left, yCheck = m_rc.top + cySpace / 2; + LONG cxyMargin = (m_pMenu->m_bHasMargin ? m_pMenu->m_cxyMargin : 0); + + LONG xBitmap = m_rc.left + cxyMargin, yBitmap = m_rc.top; + LONG xText = m_rc.left + m_pMenu->m_cxyMargin + cxyMargin + 8; + LONG yText = m_rc.top + cySpace / 2; + LONG xArrow = m_rc.left - textSize.cy + m_rc.right - 2; + LONG xRightText = m_rc.right - m_pMenu->m_cxMenuExtent - 8; + + RECT rc; + GetRect(&rc); + + if (m_bMenuItemDisabled || m_pMenu->m_pSelectedItem != this) + { + rc.right = m_pMenu->m_cxyMargin + rc.left + 2; + if (m_pMenu->m_bHasMargin) + rc.right += m_pMenu->m_cxyMargin; + + ::FillRect(hDC, &rc, m_pScheme->GetBrush(9)); + } + else + { + m_pScheme->DrawCtrlBkgd(hDC, &rc, 0, UIF_DRAW_PRESSED); + m_pScheme->DrawCtrlEdge(hDC, &rc, 0, UIF_DRAW_PRESSED); + } + + ::SetBkMode(hDC, TRANSPARENT); + + if (m_bMenuItemGrayed) + { + ::SetTextColor(hDC, m_pScheme->GetColor(11)); + ::ExtTextOutW(hDC, xText, yText, ETO_CLIPPED, &m_rc, m_pszMenuItemLeft, + m_cchMenuItemLeft, NULL); + } + else if (m_bMenuItemDisabled || m_pMenu->m_pSelectedItem != this) + { + ::SetTextColor(hDC, m_pScheme->GetColor(10)); + ::ExtTextOutW(hDC, xText, yText, ETO_CLIPPED, &m_rc, m_pszMenuItemLeft, + m_cchMenuItemLeft, NULL); + } + else + { + ::SetTextColor(hDC, m_pScheme->GetColor(5)); + ::ExtTextOutW(hDC, xText, yText, ETO_CLIPPED, &m_rc, m_pszMenuItemLeft, + m_cchMenuItemLeft, NULL); + } + + DrawUnderline(hDC, xText, yText, m_pScheme->GetBrush(5)); + + if (m_pszMenuItemRight) + { + ::ExtTextOutW(hDC, xRightText, yText, ETO_CLIPPED, &m_rc, m_pszMenuItemRight, + m_cchMenuItemRight, NULL); + } + + DrawCheck(hDC, xCheck, yCheck); + DrawBitmapProc(hDC, xBitmap, yBitmap); + DrawArrow(hDC, xArrow, yText); + + ::SelectObject(hDC, hFontOld); } inline STDMETHODIMP_(void)