diff options
author | mrwastl <mrwastl@users.sourceforge.net> | 2010-04-17 19:16:26 +0200 |
---|---|---|
committer | mrwastl <mrwastl@users.sourceforge.net> | 2010-04-17 19:16:26 +0200 |
commit | 68ac6628a31cb1472275b5282c5cf9a971d9bddd (patch) | |
tree | 0ef788b563efab6688b0381cedd43baaefbc66cc /glcdskin/skin.c | |
parent | 1011961a8af0615ee25b79d2bbd7e6820b851556 (diff) | |
download | graphlcd-base-68ac6628a31cb1472275b5282c5cf9a971d9bddd.tar.gz graphlcd-base-68ac6628a31cb1472275b5282c5cf9a971d9bddd.tar.bz2 |
backport of skin-support from 0.2.x to 0.1.x, changes for gcc 4.3 conformity
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 |