SASC-NG
DVBSoftCAM

themes.h

Go to the documentation of this file.
00001 /*
00002  * themes.h: Color themes used by skins
00003  *
00004  * See the main source file 'vdr.c' for copyright information and
00005  * how to reach the author.
00006  *
00007  * $Id: themes.h 1.1 2004/05/15 14:22:16 kls Exp $
00008  */
00009 
00010 #ifndef __THEMES_H
00011 #define __THEMES_H
00012 
00013 #include "i18n.h"
00014 #include "osd.h"
00015 
00016 class cTheme {
00017 public:
00018   enum { MaxThemeColors = 128 };
00019 private:
00020   char *name;
00021   char *descriptions[I18nNumLanguages];
00022   char *colorNames[MaxThemeColors];
00023   tColor colorValues[MaxThemeColors];
00024   bool FileNameOk(const char *FileName, bool SetName = false);
00025 public:
00026   cTheme(void);
00028   ~cTheme();
00029   const char *Name(void) { return name; }
00030   const char *Description(void);
00034   bool Load(const char *FileName, bool OnlyDescriptions = false);
00036   bool Save(const char *FileName);
00043   int AddColor(const char *Name, tColor Color);
00052   tColor Color(int Subject);
00055   };
00056 
00057 // A helper macro that simplifies defining theme colors.
00058 #define THEME_CLR(Theme, Subject, Color) static const int Subject = Theme.AddColor(#Subject, Color)
00059 
00060 class cThemes {
00061 private:
00062   int numThemes;
00063   char **names;
00064   char **fileNames;
00065   char **descriptions;
00066   static char *themesDirectory;
00067   void Clear(void);
00068 public:
00069   cThemes(void);
00070   ~cThemes();
00071   bool Load(const char *SkinName);
00072   int NumThemes(void) { return numThemes; }
00073   const char *Name(int Index) { return Index < numThemes ? names[Index] : NULL; }
00074   const char *FileName(int Index) { return Index < numThemes ? fileNames[Index] : NULL; }
00075   const char * const *Descriptions(void) { return descriptions; }
00076   int GetThemeIndex(const char *Description);
00077   static void SetThemesDirectory(const char *ThemesDirectory);
00078   static void Load(const char *SkinName, const char *ThemeName, cTheme *Theme);
00079   static void Save(const char *SkinName, cTheme *Theme);
00080   };
00081 
00082 #endif //__THEMES_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines