SASC
DVBSoftCAM

osdbase.h

Go to the documentation of this file.
00001 /*
00002  * osdbase.h: Basic interface to the On Screen Display
00003  *
00004  * See the main source file 'vdr.c' for copyright information and
00005  * how to reach the author.
00006  *
00007  * $Id: osdbase.h 1.16 2007/06/09 11:49:00 kls Exp $
00008  */
00009 
00010 #ifndef __OSDBASE_H
00011 #define __OSDBASE_H
00012 
00013 #include "config.h"
00014 #include "osd.h"
00015 #include "skins.h"
00016 #include "tools.h"
00017 
00018 enum eOSState { osUnknown,
00019                 osContinue,
00020                 osSchedule,
00021                 osChannels,
00022                 osTimers,
00023                 osRecordings,
00024                 osPlugin,
00025                 osSetup,
00026                 osCommands,
00027                 osPause,
00028                 osRecord,
00029                 osReplay,
00030                 osStopRecord,
00031                 osStopReplay,
00032                 osCancelEdit,
00033                 osSwitchDvb,
00034                 osBack,
00035                 osEnd,
00036                 os_User, // the following values can be used locally
00037                 osUser1,
00038                 osUser2,
00039                 osUser3,
00040                 osUser4,
00041                 osUser5,
00042                 osUser6,
00043                 osUser7,
00044                 osUser8,
00045                 osUser9,
00046                 osUser10,
00047               };
00048 
00049 class cOsdItem : public cListObject {
00050 private:
00051   char *text;
00052   eOSState state;
00053   bool selectable;
00054 protected:
00055   bool fresh;
00056 public:
00057   cOsdItem(eOSState State = osUnknown);
00058   cOsdItem(const char *Text, eOSState State = osUnknown, bool Selectable = true);
00059   virtual ~cOsdItem();
00060   bool Selectable(void) { return selectable; }
00061   void SetText(const char *Text, bool Copy = true);
00062   void SetSelectable(bool Selectable);
00063   void SetFresh(bool Fresh);
00064   const char *Text(void) { return text; }
00065   virtual void Set(void) {}
00066   virtual eOSState ProcessKey(eKeys Key);
00067   };
00068 
00069 class cOsdObject {
00070   friend class cOsdMenu;
00071 private:
00072   bool isMenu;
00073   bool needsFastResponse;
00074 protected:
00075   void SetNeedsFastResponse(bool NeedsFastResponse) { needsFastResponse = NeedsFastResponse; }
00076 public:
00077   cOsdObject(bool FastResponse = false) { isMenu = false; needsFastResponse = FastResponse; }
00078   virtual ~cOsdObject() {}
00079   virtual bool NeedsFastResponse(void) { return needsFastResponse; }
00080   bool IsMenu(void) { return isMenu; }
00081   virtual void Show(void);
00082   virtual eOSState ProcessKey(eKeys Key) { return osUnknown; }
00083   };
00084 
00085 class cOsdMenu : public cOsdObject, public cList<cOsdItem> {
00086 private:
00087   static cSkinDisplayMenu *displayMenu;
00088   static int displayMenuCount;
00089   static int displayMenuItems;
00090   char *title;
00091   int cols[cSkinDisplayMenu::MaxTabs];
00092   int first, current, marked;
00093   cOsdMenu *subMenu;
00094   const char *helpRed, *helpGreen, *helpYellow, *helpBlue;
00095   char *status;
00096   int digit;
00097   bool hasHotkeys;
00098 protected:
00099   void SetDisplayMenu(void);
00100   cSkinDisplayMenu *DisplayMenu(void) { return displayMenu; }
00101   const char *hk(const char *s);
00102   void SetCols(int c0, int c1 = 0, int c2 = 0, int c3 = 0, int c4 = 0);
00103   void SetHasHotkeys(bool HasHotkeys = true);
00104   virtual void Clear(void);
00105   bool SelectableItem(int idx);
00106   void SetCurrent(cOsdItem *Item);
00107   void RefreshCurrent(void);
00108   void DisplayCurrent(bool Current);
00109   void DisplayItem(cOsdItem *Item);
00110   void CursorUp(void);
00111   void CursorDown(void);
00112   void PageUp(void);
00113   void PageDown(void);
00114   void Mark(void);
00115   eOSState HotKey(eKeys Key);
00116   eOSState AddSubMenu(cOsdMenu *SubMenu);
00117   eOSState CloseSubMenu();
00118   bool HasSubMenu(void) { return subMenu; }
00119   void SetStatus(const char *s);
00120   void SetTitle(const char *Title);
00121   void SetHelp(const char *Red, const char *Green = NULL, const char *Yellow = NULL, const char *Blue = NULL);
00122   virtual void Del(int Index);
00123 public:
00124   cOsdMenu(const char *Title, int c0 = 0, int c1 = 0, int c2 = 0, int c3 = 0, int c4 = 0);
00125   virtual ~cOsdMenu();
00126   virtual bool NeedsFastResponse(void) { return subMenu ? subMenu->NeedsFastResponse() : cOsdObject::NeedsFastResponse(); }
00127   int Current(void) { return current; }
00128   void Add(cOsdItem *Item, bool Current = false, cOsdItem *After = NULL);
00129   void Ins(cOsdItem *Item, bool Current = false, cOsdItem *Before = NULL);
00130   virtual void Display(void);
00131   virtual eOSState ProcessKey(eKeys Key);
00132   };
00133 
00134 #endif //__OSDBASE_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines