blob: 122b1622144c537c8d4e0e965e4aa1b7161b6156 (
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
|
/*
* GraphLCD skin library
*
* skin.c - skin class
*
* This file is released under the GNU General Public License. Refer
* to the COPYING file distributed with this package.
*
* based on text2skin
*
*/
#include "skin.h"
#include "function.h"
namespace GLCD
{
cSkin::cSkin(cSkinConfig & Config, const std::string & Name)
: config(Config),
name(Name)
{
mImageCache = new cImageCache(this, 100);
tsEvalTick = 0;
tsEvalSwitch = 0;
}
cSkin::~cSkin(void)
{
delete mImageCache;
}
void cSkin::SetBaseSize(int width, int height)
{
baseSize.w = width;
baseSize.h = height;
}
cSkinFont * cSkin::GetFont(const std::string & Id)
{
cSkinFonts::iterator it = fonts.begin();
while (it != fonts.end())
{
if ((*it)->Id() == Id)
{
if ((*it)->Condition() == NULL || (*it)->Condition()->Evaluate())
return (*it);
}
it++;
}
return NULL;
}
cSkinDisplay * cSkin::GetDisplay(const std::string & Id)
{
cSkinDisplays::iterator it = displays.begin();
while (it != displays.end())
{
if ((*it)->Id() == Id)
{
return (*it);
}
it++;
}
return NULL;
}
cSkinVariable * cSkin::GetVariable(const std::string & Id)
{
cSkinVariables::iterator it = mVariables.begin();
while (it != mVariables.end())
{
if ((*it)->Id() == Id)
{
if ((*it)->Condition() == NULL || (*it)->Condition()->Evaluate())
return (*it);
}
it++;
}
return NULL;
}
bool cSkin::ParseEnable(const std::string & Text)
{
cDriver * driver = config.GetDriver();
if (!driver)
return false;
driver->SetFeature(Text, 1);
return true; // always return true else loading the skin would fail if touchscreen is not available
}
} // end of namespace
|