make menu text translatable
[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 {
19                 INPUT_ACTIONS,
20                 ASCII_ACTIONS
21         };
22
23         enum InputActions {
24                 moveLeft, 
25                 moveRight, 
26                 moveHome, 
27                 moveEnd,
28                 deleteForward,
29                 deleteBackward,
30                 toggleOverwrite,
31                 accept
32         };
33
34         enum AsciiActions {
35                 gotAsciiCode
36         };
37
38         void setContent(eInputContent *cnt);
39         
40         void setOverwriteMode(int o);
41         
42         void setFont(gFont *font);
43 protected:
44         ePtr<gFont> m_font;
45         int m_mode, m_have_focus;
46         ePtr<eInputContent> m_content;
47         int event(int event, void *data=0, void *data2=0);
48 };
49
50 class eInputContent: public iObject
51 {
52 public:
53                 /* management stuff */
54         void setInput(eInput *widget);
55                 /* display stuff */
56         virtual void getDisplay(std::string &res, int &cursor)=0;
57
58                 /* movement / user actions */
59         enum {
60                 dirLeft, dirRight,
61                 dirHome, dirEnd,
62                         /* contents can define their own directions */
63                 dirUser
64         };
65         virtual void moveCursor(int dir)=0;
66         
67         enum {
68                 deleteForward, deleteBackward
69         };
70         virtual void deleteChar(int dir)=0;
71         
72                 /* no movement keys except stuff like '.' or so*/
73         virtual int haveKey(int code, int overwrite)=0;
74         
75         virtual int isValid()=0;
76         virtual void validate()=0;
77 protected:
78         eInput *m_input;
79 };
80
81 #endif