Minor cleanup
[TortoiseGit.git] / src / Utils / MiscUI / IconMenu.h
blob2e029213793348f65d672194e015e02926ee1a1c
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.
20 #pragma once
21 #include "IconBitmapUtils.h"
24 /**
25 * \ingroup utils
26 * Extends the CMenu class with a convenience method to insert a menu
27 * entry with an icon.
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
34 public:
35 CIconMenu(void);
36 ~CIconMenu(void);
38 BOOL CreateMenu();
39 BOOL CreatePopupMenu();
40 BOOL AppendMenuIcon(UINT_PTR nIDNewItem, LPCTSTR lpszNewItem, UINT uIcon = 0, HMENU hsubmenu = 0);
41 BOOL AppendMenuIcon(UINT_PTR nIDNewItem, UINT_PTR nNewItem, UINT uIcon = 0, HMENU hsubmenu = 0);
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);
48 private:
49 BOOL SetMenuStyle(void);
51 private:
52 IconBitmapUtils bitmapUtils;
53 std::map<UINT_PTR, UINT> icons;
54 std::map<UINT_PTR, HICON> iconhandles;
55 bool bShowIcons;