]> icculus.org git repositories - mikachu/openbox.git/blob - src/python.hh
load config options from the python environment
[mikachu/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 #include <string>
18
19 namespace ob {
20
21 void python_init(char *argv0);
22 bool python_exec(const char *file);
23 bool python_get_string(const char *name, std::string *value);
24
25 //! Add a python callback funtion to the back of the hook list
26 /*!
27   Registering functions for KeyPress events is pointless. Use python_bind
28   instead to do this.
29 */
30 bool python_register(int action, PyObject *callback);
31 //! Add a python callback funtion to the front of the hook list
32 /*!
33   Registering functions for KeyPress events is pointless. Use python_bind
34   instead to do this.
35 */
36 bool python_preregister(int action, PyObject *callback);
37 //! Remove a python callback function from the hook list
38 bool python_unregister(int action, PyObject *callback);
39
40 //! Removes all python callback functions from the hook list
41 bool python_unregister_all(int action);
42
43 //! Add a keybinding
44 /*!
45   @param keylist A python list of modifier/key/buttons, in the form:
46                  "C-A-space" or "A-Button1" etc.
47   @param callback A python function to call when the binding is used.
48 */
49 bool python_bind(PyObject *keylist, PyObject *callback);
50
51 bool python_unbind(PyObject *keylist);
52
53 void python_set_reset_key(const std::string &key);
54
55 void python_unbind_all();
56
57 //! Fire a python callback function
58 void python_callback(OBActions::ActionType action, Window window,
59                      OBWidget::WidgetType type, unsigned int state,
60                      long d1 = LONG_MIN, long d2 = LONG_MIN,
61                      long d3 = LONG_MIN, long d4 = LONG_MIN);
62
63 //! Fire a python callback function for a key binding
64 void python_callback_binding(int id, Window window, unsigned int state,
65                              unsigned int keybutton, Time time);
66
67 }
68
69 #endif // __python_hh