summaryrefslogtreecommitdiff
path: root/plugins/HistoryStats/src/iconlib.h
blob: 31154df525e7b846b059b6017896c7b799cd7496 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#if !defined(HISTORYSTATS_GUARD_ICONLIB_H)
#define HISTORYSTATS_GUARD_ICONLIB_H

#include "stdafx.h"


#include <set>

class IconLib
	: private pattern::NotInstantiable<IconLib>
{
public:
	enum IconIndex {
		iiMenuCreateStatistics =  0,
		iiMenuShowStatistics   =  1,
		iiMenuConfigure        =  2,
		iiContactMenu          =  3,
		iiExcludeNo            =  4,
		iiExcludeYes           =  5,
		iiTreeCheck1           =  6,
		iiTreeCheck2           =  7,
		iiTreeCheck3           =  8,
		iiTreeCheck4           =  9,
		iiTreeRadio1           = 10,
		iiTreeRadio2           = 11,
		iiTreeRadio3           = 12,
		iiTreeRadio4           = 13,
		iiTreeEdit1            = 14,
		iiTreeEdit2            = 15,
		iiTreeCombo1           = 16,
		iiTreeCombo2           = 17,
		iiTreeFolder1          = 18,
		iiTreeFolder2          = 19,
		iiTreeButton1          = 20,
		iiTreeButton2          = 21,
		iiTreeDateTime1        = 22,
		iiTreeDateTime2        = 23,
	};

	typedef void (*CallbackProc)(LPARAM lParam);

private:
	struct IconInfo
	{
		uint16_t wID;
		char* szIconName;
		wchar_t* szSection;
		wchar_t* szDescription;
		HICON hIcon;
	};

	typedef std::pair<CallbackProc, LPARAM> CallbackPair;
	typedef std::set<CallbackPair> CallbackSet;

private:
	static bool m_bIcoLibAvailable;
	static HANDLE m_hHookSkin2IconsChanged;
	static IconInfo m_IconInfo[];
	static ext::string m_Section;
	static ext::a::string m_IconName;
	static CallbackSet m_Callbacks;

private:
	static int handleCallbacks(WPARAM wParam, LPARAM lParam);

public:
	static void init();
	static void uninit();
	static void registerCallback(CallbackProc callback, LPARAM lParam);
	static void unregisterCallback(CallbackProc callback, LPARAM lParam);
	static HICON getIcon(IconIndex index);
};

#endif // HISTORYSTATS_GUARD_ICONLIB_H