vdr  1.7.31
include/vdr/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.4 2012/04/23 09:40:07 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 eOSState ProcessKey(eKeys Key);
68  };
69 
70 class cOsdObject {
71  friend class cOsdMenu;
72 private:
73  bool isMenu;
75 protected:
77 public:
78  cOsdObject(bool FastResponse = false) { isMenu = false; needsFastResponse = FastResponse; }
79  virtual ~cOsdObject() {}
80  virtual bool NeedsFastResponse(void) { return needsFastResponse; }
81  bool IsMenu(void) const { return isMenu; }
82  virtual void Show(void);
83  virtual eOSState ProcessKey(eKeys Key) { return osUnknown; }
84  };
85 
86 class cOsdMenu : public cOsdObject, public cList<cOsdItem> {
87 private:
89  static int displayMenuCount;
91  char *title;
96  const char *helpRed, *helpGreen, *helpYellow, *helpBlue;
98  char *status;
99  int digit;
101  int key_nr;
103  void DisplayHelp(bool Force = false);
104 protected:
105  void SetDisplayMenu(void);
107  const char *hk(const char *s);
108  void SetCols(int c0, int c1 = 0, int c2 = 0, int c3 = 0, int c4 = 0);
109  void SetHasHotkeys(bool HasHotkeys = true);
110  virtual void Clear(void);
111  const char *Title(void) { return title; }
112  bool SelectableItem(int idx);
113  void SetCurrent(cOsdItem *Item);
114  void RefreshCurrent(void);
115  void DisplayCurrent(bool Current);
116  void DisplayItem(cOsdItem *Item);
117  void CursorUp(void);
118  void CursorDown(void);
119  void PageUp(void);
120  void PageDown(void);
121  void Mark(void);
122  eOSState HotKey(eKeys Key);
125  bool HasSubMenu(void) { return subMenu; }
126  cOsdMenu *SubMenu(void) { return subMenu; }
127  void SetStatus(const char *s);
128  void SetTitle(const char *Title);
129  void SetHelp(const char *Red, const char *Green = NULL, const char *Yellow = NULL, const char *Blue = NULL);
130  virtual void Del(int Index);
131 public:
132  cOsdMenu(const char *Title, int c0 = 0, int c1 = 0, int c2 = 0, int c3 = 0, int c4 = 0);
133  virtual ~cOsdMenu();
135  void SetMenuCategory(eMenuCategory MenuCategory);
136  int Current(void) const { return current; }
137  void Add(cOsdItem *Item, bool Current = false, cOsdItem *After = NULL);
138  void Ins(cOsdItem *Item, bool Current = false, cOsdItem *Before = NULL);
139  virtual void Display(void);
140  virtual eOSState ProcessKey(eKeys Key);
141  };
142 
143 #endif //__OSDBASE_H