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
)
38 #if USE_SYSTEM_MENUBAND
39 hr
= CoCreateInstance(CLSID_MenuBand
,
46 CMenuBand
* site
= new CComObject
<CMenuBand
>();
51 HRESULT hr
= site
->QueryInterface(riid
, ppv
);
53 if (FAILED_UNEXPECTEDLY(hr
))
60 CMenuBand::CMenuBand() :
61 m_staticToolbar(NULL
),
66 m_subMenuParent(NULL
),
72 m_topLevelWindow(NULL
),
78 m_focusManager
= CMenuFocusManager::AcquireManager();
81 CMenuBand::~CMenuBand()
83 CMenuFocusManager::ReleaseManager(m_focusManager
);
86 delete m_staticToolbar
;
92 HRESULT STDMETHODCALLTYPE
CMenuBand::Initialize(
93 IShellMenuCallback
*psmc
,
101 m_uIdAncestor
= uIdAncestor
;
106 _CallCB(SMC_CREATE
, 0, reinterpret_cast<LPARAM
>(&m_UserData
));
112 HRESULT STDMETHODCALLTYPE
CMenuBand::GetMenuInfo(
113 IShellMenuCallback
**ppsmc
,
118 if (!pdwFlags
) // maybe?
128 *puIdAncestor
= m_uIdAncestor
;
130 *pdwFlags
= m_dwFlags
;
135 HRESULT STDMETHODCALLTYPE
CMenuBand::SetMenu(
140 TRACE("CMenuBand::SetMenu called, hmenu=%p; hwnd=%p, flags=%x\n", hmenu
, hwnd
, dwFlags
);
142 BOOL created
= FALSE
;
144 if (m_staticToolbar
== NULL
)
146 m_staticToolbar
= new CMenuStaticToolbar(this);
152 HRESULT hr
= m_staticToolbar
->SetMenu(hmenu
, hwnd
, dwFlags
);
153 if (FAILED_UNEXPECTEDLY(hr
))
160 hr
= m_site
->GetWindow(&hwndParent
);
161 if (FAILED_UNEXPECTEDLY(hr
))
166 hr
= m_staticToolbar
->CreateToolbar(hwndParent
, m_dwFlags
);
167 if (FAILED_UNEXPECTEDLY(hr
))
170 hr
= m_staticToolbar
->FillToolbar();
174 hr
= m_staticToolbar
->FillToolbar(TRUE
);
181 HRESULT STDMETHODCALLTYPE
CMenuBand::GetMenu(
186 if (m_staticToolbar
== NULL
)
189 return m_staticToolbar
->GetMenu(phmenu
, phwnd
, pdwFlags
);
192 HRESULT STDMETHODCALLTYPE
CMenuBand::SetSite(IUnknown
*pUnkSite
)
199 if (pUnkSite
== NULL
)
203 hr
= pUnkSite
->QueryInterface(IID_PPV_ARG(IOleWindow
, &m_site
));
204 if (FAILED_UNEXPECTEDLY(hr
))
207 hr
= m_site
->GetWindow(&hwndParent
);
208 if (FAILED_UNEXPECTEDLY(hr
))
211 if (!::IsWindow(hwndParent
))
214 if (m_staticToolbar
!= NULL
)
216 hr
= m_staticToolbar
->CreateToolbar(hwndParent
, m_dwFlags
);
217 if (FAILED_UNEXPECTEDLY(hr
))
220 hr
= m_staticToolbar
->FillToolbar();
221 if (FAILED_UNEXPECTEDLY(hr
))
225 if (m_SFToolbar
!= NULL
)
227 hr
= m_SFToolbar
->CreateToolbar(hwndParent
, m_dwFlags
);
228 if (FAILED_UNEXPECTEDLY(hr
))
231 hr
= m_SFToolbar
->FillToolbar();
232 if (FAILED_UNEXPECTEDLY(hr
))
236 hr
= IUnknown_QueryService(m_site
, SID_SMenuPopup
, IID_PPV_ARG(IMenuPopup
, &m_subMenuParent
));
237 if (hr
!= E_NOINTERFACE
&& FAILED_UNEXPECTEDLY(hr
))
240 CComPtr
<IOleWindow
> pTopLevelWindow
;
241 hr
= IUnknown_QueryService(m_site
, SID_STopLevelBrowser
, IID_PPV_ARG(IOleWindow
, &pTopLevelWindow
));
242 if (FAILED_UNEXPECTEDLY(hr
))
245 return pTopLevelWindow
->GetWindow(&m_topLevelWindow
);
248 HRESULT STDMETHODCALLTYPE
CMenuBand::GetSite(REFIID riid
, PVOID
*ppvSite
)
253 return m_site
->QueryInterface(riid
, ppvSite
);
256 HRESULT STDMETHODCALLTYPE
CMenuBand::GetWindow(
259 if (m_SFToolbar
!= NULL
)
260 return m_SFToolbar
->GetWindow(phwnd
);
262 if (m_staticToolbar
!= NULL
)
263 return m_staticToolbar
->GetWindow(phwnd
);
268 HRESULT STDMETHODCALLTYPE
CMenuBand::OnPosRectChangeDB(RECT
*prc
)
270 SIZE maxStatic
= { 0 };
271 SIZE maxShlFld
= { 0 };
274 if (m_staticToolbar
!= NULL
)
275 hr
= m_staticToolbar
->GetSizes(NULL
, &maxStatic
, NULL
);
276 if (FAILED_UNEXPECTEDLY(hr
))
279 if (m_SFToolbar
!= NULL
)
280 hr
= m_SFToolbar
->GetSizes(NULL
, &maxShlFld
, NULL
);
281 if (FAILED_UNEXPECTEDLY(hr
))
284 if (m_staticToolbar
== NULL
&& m_SFToolbar
== NULL
)
287 int sy
= min(prc
->bottom
- prc
->top
, maxStatic
.cy
+ maxShlFld
.cy
);
289 int syStatic
= maxStatic
.cy
;
290 int syShlFld
= sy
- syStatic
;
294 m_SFToolbar
->SetPosSize(
297 prc
->right
- prc
->left
,
302 m_staticToolbar
->SetPosSize(
305 prc
->right
- prc
->left
,
311 HRESULT STDMETHODCALLTYPE
CMenuBand::GetBandInfo(
316 SIZE minStatic
= { 0 };
317 SIZE minShlFld
= { 0 };
318 SIZE maxStatic
= { 0 };
319 SIZE maxShlFld
= { 0 };
320 SIZE intStatic
= { 0 };
321 SIZE intShlFld
= { 0 };
325 if (m_staticToolbar
!= NULL
)
326 hr
= m_staticToolbar
->GetSizes(&minStatic
, &maxStatic
, &intStatic
);
327 if (FAILED_UNEXPECTEDLY(hr
))
330 if (m_SFToolbar
!= NULL
)
331 hr
= m_SFToolbar
->GetSizes(&minShlFld
, &maxShlFld
, &intShlFld
);
332 if (FAILED_UNEXPECTEDLY(hr
))
335 if (m_staticToolbar
== NULL
&& m_SFToolbar
== NULL
)
338 if (m_dwFlags
& SMINIT_VERTICAL
)
340 pdbi
->ptMinSize
.x
= max(minStatic
.cx
, minStatic
.cx
) + 20;
341 pdbi
->ptMinSize
.y
= minStatic
.cy
+ minStatic
.cy
;
342 pdbi
->ptMaxSize
.x
= max(maxStatic
.cx
, maxShlFld
.cx
) + 20;
343 pdbi
->ptMaxSize
.y
= maxStatic
.cy
+ maxShlFld
.cy
;
344 pdbi
->dwModeFlags
= DBIMF_VARIABLEHEIGHT
;
348 pdbi
->ptMinSize
.x
= minStatic
.cx
+ minStatic
.cx
;
349 pdbi
->ptMinSize
.y
= max(minStatic
.cy
, minStatic
.cy
);
350 pdbi
->ptMaxSize
.x
= maxStatic
.cx
+ maxShlFld
.cx
;
351 pdbi
->ptMaxSize
.y
= max(maxStatic
.cy
, maxShlFld
.cy
);
353 pdbi
->ptIntegral
.x
= max(intStatic
.cx
, intStatic
.cx
);
354 pdbi
->ptIntegral
.y
= max(intStatic
.cy
, intShlFld
.cy
);
355 pdbi
->ptActual
= pdbi
->ptMinSize
;
360 HRESULT STDMETHODCALLTYPE
CMenuBand::ShowDW(BOOL fShow
)
364 if (m_staticToolbar
!= NULL
)
366 hr
= m_staticToolbar
->ShowWindow(fShow
);
367 if (FAILED_UNEXPECTEDLY(hr
))
371 if (m_SFToolbar
!= NULL
)
373 hr
= m_SFToolbar
->ShowWindow(fShow
);
374 if (FAILED_UNEXPECTEDLY(hr
))
380 hr
= _CallCB(SMC_INITMENU
, 0, 0);
381 if (FAILED_UNEXPECTEDLY(hr
))
384 else if (m_parentBand
)
386 m_parentBand
->SetClient(NULL
);
389 if (_IsPopup() == S_OK
)
392 hr
= m_focusManager
->PushMenuPopup(this);
394 hr
= m_focusManager
->PopMenuPopup(this);
399 hr
= m_focusManager
->PushMenuBar(this);
401 hr
= m_focusManager
->PopMenuBar(this);
407 HRESULT STDMETHODCALLTYPE
CMenuBand::CloseDW(DWORD dwReserved
)
411 if (m_staticToolbar
!= NULL
)
412 return m_staticToolbar
->Close();
414 if (m_SFToolbar
!= NULL
)
415 return m_SFToolbar
->Close();
420 HRESULT STDMETHODCALLTYPE
CMenuBand::UIActivateIO(BOOL fActivate
, LPMSG lpMsg
)
426 hr
= m_subMenuParent
->SetSubMenu(this, fActivate
);
427 if (FAILED_UNEXPECTEDLY(hr
))
433 CComPtr
<IOleWindow
> pTopLevelWindow
;
434 hr
= IUnknown_QueryService(m_site
, SID_SMenuPopup
, IID_PPV_ARG(IOleWindow
, &pTopLevelWindow
));
435 if (FAILED_UNEXPECTEDLY(hr
))
438 hr
= pTopLevelWindow
->GetWindow(&m_topLevelWindow
);
439 if (FAILED_UNEXPECTEDLY(hr
))
444 m_topLevelWindow
= NULL
;
450 HRESULT STDMETHODCALLTYPE
CMenuBand::Exec(const GUID
*pguidCmdGroup
, DWORD nCmdID
, DWORD nCmdexecopt
, VARIANT
*pvaIn
, VARIANT
*pvaOut
)
455 if (IsEqualGUID(*pguidCmdGroup
, CLSID_MenuBand
))
457 if (nCmdID
== 16) // set (big) icon size
459 this->m_useBigIcons
= nCmdexecopt
== 2;
462 else if (nCmdID
== 19) // popup-related
474 HRESULT STDMETHODCALLTYPE
CMenuBand::QueryService(REFGUID guidService
, REFIID riid
, void **ppvObject
)
476 if (IsEqualIID(guidService
, SID_SMenuBandChild
) ||
477 IsEqualIID(guidService
, SID_SMenuBandBottom
) ||
478 IsEqualIID(guidService
, SID_SMenuBandBottomSelected
))
479 return this->QueryInterface(riid
, ppvObject
);
480 WARN("Unknown service requested %s\n", wine_dbgstr_guid(&guidService
));
481 return E_NOINTERFACE
;
484 HRESULT STDMETHODCALLTYPE
CMenuBand::Popup(POINTL
*ppt
, RECTL
*prcExclude
, MP_POPUPFLAGS dwFlags
)
490 HRESULT STDMETHODCALLTYPE
CMenuBand::OnSelect(DWORD dwSelectType
)
492 switch (dwSelectType
)
494 case MPOS_CHILDTRACKING
:
495 if (!m_subMenuParent
)
497 // TODO: Cancel timers?
498 return m_subMenuParent
->OnSelect(dwSelectType
);
499 case MPOS_SELECTLEFT
:
501 m_subMenuChild
->OnSelect(MPOS_CANCELLEVEL
);
502 if (!m_subMenuParent
)
504 return m_subMenuParent
->OnSelect(dwSelectType
);
505 case MPOS_SELECTRIGHT
:
506 if (!m_subMenuParent
)
508 return m_subMenuParent
->OnSelect(dwSelectType
);
510 case MPOS_FULLCANCEL
:
512 m_subMenuChild
->OnSelect(dwSelectType
);
513 if (!m_subMenuParent
)
515 return m_subMenuParent
->OnSelect(dwSelectType
);
516 case MPOS_CANCELLEVEL
:
518 m_subMenuChild
->OnSelect(dwSelectType
);
524 HRESULT STDMETHODCALLTYPE
CMenuBand::SetSubMenu(IMenuPopup
*pmp
, BOOL fSet
)
530 HRESULT
CMenuBand::_SetChildBand(CMenuBand
* child
)
535 _ChangePopupItem(NULL
, -1);
540 HRESULT
CMenuBand::_SetParentBand(CMenuBand
* parent
)
542 m_parentBand
= parent
;
546 HRESULT
CMenuBand::_IsPopup()
548 return m_subMenuParent
? S_OK
: S_FALSE
;
551 HRESULT
CMenuBand::_IsTracking()
553 return m_popupBar
!= NULL
;
556 HRESULT STDMETHODCALLTYPE
CMenuBand::SetClient(IUnknown
*punkClient
)
558 m_subMenuChild
= NULL
;
565 HRESULT hr
= punkClient
->QueryInterface(IID_PPV_ARG(IMenuPopup
, &m_subMenuChild
));
570 HRESULT STDMETHODCALLTYPE
CMenuBand::GetClient(IUnknown
**ppunkClient
)
572 // HACK, so I can test for a submenu in the DeskBar
576 *ppunkClient
= m_subMenuChild
;
583 HRESULT STDMETHODCALLTYPE
CMenuBand::IsMenuMessage(MSG
*pmsg
)
588 HRESULT STDMETHODCALLTYPE
CMenuBand::TranslateMenuMessage(MSG
*pmsg
, LRESULT
*plRet
)
593 HRESULT STDMETHODCALLTYPE
CMenuBand::SetShellFolder(IShellFolder
*psf
, LPCITEMIDLIST pidlFolder
, HKEY hKey
, DWORD dwFlags
)
595 if (m_SFToolbar
== NULL
)
597 m_SFToolbar
= new CMenuSFToolbar(this);
600 HRESULT hr
= m_SFToolbar
->SetShellFolder(psf
, pidlFolder
, hKey
, dwFlags
);
601 if (FAILED_UNEXPECTEDLY(hr
))
608 hr
= m_site
->GetWindow(&hwndParent
);
609 if (FAILED_UNEXPECTEDLY(hr
))
612 hr
= m_SFToolbar
->CreateToolbar(hwndParent
, m_dwFlags
);
613 if (FAILED_UNEXPECTEDLY(hr
))
616 hr
= m_SFToolbar
->FillToolbar();
622 HRESULT STDMETHODCALLTYPE
CMenuBand::GetShellFolder(DWORD
*pdwFlags
, LPITEMIDLIST
*ppidl
, REFIID riid
, void **ppv
)
625 return m_SFToolbar
->GetShellFolder(pdwFlags
, ppidl
, riid
, ppv
);
629 HRESULT STDMETHODCALLTYPE
CMenuBand::OnWinEvent(HWND hWnd
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
, LRESULT
*theResult
)
633 if (m_staticToolbar
&& m_staticToolbar
->IsWindowOwner(hWnd
) == S_OK
)
635 return m_staticToolbar
->OnWinEvent(hWnd
, uMsg
, wParam
, lParam
, theResult
);
638 if (m_SFToolbar
&& m_SFToolbar
->IsWindowOwner(hWnd
) == S_OK
)
640 return m_SFToolbar
->OnWinEvent(hWnd
, uMsg
, wParam
, lParam
, theResult
);
646 HRESULT STDMETHODCALLTYPE
CMenuBand::IsWindowOwner(HWND hWnd
)
648 if (m_staticToolbar
&& m_staticToolbar
->IsWindowOwner(hWnd
) == S_OK
)
651 if (m_SFToolbar
&& m_SFToolbar
->IsWindowOwner(hWnd
) == S_OK
)
657 HRESULT
CMenuBand::_CallCBWithItemId(UINT id
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
659 return _CallCB(uMsg
, wParam
, lParam
, id
);
662 HRESULT
CMenuBand::_CallCBWithItemPidl(LPITEMIDLIST pidl
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
664 return _CallCB(uMsg
, wParam
, lParam
, 0, pidl
);
667 HRESULT
CMenuBand::_CallCB(UINT uMsg
, WPARAM wParam
, LPARAM lParam
, UINT id
, LPITEMIDLIST pidl
)
675 SMDATA smData
= { 0 };
676 smData
.punk
= static_cast<IShellMenu2
*>(this);
678 smData
.uIdParent
= m_uId
;
679 smData
.uIdAncestor
= m_uIdAncestor
;
680 smData
.pidlItem
= pidl
;
683 smData
.hmenu
= m_hmenu
;
684 smData
.pvUserData
= NULL
;
686 m_SFToolbar
->GetShellFolder(NULL
, &smData
.pidlFolder
, IID_PPV_ARG(IShellFolder
, &smData
.psf
));
687 HRESULT hr
= m_psmc
->CallbackSM(&smData
, uMsg
, wParam
, lParam
);
688 ILFree(smData
.pidlFolder
);
690 smData
.psf
->Release();
694 HRESULT
CMenuBand::_TrackSubMenu(HMENU popup
, INT x
, INT y
, RECT
& rcExclude
)
696 TPMPARAMS params
= { sizeof(TPMPARAMS
), rcExclude
};
697 UINT flags
= TPM_VERPOSANIMATION
| TPM_VERTICAL
| TPM_LEFTALIGN
;
698 HWND hwnd
= m_menuOwner
? m_menuOwner
: m_topLevelWindow
;
700 m_focusManager
->PushTrackedPopup(popup
);
701 ::TrackPopupMenuEx(popup
, flags
, x
, y
, hwnd
, ¶ms
);
702 m_focusManager
->PopTrackedPopup(popup
);
704 _DisableMouseTrack(FALSE
);
709 HRESULT
CMenuBand::_TrackContextMenu(IContextMenu
* contextMenu
, INT x
, INT y
)
713 HMENU popup
= CreatePopupMenu();
718 DbgPrint("Before Query\n");
719 hr
= contextMenu
->QueryContextMenu(popup
, 0, 0, UINT_MAX
, CMF_NORMAL
);
720 if (FAILED_UNEXPECTEDLY(hr
))
722 DbgPrint("Query failed\n");
727 HWND hwnd
= m_menuOwner
? m_menuOwner
: m_topLevelWindow
;
729 DbgPrint("Before Tracking\n");
730 uCommand
= ::TrackPopupMenuEx(popup
, TPM_RETURNCMD
, x
, y
, hwnd
, NULL
);
734 DbgPrint("Before InvokeCommand\n");
735 CMINVOKECOMMANDINFO cmi
= { 0 };
736 cmi
.cbSize
= sizeof(cmi
);
737 cmi
.lpVerb
= MAKEINTRESOURCEA(uCommand
);
739 hr
= contextMenu
->InvokeCommand(&cmi
);
743 DbgPrint("TrackPopupMenu failed. Code=%d, LastError=%d\n", uCommand
, GetLastError());
751 HRESULT
CMenuBand::_GetTopLevelWindow(HWND
*topLevel
)
753 *topLevel
= m_topLevelWindow
;
757 HRESULT
CMenuBand::_ChangeHotItem(CMenuToolbarBase
* tb
, INT id
, DWORD dwFlags
)
759 if (m_hotBar
== tb
&& m_hotItem
== id
)
762 TRACE("Hot item changed from %p %p, to %p %p\n", m_hotBar
, m_hotItem
, tb
, id
);
768 if (m_staticToolbar
) m_staticToolbar
->ChangeHotItem(tb
, id
, dwFlags
);
769 if (m_SFToolbar
) m_SFToolbar
->ChangeHotItem(tb
, id
, dwFlags
);
771 _MenuItemHotTrack(MPOS_CHILDTRACKING
);
777 HRESULT
CMenuBand::_ChangePopupItem(CMenuToolbarBase
* tb
, INT id
)
779 TRACE("Popup item changed from %p %p, to %p %p\n", m_popupBar
, m_popupItem
, tb
, id
);
783 if (m_staticToolbar
) m_staticToolbar
->ChangePopupItem(tb
, id
);
784 if (m_SFToolbar
) m_SFToolbar
->ChangePopupItem(tb
, id
);
789 HRESULT
CMenuBand::_KeyboardItemChange(DWORD change
)
792 CMenuToolbarBase
*tb
= m_hotBar
;
796 // If no hot item was selected
797 // choose the first toolbar (prefer shell-folder, which will be positioned at the top)
802 tb
= m_staticToolbar
;
805 // Ask the first toolbar to change
806 hr
= tb
->KeyboardItemChange(change
);
811 // Select the second toolbar based on the first
812 if (tb
== m_SFToolbar
&& m_staticToolbar
)
813 tb
= m_staticToolbar
;
814 else if (m_SFToolbar
)
820 // Ask the second toolbar to change
821 return tb
->KeyboardItemChange(change
== VK_DOWN
? VK_HOME
: VK_END
);
824 HRESULT
CMenuBand::_MenuItemHotTrack(DWORD changeType
)
828 if (m_dwFlags
& SMINIT_VERTICAL
)
834 return _KeyboardItemChange(changeType
);
836 // TODO: Left/Right across multi-column menus, if they ever work.
838 changeType
= MPOS_SELECTLEFT
;
841 changeType
= MPOS_SELECTRIGHT
;
847 // In horizontal menubars, left/right are equivalent to vertical's up/down
851 hr
= _KeyboardItemChange(VK_UP
);
855 hr
= _KeyboardItemChange(VK_DOWN
);
863 case MPOS_SELECTLEFT
:
864 if (!m_subMenuParent
)
867 return m_subMenuChild
->OnSelect(MPOS_CANCELLEVEL
);
870 return m_subMenuParent
->OnSelect(MPOS_CANCELLEVEL
);
872 case MPOS_SELECTRIGHT
:
873 if (m_hotBar
&& m_hotItem
>= 0)
875 if (m_hotBar
->PopupItem(m_hotItem
) == S_OK
)
878 if (!m_subMenuParent
)
880 return m_subMenuParent
->OnSelect(MPOS_SELECTRIGHT
);
883 if (!m_subMenuParent
)
885 return m_subMenuParent
->OnSelect(changeType
);
889 HRESULT
CMenuBand::_CancelCurrentPopup()
894 HRESULT hr
= m_subMenuChild
->OnSelect(MPOS_CANCELLEVEL
);
898 HRESULT
CMenuBand::_OnPopupSubMenu(IShellMenu
* childShellMenu
, POINTL
* pAt
, RECTL
* pExclude
)
901 IBandSite
* pBandSite
;
904 // Create the necessary objects
905 hr
= CMenuSite_Constructor(IID_PPV_ARG(IBandSite
, &pBandSite
));
906 if (FAILED_UNEXPECTEDLY(hr
))
909 hr
= CMenuDeskBar_Constructor(IID_PPV_ARG(IDeskBar
, &pDeskBar
));
910 if (FAILED_UNEXPECTEDLY(hr
))
913 hr
= pDeskBar
->SetClient(pBandSite
);
914 if (FAILED_UNEXPECTEDLY(hr
))
917 hr
= pBandSite
->AddBand(childShellMenu
);
918 if (FAILED_UNEXPECTEDLY(hr
))
922 CComPtr
<IMenuPopup
> popup
;
923 hr
= pDeskBar
->QueryInterface(IID_PPV_ARG(IMenuPopup
, &popup
));
924 if (FAILED_UNEXPECTEDLY(hr
))
927 m_subMenuChild
= popup
;
930 IUnknown_SetSite(popup
, m_subMenuParent
);
932 IUnknown_SetSite(popup
, m_site
);
934 popup
->Popup(pAt
, pExclude
, MPPF_RIGHT
);
939 HRESULT
CMenuBand::_DisableMouseTrack(BOOL bDisable
)
942 m_staticToolbar
->DisableMouseTrack(bDisable
);
944 m_SFToolbar
->DisableMouseTrack(bDisable
);
948 HRESULT
CMenuBand::_KillPopupTimers()
952 hr
= m_staticToolbar
->KillPopupTimer();
957 hr
= m_SFToolbar
->KillPopupTimer();
962 HRESULT STDMETHODCALLTYPE
CMenuBand::InvalidateItem(LPSMDATA psmd
, DWORD dwFlags
)
968 HRESULT STDMETHODCALLTYPE
CMenuBand::GetState(LPSMDATA psmd
)
974 HRESULT STDMETHODCALLTYPE
CMenuBand::SetMenuToolbar(IUnknown
*punk
, DWORD dwFlags
)
980 HRESULT STDMETHODCALLTYPE
CMenuBand::ResizeBorderDW(LPCRECT prcBorder
, IUnknown
*punkToolbarSite
, BOOL fReserved
)
986 HRESULT STDMETHODCALLTYPE
CMenuBand::ContextSensitiveHelp(BOOL fEnterMode
)
992 HRESULT STDMETHODCALLTYPE
CMenuBand::GetSubMenu(THIS
)
998 HRESULT STDMETHODCALLTYPE
CMenuBand::SetToolbar(THIS
)
1004 HRESULT STDMETHODCALLTYPE
CMenuBand::SetMinWidth(THIS
)
1010 HRESULT STDMETHODCALLTYPE
CMenuBand::SetNoBorder(THIS
)
1016 HRESULT STDMETHODCALLTYPE
CMenuBand::SetTheme(THIS
)
1022 HRESULT STDMETHODCALLTYPE
CMenuBand::GetTop(THIS
)
1028 HRESULT STDMETHODCALLTYPE
CMenuBand::GetBottom(THIS
)
1034 HRESULT STDMETHODCALLTYPE
CMenuBand::GetTracked(THIS
)
1040 HRESULT STDMETHODCALLTYPE
CMenuBand::GetParentSite(THIS
)
1046 HRESULT STDMETHODCALLTYPE
CMenuBand::GetState(THIS
)
1052 HRESULT STDMETHODCALLTYPE
CMenuBand::DoDefaultAction(THIS
)
1058 HRESULT STDMETHODCALLTYPE
CMenuBand::IsEmpty(THIS
)
1064 HRESULT STDMETHODCALLTYPE
CMenuBand::HasFocusIO()
1070 HRESULT STDMETHODCALLTYPE
CMenuBand::TranslateAcceleratorIO(LPMSG lpMsg
)
1076 HRESULT STDMETHODCALLTYPE
CMenuBand::IsDirty()
1082 HRESULT STDMETHODCALLTYPE
CMenuBand::Load(IStream
*pStm
)
1088 HRESULT STDMETHODCALLTYPE
CMenuBand::Save(IStream
*pStm
, BOOL fClearDirty
)
1094 HRESULT STDMETHODCALLTYPE
CMenuBand::GetSizeMax(ULARGE_INTEGER
*pcbSize
)
1100 HRESULT STDMETHODCALLTYPE
CMenuBand::GetClassID(CLSID
*pClassID
)
1106 HRESULT STDMETHODCALLTYPE
CMenuBand::QueryStatus(const GUID
*pguidCmdGroup
, ULONG cCmds
, OLECMD prgCmds
[], OLECMDTEXT
*pCmdText
)