diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2003-01-19 14:59:46 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2003-01-19 14:59:46 +0100 |
commit | 413b22dc636dbd78f7acd0dd816cde933fe6a78d (patch) | |
tree | ecedee45e76a4de00196c01743160910ce3a6403 /menuitems.c | |
parent | c1dcc3e5a597f6feb470c83577e4684a188dff1a (diff) | |
download | vdr-413b22dc636dbd78f7acd0dd816cde933fe6a78d.tar.gz vdr-413b22dc636dbd78f7acd0dd816cde933fe6a78d.tar.bz2 |
Implemented actual user input for CAM enquiry menus
Diffstat (limited to 'menuitems.c')
-rw-r--r-- | menuitems.c | 56 |
1 files changed, 55 insertions, 1 deletions
diff --git a/menuitems.c b/menuitems.c index c92d5318..56b91995 100644 --- a/menuitems.c +++ b/menuitems.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: menuitems.c 1.11 2002/12/15 11:05:19 kls Exp $ + * $Id: menuitems.c 1.12 2003/01/18 13:34:40 kls Exp $ */ #include "menuitems.h" @@ -109,6 +109,60 @@ void cMenuEditBoolItem::Set(void) SetValue(buf); } +// --- cMenuEditNumItem ------------------------------------------------------ + +cMenuEditNumItem::cMenuEditNumItem(const char *Name, char *Value, int Length, bool Blind) +:cMenuEditItem(Name) +{ + value = Value; + length = Length; + blind = Blind; + Set(); +} + +void cMenuEditNumItem::Set(void) +{ + if (blind) { + char buf[length + 1]; + int i; + for (i = 0; i < length && value[i]; i++) + buf[i] = '*'; + buf[i] = 0; + SetValue(buf); + } + else + SetValue(value); +} + +eOSState cMenuEditNumItem::ProcessKey(eKeys Key) +{ + eOSState state = cMenuEditItem::ProcessKey(Key); + + if (state == osUnknown) { + Key = NORMALKEY(Key); + switch (Key) { + case kLeft: { + int l = strlen(value); + if (l > 0) + value[l - 1] = 0; + } + break; + case k0 ... k9: { + int l = strlen(value); + if (l < length) { + value[l] = Key - k0 + '0'; + value[l + 1] = 0; + } + } + break; + default: return state; + } + Set(); + state = osContinue; + } + return state; +} + // --- cMenuEditChrItem ------------------------------------------------------ cMenuEditChrItem::cMenuEditChrItem(const char *Name, char *Value, const char *Allowed) |