summaryrefslogtreecommitdiff
path: root/plugins/!Deprecated/W7UI/src/clistproxywindow.h
blob: 153c59089b30664c2fa75e2ccac158ad217c9f1d (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
#ifndef clistproxywindow_h__
#define clistproxywindow_h__

class CClistProxyWindow: public CDwmWindow
{
public:
	CClistProxyWindow();
	~CClistProxyWindow();

	void Flash();
	void SetOverlayIcon(HICON hIcon);
	void SetOverlayIconHandle(HANDLE hIcolibIcon);
	void AddOverlayEvent(int idx);
	void RemoveOverlayEvent(int idx);
	int AllocateOverlayEvent(HANDLE hIcolibIcon);

private:
	class COverlayEventSlot
	{
	private:
		HANDLE m_hIcolibItem;
		TCHAR *m_overlayText;
		int m_level;

	public:
		COverlayEventSlot(HANDLE hIcolibItem, TCHAR *overlayText)
		{
			m_hIcolibItem = hIcolibItem;
			m_overlayText = mir_tstrdup(overlayText);
			m_level = 0;
		}
		~COverlayEventSlot() { mir_free(m_overlayText); }
		void Push() { m_level++; }
		void Pop() { if (m_level > 0) m_level--; }
		operator bool() { return m_level > 0; }
		HANDLE GetIcon() { return m_hIcolibItem; }
	};

	int m_activeOverlay;
	HICON m_overlayIcon;
	HANDLE m_overlayIconHandle;
	TCHAR *m_overlayText;
	OBJLIST<COverlayEventSlot> m_overlayEvents;

	int __cdecl OnStatusModeChanged(WPARAM wParam, LPARAM lParam);
	int __cdecl OnAvatarChanged(WPARAM wParam, LPARAM lParam);
	int __cdecl OnModulesLoaded(WPARAM wParam, LPARAM lParam);
	int __cdecl OnAccListChanged(WPARAM wParam, LPARAM lParam);

	HANDLE SetEventHook(char *evt, int (__cdecl CClistProxyWindow::*fn)(WPARAM, LPARAM));

	void Update();

protected:
	void OnActivate(HWND hwndFrom);
	void OnToolbar(int id, INT_PTR data);
	void OnRenderThumbnail(int width, int height);
	void OnClose();
	void OnTimer(int id);
};

extern CClistProxyWindow *g_clistProxyWnd;

#endif // clistproxywindow_h__