https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f465035cd91c5d543fd01…
commit f465035cd91c5d543fd013ff6bc2adfb80b2229d
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Wed Jan 24 14:42:17 2024 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Wed Jan 24 14:42:17 2024 +0900
[SDK] cicuif.h: Fix CUIFMenuItem::Init (#6405)
Supporting Language Bar...
JIRA issue: CORE-19363
Implement CUIFMenuItem::Init method.
---
sdk/include/reactos/cicero/cicuif.h | 50 +++++++++++++++++++++++++++++++++++--
1 file changed, 48 insertions(+), 2 deletions(-)
diff --git a/sdk/include/reactos/cicero/cicuif.h b/sdk/include/reactos/cicero/cicuif.h
index 46a63d8462d..e48cdbad0ab 100644
--- a/sdk/include/reactos/cicero/cicuif.h
+++ b/sdk/include/reactos/cicero/cicuif.h
@@ -5911,10 +5911,56 @@ inline CUIFMenuItem::~CUIFMenuItem()
}
}
-/// @unimplemented
inline BOOL CUIFMenuItem::Init(UINT nMenuItemID, LPCWSTR pszText)
{
- //FIXME
+ m_nMenuItemID = nMenuItemID;
+
+ if (!pszText)
+ {
+ m_pszMenuItemLeft = NULL;
+ m_cchMenuItemLeft = 0;
+ return TRUE;
+ }
+
+ INT cch = lstrlenW(pszText);
+ m_pszMenuItemLeft = new(cicNoThrow) WCHAR[cch + 1];
+ if (!m_pszMenuItemLeft)
+ return FALSE;
+
+ const WCHAR *pch0 = pszText;
+ INT ich1, ich2;
+ for (ich1 = 0; *pch0 && *pch0 != L'\t'; ++ich1, ++pch0)
+ {
+ if (*pch0 == L'&' && *++pch0 != L'&')
+ {
+ m_nMenuItemVKey = ::VkKeyScanW(*pch0);
+ if (!m_nMenuItemVKey)
+ m_nMenuItemVKey = (BYTE)VkKeyScanA(*(BYTE*)pch0);
+ m_ichMenuItemPrefix = ich1;
+ }
+ m_pszMenuItemLeft[ich1] = *pch0;
+ }
+ m_pszMenuItemLeft[ich1] = 0;
+ m_cchMenuItemLeft = lstrlenW(m_pszMenuItemLeft);
+
+ if (*pch0 == L'\t')
+ {
+ m_cchMenuItemRight = 0;
+ m_pszMenuItemRight = new(cicNoThrow) WCHAR[cch + 1];
+ if (m_pszMenuItemRight)
+ {
+ ++pch0;
+ WCHAR wch = *pch0;
+ for (ich2 = 0; *pch0; ++ich2)
+ {
+ m_pszMenuItemRight[ich2] = wch;
+ wch = *++pch0;
+ }
+ m_pszMenuItemRight[ich2] = 0;
+ m_cchMenuItemRight = lstrlenW(m_pszMenuItemRight);
+ }
+ }
+
return TRUE;
}