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
23 class CMenuFocusManager
;
25 class CMenuToolbarBase
28 HWND m_hwnd
; // May be the pager
33 CMenuBand
* m_menuBand
;
38 WNDPROC m_SubclassOld
;
44 static LRESULT CALLBACK
s_SubclassProc(HWND hWnd
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
);
47 CMenuToolbarBase(CMenuBand
*menuBand
, BOOL usePager
);
48 virtual ~CMenuToolbarBase();
50 HRESULT
IsWindowOwner(HWND hwnd
);
51 HRESULT
CreateToolbar(HWND hwndParent
, DWORD dwFlags
);
52 HRESULT
GetWindow(HWND
*phwnd
);
53 HRESULT
ShowWindow(BOOL fShow
);
56 HRESULT
OnWinEvent(HWND hWnd
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
, LRESULT
*theResult
);
58 virtual HRESULT
FillToolbar() = 0;
59 virtual HRESULT
PopupItem(UINT uItem
) = 0;
60 virtual HRESULT
HasSubMenu(UINT uItem
) = 0;
61 virtual HRESULT
OnContextMenu(NMMOUSE
* rclick
) = 0;
63 HRESULT
PopupSubMenu(UINT itemId
, UINT index
, IShellMenu
* childShellMenu
);
64 HRESULT
PopupSubMenu(UINT index
, HMENU menu
);
65 HRESULT
DoContextMenu(IContextMenu
* contextMenu
);
67 HRESULT
ChangeHotItem(DWORD changeType
);
68 HRESULT
OnHotItemChange(const NMTBHOTITEM
* hot
);
70 HRESULT
GetIdealSize(SIZE
& size
);
71 HRESULT
SetPosSize(int x
, int y
, int cx
, int cy
);
73 void InvalidateDraw();
76 virtual HRESULT
OnCommand(WPARAM wParam
, LPARAM lParam
, LRESULT
*theResult
);
78 LRESULT CALLBACK
SubclassProc(HWND hWnd
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
);
80 HRESULT
UpdateImageLists();
83 class CMenuStaticToolbar
:
84 public CMenuToolbarBase
90 CMenuStaticToolbar(CMenuBand
*menuBand
);
91 virtual ~CMenuStaticToolbar() {}
93 HRESULT
SetMenu(HMENU hmenu
, HWND hwnd
, DWORD dwFlags
);
94 HRESULT
GetMenu(HMENU
*phmenu
, HWND
*phwnd
, DWORD
*pdwFlags
);
96 virtual HRESULT
FillToolbar();
97 virtual HRESULT
PopupItem(UINT uItem
);
98 virtual HRESULT
HasSubMenu(UINT uItem
);
99 virtual HRESULT
OnCommand(WPARAM wParam
, LPARAM lParam
, LRESULT
*theResult
);
100 virtual HRESULT
OnContextMenu(NMMOUSE
* rclick
);
104 class CMenuSFToolbar
:
105 public CMenuToolbarBase
108 IShellFolder
* m_shellFolder
;
109 LPCITEMIDLIST m_idList
;
113 CMenuSFToolbar(CMenuBand
*menuBand
);
114 virtual ~CMenuSFToolbar();
116 HRESULT
SetShellFolder(IShellFolder
*psf
, LPCITEMIDLIST pidlFolder
, HKEY hKey
, DWORD dwFlags
);
117 HRESULT
GetShellFolder(DWORD
*pdwFlags
, LPITEMIDLIST
*ppidl
, REFIID riid
, void **ppv
);
119 virtual HRESULT
FillToolbar();
120 virtual HRESULT
PopupItem(UINT uItem
);
121 virtual HRESULT
HasSubMenu(UINT uItem
);
122 virtual HRESULT
OnCommand(WPARAM wParam
, LPARAM lParam
, LRESULT
*theResult
);
123 virtual HRESULT
OnContextMenu(NMMOUSE
* rclick
);
126 LPITEMIDLIST
GetPidlFromId(UINT uItem
, INT
* pIndex
= NULL
);