sanity checks for the timer
[enigma2.git] / lib / gui / einput.h
1 #ifndef __lib_gui_einput_h
2 #define __lib_gui_einput_h
3
4 #include <lib/gui/ewidget.h>
5 #include <lib/python/connections.h>
6
7 class eInputContent;
8
9 class eInput: public eWidget
10 {
11 public:
12         eInput(eWidget *parent);
13         virtual ~eInput();
14         PSignal0<void> changed;
15
16         int m_cursor;
17         
18         enum InputActions {
19                 moveLeft, 
20                 moveRight, 
21                 moveHome, 
22                 moveEnd,
23                 deleteForward,
24                 deleteBackward,
25                 toggleOverwrite,
26                 accept
27         };
28         
29         void setContent(eInputContent *cnt);
30         
31         void setOverwriteMode(int o);
32         
33         void setFont(gFont *font);
34 protected:
35         ePtr<gFont> m_font;
36         int m_mode, m_have_focus;
37         ePtr<eInputContent> m_content;
38         int event(int event, void *data=0, void *data2=0);
39 };
40
41 class eInputContent: public iObject
42 {
43 public:
44                 /* management stuff */
45         void setInput(eInput *widget);
46                 /* display stuff */
47         virtual void getDisplay(std::string &res, int &cursor)=0;
48
49                 /* movement / user actions */
50         enum {
51                 dirLeft, dirRight,
52                 dirHome, dirEnd,
53                         /* contents can define their own directions */
54                 dirUser
55         };
56         virtual void moveCursor(int dir)=0;
57         
58         enum {
59                 deleteForward, deleteBackward
60         };
61         virtual void deleteChar(int dir)=0;
62         
63                 /* no movement keys except stuff like '.' or so*/
64         virtual int haveKey(int code, int overwrite)=0;
65         
66         virtual int isValid()=0;
67         virtual void validate()=0;
68 protected:
69         eInput *m_input;
70 };
71
72 #endif