vdr  2.0.2
osdbase.h
Go to the documentation of this file.
1 /*
2  * osdbase.h: Basic interface to the On Screen Display
3  *
4  * See the main source file 'vdr.c' for copyright information and
5  * how to reach the author.
6  *
7  * $Id: osdbase.h 2.5 2012/12/07 09:49:35 kls Exp $
8  */
9 
10 #ifndef __OSDBASE_H
11 #define __OSDBASE_H
12 
13 #include "config.h"
14 #include "osd.h"
15 #include "skins.h"
16 #include "tools.h"
17 
37  os_User, // the following values can be used locally
48  };
49 
50 class cOsdItem : public cListObject {
51 private:
52  char *text;
54  bool selectable;
55 protected:
56  bool fresh;
57 public:
58  cOsdItem(eOSState State = osUnknown);
59  cOsdItem(const char *Text, eOSState State = osUnknown, bool Selectable = true);
60  virtual ~cOsdItem();
61  bool Selectable(void) const { return selectable; }
62  void SetText(const char *Text, bool Copy = true);
63  void SetSelectable(bool Selectable);
64  void SetFresh(bool Fresh);
65  const char *Text(void) const { return text; }
66  virtual void Set(void) {}
67  virtual void SetMenuItem(cSkinDisplayMenu *DisplayMenu, int Index, bool Current, bool Selectable);
68  virtual eOSState ProcessKey(eKeys Key);
69  };
70 
71 class cOsdObject {
72  friend class cOsdMenu;
73 private:
74  bool isMenu;
76 protected:
78 public:
79  cOsdObject(bool FastResponse = false) { isMenu = false; needsFastResponse = FastResponse; }
80  virtual ~cOsdObject() {}
81  virtual bool NeedsFastResponse(void) { return needsFastResponse; }
82  bool IsMenu(void) const { return isMenu; }
83  virtual void Show(void);
84  virtual eOSState ProcessKey(eKeys Key) { return osUnknown; }
85  };
86 
87 class cOsdMenu : public cOsdObject, public cList<cOsdItem> {
88 private:
90  static int displayMenuCount;
92  char *title;
97  const char *helpRed, *helpGreen, *helpYellow, *helpBlue;
99  char *status;
100  int digit;
102  int key_nr;
104  void DisplayHelp(bool Force = false);
105 protected:
106  void SetDisplayMenu(void);
108  const char *hk(const char *s);
109  void SetCols(int c0, int c1 = 0, int c2 = 0, int c3 = 0, int c4 = 0);
110  void SetHasHotkeys(bool HasHotkeys = true);
111  virtual void Clear(void);
112  const char *Title(void) { return title; }
113  bool SelectableItem(int idx);
114  void SetCurrent(cOsdItem *Item);
115  void RefreshCurrent(void);
116  void DisplayCurrent(bool Current);
117  void DisplayItem(cOsdItem *Item);
118  void CursorUp(void);
119  void CursorDown(void);
120  void PageUp(void);
121  void PageDown(void);
122  void Mark(void);
123  eOSState HotKey(eKeys Key);
126  bool HasSubMenu(void) { return subMenu; }
127  cOsdMenu *SubMenu(void) { return subMenu; }
128  void SetStatus(const char *s);
129  void SetTitle(const char *Title);
130  void SetHelp(const char *Red, const char *Green = NULL, const char *Yellow = NULL, const char *Blue = NULL);
131  virtual void Del(int Index);
132 public:
133  cOsdMenu(const char *Title, int c0 = 0, int c1 = 0, int c2 = 0, int c3 = 0, int c4 = 0);
134  virtual ~cOsdMenu();
136  void SetMenuCategory(eMenuCategory MenuCategory);
137  int Current(void) const { return current; }
138  void Add(cOsdItem *Item, bool Current = false, cOsdItem *After = NULL);
139  void Ins(cOsdItem *Item, bool Current = false, cOsdItem *Before = NULL);
140  virtual void Display(void);
141  virtual eOSState ProcessKey(eKeys Key);
142  };
143 
144 #endif //__OSDBASE_H
145