diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2001-02-03 15:28:49 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2001-02-03 15:28:49 +0100 |
commit | 7f6a2a7a0c001c425efdab381914e7c297f61166 (patch) | |
tree | 044a9b08d0aef5e2aa997a1f8e2a659ef552f82f /osd.c | |
parent | caa96c00eaecd5f0c67f0575468dd088f2c8ee1e (diff) | |
download | vdr-7f6a2a7a0c001c425efdab381914e7c297f61166.tar.gz vdr-7f6a2a7a0c001c425efdab381914e7c297f61166.tar.bz2 |
Implemented hotkeys for Main and Commands menu
Diffstat (limited to 'osd.c')
-rw-r--r-- | osd.c | 20 |
1 files changed, 19 insertions, 1 deletions
@@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: osd.c 1.14 2001/02/03 14:26:18 kls Exp $ + * $Id: osd.c 1.15 2001/02/03 15:14:45 kls Exp $ */ #include "osd.h" @@ -77,6 +77,7 @@ eOSState cOsdItem::ProcessKey(eKeys Key) cOsdMenu::cOsdMenu(const char *Title, int c0, int c1, int c2, int c3, int c4) { + hasHotkeys = false; visible = false; title = strdup(Title); cols[0] = c0; @@ -290,6 +291,20 @@ void cOsdMenu::Mark(void) } } +eOSState cOsdMenu::HotKey(eKeys Key) +{ + for (cOsdItem *item = First(); item; item = Next(item)) { + const char *s = item->Text(); + if (s && (s = skipspace(s)) != NULL) { + if (*s == Key - k1 + '1') { + current = item->Index(); + return ProcessKey(kOk); + } + } + } + return osContinue; +} + eOSState cOsdMenu::AddSubMenu(cOsdMenu *SubMenu) { delete subMenu; @@ -319,6 +334,9 @@ eOSState cOsdMenu::ProcessKey(eKeys Key) return state; } switch (Key) { + case k1...k9: if (hasHotkeys) + return HotKey(Key); + break; case kUp|k_Repeat: case kUp: CursorUp(); break; case kDown|k_Repeat: |