summaryrefslogtreecommitdiff
path: root/plugins/TipperYM/src/popwin.h
blob: 252a1c85f527d8f6074b585d69ec1e645780e658 (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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/*
Copyright (C) 2006-2007 Scott Ellis
Copyright (C) 2007-2011 Jan Holub

This is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.

This is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Library General Public License for more details.

You should have received a copy of the GNU Library General Public
License along with this file; see the file license.txt.  If
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.  
*/

#ifndef _POPWIN_INC
#define _POPWIN_INC

#define POP_WIN_CLASS					_T(MODULENAME) L"MimTTClass"

#define PUM_GETHEIGHT					(WM_USER + 0x020)
#define PUM_CALCPOS						(WM_USER + 0x021)
#define PUM_SETSTATUSTEXT				(WM_USER + 0x022)
#define PUM_UPDATERGN					(WM_USER + 0x023)
#define PUM_SETAVATAR					(WM_USER + 0x024)
#define PUM_REFRESH_VALUES				(WM_USER + 0x025)
#define PUM_SHOWXSTATUS					(WM_USER + 0x026)
#define PUM_EXPANDTRAYTIP				(WM_USER + 0x027)
#define PUM_REFRESHTRAYTIP				(WM_USER + 0x028)
#define PUM_FADEOUTWINDOW				(WM_USER + 0x029)

// extra icons
#define EXICONS_COUNT 6
#define CTRY_ERROR   42	// Flags - some strange value ???
#define GEN_FEMALE   70	
#define GEN_MALE     77

// copy menu
#define	COPYMENU_ALLITEMS_LABELS   1000	
#define	COPYMENU_ALLITEMS          1001
#define	COPYMENU_AVATAR            1002

// tray tooltip items
#define TRAYTIP_NUMCONTACTS            1
#define TRAYTIP_LOCKSTATUS             2
#define TRAYTIP_LOGON                  4
#define TRAYTIP_UNREAD_EMAILS          8
#define TRAYTIP_STATUS                16
#define TRAYTIP_STATUS_MSG            32
#define TRAYTIP_EXTRA_STATUS          64
#define TRAYTIP_LISTENINGTO          128
#define TRAYTIP_FAVCONTACTS          256
#define TRAYTIP_MIRANDA_UPTIME       512
#define TRAYTIP_CLIST_EVENT         1024

// favorite contacts options
#define FAVCONT_HIDE_OFFLINE           1
#define FAVCONT_APPEND_PROTO           2

// other
#define TITLE_TEXT_LEN               512
#define MAX_VALUE_LEN                 64

#define ANIM_ELAPSE                   10
#define ANIM_STEPS                   255
#define CHECKMOUSE_ELAPSE            250

#define ID_TIMER_ANIMATE          0x0100
#define ID_TIMER_CHECKMOUSE       0x0101
#define ID_TIMER_TRAYTIP          0x0102

struct ExtraIcons
{
	HICON hIcon;
	bool bDestroy;
};

struct CLCINFOTIPEX
{
	int cbSize;
	int isTreeFocused;   //so the plugin can provide an option
	int isGroup;		//0 if it's a contact, 1 if it's a group
	HANDLE hItem;		//handle to group or contact
	POINT ptCursor;
	RECT rcItem;
	wchar_t *swzText;		// for tips with specific text
	char *szProto;		// for proto tips
};

struct RowData
{
	wchar_t *swzLabel, *swzValue;
	HICON hIcon;
	bool bValueNewline;
	bool bLineAbove;
	bool bIsTitle;
	int iLabelHeight, iValueHeight, iTotalHeight;
	SMILEYPARSEINFO spi;
};

struct PopupWindowData
{
	HPEN hpenBorder, hpenDivider;
	int iTitleHeight, iAvatarHeight, iIconsHeight, iTextHeight, iLabelWidth;
	int iRealAvatarWidth, iRealAvatarHeight;
	MCONTACT hContact;
	int iIconIndex;
	CLCINFOTIPEX clcit;
	wchar_t swzTitle[TITLE_TEXT_LEN];
	SMILEYPARSEINFO spiTitle;
	RowData *rows;
	int iRowCount;
	int iAnimStep;
	int iCurrentTrans;
	bool bIsTextTip, bIsTrayTip;
	int iIndent, iSidebarWidth;
	POINT ptCursorStartPos; // work around bugs with hiding tips (timer check mouse position)
	ExtraIcons extraIcons[EXICONS_COUNT];
	bool bIsIconVisible[EXICONS_COUNT];
	int iTrans;
	int iHotkeyId;
	bool bIsPainted;
	bool bNeedRefresh;
	bool bAllowReposition;
	RECT rcWindow;
	HRGN hrgnAeroGlass;
};

LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
extern int IsTrayProto(const wchar_t *swzProto, BOOL bExtendedTip);

#endif