diff options
Diffstat (limited to 'glcdskin/skin.c')
-rw-r--r-- | glcdskin/skin.c | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/glcdskin/skin.c b/glcdskin/skin.c new file mode 100644 index 0000000..a7facdd --- /dev/null +++ b/glcdskin/skin.c @@ -0,0 +1,82 @@ +/* + * 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); +} + +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; +} + + +} // end of namespace |