[SDK] cicuif.h: Add CUIFMenuItemSeparator (#6411)

Supporting Language Bar...
JIRA issue: CORE-19363
- Add CUIFMenuItemSeparator class.
- Implement CUIFMenu::InsertSeparator
  method.
This commit is contained in:
Katayama Hirofumi MZ 2024-01-25 12:35:04 +09:00 committed by GitHub
parent a88c85259b
commit 6b0ee735c7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 72 additions and 7 deletions

View file

@ -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)

View file

@ -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
}