summaryrefslogtreecommitdiff
path: root/glcdskin/skin.h
blob: 048c1938de7d542dfd85babcbb93b3af463583fb (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
/*
 * GraphLCD skin library
 *
 * skin.h  -  skin class
 *
 * This file is released under the GNU General Public License. Refer
 * to the COPYING file distributed with this package.
 *
 * based on text2skin
 *
 */

#ifndef _GLCDSKIN_SKIN_H_
#define _GLCDSKIN_SKIN_H_

#include <string>

#include "display.h"
#include "font.h"
#include "type.h"
#include "string.h"
#include "cache.h"
#include "config.h"
#include "variable.h"


namespace GLCD
{

class cSkin
{
    friend bool StartElem(const std::string & name, std::map<std::string,std::string> & attrs);
    friend bool EndElem(const std::string & name);

private:
    cSkinConfig & config;
    std::string name;
    std::string title;
    std::string version;
    tSize baseSize;

    cSkinFonts fonts;
    cSkinDisplays displays;
    cSkinVariables mVariables;
    cImageCache * mImageCache;
    uint64_t  tsEvalTick;
    uint64_t  tsEvalSwitch;

public:
    cSkin(cSkinConfig & Config, const std::string & Name);
    ~cSkin(void);

    void SetBaseSize(int width, int height);

    cSkinFont * GetFont(const std::string & Id);
    cSkinDisplay * GetDisplay(const std::string & Id);
    cSkinVariable * GetVariable(const std::string & Id);

    cSkinConfig & Config(void) { return config; }
    const std::string & Name(void) const { return name; }
    const std::string & Title(void) const { return title; }
    const std::string & Version(void) const { return version; }
    const tSize & BaseSize(void) const { return baseSize; }

    cImageCache * ImageCache(void) { return mImageCache; }

    bool ParseEnable(const std::string &Text);

    cColor GetBackgroundColor(void) { return config.GetDriver()->GetBackgroundColor(); }
    cColor GetForegroundColor(void) { return config.GetDriver()->GetForegroundColor(); }
    
    void     SetTSEvalTick(uint64_t ts) { tsEvalTick = ts; }
    void     SetTSEvalSwitch(uint64_t ts) { tsEvalSwitch = ts; }
    const uint64_t GetTSEvalTick(void) { return tsEvalTick; }
    const uint64_t GetTSEvalSwitch(void) { return tsEvalSwitch; }
};

} // end of namespace

#endif