2014-01-25 17:24:24 +00:00
|
|
|
#pragma once
|
2013-07-23 10:53:06 +00:00
|
|
|
|
2013-10-16 19:13:49 +00:00
|
|
|
class CMenuBand;
|
|
|
|
|
|
|
|
class CMenuStaticToolbar
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CMenuStaticToolbar(CMenuBand *menuBand);
|
|
|
|
|
|
|
|
HRESULT CreateToolbar(HWND hwndParent, DWORD dwFlags);
|
|
|
|
HRESULT FillToolbar();
|
|
|
|
HRESULT GetWindow(HWND *phwnd);
|
|
|
|
HRESULT SetMenu(HMENU hmenu, HWND hwnd, DWORD dwFlags);
|
|
|
|
HRESULT GetMenu(HMENU *phmenu, HWND *phwnd, DWORD *pdwFlags);
|
|
|
|
HRESULT ShowWindow(BOOL fShow);
|
|
|
|
HRESULT Close();
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
static const UINT WM_USER_SHOWPOPUPMENU = WM_USER + 1;
|
|
|
|
|
|
|
|
CMenuBand *m_menuBand;
|
|
|
|
HWND m_hwnd;
|
|
|
|
HMENU m_hmenu;
|
|
|
|
HWND m_hwndOwner;
|
|
|
|
DWORD m_dwMenuFlags;
|
|
|
|
};
|
|
|
|
|
2013-07-23 10:53:06 +00:00
|
|
|
class CMenuBand :
|
|
|
|
public CComCoClass<CMenuBand, &CLSID_MenuBand>,
|
|
|
|
public CComObjectRootEx<CComMultiThreadModelNoCS>,
|
|
|
|
public IDeskBand,
|
|
|
|
public IObjectWithSite,
|
|
|
|
public IInputObject,
|
|
|
|
public IPersistStream,
|
|
|
|
public IOleCommandTarget,
|
|
|
|
public IServiceProvider,
|
|
|
|
public IMenuPopup,
|
|
|
|
public IMenuBand,
|
|
|
|
public IShellMenu2,
|
|
|
|
public IWinEventHandler,
|
|
|
|
public IShellMenuAcc
|
|
|
|
{
|
2013-10-16 19:13:49 +00:00
|
|
|
public:
|
|
|
|
CMenuBand();
|
|
|
|
~CMenuBand();
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
IOleWindow *m_site;
|
|
|
|
CMenuStaticToolbar *m_staticToolbar;
|
|
|
|
|
|
|
|
IShellMenuCallback *m_psmc;
|
|
|
|
UINT m_uId;
|
|
|
|
UINT m_uIdAncestor;
|
|
|
|
DWORD m_dwFlags;
|
2013-07-23 10:53:06 +00:00
|
|
|
public :
|
|
|
|
|
|
|
|
// *** IDeskBand methods ***
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE GetBandInfo(DWORD dwBandID, DWORD dwViewMode, DESKBANDINFO *pdbi);
|
|
|
|
|
|
|
|
// *** IDockingWindow methods ***
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE ShowDW(BOOL fShow);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE CloseDW(DWORD dwReserved);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE ResizeBorderDW(LPCRECT prcBorder, IUnknown *punkToolbarSite, BOOL fReserved);
|
|
|
|
|
|
|
|
// *** IOleWindow methods ***
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND *phwnd);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(BOOL fEnterMode);
|
|
|
|
|
|
|
|
// *** IObjectWithSite methods ***
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE SetSite(IUnknown *pUnkSite);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE GetSite(REFIID riid, PVOID *ppvSite);
|
|
|
|
|
|
|
|
// *** IInputObject methods ***
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE UIActivateIO(BOOL fActivate, LPMSG lpMsg);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE HasFocusIO();
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE TranslateAcceleratorIO(LPMSG lpMsg);
|
|
|
|
|
|
|
|
// *** IPersistStream methods ***
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE IsDirty();
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE Load(IStream *pStm);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE Save(IStream *pStm, BOOL fClearDirty);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE GetSizeMax(ULARGE_INTEGER *pcbSize);
|
|
|
|
|
|
|
|
// *** IPersist methods ***
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE GetClassID(CLSID *pClassID);
|
|
|
|
|
|
|
|
// *** IOleCommandTarget methods ***
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[ ], OLECMDTEXT *pCmdText);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut);
|
|
|
|
|
|
|
|
// *** IServiceProvider methods ***
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void **ppvObject);
|
|
|
|
|
|
|
|
// *** IMenuPopup methods ***
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE Popup(POINTL *ppt, RECTL *prcExclude, MP_POPUPFLAGS dwFlags);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE OnSelect(DWORD dwSelectType);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE SetSubMenu(IMenuPopup *pmp, BOOL fSet);
|
|
|
|
|
|
|
|
// *** IDeskBar methods ***
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE SetClient(IUnknown *punkClient);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE GetClient(IUnknown **ppunkClient);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE OnPosRectChangeDB(RECT *prc);
|
|
|
|
|
|
|
|
// *** IMenuBand methods ***
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE IsMenuMessage(MSG *pmsg);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE TranslateMenuMessage(MSG *pmsg, LRESULT *plRet);
|
|
|
|
|
|
|
|
// *** IShellMenu methods ***
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE Initialize(IShellMenuCallback *psmc, UINT uId, UINT uIdAncestor,DWORD dwFlags);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE GetMenuInfo(IShellMenuCallback **ppsmc, UINT *puId, UINT *puIdAncestor, DWORD *pdwFlags);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE SetShellFolder(IShellFolder *psf, LPCITEMIDLIST pidlFolder, HKEY hKey, DWORD dwFlags);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE GetShellFolder(DWORD *pdwFlags, LPITEMIDLIST *ppidl, REFIID riid, void **ppv);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE SetMenu(HMENU hmenu, HWND hwnd, DWORD dwFlags);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE GetMenu(HMENU *phmenu, HWND *phwnd, DWORD *pdwFlags);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE InvalidateItem(LPSMDATA psmd, DWORD dwFlags);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE GetState(LPSMDATA psmd);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE SetMenuToolbar(IUnknown *punk, DWORD dwFlags);
|
|
|
|
|
|
|
|
// *** IWinEventHandler methods ***
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE IsWindowOwner(HWND hWnd);
|
|
|
|
|
|
|
|
// *** IShellMenu2 methods ***
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE GetSubMenu(THIS);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE SetToolbar(THIS);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE SetMinWidth(THIS);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE SetNoBorder(THIS);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE SetTheme(THIS);
|
|
|
|
|
|
|
|
// *** IShellMenuAcc methods ***
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE GetTop(THIS);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE GetBottom(THIS);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE GetTracked(THIS);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE GetParentSite(THIS);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE GetState(THIS);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE DoDefaultAction(THIS);
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE IsEmpty(THIS);
|
|
|
|
|
|
|
|
DECLARE_REGISTRY_RESOURCEID(IDR_MENUBAND)
|
|
|
|
DECLARE_NOT_AGGREGATABLE(CMenuBand)
|
|
|
|
DECLARE_PROTECT_FINAL_CONSTRUCT()
|
|
|
|
|
|
|
|
BEGIN_COM_MAP(CMenuBand)
|
2013-10-16 19:13:49 +00:00
|
|
|
COM_INTERFACE_ENTRY_IID(IID_IDeskBar, IMenuPopup)
|
2013-07-23 10:53:06 +00:00
|
|
|
COM_INTERFACE_ENTRY_IID(IID_IShellMenu, IShellMenu)
|
|
|
|
COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget)
|
|
|
|
COM_INTERFACE_ENTRY_IID(IID_IOleWindow, IDeskBand)
|
|
|
|
COM_INTERFACE_ENTRY_IID(IID_IDockingWindow, IDockingWindow)
|
|
|
|
COM_INTERFACE_ENTRY_IID(IID_IDeskBand, IDeskBand)
|
|
|
|
COM_INTERFACE_ENTRY_IID(IID_IObjectWithSite, IObjectWithSite)
|
|
|
|
COM_INTERFACE_ENTRY_IID(IID_IInputObject, IInputObject)
|
|
|
|
COM_INTERFACE_ENTRY_IID(IID_IPersistStream, IPersistStream)
|
2013-10-16 19:13:49 +00:00
|
|
|
COM_INTERFACE_ENTRY_IID(IID_IPersist, IPersistStream)
|
2013-07-23 10:53:06 +00:00
|
|
|
COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider)
|
2013-10-16 19:13:49 +00:00
|
|
|
COM_INTERFACE_ENTRY_IID(IID_IMenuPopup, IMenuPopup)
|
2013-07-23 10:53:06 +00:00
|
|
|
COM_INTERFACE_ENTRY_IID(IID_IMenuBand, IMenuBand)
|
|
|
|
COM_INTERFACE_ENTRY_IID(IID_IShellMenu2, IShellMenu2)
|
|
|
|
COM_INTERFACE_ENTRY_IID(IID_IWinEventHandler, IWinEventHandler)
|
|
|
|
COM_INTERFACE_ENTRY_IID(IID_IShellMenuAcc, IShellMenuAcc)
|
|
|
|
END_COM_MAP()
|
|
|
|
|
2014-01-25 17:24:24 +00:00
|
|
|
};
|