https://git.reactos.org/?p=reactos.git;a=commitdiff;h=8bfebdf444d96337429a0…
commit 8bfebdf444d96337429a01cdf4a92711f39b4c91
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Tue Feb 6 13:34:34 2024 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Tue Feb 6 13:34:34 2024 +0900
[MSUTB] Add CUTBLBarMenu (#6445)
Supporting Language Bar...
JIRA issue: CORE-19363
- Implement CUTBLBarMenu class.
---
dll/win32/msutb/msutb.cpp | 119 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 119 insertions(+)
diff --git a/dll/win32/msutb/msutb.cpp b/dll/win32/msutb/msutb.cpp
index 4585ed7e6ca..4d988b4f26b 100644
--- a/dll/win32/msutb/msutb.cpp
+++ b/dll/win32/msutb/msutb.cpp
@@ -725,6 +725,39 @@ public:
/***********************************************************************/
+class CUTBLBarMenuItem;
+
+class CUTBLBarMenu : public CCicLibMenu
+{
+protected:
+ CUTBMenuWnd *m_pMenuUI;
+ HINSTANCE m_hInst;
+
+public:
+ CUTBLBarMenu(HINSTANCE hInst);
+ ~CUTBLBarMenu() override;
+
+ CUTBMenuWnd *CreateMenuUI();
+ INT ShowPopup(CUIFWindow *pWindow, POINT pt, LPCRECT prcExclude);
+
+ STDMETHOD_(CCicLibMenuItem*, CreateMenuItem)() override;
+ STDMETHOD_(CCicLibMenu*, CreateSubMenu)() override;
+};
+
+/***********************************************************************/
+
+class CUTBLBarMenuItem : public CCicLibMenuItem
+{
+public:
+ CUTBLBarMenu *m_pLBarMenu;
+
+public:
+ CUTBLBarMenuItem() { m_pLBarMenu = NULL; }
+ BOOL InsertToUI(CUTBMenuWnd *pMenuUI);
+};
+
+/***********************************************************************/
+
class CTrayIconWnd
{
protected:
@@ -2500,6 +2533,92 @@ STDMETHODIMP CLBarItemBase::GetTooltipString(BSTR *pbstrToolTip)
return bstr ? S_OK : E_OUTOFMEMORY;
}
+/***********************************************************************
+ * CUTBLBarMenu
+ */
+
+CUTBLBarMenu::CUTBLBarMenu(HINSTANCE hInst) : CCicLibMenu()
+{
+ m_hInst = hInst;
+}
+
+CUTBLBarMenu::~CUTBLBarMenu()
+{
+}
+
+STDMETHODIMP_(CCicLibMenuItem*) CUTBLBarMenu::CreateMenuItem()
+{
+ CUTBLBarMenuItem *pItem = new(cicNoThrow) CUTBLBarMenuItem();
+ if (!pItem)
+ return NULL;
+ pItem->m_pLBarMenu = this;
+ return pItem;
+}
+
+CUTBMenuWnd *CUTBLBarMenu::CreateMenuUI()
+{
+ CUTBMenuWnd *pMenuUI = new(cicNoThrow) CUTBMenuWnd(m_hInst, g_dwMenuStyle, 0);
+ if (!pMenuUI)
+ return NULL;
+
+ pMenuUI->Initialize();
+ for (size_t iItem = 0; iItem < m_MenuItems.size(); ++iItem)
+ {
+ CUTBLBarMenuItem *pItem = (CUTBLBarMenuItem *)m_MenuItems[iItem];
+ pItem->InsertToUI(pMenuUI);
+ }
+
+ return pMenuUI;
+}
+
+STDMETHODIMP_(CCicLibMenu*) CUTBLBarMenu::CreateSubMenu()
+{
+ return new(cicNoThrow) CUTBLBarMenu(m_hInst);
+}
+
+INT CUTBLBarMenu::ShowPopup(CUIFWindow *pWindow, POINT pt, LPCRECT prcExclude)
+{
+ if (m_pMenuUI)
+ return 0;
+
+ m_pMenuUI = CreateMenuUI();
+ if (!m_pMenuUI)
+ return -1;
+
+ INT nCommandId = m_pMenuUI->ShowModalPopup(pWindow, prcExclude, TRUE);
+
+ if (m_pMenuUI)
+ {
+ delete m_pMenuUI;
+ m_pMenuUI = NULL;
+ }
+
+ return nCommandId;
+}
+
+/***********************************************************************
+ * CUTBLBarMenuItem
+ */
+
+/// @unimplemented
+BOOL CUTBLBarMenuItem::InsertToUI(CUTBMenuWnd *pMenuUI)
+{
+ if ((m_dwFlags & 4) != 0)
+ {
+ pMenuUI->InsertSeparator();
+ return TRUE;
+ }
+ if (m_dwFlags & 2)
+ {
+ //FIXME
+ }
+ else
+ {
+ //FIXME
+ }
+ return FALSE;
+}
+
/***********************************************************************
* GetLibTls (MSUTB.@)
*