show "in timer" icon also in multiepg
[enigma2.git] / lib / actions / action.h
1 #ifndef __lib_driver_action_h
2 #define __lib_driver_action_h
3
4 #include <lib/base/object.h>
5
6                 /* avoid warnigs :) */
7 #include <features.h>
8 #undef _POSIX_C_SOURCE
9 #define _POSIX_C_SOURCE 200112L
10 #include <Python.h>
11 #include <lib/python/python.h>
12 #include <string>
13 #include <map>
14
15 class eWidget;
16
17 class eActionMap: public iObject
18 {
19 DECLARE_REF(eActionMap);
20 #ifdef SWIG
21         eActionMap();
22         ~eActionMap();
23 #endif
24 public:
25 #ifndef SWIG
26         eActionMap();
27         ~eActionMap();
28         void bindAction(const std::string &context, int priority, int id, eWidget *widget);
29         void unbindAction(eWidget *widget, int id);
30 #endif
31
32         void bindAction(const std::string &context, int priority, PyObject *function);
33         void unbindAction(const std::string &context, PyObject *function);
34         
35         void bindKey(const std::string &device, int key, int flags, const std::string &context, const std::string &action);
36         
37         void keyPressed(int device, int key, int flags);
38         
39         static RESULT getInstance(ePtr<eActionMap> &ptr);
40 #ifndef SWIG
41 private:
42         static eActionMap *instance;
43         struct eActionBinding
44         {
45 //              eActionContext *m_context;
46                 std::string m_context; // FIXME
47                 
48                 PyObject *m_fnc;
49                 
50                 eWidget *m_widget;
51                 int m_id;
52         };
53         
54         std::multimap<int, eActionBinding> m_bindings;
55
56         friend struct compare_string_keybind_native;
57         struct eNativeKeyBinding
58         {
59                 int m_device;
60                 int m_key;
61                 int m_flags;
62                 
63 //              eActionContext *m_context;
64                 int m_action;
65         };
66         
67         std::multimap<std::string, eNativeKeyBinding> m_native_keys;
68         
69         friend struct compare_string_keybind_python;
70         struct ePythonKeyBinding
71         {
72                 int m_device;
73                 int m_key;
74                 int m_flags;
75                 
76                 std::string m_action;
77         };
78         
79         std::multimap<std::string, ePythonKeyBinding> m_python_keys;
80 #endif
81 };
82
83 #endif