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

#include "display.h"

namespace GLCD
{

cSkinDisplay::cSkinDisplay(cSkin * parent)
:   mSkin(parent),
    mId("")
{
}

void cSkinDisplay::Render(cBitmap * screen)
{
    for (uint32_t i = 0; i < NumObjects(); ++i)
        GetObject(i)->Render(screen);
}


bool cSkinDisplay::NeedsUpdate(uint64_t CurrentTime)
{
    for (uint32_t i = 0; i < NumObjects(); ++i) {
        if ( GetObject(i)->NeedsUpdate(CurrentTime) ) {
            return true;
        }
    }
    return false;
}


std::string cSkinDisplay::CheckAction(cGLCDEvent * ev) {
    std::string rv = "";

    if (!ev)
        return "";

    for (uint32_t i = 0; i < NumObjects(); ++i) {
        if ( (rv = GetObject(i)->CheckAction(ev) ) != "" ) {
            return rv;
        }
    }
    return "";
}


cSkinDisplays::cSkinDisplays(void)
{
}

cSkinDisplays::~cSkinDisplays()
{
    iterator it = begin();
    while (it != end())
    {
        delete (*it);
        it++;
    }
}

} // end of namespace