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
|
#include "config.h"
#include "helpers.h"
#include "imageloader.h"
#include "messagebox.h"
cNopacityMessageBox::cNopacityMessageBox(cOsd *Osd, const cRect &Rect, eMessageType Type, const char *Text, bool isMenuMessage) {
osd = Osd;
pixmap = osd->CreatePixmap(7, Rect);
pixmapBackground = osd->CreatePixmap(6, Rect);
tColor col;
tColor colFont;
eSkinElementType seType;
switch (Type) {
case mtInfo:
col = Theme.Color(clrMessageInfo);
colFont = Theme.Color(clrMessageFontInfo);
seType = seMessageInfo;
break;
case mtWarning:
col = Theme.Color(clrMessageWarning);
colFont = Theme.Color(clrMessageFontWarning);
seType = seMessageWarning;
break;
case mtError:
col = Theme.Color(clrMessageError);
colFont = Theme.Color(clrMessageFontError);
seType = seMessageError;
break;
default: // case mtStatus:
col = Theme.Color(clrMessageStatus);
colFont = Theme.Color(clrMessageFontStatus);
seType = seMessageStatus;
break;
}
pixmap->Fill(clrTransparent);
if (config.GetValue("displayType") == dtGraphical) {
pixmapBackground->Fill(clrTransparent);
cImage *imgBack = imgCache->GetSkinElement(seType);
if (imgBack) {
pixmapBackground->DrawImage(cPoint(0, 0), *imgBack);
}
} else {
pixmapBackground->Fill(col);
if (config.GetValue("displayType") == dtBlending) {
cImage imgBack = imgCache->GetBackground(Theme.Color(clrMessageBlend), col, Rect.Width()-2, Rect.Height()-2, true);
pixmapBackground->DrawImage(cPoint(1, 1), imgBack);
}
if (config.GetValue("roundedCorners")) {
DrawRoundedCornersWithBorder(pixmapBackground, col, config.GetValue("cornerRadius"), Rect.Width(), Rect.Height());
}
}
cFont *font = isMenuMessage ? fontManager->menuMessage : fontManager->messageText;
pixmap->DrawText(cPoint((Rect.Width() - font->Width(Text)) / 2,
(Rect.Height() - font->Height()) / 2),
Text,
colFont,
clrTransparent,
font);
}
cNopacityMessageBox::~cNopacityMessageBox() {
osd->DestroyPixmap(pixmap);
osd->DestroyPixmap(pixmapBackground);
}
void cNopacityMessageBox::SetAlpha(int Alpha) {
pixmap->SetAlpha(Alpha);
pixmapBackground->SetAlpha(Alpha);
}
|