2014-02-24 11:59:34 +00:00
|
|
|
/*
|
|
|
|
* Shell Menu Band
|
|
|
|
*
|
|
|
|
* Copyright 2014 David Quintana
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
class CMenuBand;
|
|
|
|
class CMenuFocusManager;
|
|
|
|
|
|
|
|
class CMenuToolbarBase
|
|
|
|
{
|
|
|
|
private:
|
2014-02-26 11:13:23 +00:00
|
|
|
HWND m_hwnd; // May be the pager
|
|
|
|
HFONT m_marlett;
|
|
|
|
BOOL m_useFlatMenus;
|
2014-02-24 11:59:34 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
CMenuBand * m_menuBand;
|
|
|
|
HWND m_hwndToolbar;
|
|
|
|
DWORD m_dwMenuFlags;
|
|
|
|
WNDPROC m_SubclassOld;
|
|
|
|
BOOL m_hasIdealSize;
|
|
|
|
SIZE m_idealSize;
|
|
|
|
BOOL m_usePager;
|
2014-02-27 11:56:28 +00:00
|
|
|
CMenuToolbarBase * m_hotBar;
|
|
|
|
INT m_hotItem;
|
|
|
|
CMenuToolbarBase * m_popupBar;
|
|
|
|
INT m_popupItem;
|
2014-02-24 11:59:34 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
static LRESULT CALLBACK s_SubclassProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
|
|
|
|
|
|
|
public:
|
|
|
|
CMenuToolbarBase(CMenuBand *menuBand, BOOL usePager);
|
2014-02-26 11:13:23 +00:00
|
|
|
virtual ~CMenuToolbarBase();
|
2014-02-24 11:59:34 +00:00
|
|
|
|
|
|
|
HRESULT IsWindowOwner(HWND hwnd);
|
|
|
|
HRESULT CreateToolbar(HWND hwndParent, DWORD dwFlags);
|
|
|
|
HRESULT GetWindow(HWND *phwnd);
|
|
|
|
HRESULT ShowWindow(BOOL fShow);
|
|
|
|
HRESULT Close();
|
|
|
|
|
2014-02-26 11:13:23 +00:00
|
|
|
HRESULT OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult);
|
|
|
|
|
2014-02-27 11:56:28 +00:00
|
|
|
HRESULT OnHotItemChanged(CMenuToolbarBase * toolbar, INT item);
|
|
|
|
HRESULT OnPopupItemChanged(CMenuToolbarBase * toolbar, INT item);
|
2014-02-24 11:59:34 +00:00
|
|
|
|
|
|
|
HRESULT PopupSubMenu(UINT itemId, UINT index, IShellMenu* childShellMenu);
|
|
|
|
HRESULT PopupSubMenu(UINT index, HMENU menu);
|
|
|
|
HRESULT DoContextMenu(IContextMenu* contextMenu);
|
|
|
|
|
|
|
|
HRESULT ChangeHotItem(DWORD changeType);
|
|
|
|
HRESULT OnHotItemChange(const NMTBHOTITEM * hot);
|
|
|
|
|
|
|
|
HRESULT GetIdealSize(SIZE& size);
|
|
|
|
HRESULT SetPosSize(int x, int y, int cx, int cy);
|
|
|
|
|
|
|
|
void InvalidateDraw();
|
|
|
|
|
2014-02-27 11:56:28 +00:00
|
|
|
virtual HRESULT FillToolbar() = 0;
|
|
|
|
virtual HRESULT PopupItem(INT uItem) = 0;
|
|
|
|
virtual HRESULT HasSubMenu(INT uItem) = 0;
|
|
|
|
virtual HRESULT OnContextMenu(NMMOUSE * rclick) = 0;
|
|
|
|
|
2014-02-24 11:59:34 +00:00
|
|
|
protected:
|
2014-02-26 11:13:23 +00:00
|
|
|
virtual HRESULT OnCommand(WPARAM wParam, LPARAM lParam, LRESULT *theResult);
|
|
|
|
|
2014-02-24 11:59:34 +00:00
|
|
|
LRESULT CALLBACK SubclassProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
2014-02-25 10:44:28 +00:00
|
|
|
|
|
|
|
HRESULT UpdateImageLists();
|
2014-02-24 11:59:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class CMenuStaticToolbar :
|
|
|
|
public CMenuToolbarBase
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
HMENU m_hmenu;
|
|
|
|
|
|
|
|
public:
|
|
|
|
CMenuStaticToolbar(CMenuBand *menuBand);
|
|
|
|
virtual ~CMenuStaticToolbar() {}
|
|
|
|
|
|
|
|
HRESULT SetMenu(HMENU hmenu, HWND hwnd, DWORD dwFlags);
|
|
|
|
HRESULT GetMenu(HMENU *phmenu, HWND *phwnd, DWORD *pdwFlags);
|
|
|
|
|
|
|
|
virtual HRESULT FillToolbar();
|
2014-02-27 11:56:28 +00:00
|
|
|
virtual HRESULT PopupItem(INT uItem);
|
|
|
|
virtual HRESULT HasSubMenu(INT uItem);
|
2014-02-24 11:59:34 +00:00
|
|
|
virtual HRESULT OnCommand(WPARAM wParam, LPARAM lParam, LRESULT *theResult);
|
|
|
|
virtual HRESULT OnContextMenu(NMMOUSE * rclick);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
class CMenuSFToolbar :
|
|
|
|
public CMenuToolbarBase
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
IShellFolder * m_shellFolder;
|
|
|
|
LPCITEMIDLIST m_idList;
|
|
|
|
HKEY m_hKey;
|
|
|
|
|
|
|
|
public:
|
|
|
|
CMenuSFToolbar(CMenuBand *menuBand);
|
|
|
|
virtual ~CMenuSFToolbar();
|
|
|
|
|
|
|
|
HRESULT SetShellFolder(IShellFolder *psf, LPCITEMIDLIST pidlFolder, HKEY hKey, DWORD dwFlags);
|
|
|
|
HRESULT GetShellFolder(DWORD *pdwFlags, LPITEMIDLIST *ppidl, REFIID riid, void **ppv);
|
|
|
|
|
|
|
|
virtual HRESULT FillToolbar();
|
2014-02-27 11:56:28 +00:00
|
|
|
virtual HRESULT PopupItem(INT uItem);
|
|
|
|
virtual HRESULT HasSubMenu(INT uItem);
|
2014-02-24 11:59:34 +00:00
|
|
|
virtual HRESULT OnCommand(WPARAM wParam, LPARAM lParam, LRESULT *theResult);
|
|
|
|
virtual HRESULT OnContextMenu(NMMOUSE * rclick);
|
|
|
|
|
|
|
|
private:
|
2014-02-27 11:56:28 +00:00
|
|
|
LPITEMIDLIST GetPidlFromId(INT uItem, INT* pIndex = NULL);
|
2014-02-24 11:59:34 +00:00
|
|
|
};
|