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
|
#ifndef __ROWHEIGHT_FUNCS_H__
# define __ROWHEIGHT_FUNCS_H__
#define ROW_SPACE_BEETWEEN_LINES 0
#define ICON_HEIGHT 16
class RowHeight
{
public:
static BOOL Alloc(ClcData *dat, int size);
static BOOL Init(ClcData *dat);
static void Free(ClcData *dat);
static void Clear(ClcData *dat);
// Calc and store max row height
static int getMaxRowHeight(ClcData *dat, const HWND hwnd);
// Calc and store row height
static int getRowHeight(ClcData *dat, ClcContact *contact, int item, uint32_t style)
{
if (!Alloc(dat, item + 1))
return -1;
int height = dat->fontInfo[GetBasicFontID(contact)].fontHeight;
if (!dat->bisEmbedded) {
if (contact->bSecondLine != MULTIROW_NEVER && contact->bSecondLine != MULTIROW_IFSPACE && contact->type == CLCIT_CONTACT) {
if ((contact->bSecondLine == MULTIROW_ALWAYS || ((cfg::dat.dwFlags & CLUI_FRAME_SHOWSTATUSMSG && contact->bSecondLine == MULTIROW_IFNEEDED) && (contact->xStatus > 0 || contact->pExtra->bStatusMsgValid > STATUSMSG_XSTATUSID))))
height += (dat->fontInfo[FONTID_STATUS].fontHeight + cfg::dat.avatarPadding);
}
// Avatar size
if (contact->cFlags & ECF_AVATAR && contact->type == CLCIT_CONTACT && contact->ace != nullptr && !(contact->ace->dwFlags & AVS_HIDEONCLIST))
height = max(height, cfg::dat.avatarSize + cfg::dat.avatarPadding);
}
// Checkbox size
if ((style & CLS_CHECKBOXES && contact->type == CLCIT_CONTACT) ||
(style & CLS_GROUPCHECKBOXES && contact->type == CLCIT_GROUP) ||
(contact->type == CLCIT_INFO && contact->flags & CLCIIF_CHECKBOX)) {
height = max(height, dat->checkboxSize);
}
// Min size
height = max(height, contact->type == CLCIT_GROUP ? dat->group_row_height : dat->min_row_heigh);
height += cfg::dat.bRowSpacing;
dat->row_heights[item] = height;
return height;
}
// Calc and store row height for all itens in the list
static void calcRowHeights(ClcData *dat, HWND hwnd);
// Calc item top Y (using stored data)
static int getItemTopY(ClcData *dat, int item);
// Calc item bottom Y (using stored data)
static int getItemBottomY(ClcData *dat, int item);
// Calc total height of rows (using stored data)
static int getTotalHeight(ClcData *dat);
// Return the line that pos_y is at or -1 (using stored data). Y start at 0
static int hitTest(ClcData *dat, int pos_y);
// Returns the height of the chosen row
static int getHeight(ClcData *dat, int item);
};
#endif // __ROWHEIGHT_FUNCS_H__
|