vdr  2.0.4
menuitems.h
Go to the documentation of this file.
1 /*
2  * menuitems.h: General purpose menu items
3  *
4  * See the main source file 'vdr.c' for copyright information and
5  * how to reach the author.
6  *
7  * $Id: menuitems.h 2.8 2012/03/13 11:19:11 kls Exp $
8  */
9 
10 #ifndef __MENUITEMS_H
11 #define __MENUITEMS_H
12 
13 #include <limits.h>
14 #include "dvbdevice.h"
15 #include "osdbase.h"
16 
17 extern const char *FileNameChars;
18 
19 class cMenuEditItem : public cOsdItem {
20 private:
21  char *name;
22  const char *helpRed, *helpGreen, *helpYellow, *helpBlue;
24 protected:
25  void SetHelp(const char *Red, const char *Green = NULL, const char *Yellow = NULL, const char *Blue = NULL);
26 public:
27  cMenuEditItem(const char *Name);
29  void SetValue(const char *Value);
30  bool DisplayHelp(void);
31  };
32 
34 protected:
35  int *value;
36  int min, max;
37  const char *minString, *maxString;
38  virtual void Set(void);
39 public:
40  cMenuEditIntItem(const char *Name, int *Value, int Min = 0, int Max = INT_MAX, const char *MinString = NULL, const char *MaxString = NULL);
41  virtual eOSState ProcessKey(eKeys Key);
42  };
43 
45 protected:
46  const char *falseString, *trueString;
47  virtual void Set(void);
48 public:
49  cMenuEditBoolItem(const char *Name, int *Value, const char *FalseString = NULL, const char *TrueString = NULL);
50  };
51 
53 protected:
54  uint *value;
55  uint mask;
56  int bit;
57  virtual void Set(void);
58 public:
59  cMenuEditBitItem(const char *Name, uint *Value, uint Mask, const char *FalseString = NULL, const char *TrueString = NULL);
60  };
61 
63 protected:
64  char *value;
65  int length;
66  bool blind;
67  virtual void Set(void);
68 public:
69  cMenuEditNumItem(const char *Name, char *Value, int Length, bool Blind = false);
70  virtual eOSState ProcessKey(eKeys Key);
71  };
72 
74 protected:
75  double *value;
76  double min, max;
77  int decimals;
78  int factor;
79  virtual void Set(void);
80 public:
81  cMenuEditPrcItem(const char *Name, double *Value, double Min = 0.0, double Max = 1.0, int Decimals = 0);
82  virtual eOSState ProcessKey(eKeys Key);
83  };
84 
86 private:
87  char *value;
88  char *allowed;
89  const char *current;
90  virtual void Set(void);
91 public:
92  cMenuEditChrItem(const char *Name, char *Value, const char *Allowed);
94  virtual eOSState ProcessKey(eKeys Key);
95  };
96 
98 private:
99  char *value;
100  int length;
101  const char *allowed;
102  int pos, offset;
105  uint *valueUtf8;
106  uint *allowedUtf8;
107  uint *charMapUtf8;
111  void SetHelpKeys(void);
112  uint *IsAllowed(uint c);
113  void AdvancePos(void);
114  virtual void Set(void);
115  uint Inc(uint c, bool Up);
116  void Type(uint c);
117  void Insert(void);
118  void Delete(void);
119 protected:
120  void EnterEditMode(void);
121  void LeaveEditMode(bool SaveValue = false);
122  bool InEditMode(void) { return valueUtf8 != NULL; }
123 public:
124  cMenuEditStrItem(const char *Name, char *Value, int Length, const char *Allowed = NULL);
126  virtual eOSState ProcessKey(eKeys Key);
127  };
128 
130 private:
131  const char * const *strings;
132 protected:
133  virtual void Set(void);
134 public:
135  cMenuEditStraItem(const char *Name, int *Value, int NumStrings, const char * const *Strings);
136  };
137 
139 protected:
140  const char *noneString;
143  virtual void Set(void);
144 public:
145  cMenuEditChanItem(const char *Name, int *Value, const char *NoneString = NULL);
146  cMenuEditChanItem(const char *Name, cString *ChannelID, const char *NoneString = NULL);
147  virtual eOSState ProcessKey(eKeys Key);
148  };
149 
151 private:
152  int number;
153  int *source;
155 public:
156  cMenuEditTranItem(const char *Name, int *Value, int *Source);
157  virtual eOSState ProcessKey(eKeys Key);
158  };
159 
161 private:
162  static int days[];
163  time_t *value;
164  int *weekdays;
165  time_t oldvalue;
167  int dayindex;
168  int FindDayIndex(int WeekDays);
169  virtual void Set(void);
170 public:
171  cMenuEditDateItem(const char *Name, time_t *Value, int *WeekDays = NULL);
172  void ToggleRepeating(void);
173  virtual eOSState ProcessKey(eKeys Key);
174  };
175 
177 protected:
178  int *value;
179  int hh, mm;
180  int pos;
181  virtual void Set(void);
182 public:
183  cMenuEditTimeItem(const char *Name, int *Value);
184  virtual eOSState ProcessKey(eKeys Key);
185  };
186 
188 protected:
189  int *value;
191  const char *zeroString;
192  virtual void Set(void);
193 public:
194  cMenuEditMapItem(const char *Name, int *Value, const tDvbParameterMap *Map, const char *ZeroString = NULL);
195  virtual eOSState ProcessKey(eKeys Key);
196  };
197 
198 class cPlugin;
199 
200 class cMenuSetupPage : public cOsdMenu {
201 private:
203 protected:
204  void SetSection(const char *Section);
205  virtual void Store(void) = 0;
206  void SetupStore(const char *Name, const char *Value = NULL);
207  void SetupStore(const char *Name, int Value);
208 public:
209  cMenuSetupPage(void);
210  virtual eOSState ProcessKey(eKeys Key);
211  void SetPlugin(cPlugin *Plugin);
212  };
213 
214 #endif //__MENUITEMS_H
215