summaryrefslogtreecommitdiff
path: root/Plugins/emoticons/EmoticonsSelectionLayout.h
blob: 27920a9decc2054d1e193dfe45671eb28ded11b2 (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
75
76
77
78
#define MIN_COLS 6
#define MAX_LINES 6
#define MAX_COLS 12
#define BORDER 3


struct EmoticonSelectionData
{
	HANDLE hContact;
	Module *module;
	const char *proto;
	COLORREF background;

    int xPosition;
    int yPosition;
    int Direction;
    HWND hwndTarget;
    UINT targetMessage;
    LPARAM targetWParam;
};


class EmoticonsSelectionLayout
{
public:
	EmoticonSelectionData *ssd;
	HWND hwnd;
	int selection;

	struct {
		int width;
		int height;
	} window;

	EmoticonsSelectionLayout() {}
	virtual ~EmoticonsSelectionLayout() {}

	virtual void OnUp(HWND hwnd) = 0;
	virtual void OnDown(HWND hwnd) = 0;
	virtual void OnLeft(HWND hwnd) = 0;
	virtual void OnRight(HWND hwnd) = 0;

	virtual void Draw(HDC hdc) = 0;

	virtual void SetSelection(HWND hwnd, POINT p) = 0;

	void SetSelection(HWND hwnd, int sel);
	
	virtual void CreateToolTips() = 0;

	void DestroyToolTips();

protected:

	virtual HFONT GetFont(HDC hdc);
	virtual void ReleaseFont(HFONT hFont);

	RECT CalcRect(TCHAR *txt);
#ifdef UNICODE
	RECT CalcRect(char *txt);
#endif

	void GetEmoticonSize(Emoticon *e, int &width, int &height);

	int GetNumOfCols(int num_emotes);
	int GetNumOfLines(int num_emotes, int cols);

	void CreateEmoticonToolTip(Emoticon *e, RECT fr);

	void EraseBackground(HDC hdc);

	void DrawEmoticon(HDC hdc, int index, RECT rc);
	void DrawEmoticonText(HDC hdc, TCHAR *txt, RECT rc);
#ifdef UNICODE
	void DrawEmoticonText(HDC hdc, char *txt, RECT rc);
#endif

};