https://git.reactos.org/?p=reactos.git;a=commitdiff;h=76c898ca8e6072931c5ae…
commit 76c898ca8e6072931c5aeb824279d51d3604051a
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Wed Jan 24 17:51:59 2024 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Wed Jan 24 17:51:59 2024 +0900
[SDK] cicuif.h: Fix CUIFMenuItem::InitMenuExtent (#6407)
Supporting Language Bar...
JIRA issue: CORE-19363
Implement CUIFMenuItem::InitMenuExtent
method.
---
sdk/include/reactos/cicero/cicuif.h | 37 +++++++++++++++++++++++++++++++++++--
1 file changed, 35 insertions(+), 2 deletions(-)
diff --git a/sdk/include/reactos/cicero/cicuif.h b/sdk/include/reactos/cicero/cicuif.h
index 7ae16842900..f6fcf6a9f0c 100644
--- a/sdk/include/reactos/cicero/cicuif.h
+++ b/sdk/include/reactos/cicero/cicuif.h
@@ -5979,11 +5979,44 @@ inline BOOL CUIFMenuItem::Init(UINT nMenuItemID, LPCWSTR pszText)
return TRUE;
}
-/// @unimplemented
inline STDMETHODIMP_(void)
CUIFMenuItem::InitMenuExtent()
{
- //FIXME
+ if (!m_pszMenuItemLeft)
+ {
+ if (m_hbmColor)
+ {
+ BITMAP bm;
+ ::GetObject(m_hbmColor, sizeof(bm), &bm);
+ m_MenuLeftExtent.cx = bm.bmWidth + 2;
+ m_MenuLeftExtent.cy = bm.bmHeight + 4;
+ }
+ else
+ {
+ m_MenuLeftExtent.cx = m_MenuLeftExtent.cy = 0;
+ }
+ return;
+ }
+
+ HDC hDC = ::GetDC(*m_pWindow);
+
+ HGDIOBJ hFontOld = ::SelectObject(hDC, m_hFont);
+ ::GetTextExtentPoint32W(hDC, m_pszMenuItemLeft, m_cchMenuItemLeft,
&m_MenuLeftExtent);
+ m_MenuLeftExtent.cx += 16;
+ m_MenuLeftExtent.cy += 8;
+ if (m_pszMenuItemRight)
+ {
+ ::GetTextExtentPoint32W(hDC, m_pszMenuItemRight, m_cchMenuItemRight,
&m_MenuRightExtent);
+ m_MenuRightExtent.cy += 8;
+ }
+ ::SelectObject(hDC, hFontOld);
+
+ if (m_pSubMenu)
+ m_MenuLeftExtent.cx += m_MenuLeftExtent.cy + 2;
+ if (m_pMenu->m_style & UIF_MENU_USE_OFF10)
+ m_MenuLeftExtent.cx += 24;
+
+ ::ReleaseDC(*m_pWindow, hDC);
}
inline BOOL CUIFMenuItem::IsCheck()