Home

Dokumentation

Impressum

Dokumentation VDR
 

Main Page   Class Hierarchy   Alphabetical List   Data Structures   File List   Data Fields   Globals  

osd.h

Go to the documentation of this file.
00001 
00010 #ifndef __OSD_H
00011 #define __OSD_H
00012 
00013 #if defined(DEBUG_OSD)
00014 #include <ncurses.h>
00015 #endif
00016 #include "config.h"
00017 #include "osdbase.h"
00018 #include "interface.h"
00019 #include "osdbase.h"
00020 #include "tools.h"
00021 
00022 #define MAXOSDITEMS (Setup.OSDheight - 4)
00023 
00024 enum eOSState { osUnknown,
00025                 osContinue,
00026                 osSchedule,
00027                 osChannels,
00028                 osTimers,
00029                 osRecordings,
00030                 osPlugin,
00031                 osSetup,
00032                 osCommands,
00033                 osRecord,
00034                 osReplay,
00035                 osStopRecord,
00036                 osStopReplay,
00037                 osCancelEdit,
00038                 osSwitchDvb,
00039                 osBack,
00040                 osEnd,
00041                 os_User, // the following values can be used locally
00042                 osUser1,
00043                 osUser2,
00044                 osUser3,
00045                 osUser4,
00046                 osUser5,
00047                 osUser6,
00048                 osUser7,
00049                 osUser8,
00050                 osUser9,
00051                 osUser10,
00052               };
00053 
00055 class cOsd {
00056 private:
00057   enum {
00061  charWidth  = 12, // average character width
00062          
00066  lineHeight = 27  // smallest text height
00067        };
00068 
00069 #ifdef DEBUG_OSD
00070   static WINDOW *window;
00071   enum { MaxColorPairs = 16 };
00072   static int colorPairs[MaxColorPairs];
00073   static void SetColor(eDvbColor colorFg, eDvbColor colorBg = clrBackground);
00074 #else
00075   static cOsdBase *osd;
00076 #endif
00077   static int cols, rows;
00078 public:
00079   static void Initialize(void);
00080   static void Shutdown(void);
00081 
00087   static cOsdBase *OpenRaw(int x, int y);
00088   static void Open(int w, int h);
00089   static void Close(void);
00090   static void Clear(void);
00091   static void Fill(int x, int y, int w, int h, eDvbColor color = clrBackground);
00092   static void SetBitmap(int x, int y, const cBitmap &Bitmap);
00093   static void ClrEol(int x, int y, eDvbColor color = clrBackground);
00094   static int CellWidth(void);
00095   static int LineHeight(void);
00096   static int Width(unsigned char c);
00097   static int WidthInCells(const char *s);
00098   static eDvbFont SetFont(eDvbFont Font);
00099   static void Text(int x, int y, const char *s, eDvbColor colorFg = clrWhite, eDvbColor colorBg = clrBackground);
00100   static void Flush(void);
00101   };
00102 
00104 class cOsdItem : public cListObject {
00105 private:
00106   char *text;
00107   int offset;
00108   eOSState state;
00109 protected:
00110   bool fresh;
00111   bool userColor;
00112   eDvbColor fgColor, bgColor;
00113 public:
00114   cOsdItem(eOSState State = osUnknown);
00115   cOsdItem(const char *Text, eOSState State = osUnknown);
00116   virtual ~cOsdItem();
00117   bool HasUserColor(void) { return userColor; }
00118   void SetText(const char *Text, bool Copy = true);
00119   void SetColor(eDvbColor FgColor, eDvbColor BgColor = clrBackground);
00120   const char *Text(void) { return text; }
00121   virtual void Display(int Offset = -1, eDvbColor FgColor = clrWhite, eDvbColor BgColor = clrBackground);
00122   virtual void Set(void) {}
00123   virtual eOSState ProcessKey(eKeys Key);
00124   };
00125 
00127 class cOsdObject {
00128   friend class cOsdMenu;
00129 private:
00130   bool isMenu;
00131 protected:
00132   bool needsFastResponse;
00133 public:
00134   cOsdObject(bool FastResponse = false) { isMenu = false; needsFastResponse = FastResponse; }
00135   virtual ~cOsdObject() {}
00136   int Width(void) { return Interface->Width(); }
00137   int Height(void) { return Interface->Height(); }
00138   bool NeedsFastResponse(void) { return needsFastResponse; }
00139   bool IsMenu(void) { return isMenu; }
00140   virtual void Show(void) {}
00141   virtual eOSState ProcessKey(eKeys Key) { return osUnknown; }
00142   };
00143 
00145 class cOsdMenu : public cOsdObject, public cList<cOsdItem> {
00146 private:
00147   char *title;
00148   int cols[cInterface::MaxCols];
00149   int first, current, marked;
00150   cOsdMenu *subMenu;
00151   const char *helpRed, *helpGreen, *helpYellow, *helpBlue;
00152   char *status;
00153   int digit;
00154   bool hasHotkeys;
00155 protected:
00156 
00160   bool visible;
00161   const char *hk(const char *s);
00162   void SetHasHotkeys(void);
00163   virtual void Clear(void);
00164   bool SpecialItem(int idx);
00165   void SetCurrent(cOsdItem *Item);
00166   void RefreshCurrent(void);
00167   void DisplayCurrent(bool Current);
00168   void CursorUp(void);
00169   void CursorDown(void);
00170   void PageUp(void);
00171   void PageDown(void);
00172   void Mark(void);
00173   eOSState HotKey(eKeys Key);
00174   eOSState AddSubMenu(cOsdMenu *SubMenu);
00175   eOSState CloseSubMenu();
00176   bool HasSubMenu(void) { return subMenu; }
00177   void SetStatus(const char *s);
00178   void SetTitle(const char *Title, bool ShowDate = true);
00179   void SetHelp(const char *Red, const char *Green = NULL, const char *Yellow = NULL, const char *Blue = NULL);
00180   virtual void Del(int Index);
00181 public:
00182 
00186   cOsdMenu(const char *Title, int c0 = 0, int c1 = 0, int c2 = 0, int c3 = 0, int c4 = 0);
00187   virtual ~cOsdMenu();
00188   int Current(void) { return current; }
00189   void Add(cOsdItem *Item, bool Current = false, cOsdItem *After = NULL);
00190   void Ins(cOsdItem *Item, bool Current = false, cOsdItem *Before = NULL);
00191   void Display(void);
00192   virtual eOSState ProcessKey(eKeys Key);
00193   };
00194 
00195 #endif //__OSD_H
00196 

Generated on Wed Feb 5 23:30:10 2003 for VDR by doxygen1.3-rc2