|
SASC
DVBSoftCAM
|
00001 /* 00002 * skins.h: The optical appearance of the OSD 00003 * 00004 * See the main source file 'vdr.c' for copyright information and 00005 * how to reach the author. 00006 * 00007 * $Id: skins.h 1.15 2007/01/04 13:08:55 kls Exp $ 00008 */ 00009 00010 #ifndef __SKINS_H 00011 #define __SKINS_H 00012 00013 #include "channels.h" 00014 #include "epg.h" 00015 #include "keys.h" 00016 #include "osd.h" 00017 #include "recording.h" 00018 #include "themes.h" 00019 #include "thread.h" 00020 #include "tools.h" 00021 00022 enum eMessageType { mtStatus = 0, mtInfo, mtWarning, mtError }; // will be used to calculate color offsets! 00023 00024 class cSkinDisplay { 00025 private: 00026 static cSkinDisplay *current; 00027 int editableWidth; //XXX this is not nice, but how else could we know this value? 00028 public: 00029 cSkinDisplay(void); 00030 virtual ~cSkinDisplay(); 00031 int EditableWidth(void) { return editableWidth; } 00032 void SetEditableWidth(int Width) { editableWidth = Width; } 00036 virtual void SetButtons(const char *Red, const char *Green = NULL, const char *Yellow = NULL, const char *Blue = NULL) {} 00039 virtual void SetMessage(eMessageType Type, const char *Text) {} 00042 virtual void Flush(void) {} 00044 static cSkinDisplay *Current(void) { return NULL; } 00046 }; 00047 00048 class cSkinDisplayChannel : public cSkinDisplay { 00052 public: 00053 virtual void SetChannel(const cChannel *Channel, int Number) = 0; 00057 virtual void SetEvents(const cEvent *Present, const cEvent *Following) = 0; 00060 virtual void SetMessage(eMessageType Type, const char *Text) = 0; 00065 /*TODO 00066 SetButtons 00067 Red = Video options 00068 Green = Info now 00069 Yellow = Info next 00070 */ 00071 }; 00072 00073 class cSkinDisplayMenu : public cSkinDisplay { 00090 public: 00091 enum { MaxTabs = 6 }; 00092 private: 00093 int tabs[MaxTabs]; 00094 protected: 00095 cTextScroller textScroller; 00096 int Tab(int n) { return (n >= 0 && n < MaxTabs) ? tabs[n] : 0; } 00099 const char *GetTabbedText(const char *s, int Tab); 00103 public: 00104 cSkinDisplayMenu(void); 00105 virtual void SetTabs(int Tab1, int Tab2 = 0, int Tab3 = 0, int Tab4 = 0, int Tab5 = 0); 00108 virtual void Scroll(bool Up, bool Page); 00114 virtual int MaxItems(void) = 0; 00116 virtual void Clear(void) = 0; 00118 virtual void SetTitle(const char *Title) = 0; 00120 virtual void SetButtons(const char *Red, const char *Green = NULL, const char *Yellow = NULL, const char *Blue = NULL) = 0; 00123 virtual void SetMessage(eMessageType Type, const char *Text) = 0; 00128 virtual void SetItem(const char *Text, int Index, bool Current, bool Selectable) = 0; 00140 /*TODO 00141 virtual void SetItem(const cEvent *Event, int Index, bool Current, bool Selectable, bool NowNext???, bool Schedule???); 00142 virtual void SetItem(const cTimer *Timer, int Index, bool Current, bool Selectable); 00143 virtual void SetItem(const cChannel *Channel, int Index, bool Current, bool Selectable); 00144 virtual void SetItem(const cRecording *Recording, int Index, bool Current, bool Selectable); 00145 --> false: call SetItem(text) 00146 */ 00147 virtual void SetEvent(const cEvent *Event) = 0; 00152 virtual void SetRecording(const cRecording *Recording) = 0; 00157 virtual void SetText(const char *Text, bool FixedFont) = 0; 00162 //XXX ??? virtual void SetHelp(const char *Help) = 0; 00163 virtual int GetTextAreaWidth(void) const; 00169 virtual const cFont *GetTextAreaFont(bool FixedFont) const; 00176 }; 00177 00178 class cSkinDisplayReplay : public cSkinDisplay { 00181 protected: 00182 const cMarks *marks; 00183 class cProgressBar : public cBitmap { 00184 protected: 00185 int total; 00186 int Pos(int p) { return p * Width() / total; } 00187 void Mark(int x, bool Start, bool Current, tColor ColorMark, tColor ColorCurrent); 00188 public: 00189 cProgressBar(int Width, int Height, int Current, int Total, const cMarks *Marks, tColor ColorSeen, tColor ColorRest, tColor ColorSelected, tColor ColorMark, tColor ColorCurrent); 00190 }; 00191 public: 00192 cSkinDisplayReplay(void); 00193 virtual void SetMarks(const cMarks *Marks); 00196 virtual void SetTitle(const char *Title) = 0; 00198 virtual void SetMode(bool Play, bool Forward, int Speed) = 0; 00202 virtual void SetProgress(int Current, int Total) = 0; 00206 virtual void SetCurrent(const char *Current) = 0; 00212 virtual void SetTotal(const char *Total) = 0; 00215 virtual void SetJump(const char *Jump) = 0; 00221 virtual void SetMessage(eMessageType Type, const char *Text) = 0; 00226 }; 00227 00228 class cSkinDisplayVolume : public cSkinDisplay { 00230 public: 00231 virtual void SetVolume(int Current, int Total, bool Mute) = 0; 00235 }; 00236 00237 class cSkinDisplayTracks : public cSkinDisplay { 00239 public: 00240 virtual void SetTrack(int Index, const char * const *Tracks) = 0; 00243 virtual void SetAudioChannel(int AudioChannel) = 0; 00246 }; 00247 00248 class cSkinDisplayMessage : public cSkinDisplay { 00250 public: 00251 virtual void SetMessage(eMessageType Type, const char *Text) = 0; 00254 }; 00255 00256 class cSkin : public cListObject { 00257 private: 00258 char *name; 00259 cTheme *theme; 00260 public: 00261 cSkin(const char *Name, cTheme *Theme = NULL); 00274 virtual ~cSkin(); 00275 const char *Name(void) { return name; } 00276 cTheme *Theme(void) { return theme; } 00277 virtual const char *Description(void) = 0; 00283 virtual cSkinDisplayChannel *DisplayChannel(bool WithInfo) = 0; 00289 virtual cSkinDisplayMenu *DisplayMenu(void) = 0; 00292 virtual cSkinDisplayReplay *DisplayReplay(bool ModeOnly) = 0; 00297 virtual cSkinDisplayVolume *DisplayVolume(void) = 0; 00300 virtual cSkinDisplayTracks *DisplayTracks(const char *Title, int NumTracks, const char * const *Tracks) = 0; 00306 virtual cSkinDisplayMessage *DisplayMessage(void) = 0; 00309 }; 00310 00311 class cSkins : public cList<cSkin> { 00312 private: 00313 cSkin *current; 00314 cSkinDisplayMessage *displayMessage; 00315 cMutex queueMessageMutex; 00316 public: 00317 cSkins(void); 00318 ~cSkins(); 00319 bool SetCurrent(const char *Name = NULL); 00322 cSkin *Current(void) { return current; } 00324 bool IsOpen(void) { return cSkinDisplay::Current(); } 00326 eKeys Message(eMessageType Type, const char *s, int Seconds = 0); 00334 int QueueMessage(eMessageType Type, const char *s, int Seconds = 0, int Timeout = 0); 00359 void ProcessQueuedMessages(void); 00361 void Flush(void); 00363 virtual void Clear(void); 00365 }; 00366 00367 extern cSkins Skins; 00368 00369 #endif //__SKINS_H