]> icculus.org git repositories - dana/openbox.git/blob - src/python.hh
bindings work. now they have a reset key too.
[dana/openbox.git] / src / python.hh
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
2 #ifndef   __python_hh
3 #define   __python_hh
4
5 /*! @file python.hh
6   @brief wee
7 */
8
9 #include "actions.hh"
10 #include "widget.hh"
11 #include "bindings.hh"
12
13 extern "C" {
14 #include <Python.h>
15 }
16
17 namespace ob {
18
19 //! Add a python callback funtion to the back of the hook list
20 /*!
21   Registering functions for KeyPress events is pointless. Use python_bind_key
22   instead to do this.
23 */
24 bool python_register(int action, PyObject *callback);
25 //! Add a python callback funtion to the front of the hook list
26 /*!
27   Registering functions for KeyPress events is pointless. Use python_bind_key
28   instead to do this.
29 */
30 bool python_preregister(int action, PyObject *callback);
31 //! Remove a python callback function from the hook list
32 bool python_unregister(int action, PyObject *callback);
33
34 //! Removes all python callback functions from the hook list
35 bool python_unregister_all(int action);
36
37 //! Add a keybinding
38 /*!
39   @param keylist A python list of modifier/key/buttons, in the form:
40                  "C-A-space" or "A-Button1" etc.
41   @param callback A python function to call when the binding is used.
42 */
43 bool python_bind_key(PyObject *keylist, PyObject *callback);
44
45 bool python_unbind_key(PyObject *keylist);
46
47 void python_set_reset_key(const std::string &key);
48
49 //! Adds a mouse binding
50 /*!
51   Bindings do not generate motion events. You can only handle motion events by
52   using register to set a function for all motion events. Bindings do generate
53   ButtonPress, ButtonRelease, Click, and DoubleClick events.
54 */
55 bool python_bind_mouse(const std::string &button, PyObject *callback);
56
57 bool python_unbind_mouse(const std::string &button);
58
59 void python_unbind_all();
60
61 //! Fire a python callback function
62 void python_callback(OBActions::ActionType action, Window window,
63                      OBWidget::WidgetType type, unsigned int state,
64                      long d1 = LONG_MIN, long d2 = LONG_MIN,
65                      long d3 = LONG_MIN, long d4 = LONG_MIN);
66
67 void python_callback_binding(int id, OBActions::ActionType action,
68                              Window window, unsigned int state,
69                              unsigned int keybutton, Time time);
70
71 }
72
73 #endif // __python_hh