remove unneeded workaround
[vuplus_dvbapp] / 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 <lib/python/python.h>
11 #include <string>
12 #include <map>
13
14 class eWidget;
15
16 SWIG_IGNORE(eActionMap);
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, SWIG_PYOBJECT(ePyObject) function);
33         void unbindAction(const std::string &context, SWIG_PYOBJECT(ePyObject) 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(const std::string &device, int key, int flags);
38         
39 #ifndef SWIG
40         static RESULT getInstance(ePtr<eActionMap> &);
41 private:
42         static eActionMap *instance;
43         struct eActionBinding
44         {
45 //              eActionContext *m_context;
46                 std::string m_context; // FIXME
47                 
48                 ePyObject 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                 std::string 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                 std::string 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 SWIG_TEMPLATE_TYPEDEF(ePtr<eActionMap>, eActionMap);
83 SWIG_EXTEND(ePtr<eActionMap>,
84         static ePtr<eActionMap> getInstance()
85         {
86                 extern ePtr<eActionMap> NewActionMapPtr(void);
87                 return NewActionMapPtr();
88         }
89 );
90
91 #endif