]> icculus.org git repositories - mikachu/openbox.git/blob - src/openbox.i
working popups for moving/resizing
[mikachu/openbox.git] / src / openbox.i
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
2
3 %module ob
4
5 %{
6 #ifdef HAVE_CONFIG_H
7 #  include "../config.h"
8 #endif
9
10 #include "frame.hh"
11 #include "openbox.hh"
12 #include "screen.hh"
13 #include "client.hh"
14 #include "bindings.hh"
15 #include "actions.hh"
16 #include "python.hh"
17 #include "otk/otk.hh"
18 %}
19
20 %include "stl.i"
21 //%include std_list.i
22 //%template(ClientList) std::list<Client*>;
23
24 %ignore ob::openbox;
25 %inline %{
26   ob::Openbox *Openbox_instance() { return ob::openbox; }
27 %};
28
29 %{
30 namespace ob {
31 void python_callback(PyObject *func, MouseData *data)
32 {
33   PyObject *arglist;
34   PyObject *result;
35
36   arglist = Py_BuildValue("(O)", SWIG_NewPointerObj((void *) data,
37                                                     SWIGTYPE_p_ob__MouseData,
38                                                     0));
39   
40   // call the callback
41   result = PyEval_CallObject(func, arglist);
42   if (!result || PyErr_Occurred()) {
43     // an exception occured in the script, display it
44     PyErr_Print();
45   }
46
47   Py_XDECREF(result);
48   Py_DECREF(arglist);
49 }
50
51 void python_callback(PyObject *func, EventData *data)
52 {
53   PyObject *arglist;
54   PyObject *result;
55
56   arglist = Py_BuildValue("(O)", SWIG_NewPointerObj((void *) data,
57                                                     SWIGTYPE_p_ob__EventData,
58                                                     0));
59   
60   // call the callback
61   result = PyEval_CallObject(func, arglist);
62   if (!result || PyErr_Occurred()) {
63     // an exception occured in the script, display it
64     PyErr_Print();
65   }
66
67   Py_XDECREF(result);
68   Py_DECREF(arglist);
69 }
70
71 void python_callback(PyObject *func, KeyData *data)
72 {
73   PyObject *arglist;
74   PyObject *result;
75
76   arglist = Py_BuildValue("(O)", SWIG_NewPointerObj((void *) data,
77                                                     SWIGTYPE_p_ob__KeyData,
78                                                     0));
79   
80   // call the callback
81   result = PyEval_CallObject(func, arglist);
82   if (!result || PyErr_Occurred()) {
83     // an exception occured in the script, display it
84     PyErr_Print();
85   }
86
87   Py_XDECREF(result);
88   Py_DECREF(arglist);
89 }
90
91 }
92 %}
93
94 #ignore ob::openbox;
95
96 %ignore ob::Screen::clients;
97 %{
98   #include <iterator>
99 %}
100 %extend ob::Screen {
101   Client *client(int i) {
102     if (i < 0 || i >= (int)self->clients.size())
103       return NULL;
104     ob::Client::List::iterator it = self->clients.begin();
105     std::advance(it,i);
106     return *it;
107   }
108   int clientCount() const {
109     return (int) self->clients.size();
110   }
111 };
112
113 /*
114 %include "../otk/ustring.i"
115
116 %ignore otk::display;
117 %inline %{
118   otk::Display *Display_instance() { return otk::display; }
119 %};
120
121 %ignore otk::Property::atoms;
122 %inline %{
123   const otk::Atoms& Property_atoms() { return otk::Property::atoms; }
124 %};
125
126 %include "../otk/display.hh"
127 %include "../otk/point.hh"
128 %include "../otk/property.hh"
129 %include "../otk/rect.hh"
130 %include "../otk/screeninfo.hh"
131 %include "../otk/strut.hh"
132
133 %include "../otk/eventhandler.hh"
134 %include "../otk/eventdispatcher.hh"
135
136 %import "../otk/widget.hh"
137 */
138 %import "../otk/otk.i"
139
140 %import "widgetbase.hh"
141 %import "actions.hh"
142
143 %include "openbox.hh"
144 %include "screen.hh"
145 %include "client.hh"
146 %include "frame.hh"
147 %include "python.hh"
148
149 // for Mod1Mask etc
150 %include "X11/X.h"