1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2010, 2013 - TortoiseGit
4 // Copyright (C) 2008-2009, 2011 - TortoiseSVN
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
11 // This program 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
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software Foundation,
18 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 #include "IconBitmapUtils.h"
26 * Extends the CMenu class with a convenience method to insert a menu
29 * The icons are loaded from the resources and converted to a bitmap.
30 * The bitmaps are destroyed together with the CIconMenu object.
32 class CIconMenu
: public CMenu
39 BOOL
CreatePopupMenu();
40 BOOL
AppendMenuIcon(UINT_PTR nIDNewItem
, LPCTSTR lpszNewItem
, UINT uIcon
= 0, HMENU hsubmenu
= nullptr);
41 BOOL
AppendMenuIcon(UINT_PTR nIDNewItem
, UINT_PTR nNewItem
, UINT uIcon
= 0, HMENU hsubmenu
= nullptr);
42 void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct
);
43 void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct
);
45 BOOL
SetMenuItemData(UINT_PTR nIDNewItem
, LONG_PTR data
);
46 LONG_PTR
GetMenuItemData(UINT_PTR nIDNewItem
);
49 BOOL
SetMenuStyle(void);
52 IconBitmapUtils bitmapUtils
;
53 std::map
<UINT_PTR
, UINT
> icons
;
54 std::map
<UINT_PTR
, HICON
> iconhandles
;