2002-05-09 16:26:56 +02:00
|
|
|
/*
|
|
|
|
* menuitems.h: General purpose menu items
|
|
|
|
*
|
|
|
|
* See the main source file 'vdr.c' for copyright information and
|
|
|
|
* how to reach the author.
|
|
|
|
*
|
2013-08-21 11:02:52 +02:00
|
|
|
* $Id: menuitems.h 3.1 2013/05/24 10:19:55 kls Exp $
|
2002-05-09 16:26:56 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __MENUITEMS_H
|
|
|
|
#define __MENUITEMS_H
|
|
|
|
|
2008-02-16 16:12:21 +01:00
|
|
|
#include <limits.h>
|
2010-02-28 12:19:50 +01:00
|
|
|
#include "dvbdevice.h"
|
2004-05-16 10:35:36 +02:00
|
|
|
#include "osdbase.h"
|
2002-05-09 16:26:56 +02:00
|
|
|
|
2002-08-15 11:28:26 +02:00
|
|
|
extern const char *FileNameChars;
|
|
|
|
|
2002-05-09 16:26:56 +02:00
|
|
|
class cMenuEditItem : public cOsdItem {
|
|
|
|
private:
|
2002-08-11 13:32:23 +02:00
|
|
|
char *name;
|
2012-03-02 15:49:57 +01:00
|
|
|
const char *helpRed, *helpGreen, *helpYellow, *helpBlue;
|
|
|
|
bool helpDisplayed;
|
|
|
|
protected:
|
|
|
|
void SetHelp(const char *Red, const char *Green = NULL, const char *Yellow = NULL, const char *Blue = NULL);
|
2002-05-09 16:26:56 +02:00
|
|
|
public:
|
|
|
|
cMenuEditItem(const char *Name);
|
|
|
|
~cMenuEditItem();
|
|
|
|
void SetValue(const char *Value);
|
2013-08-21 11:02:52 +02:00
|
|
|
bool DisplayHelp(bool Current);
|
2002-05-09 16:26:56 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
class cMenuEditIntItem : public cMenuEditItem {
|
|
|
|
protected:
|
|
|
|
int *value;
|
|
|
|
int min, max;
|
2006-04-09 12:05:05 +02:00
|
|
|
const char *minString, *maxString;
|
2002-05-09 16:26:56 +02:00
|
|
|
virtual void Set(void);
|
|
|
|
public:
|
2006-04-09 12:05:05 +02:00
|
|
|
cMenuEditIntItem(const char *Name, int *Value, int Min = 0, int Max = INT_MAX, const char *MinString = NULL, const char *MaxString = NULL);
|
2002-05-09 16:26:56 +02:00
|
|
|
virtual eOSState ProcessKey(eKeys Key);
|
|
|
|
};
|
|
|
|
|
|
|
|
class cMenuEditBoolItem : public cMenuEditIntItem {
|
|
|
|
protected:
|
|
|
|
const char *falseString, *trueString;
|
|
|
|
virtual void Set(void);
|
|
|
|
public:
|
|
|
|
cMenuEditBoolItem(const char *Name, int *Value, const char *FalseString = NULL, const char *TrueString = NULL);
|
|
|
|
};
|
|
|
|
|
2004-02-29 14:21:22 +01:00
|
|
|
class cMenuEditBitItem : public cMenuEditBoolItem {
|
|
|
|
protected:
|
2006-01-06 14:31:57 +01:00
|
|
|
uint *value;
|
|
|
|
uint mask;
|
2004-02-29 14:21:22 +01:00
|
|
|
int bit;
|
|
|
|
virtual void Set(void);
|
|
|
|
public:
|
2006-01-06 14:31:57 +01:00
|
|
|
cMenuEditBitItem(const char *Name, uint *Value, uint Mask, const char *FalseString = NULL, const char *TrueString = NULL);
|
2004-02-29 14:21:22 +01:00
|
|
|
};
|
|
|
|
|
2003-01-19 14:59:46 +01:00
|
|
|
class cMenuEditNumItem : public cMenuEditItem {
|
|
|
|
protected:
|
|
|
|
char *value;
|
|
|
|
int length;
|
|
|
|
bool blind;
|
|
|
|
virtual void Set(void);
|
|
|
|
public:
|
|
|
|
cMenuEditNumItem(const char *Name, char *Value, int Length, bool Blind = false);
|
|
|
|
virtual eOSState ProcessKey(eKeys Key);
|
|
|
|
};
|
|
|
|
|
2013-08-21 11:02:52 +02:00
|
|
|
class cMenuEditIntxItem : public cMenuEditIntItem {
|
|
|
|
private:
|
|
|
|
int factor;
|
|
|
|
const char *negString, *posString;
|
|
|
|
void SetHelpKeys(void);
|
|
|
|
virtual void Set(void);
|
|
|
|
public:
|
|
|
|
cMenuEditIntxItem(const char *Name, int *Value, int Min = INT_MIN, int Max = INT_MAX, int Factor = 1, const char *NegString = NULL, const char *PosString = NULL);
|
|
|
|
virtual eOSState ProcessKey(eKeys Key);
|
|
|
|
};
|
|
|
|
|
2009-05-03 14:15:21 +02:00
|
|
|
class cMenuEditPrcItem : public cMenuEditItem {
|
|
|
|
protected:
|
|
|
|
double *value;
|
|
|
|
double min, max;
|
|
|
|
int decimals;
|
|
|
|
int factor;
|
|
|
|
virtual void Set(void);
|
|
|
|
public:
|
|
|
|
cMenuEditPrcItem(const char *Name, double *Value, double Min = 0.0, double Max = 1.0, int Decimals = 0);
|
|
|
|
virtual eOSState ProcessKey(eKeys Key);
|
|
|
|
};
|
|
|
|
|
2002-05-09 16:26:56 +02:00
|
|
|
class cMenuEditChrItem : public cMenuEditItem {
|
|
|
|
private:
|
|
|
|
char *value;
|
2002-08-11 13:32:23 +02:00
|
|
|
char *allowed;
|
2002-05-09 16:26:56 +02:00
|
|
|
const char *current;
|
|
|
|
virtual void Set(void);
|
|
|
|
public:
|
|
|
|
cMenuEditChrItem(const char *Name, char *Value, const char *Allowed);
|
|
|
|
~cMenuEditChrItem();
|
|
|
|
virtual eOSState ProcessKey(eKeys Key);
|
|
|
|
};
|
|
|
|
|
|
|
|
class cMenuEditStrItem : public cMenuEditItem {
|
|
|
|
private:
|
|
|
|
char *value;
|
|
|
|
int length;
|
2007-06-10 13:02:43 +02:00
|
|
|
const char *allowed;
|
|
|
|
int pos, offset;
|
2002-05-09 16:26:56 +02:00
|
|
|
bool insert, newchar, uppercase;
|
2007-06-10 13:02:43 +02:00
|
|
|
int lengthUtf8;
|
|
|
|
uint *valueUtf8;
|
|
|
|
uint *allowedUtf8;
|
|
|
|
uint *charMapUtf8;
|
|
|
|
uint *currentCharUtf8;
|
2006-01-06 16:57:41 +01:00
|
|
|
eKeys lastKey;
|
2006-01-21 12:27:14 +01:00
|
|
|
cTimeMs autoAdvanceTimeout;
|
2002-05-09 16:26:56 +02:00
|
|
|
void SetHelpKeys(void);
|
2007-06-10 13:02:43 +02:00
|
|
|
uint *IsAllowed(uint c);
|
2006-01-21 12:27:14 +01:00
|
|
|
void AdvancePos(void);
|
2002-05-09 16:26:56 +02:00
|
|
|
virtual void Set(void);
|
2007-06-10 13:02:43 +02:00
|
|
|
uint Inc(uint c, bool Up);
|
2010-06-06 10:56:11 +02:00
|
|
|
void Type(uint c);
|
2007-06-10 13:02:43 +02:00
|
|
|
void Insert(void);
|
|
|
|
void Delete(void);
|
2006-01-03 12:50:58 +01:00
|
|
|
protected:
|
2007-06-10 13:02:43 +02:00
|
|
|
void EnterEditMode(void);
|
|
|
|
void LeaveEditMode(bool SaveValue = false);
|
|
|
|
bool InEditMode(void) { return valueUtf8 != NULL; }
|
2002-05-09 16:26:56 +02:00
|
|
|
public:
|
2007-11-03 15:06:00 +01:00
|
|
|
cMenuEditStrItem(const char *Name, char *Value, int Length, const char *Allowed = NULL);
|
2002-05-09 16:26:56 +02:00
|
|
|
~cMenuEditStrItem();
|
|
|
|
virtual eOSState ProcessKey(eKeys Key);
|
|
|
|
};
|
|
|
|
|
|
|
|
class cMenuEditStraItem : public cMenuEditIntItem {
|
|
|
|
private:
|
|
|
|
const char * const *strings;
|
|
|
|
protected:
|
|
|
|
virtual void Set(void);
|
|
|
|
public:
|
|
|
|
cMenuEditStraItem(const char *Name, int *Value, int NumStrings, const char * const *Strings);
|
|
|
|
};
|
|
|
|
|
2004-03-28 09:20:02 +02:00
|
|
|
class cMenuEditChanItem : public cMenuEditIntItem {
|
|
|
|
protected:
|
2006-04-09 12:05:05 +02:00
|
|
|
const char *noneString;
|
2011-06-13 14:48:41 +02:00
|
|
|
int dummyValue;
|
|
|
|
cString *channelID;
|
2004-03-28 09:20:02 +02:00
|
|
|
virtual void Set(void);
|
|
|
|
public:
|
2006-04-09 12:05:05 +02:00
|
|
|
cMenuEditChanItem(const char *Name, int *Value, const char *NoneString = NULL);
|
2011-06-13 14:48:41 +02:00
|
|
|
cMenuEditChanItem(const char *Name, cString *ChannelID, const char *NoneString = NULL);
|
2004-03-28 09:20:02 +02:00
|
|
|
virtual eOSState ProcessKey(eKeys Key);
|
|
|
|
};
|
|
|
|
|
|
|
|
class cMenuEditTranItem : public cMenuEditChanItem {
|
|
|
|
private:
|
|
|
|
int number;
|
2004-05-16 12:58:04 +02:00
|
|
|
int *source;
|
2006-04-01 09:12:38 +02:00
|
|
|
int *transponder;
|
2004-03-28 09:20:02 +02:00
|
|
|
public:
|
2004-05-16 12:58:04 +02:00
|
|
|
cMenuEditTranItem(const char *Name, int *Value, int *Source);
|
2004-03-28 09:20:02 +02:00
|
|
|
virtual eOSState ProcessKey(eKeys Key);
|
|
|
|
};
|
|
|
|
|
2005-03-19 15:38:43 +01:00
|
|
|
class cMenuEditDateItem : public cMenuEditItem {
|
2004-11-21 13:28:05 +01:00
|
|
|
private:
|
2004-03-28 09:20:02 +02:00
|
|
|
static int days[];
|
|
|
|
time_t *value;
|
2005-03-19 15:38:43 +01:00
|
|
|
int *weekdays;
|
|
|
|
time_t oldvalue;
|
2012-03-13 11:27:54 +01:00
|
|
|
int oldweekdays;
|
2005-03-19 15:38:43 +01:00
|
|
|
int dayindex;
|
2005-11-11 13:31:02 +01:00
|
|
|
int FindDayIndex(int WeekDays);
|
2004-03-28 09:20:02 +02:00
|
|
|
virtual void Set(void);
|
|
|
|
public:
|
2005-03-19 15:38:43 +01:00
|
|
|
cMenuEditDateItem(const char *Name, time_t *Value, int *WeekDays = NULL);
|
2012-03-08 13:51:00 +01:00
|
|
|
void ToggleRepeating(void);
|
2004-03-28 09:20:02 +02:00
|
|
|
virtual eOSState ProcessKey(eKeys Key);
|
|
|
|
};
|
|
|
|
|
|
|
|
class cMenuEditTimeItem : public cMenuEditItem {
|
|
|
|
protected:
|
|
|
|
int *value;
|
|
|
|
int hh, mm;
|
|
|
|
int pos;
|
|
|
|
virtual void Set(void);
|
|
|
|
public:
|
|
|
|
cMenuEditTimeItem(const char *Name, int *Value);
|
|
|
|
virtual eOSState ProcessKey(eKeys Key);
|
|
|
|
};
|
|
|
|
|
2008-04-12 13:39:12 +02:00
|
|
|
class cMenuEditMapItem : public cMenuEditItem {
|
|
|
|
protected:
|
|
|
|
int *value;
|
2010-02-28 12:19:50 +01:00
|
|
|
const tDvbParameterMap *map;
|
2008-04-12 13:39:12 +02:00
|
|
|
const char *zeroString;
|
|
|
|
virtual void Set(void);
|
|
|
|
public:
|
2010-02-28 12:19:50 +01:00
|
|
|
cMenuEditMapItem(const char *Name, int *Value, const tDvbParameterMap *Map, const char *ZeroString = NULL);
|
2008-04-12 13:39:12 +02:00
|
|
|
virtual eOSState ProcessKey(eKeys Key);
|
|
|
|
};
|
|
|
|
|
2002-05-11 13:44:58 +02:00
|
|
|
class cPlugin;
|
|
|
|
|
2002-05-09 16:26:56 +02:00
|
|
|
class cMenuSetupPage : public cOsdMenu {
|
2002-05-11 13:44:58 +02:00
|
|
|
private:
|
|
|
|
cPlugin *plugin;
|
2002-05-09 16:26:56 +02:00
|
|
|
protected:
|
2002-05-11 13:44:58 +02:00
|
|
|
void SetSection(const char *Section);
|
|
|
|
virtual void Store(void) = 0;
|
|
|
|
void SetupStore(const char *Name, const char *Value = NULL);
|
|
|
|
void SetupStore(const char *Name, int Value);
|
2002-05-09 16:26:56 +02:00
|
|
|
public:
|
|
|
|
cMenuSetupPage(void);
|
|
|
|
virtual eOSState ProcessKey(eKeys Key);
|
2002-05-11 13:44:58 +02:00
|
|
|
void SetPlugin(cPlugin *Plugin);
|
2002-05-09 16:26:56 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif //__MENUITEMS_H
|