https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6b0ee735c739764cd7f52…
commit 6b0ee735c739764cd7f523bbc723a7d57e0998bb
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Thu Jan 25 12:35:04 2024 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Thu Jan 25 12:35:04 2024 +0900
[SDK] cicuif.h: Add CUIFMenuItemSeparator (#6411)
Supporting Language Bar...
JIRA issue: CORE-19363
- Add CUIFMenuItemSeparator class.
- Implement CUIFMenu::InsertSeparator
method.
---
sdk/include/reactos/cicero/cicarray.h | 9 +++++
sdk/include/reactos/cicero/cicuif.h | 70 +++++++++++++++++++++++++++++++----
2 files changed, 72 insertions(+), 7 deletions(-)
diff --git a/sdk/include/reactos/cicero/cicarray.h
b/sdk/include/reactos/cicero/cicarray.h
index 880188b5186..1d2142f1c59 100644
--- a/sdk/include/reactos/cicero/cicarray.h
+++ b/sdk/include/reactos/cicero/cicarray.h
@@ -57,6 +57,15 @@ public:
using CicArrayBase::Insert;
using CicArrayBase::Remove;
+ BOOL Add(const T_ITEM& item)
+ {
+ T_ITEM *pItem = Append(1);
+ if (!pItem)
+ return FALSE;
+ CopyMemory(pItem, &item, sizeof(T_ITEM));
+ return TRUE;
+ }
+
ssize_t Find(const T_ITEM& item) const
{
for (size_t iItem = 0; iItem < m_cItems; ++iItem)
diff --git a/sdk/include/reactos/cicero/cicuif.h b/sdk/include/reactos/cicero/cicuif.h
index c1e2f337027..b4715f93263 100644
--- a/sdk/include/reactos/cicero/cicuif.h
+++ b/sdk/include/reactos/cicero/cicuif.h
@@ -34,6 +34,7 @@ class CUIFTheme;
class CUIFWndFrame;
class CUIFGripper;
class CUIFMenuItem;
+ class CUIFMenuItemSeparator;
class CUIFObjectArray;
class CUIFColorTable;
class CUIFColorTableSys;
@@ -806,13 +807,25 @@ public:
STDMETHOD_(void, OnTimer)() override;
STDMETHOD_(void, InitMenuExtent)();
- STDMETHOD_(void, OnPaintO10)(HDC hDC);
STDMETHOD_(void, OnPaintDef)(HDC hDC);
+ STDMETHOD_(void, OnPaintO10)(HDC hDC);
STDMETHOD_(void, OnUnknownMethod)() { } // FIXME: method name
};
/////////////////////////////////////////////////////////////////////////////
+class CUIFMenuItemSeparator : public CUIFMenuItem
+{
+public:
+ CUIFMenuItemSeparator(CUIFMenu *pMenu);
+
+ STDMETHOD_(void, InitMenuExtent)() override;
+ STDMETHOD_(void, OnPaintDef)(HDC hDC) override;
+ STDMETHOD_(void, OnPaintO10)(HDC hDC) override;
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
// m_style flags for CUIFButton
enum
{
@@ -5733,20 +5746,27 @@ CUIFMenu::InitShow(CUIFWindow *pWindow, LPCRECT prc, BOOL bFlag,
BOOL bDoAnimati
inline BOOL CUIFMenu::InsertItem(CUIFMenuItem *pItem)
{
- CUIFMenuItem **ppAdded = m_MenuItems.Append(1);
- if (!ppAdded)
+ if (!m_MenuItems.Add(pItem))
return FALSE;
- *ppAdded = pItem;
pItem->SetFont(m_hFont);
return TRUE;
}
-/// @unimplemented
inline BOOL CUIFMenu::InsertSeparator()
{
- //FIXME
- return FALSE;
+ CUIFMenuItemSeparator *pSep = new(cicNoThrow) CUIFMenuItemSeparator(this);
+ if (!pSep)
+ return FALSE;
+
+ if (!m_MenuItems.Add(pSep))
+ {
+ delete pSep;
+ return FALSE;
+ }
+
+ pSep->Initialize();
+ return TRUE;
}
inline STDMETHODIMP_(void)
@@ -6370,3 +6390,39 @@ inline void CUIFMenuItem::ShowSubPopup()
::ClientToScreen(*m_pWindow, (LPPOINT)&rc.right);
m_pSubMenu->ShowSubPopup(m_pMenu, &rc, FALSE);
}
+
+/////////////////////////////////////////////////////////////////////////////
+
+inline
+CUIFMenuItemSeparator::CUIFMenuItemSeparator(CUIFMenu *pMenu) : CUIFMenuItem(pMenu,
TRUE)
+{
+ m_nMenuItemID = -1;
+}
+
+inline STDMETHODIMP_(void)
+CUIFMenuItemSeparator::InitMenuExtent()
+{
+ m_MenuLeftExtent.cx = 0;
+ m_MenuLeftExtent.cy = 6;
+}
+
+inline STDMETHODIMP_(void)
+CUIFMenuItemSeparator::OnPaintDef(HDC hDC)
+{
+ if (!m_pScheme)
+ return;
+
+ RECT rc;
+ rc.left = m_rc.left + 2;
+ rc.top = m_rc.top + (m_rc.bottom - m_rc.top - 2) / 2;
+ rc.right = m_rc.right - 2;
+ rc.bottom = rc.top + 2;
+ m_pScheme->DrawMenuSeparator(hDC, &rc);
+}
+
+/// @unimplemented
+inline STDMETHODIMP_(void)
+CUIFMenuItemSeparator::OnPaintO10(HDC hDC)
+{
+ //FIXME
+}