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
|
#include "headers.h"
void CSkinImage::LoadFromXml(HXML hXml)
{
CSkinObject::LoadFromXml(hXml);
m_source = xi.getAttrValue(hXml, _T("src"));
m_hbmp = m_ds->GetBitmap(m_source);
GetObject(m_hbmp, sizeof(m_bi), &m_bi);
}
void CSkinImage::Measure(SkinRenderParams *params)
{
SetRect(¶ms->rc, 0, 0, 0, 0);
if (m_width == 0) params->rc.right = m_bi.bmWidth;
else if (m_width < 0) params->rc.right = 0;
else params->rc.right = m_width;
if (m_height == 0) params->rc.bottom = m_bi.bmHeight;
else if (m_height < 0) params->rc.bottom = 0;
else params->rc.bottom = m_height;
}
void CSkinImage::Paint(SkinRenderParams *params)
{
HDC hdc = CreateCompatibleDC(params->hdc);
SelectObject(hdc, m_hbmp);
BLENDFUNCTION bf = {0};
bf.AlphaFormat = AC_SRC_ALPHA;
bf.BlendOp = AC_SRC_OVER;
bf.SourceConstantAlpha = 255;
AlphaBlend(params->hdc,
m_rcPosition.left, m_rcPosition.top,
m_rcPosition.right - m_rcPosition.left, m_rcPosition.bottom - m_rcPosition.top,
hdc, 0, 0,
m_bi.bmWidth, abs(m_bi.bmHeight),
bf);
DeleteDC(hdc);
}
void CSkinIcon::LoadFromXml(HXML hXml)
{
CSkinObject::LoadFromXml(hXml);
m_source = xi.getAttrValue(hXml, _T("src"));
}
void CSkinIcon::Measure(SkinRenderParams *params)
{
SetRect(¶ms->rc, 0, 0, 16, 16);
}
void CSkinIcon::Paint(SkinRenderParams *params)
{
DrawIconEx(params->hdc,
(m_rcPosition.left + m_rcPosition.right - 16) / 2,
(m_rcPosition.top + m_rcPosition.bottom - 16) / 2,
LoadSkinnedIcon(SKINICON_OTHER_MIRANDA),
16, 16,
0, NULL, DI_NORMAL);
}
void CSkinText::LoadFromXml(HXML hXml)
{
CSkinObject::LoadFromXml(hXml);
m_text = xi.getAttrValue(hXml, _T("text"));
}
void CSkinText::Measure(SkinRenderParams *params)
{
LPCTSTR text = m_ds ? m_ds->GetText(m_text) : m_text;
DrawText(params->hdc, text, lstrlen(text), ¶ms->rc, DT_NOPREFIX|DT_WORDBREAK|DT_CALCRECT);
}
void CSkinText::Paint(SkinRenderParams *params)
{
LPCTSTR text = m_ds ? m_ds->GetText(m_text) : m_text;
SetTextColor(params->hdc, RGB(255, 255, 255));
SetBkMode(params->hdc, TRANSPARENT);
DrawText(params->hdc, text, lstrlen(text), &m_rcPosition, DT_NOPREFIX|DT_WORDBREAK);
}
|