4 * Copyright 2014 David Quintana
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #include <commoncontrols.h>
23 #include <shlwapi_undoc.h>
25 #include "CMenuBand.h"
26 #include "CMenuToolbars.h"
27 #include "CMenuFocusManager.h"
29 WINE_DEFAULT_DEBUG_CHANNEL(CMenuBand
);
33 #define UNIMPLEMENTED TRACE("%s is UNIMPLEMENTED!\n", __FUNCTION__)
36 HRESULT WINAPI
CMenuBand_Constructor(REFIID riid
, LPVOID
*ppv
)
39 #if USE_SYSTEM_MENUBAND
40 hr
= CoCreateInstance(CLSID_MenuBand
,
47 CMenuBand
* site
= new CComObject
<CMenuBand
>();
52 hr
= site
->QueryInterface(riid
, ppv
);
54 if (FAILED_UNEXPECTEDLY(hr
))
61 CMenuBand::CMenuBand() :
62 m_staticToolbar(NULL
),
67 m_subMenuParent(NULL
),
73 m_topLevelWindow(NULL
),
79 m_focusManager
= CMenuFocusManager::AcquireManager();
82 CMenuBand::~CMenuBand()
84 CMenuFocusManager::ReleaseManager(m_focusManager
);
87 delete m_staticToolbar
;
93 HRESULT STDMETHODCALLTYPE
CMenuBand::Initialize(
94 IShellMenuCallback
*psmc
,
102 m_uIdAncestor
= uIdAncestor
;
107 _CallCB(SMC_CREATE
, 0, reinterpret_cast<LPARAM
>(&m_UserData
));
113 HRESULT STDMETHODCALLTYPE
CMenuBand::GetMenuInfo(
114 IShellMenuCallback
**ppsmc
,
119 if (!pdwFlags
) // maybe?
129 *puIdAncestor
= m_uIdAncestor
;
131 *pdwFlags
= m_dwFlags
;
136 HRESULT STDMETHODCALLTYPE
CMenuBand::SetMenu(
141 TRACE("CMenuBand::SetMenu called, hmenu=%p; hwnd=%p, flags=%x\n", hmenu
, hwnd
, dwFlags
);
143 BOOL created
= FALSE
;
145 if (m_staticToolbar
== NULL
)
147 m_staticToolbar
= new CMenuStaticToolbar(this);
153 HRESULT hr
= m_staticToolbar
->SetMenu(hmenu
, hwnd
, dwFlags
);
154 if (FAILED_UNEXPECTEDLY(hr
))
161 hr
= m_site
->GetWindow(&hwndParent
);
162 if (FAILED_UNEXPECTEDLY(hr
))
167 hr
= m_staticToolbar
->CreateToolbar(hwndParent
, m_dwFlags
);
168 if (FAILED_UNEXPECTEDLY(hr
))
171 hr
= m_staticToolbar
->FillToolbar();
175 hr
= m_staticToolbar
->FillToolbar(TRUE
);
182 HRESULT STDMETHODCALLTYPE
CMenuBand::GetMenu(
187 if (m_staticToolbar
== NULL
)
190 return m_staticToolbar
->GetMenu(phmenu
, phwnd
, pdwFlags
);
193 HRESULT STDMETHODCALLTYPE
CMenuBand::SetSite(IUnknown
*pUnkSite
)
200 if (pUnkSite
== NULL
)
204 hr
= pUnkSite
->QueryInterface(IID_PPV_ARG(IOleWindow
, &m_site
));
205 if (FAILED_UNEXPECTEDLY(hr
))
208 hr
= m_site
->GetWindow(&hwndParent
);
209 if (FAILED_UNEXPECTEDLY(hr
))
212 if (!::IsWindow(hwndParent
))
215 if (m_staticToolbar
!= NULL
)
217 hr
= m_staticToolbar
->CreateToolbar(hwndParent
, m_dwFlags
);
218 if (FAILED_UNEXPECTEDLY(hr
))
221 hr
= m_staticToolbar
->FillToolbar();
222 if (FAILED_UNEXPECTEDLY(hr
))
226 if (m_SFToolbar
!= NULL
)
228 hr
= m_SFToolbar
->CreateToolbar(hwndParent
, m_dwFlags
);
229 if (FAILED_UNEXPECTEDLY(hr
))
232 hr
= m_SFToolbar
->FillToolbar();
233 if (FAILED_UNEXPECTEDLY(hr
))
237 hr
= IUnknown_QueryService(m_site
, SID_SMenuPopup
, IID_PPV_ARG(IMenuPopup
, &m_subMenuParent
));
238 if (hr
!= E_NOINTERFACE
&& FAILED_UNEXPECTEDLY(hr
))
241 CComPtr
<IOleWindow
> pTopLevelWindow
;
242 hr
= IUnknown_QueryService(m_site
, SID_STopLevelBrowser
, IID_PPV_ARG(IOleWindow
, &pTopLevelWindow
));
243 if (FAILED_UNEXPECTEDLY(hr
))
246 return pTopLevelWindow
->GetWindow(&m_topLevelWindow
);
249 HRESULT STDMETHODCALLTYPE
CMenuBand::GetSite(REFIID riid
, PVOID
*ppvSite
)
254 return m_site
->QueryInterface(riid
, ppvSite
);
257 HRESULT STDMETHODCALLTYPE
CMenuBand::GetWindow(
260 if (m_SFToolbar
!= NULL
)
261 return m_SFToolbar
->GetWindow(phwnd
);
263 if (m_staticToolbar
!= NULL
)
264 return m_staticToolbar
->GetWindow(phwnd
);
269 HRESULT STDMETHODCALLTYPE
CMenuBand::OnPosRectChangeDB(RECT
*prc
)
271 SIZE maxStatic
= { 0 };
272 SIZE maxShlFld
= { 0 };
275 if (m_staticToolbar
!= NULL
)
276 hr
= m_staticToolbar
->GetSizes(NULL
, &maxStatic
, NULL
);
277 if (FAILED_UNEXPECTEDLY(hr
))
280 if (m_SFToolbar
!= NULL
)
281 hr
= m_SFToolbar
->GetSizes(NULL
, &maxShlFld
, NULL
);
282 if (FAILED_UNEXPECTEDLY(hr
))
285 if (m_staticToolbar
== NULL
&& m_SFToolbar
== NULL
)
288 int sy
= min(prc
->bottom
- prc
->top
, maxStatic
.cy
+ maxShlFld
.cy
);
290 int syStatic
= maxStatic
.cy
;
291 int syShlFld
= sy
- syStatic
;
295 m_SFToolbar
->SetPosSize(
298 prc
->right
- prc
->left
,
303 m_staticToolbar
->SetPosSize(
306 prc
->right
- prc
->left
,
313 HRESULT STDMETHODCALLTYPE
CMenuBand::GetBandInfo(
318 SIZE minStatic
= { 0 };
319 SIZE minShlFld
= { 0 };
320 SIZE maxStatic
= { 0 };
321 SIZE maxShlFld
= { 0 };
322 SIZE intStatic
= { 0 };
323 SIZE intShlFld
= { 0 };
327 if (m_staticToolbar
!= NULL
)
328 hr
= m_staticToolbar
->GetSizes(&minStatic
, &maxStatic
, &intStatic
);
329 if (FAILED_UNEXPECTEDLY(hr
))
332 if (m_SFToolbar
!= NULL
)
333 hr
= m_SFToolbar
->GetSizes(&minShlFld
, &maxShlFld
, &intShlFld
);
334 if (FAILED_UNEXPECTEDLY(hr
))
337 if (m_staticToolbar
== NULL
&& m_SFToolbar
== NULL
)
340 if (m_dwFlags
& SMINIT_VERTICAL
)
342 pdbi
->ptMinSize
.x
= max(minStatic
.cx
, minShlFld
.cx
) + 20;
343 pdbi
->ptMinSize
.y
= minStatic
.cy
+ minShlFld
.cy
;
344 pdbi
->ptMaxSize
.x
= max(maxStatic
.cx
, maxShlFld
.cx
) + 20;
345 pdbi
->ptMaxSize
.y
= maxStatic
.cy
+ maxShlFld
.cy
;
346 pdbi
->dwModeFlags
= DBIMF_VARIABLEHEIGHT
;
350 pdbi
->ptMinSize
.x
= minStatic
.cx
+ minShlFld
.cx
;
351 pdbi
->ptMinSize
.y
= max(minStatic
.cy
, minShlFld
.cy
);
352 pdbi
->ptMaxSize
.x
= maxStatic
.cx
+ maxShlFld
.cx
;
353 pdbi
->ptMaxSize
.y
= max(maxStatic
.cy
, maxShlFld
.cy
);
355 pdbi
->ptIntegral
.x
= max(intStatic
.cx
, intShlFld
.cx
);
356 pdbi
->ptIntegral
.y
= max(intStatic
.cy
, intShlFld
.cy
);
357 pdbi
->ptActual
= pdbi
->ptMinSize
;
362 HRESULT STDMETHODCALLTYPE
CMenuBand::ShowDW(BOOL fShow
)
366 if (m_staticToolbar
!= NULL
)
368 hr
= m_staticToolbar
->ShowWindow(fShow
);
369 if (FAILED_UNEXPECTEDLY(hr
))
373 if (m_SFToolbar
!= NULL
)
375 hr
= m_SFToolbar
->ShowWindow(fShow
);
376 if (FAILED_UNEXPECTEDLY(hr
))
382 hr
= _CallCB(SMC_INITMENU
, 0, 0);
383 if (FAILED_UNEXPECTEDLY(hr
))
386 else if (m_parentBand
)
388 m_parentBand
->SetClient(NULL
);
391 if (_IsPopup() == S_OK
)
394 hr
= m_focusManager
->PushMenuPopup(this);
396 hr
= m_focusManager
->PopMenuPopup(this);
401 hr
= m_focusManager
->PushMenuBar(this);
403 hr
= m_focusManager
->PopMenuBar(this);
409 HRESULT STDMETHODCALLTYPE
CMenuBand::CloseDW(DWORD dwReserved
)
413 if (m_staticToolbar
!= NULL
)
414 return m_staticToolbar
->Close();
416 if (m_SFToolbar
!= NULL
)
417 return m_SFToolbar
->Close();
422 HRESULT STDMETHODCALLTYPE
CMenuBand::UIActivateIO(BOOL fActivate
, LPMSG lpMsg
)
428 hr
= m_subMenuParent
->SetSubMenu(this, fActivate
);
429 if (FAILED_UNEXPECTEDLY(hr
))
435 CComPtr
<IOleWindow
> pTopLevelWindow
;
436 hr
= IUnknown_QueryService(m_site
, SID_SMenuPopup
, IID_PPV_ARG(IOleWindow
, &pTopLevelWindow
));
437 if (FAILED_UNEXPECTEDLY(hr
))
440 hr
= pTopLevelWindow
->GetWindow(&m_topLevelWindow
);
441 if (FAILED_UNEXPECTEDLY(hr
))
446 m_topLevelWindow
= NULL
;
452 HRESULT STDMETHODCALLTYPE
CMenuBand::Exec(const GUID
*pguidCmdGroup
, DWORD nCmdID
, DWORD nCmdexecopt
, VARIANT
*pvaIn
, VARIANT
*pvaOut
)
457 if (IsEqualGUID(*pguidCmdGroup
, CLSID_MenuBand
))
459 if (nCmdID
== 16) // set (big) icon size
461 this->m_useBigIcons
= nCmdexecopt
== 2;
464 else if (nCmdID
== 19) // popup-related
468 else if (nCmdID
== 5) // select an item
470 if (nCmdexecopt
== 0) // first
472 _KeyboardItemChange(VK_HOME
);
476 _KeyboardItemChange(VK_END
);
488 HRESULT STDMETHODCALLTYPE
CMenuBand::QueryService(REFGUID guidService
, REFIID riid
, void **ppvObject
)
490 if (IsEqualIID(guidService
, SID_SMenuBandChild
) ||
491 IsEqualIID(guidService
, SID_SMenuBandBottom
) ||
492 IsEqualIID(guidService
, SID_SMenuBandBottomSelected
))
493 return this->QueryInterface(riid
, ppvObject
);
494 WARN("Unknown service requested %s\n", wine_dbgstr_guid(&guidService
));
495 return E_NOINTERFACE
;
498 HRESULT STDMETHODCALLTYPE
CMenuBand::Popup(POINTL
*ppt
, RECTL
*prcExclude
, MP_POPUPFLAGS dwFlags
)
504 HRESULT STDMETHODCALLTYPE
CMenuBand::OnSelect(DWORD dwSelectType
)
506 switch (dwSelectType
)
508 case MPOS_CHILDTRACKING
:
509 if (!m_subMenuParent
)
511 // TODO: Cancel timers?
512 return m_subMenuParent
->OnSelect(dwSelectType
);
513 case MPOS_SELECTLEFT
:
515 m_subMenuChild
->OnSelect(MPOS_CANCELLEVEL
);
516 if (!m_subMenuParent
)
518 return m_subMenuParent
->OnSelect(dwSelectType
);
519 case MPOS_SELECTRIGHT
:
520 if (!m_subMenuParent
)
522 return m_subMenuParent
->OnSelect(dwSelectType
);
524 case MPOS_FULLCANCEL
:
526 m_subMenuChild
->OnSelect(dwSelectType
);
527 if (!m_subMenuParent
)
529 return m_subMenuParent
->OnSelect(dwSelectType
);
530 case MPOS_CANCELLEVEL
:
532 m_subMenuChild
->OnSelect(dwSelectType
);
538 HRESULT STDMETHODCALLTYPE
CMenuBand::SetSubMenu(IMenuPopup
*pmp
, BOOL fSet
)
544 HRESULT
CMenuBand::_SetChildBand(CMenuBand
* child
)
549 _ChangePopupItem(NULL
, -1);
554 HRESULT
CMenuBand::_SetParentBand(CMenuBand
* parent
)
556 m_parentBand
= parent
;
560 HRESULT
CMenuBand::_IsPopup()
562 return m_subMenuParent
? S_OK
: S_FALSE
;
565 HRESULT
CMenuBand::_IsTracking()
567 return m_popupBar
!= NULL
;
570 HRESULT STDMETHODCALLTYPE
CMenuBand::SetClient(IUnknown
*punkClient
)
572 m_subMenuChild
= NULL
;
579 HRESULT hr
= punkClient
->QueryInterface(IID_PPV_ARG(IMenuPopup
, &m_subMenuChild
));
584 HRESULT STDMETHODCALLTYPE
CMenuBand::GetClient(IUnknown
**ppunkClient
)
586 // HACK, so I can test for a submenu in the DeskBar
590 *ppunkClient
= m_subMenuChild
;
597 HRESULT STDMETHODCALLTYPE
CMenuBand::IsMenuMessage(MSG
*pmsg
)
602 HRESULT STDMETHODCALLTYPE
CMenuBand::TranslateMenuMessage(MSG
*pmsg
, LRESULT
*plRet
)
607 HRESULT STDMETHODCALLTYPE
CMenuBand::SetShellFolder(IShellFolder
*psf
, LPCITEMIDLIST pidlFolder
, HKEY hKey
, DWORD dwFlags
)
609 if (m_SFToolbar
== NULL
)
611 m_SFToolbar
= new CMenuSFToolbar(this);
614 HRESULT hr
= m_SFToolbar
->SetShellFolder(psf
, pidlFolder
, hKey
, dwFlags
);
615 if (FAILED_UNEXPECTEDLY(hr
))
622 hr
= m_site
->GetWindow(&hwndParent
);
623 if (FAILED_UNEXPECTEDLY(hr
))
626 hr
= m_SFToolbar
->CreateToolbar(hwndParent
, m_dwFlags
);
627 if (FAILED_UNEXPECTEDLY(hr
))
630 hr
= m_SFToolbar
->FillToolbar();
636 HRESULT STDMETHODCALLTYPE
CMenuBand::GetShellFolder(DWORD
*pdwFlags
, LPITEMIDLIST
*ppidl
, REFIID riid
, void **ppv
)
639 return m_SFToolbar
->GetShellFolder(pdwFlags
, ppidl
, riid
, ppv
);
643 HRESULT STDMETHODCALLTYPE
CMenuBand::OnWinEvent(HWND hWnd
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
, LRESULT
*theResult
)
647 if (m_staticToolbar
&& m_staticToolbar
->IsWindowOwner(hWnd
) == S_OK
)
649 return m_staticToolbar
->OnWinEvent(hWnd
, uMsg
, wParam
, lParam
, theResult
);
652 if (m_SFToolbar
&& m_SFToolbar
->IsWindowOwner(hWnd
) == S_OK
)
654 return m_SFToolbar
->OnWinEvent(hWnd
, uMsg
, wParam
, lParam
, theResult
);
660 HRESULT STDMETHODCALLTYPE
CMenuBand::IsWindowOwner(HWND hWnd
)
662 if (m_staticToolbar
&& m_staticToolbar
->IsWindowOwner(hWnd
) == S_OK
)
665 if (m_SFToolbar
&& m_SFToolbar
->IsWindowOwner(hWnd
) == S_OK
)
671 HRESULT
CMenuBand::_CallCBWithItemId(UINT id
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
673 return _CallCB(uMsg
, wParam
, lParam
, id
);
676 HRESULT
CMenuBand::_CallCBWithItemPidl(LPITEMIDLIST pidl
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
678 return _CallCB(uMsg
, wParam
, lParam
, 0, pidl
);
681 HRESULT
CMenuBand::_CallCB(UINT uMsg
, WPARAM wParam
, LPARAM lParam
, UINT id
, LPITEMIDLIST pidl
)
689 SMDATA smData
= { 0 };
690 smData
.punk
= static_cast<IShellMenu2
*>(this);
692 smData
.uIdParent
= m_uId
;
693 smData
.uIdAncestor
= m_uIdAncestor
;
694 smData
.pidlItem
= pidl
;
697 smData
.hmenu
= m_hmenu
;
698 smData
.pvUserData
= NULL
;
700 m_SFToolbar
->GetShellFolder(NULL
, &smData
.pidlFolder
, IID_PPV_ARG(IShellFolder
, &smData
.psf
));
701 HRESULT hr
= m_psmc
->CallbackSM(&smData
, uMsg
, wParam
, lParam
);
702 ILFree(smData
.pidlFolder
);
704 smData
.psf
->Release();
708 HRESULT
CMenuBand::_TrackSubMenu(HMENU popup
, INT x
, INT y
, RECT
& rcExclude
)
710 TPMPARAMS params
= { sizeof(TPMPARAMS
), rcExclude
};
711 UINT flags
= TPM_VERPOSANIMATION
| TPM_VERTICAL
| TPM_LEFTALIGN
;
712 HWND hwnd
= m_menuOwner
? m_menuOwner
: m_topLevelWindow
;
714 m_focusManager
->PushTrackedPopup(popup
);
715 ::TrackPopupMenuEx(popup
, flags
, x
, y
, hwnd
, ¶ms
);
716 m_focusManager
->PopTrackedPopup(popup
);
718 _DisableMouseTrack(FALSE
);
723 HRESULT
CMenuBand::_TrackContextMenu(IContextMenu
* contextMenu
, INT x
, INT y
)
727 HMENU popup
= CreatePopupMenu();
732 TRACE("Before Query\n");
733 hr
= contextMenu
->QueryContextMenu(popup
, 0, 0, UINT_MAX
, CMF_NORMAL
);
734 if (FAILED_UNEXPECTEDLY(hr
))
736 TRACE("Query failed\n");
741 HWND hwnd
= m_menuOwner
? m_menuOwner
: m_topLevelWindow
;
743 TRACE("Before Tracking\n");
744 uCommand
= ::TrackPopupMenuEx(popup
, TPM_RETURNCMD
, x
, y
, hwnd
, NULL
);
748 TRACE("Before InvokeCommand\n");
749 CMINVOKECOMMANDINFO cmi
= { 0 };
750 cmi
.cbSize
= sizeof(cmi
);
751 cmi
.lpVerb
= MAKEINTRESOURCEA(uCommand
);
753 hr
= contextMenu
->InvokeCommand(&cmi
);
757 TRACE("TrackPopupMenu failed. Code=%d, LastError=%d\n", uCommand
, GetLastError());
765 HRESULT
CMenuBand::_GetTopLevelWindow(HWND
*topLevel
)
767 *topLevel
= m_topLevelWindow
;
771 HRESULT
CMenuBand::_ChangeHotItem(CMenuToolbarBase
* tb
, INT id
, DWORD dwFlags
)
773 if (m_hotBar
== tb
&& m_hotItem
== id
)
776 TRACE("Hot item changed from %p %p, to %p %p\n", m_hotBar
, m_hotItem
, tb
, id
);
782 if (m_staticToolbar
) m_staticToolbar
->ChangeHotItem(tb
, id
, dwFlags
);
783 if (m_SFToolbar
) m_SFToolbar
->ChangeHotItem(tb
, id
, dwFlags
);
785 _MenuItemHotTrack(MPOS_CHILDTRACKING
);
791 HRESULT
CMenuBand::_ChangePopupItem(CMenuToolbarBase
* tb
, INT id
)
793 TRACE("Popup item changed from %p %p, to %p %p\n", m_popupBar
, m_popupItem
, tb
, id
);
797 if (m_staticToolbar
) m_staticToolbar
->ChangePopupItem(tb
, id
);
798 if (m_SFToolbar
) m_SFToolbar
->ChangePopupItem(tb
, id
);
803 HRESULT
CMenuBand::_KeyboardItemChange(DWORD change
)
806 CMenuToolbarBase
*tb
= m_hotBar
;
810 // If no hot item was selected choose the appropriate toolbar
811 if (change
== VK_UP
|| change
== VK_END
)
814 tb
= m_staticToolbar
;
818 else if (change
== VK_DOWN
|| change
== VK_HOME
)
823 tb
= m_staticToolbar
;
827 // Ask the first toolbar to change
828 hr
= tb
->KeyboardItemChange(change
);
833 // Select the second toolbar based on the first
834 if (tb
== m_SFToolbar
&& m_staticToolbar
)
835 tb
= m_staticToolbar
;
836 else if (m_SFToolbar
)
842 // Ask the second toolbar to change
843 return tb
->KeyboardItemChange(change
== VK_DOWN
? VK_HOME
: VK_END
);
846 HRESULT
CMenuBand::_MenuItemHotTrack(DWORD changeType
)
850 if (m_dwFlags
& SMINIT_VERTICAL
)
856 return _KeyboardItemChange(changeType
);
858 // TODO: Left/Right across multi-column menus, if they ever work.
860 changeType
= MPOS_SELECTLEFT
;
863 changeType
= MPOS_SELECTRIGHT
;
869 // In horizontal menubars, left/right are equivalent to vertical's up/down
873 hr
= _KeyboardItemChange(VK_UP
);
877 hr
= _KeyboardItemChange(VK_DOWN
);
886 m_hotBar
->ExecuteItem(m_hotItem
);
889 case MPOS_SELECTLEFT
:
890 if (m_parentBand
&& m_parentBand
->_IsPopup()==S_FALSE
)
891 return m_parentBand
->_MenuItemHotTrack(VK_LEFT
);
893 return m_subMenuChild
->OnSelect(MPOS_CANCELLEVEL
);
894 if (!m_subMenuParent
)
896 return m_subMenuParent
->OnSelect(MPOS_CANCELLEVEL
);
898 case MPOS_SELECTRIGHT
:
899 if (m_hotBar
&& m_hotItem
>= 0 && m_hotBar
->PopupItem(m_hotItem
, TRUE
) == S_OK
)
902 return m_parentBand
->_MenuItemHotTrack(VK_RIGHT
);
903 if (!m_subMenuParent
)
905 return m_subMenuParent
->OnSelect(MPOS_SELECTRIGHT
);
908 if (!m_subMenuParent
)
910 return m_subMenuParent
->OnSelect(changeType
);
916 HRESULT
CMenuBand::_CancelCurrentPopup()
921 HRESULT hr
= m_subMenuChild
->OnSelect(MPOS_CANCELLEVEL
);
925 HRESULT
CMenuBand::_OnPopupSubMenu(IShellMenu
* childShellMenu
, POINTL
* pAt
, RECTL
* pExclude
, BOOL keyInitiated
)
928 IBandSite
* pBandSite
;
931 // Create the necessary objects
932 hr
= CMenuSite_Constructor(IID_PPV_ARG(IBandSite
, &pBandSite
));
933 if (FAILED_UNEXPECTEDLY(hr
))
936 hr
= CMenuDeskBar_Constructor(IID_PPV_ARG(IDeskBar
, &pDeskBar
));
937 if (FAILED_UNEXPECTEDLY(hr
))
940 hr
= pDeskBar
->SetClient(pBandSite
);
941 if (FAILED_UNEXPECTEDLY(hr
))
944 hr
= pBandSite
->AddBand(childShellMenu
);
945 if (FAILED_UNEXPECTEDLY(hr
))
949 CComPtr
<IMenuPopup
> popup
;
950 hr
= pDeskBar
->QueryInterface(IID_PPV_ARG(IMenuPopup
, &popup
));
951 if (FAILED_UNEXPECTEDLY(hr
))
954 m_subMenuChild
= popup
;
957 IUnknown_SetSite(popup
, m_subMenuParent
);
959 IUnknown_SetSite(popup
, m_site
);
961 DWORD flags
= MPPF_RIGHT
;
963 if (keyInitiated
&& m_dwFlags
& SMINIT_VERTICAL
)
964 flags
|= MPPF_INITIALSELECT
;
966 popup
->Popup(pAt
, pExclude
, flags
);
971 HRESULT
CMenuBand::_DisableMouseTrack(BOOL bDisable
)
974 m_staticToolbar
->DisableMouseTrack(bDisable
);
976 m_SFToolbar
->DisableMouseTrack(bDisable
);
980 HRESULT
CMenuBand::_KillPopupTimers()
984 hr
= m_staticToolbar
->KillPopupTimer();
989 hr
= m_SFToolbar
->KillPopupTimer();
994 HRESULT STDMETHODCALLTYPE
CMenuBand::InvalidateItem(LPSMDATA psmd
, DWORD dwFlags
)
1000 HRESULT STDMETHODCALLTYPE
CMenuBand::GetState(LPSMDATA psmd
)
1006 HRESULT STDMETHODCALLTYPE
CMenuBand::SetMenuToolbar(IUnknown
*punk
, DWORD dwFlags
)
1012 HRESULT STDMETHODCALLTYPE
CMenuBand::ResizeBorderDW(LPCRECT prcBorder
, IUnknown
*punkToolbarSite
, BOOL fReserved
)
1018 HRESULT STDMETHODCALLTYPE
CMenuBand::ContextSensitiveHelp(BOOL fEnterMode
)
1024 HRESULT STDMETHODCALLTYPE
CMenuBand::GetSubMenu(THIS
)
1030 HRESULT STDMETHODCALLTYPE
CMenuBand::SetToolbar(THIS
)
1036 HRESULT STDMETHODCALLTYPE
CMenuBand::SetMinWidth(THIS
)
1042 HRESULT STDMETHODCALLTYPE
CMenuBand::SetNoBorder(THIS
)
1048 HRESULT STDMETHODCALLTYPE
CMenuBand::SetTheme(THIS
)
1054 HRESULT STDMETHODCALLTYPE
CMenuBand::GetTop(THIS
)
1060 HRESULT STDMETHODCALLTYPE
CMenuBand::GetBottom(THIS
)
1066 HRESULT STDMETHODCALLTYPE
CMenuBand::GetTracked(THIS
)
1072 HRESULT STDMETHODCALLTYPE
CMenuBand::GetParentSite(THIS
)
1078 HRESULT STDMETHODCALLTYPE
CMenuBand::GetState(THIS
)
1084 HRESULT STDMETHODCALLTYPE
CMenuBand::DoDefaultAction(THIS
)
1090 HRESULT STDMETHODCALLTYPE
CMenuBand::IsEmpty(THIS
)
1096 HRESULT STDMETHODCALLTYPE
CMenuBand::HasFocusIO()
1102 HRESULT STDMETHODCALLTYPE
CMenuBand::TranslateAcceleratorIO(LPMSG lpMsg
)
1108 HRESULT STDMETHODCALLTYPE
CMenuBand::IsDirty()
1114 HRESULT STDMETHODCALLTYPE
CMenuBand::Load(IStream
*pStm
)
1120 HRESULT STDMETHODCALLTYPE
CMenuBand::Save(IStream
*pStm
, BOOL fClearDirty
)
1126 HRESULT STDMETHODCALLTYPE
CMenuBand::GetSizeMax(ULARGE_INTEGER
*pcbSize
)
1132 HRESULT STDMETHODCALLTYPE
CMenuBand::GetClassID(CLSID
*pClassID
)
1138 HRESULT STDMETHODCALLTYPE
CMenuBand::QueryStatus(const GUID
*pguidCmdGroup
, ULONG cCmds
, OLECMD prgCmds
[], OLECMDTEXT
*pCmdText
)