]> Dogcows Code - chaz/openbox/blob - src/python.hh
rm the python api docs
[chaz/openbox] / 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 "otk/point.hh"
10 #include "otk/rect.hh"
11 #include "otk/property.hh"
12 #include "otk/display.hh"
13 #include "otk/ustring.hh"
14
15 extern "C" {
16 #include <X11/Xlib.h>
17 }
18
19 #include <string>
20 #include <vector>
21
22
23 namespace ob {
24
25 class Client;
26
27 struct MouseContext {
28 enum MC {
29 Frame,
30 Titlebar,
31 Handle,
32 Window,
33 IconButton,
34 MaximizeButton,
35 CloseButton,
36 IconifyButton,
37 AllDesktopsButton,
38 Grip,
39 Root,
40 MenuItem
41 #ifndef DOXYGEN_IGNORE
42 , NUM_MOUSE_CONTEXT
43 #endif
44 };
45 };
46
47 struct MouseAction {
48 enum MA {
49 Press,
50 Release,
51 Click,
52 DoubleClick,
53 Motion
54 #ifndef DOXYGEN_IGNORE
55 , NUM_MOUSE_ACTION
56 #endif
57 };
58 };
59
60 struct KeyContext {
61 enum KC {
62 Menu,
63 All
64 #ifndef DOXYGEN_IGNORE
65 , NUM_KEY_CONTEXT
66 #endif
67 };
68 };
69
70 struct KeyAction {
71 enum KA {
72 Press,
73 Release
74 #ifndef DOXYGEN_IGNORE
75 , NUM_KEY_ACTION
76 #endif
77 };
78 };
79
80 struct EventAction {
81 enum EA {
82 EnterWindow, //!< Occurs when the mouse enters a window
83 LeaveWindow, //!< Occurs when the mouse leaves a window
84 //! Occurs while a window is being managed. The handler should call
85 //! Client::move on the window
86 PlaceWindow,
87 //! Occurs while a window is being managed, just before the window is
88 //! displayed
89 /*!
90 Note that the window's state may not be completely stabilized by this
91 point. The NewWindow event should be used when possible.
92 */
93 DisplayingWindow,
94 //! Occurs when a window is finished being managed
95 NewWindow,
96 //! Occurs when a window has been closed and is going to be unmanaged
97 CloseWindow,
98 //! Occurs when the window manager manages a screen
99 /*!
100 This event occurs on each managed screen during startup.
101 */
102 Startup,
103 //! Occurs when the window manager unmanages a screen
104 /*!
105 This event occurs on each managed screen during shutdown.
106 */
107 Shutdown,
108 //! Occurs when the input focus target changes
109 /*!
110 The data.client will be None of no client is focused.
111 */
112 Focus,
113 //! Occurs when the system is fired through X.
114 /*!
115 The data.client will hold the client associated with the bell if
116 one has been specified, or None.
117 */
118 Bell,
119 //! Occurs when a client toggles its urgent status.
120 /*!
121 The Client::urgent method can be used to get the status.
122 */
123 UrgentWindow
124 #ifndef DOXYGEN_IGNORE
125 , NUM_EVENT_ACTION
126 #endif
127 };
128 };
129
130 class MouseData {
131 public:
132 int screen;
133 Client *client;
134 Time time;
135 unsigned int state;
136 unsigned int button;
137 MouseContext::MC context;
138 MouseAction::MA action;
139 int xroot;
140 int yroot;
141 int pressx;
142 int pressy;
143 int press_clientx;
144 int press_clienty;
145 int press_clientwidth;
146 int press_clientheight;
147
148 MouseData(int screen, Client *client, Time time, unsigned int state,
149 unsigned int button, MouseContext::MC context,
150 MouseAction::MA action, int xroot, int yroot,
151 const otk::Point &initpos, const otk::Rect &initarea) {
152 this->screen = screen;
153 this->client = client;
154 this->time = time;
155 this->state = state;
156 this->button = button;
157 this->context= context;
158 this->action = action;
159 this->xroot = xroot;
160 this->yroot = yroot;
161 this->pressx = initpos.x();
162 this->pressy = initpos.y();
163 this->press_clientx = initarea.x();
164 this->press_clienty = initarea.y();
165 this->press_clientwidth = initarea.width();
166 this->press_clientheight = initarea.height();
167 }
168 MouseData(int screen, Client *client, Time time, unsigned int state,
169 unsigned int button, MouseContext::MC context,
170 MouseAction::MA action) {
171 this->screen = screen;
172 this->client = client;
173 this->time = time;
174 this->state = state;
175 this->button = button;
176 this->context= context;
177 this->action = action;
178 this->xroot = xroot;
179 this->yroot = yroot;
180 this->pressx = 0;
181 this->pressy = 0;
182 this->press_clientx = 0;
183 this->press_clienty = 0;
184 this->press_clientwidth = 0;
185 this->press_clientheight = 0;
186 }
187 };
188
189 class EventData {
190 public:
191 int screen;
192 Client *client;
193 unsigned int state;
194 EventAction::EA action;
195
196 EventData(int screen, Client *client, EventAction::EA action,
197 unsigned int state) {
198 this->screen = screen;
199 this->client = client;
200 this->action = action;
201 this->state = state;
202 }
203 };
204
205 class KeyData {
206 public:
207 int screen;
208 Client *client;
209 Time time;
210 unsigned int state;
211 char *key;
212 KeyAction::KA action;
213
214 KeyData(int screen, Client *client, Time time, unsigned int state,
215 unsigned int key, KeyAction::KA action) {
216 this->screen = screen;
217 this->client = client;
218 this->time = time;
219 this->state = state;
220 this->key = XKeysymToString(XKeycodeToKeysym(**otk::display,
221 key, 0));
222 this->action = action;
223 }
224 };
225
226 // The void*'s will be used to hold the native language's function pointer
227 typedef void (*MouseCallback)(MouseData*, void*);
228 typedef void (*KeyCallback)(KeyData*, void*);
229 typedef void (*EventCallback)(EventData*, void*);
230
231 void python_init(char *argv0);
232 void python_destroy();
233 //! Returns 0 for success, 1 for failing to open the file, 2 for an exception
234 int python_exec(const std::string &path);
235
236 bool python_get_long(const char *name, long *value);
237 bool python_get_string(const char *name, otk::ustring *value);
238 bool python_get_stringlist(const char *name, std::vector<otk::ustring> *value);
239
240 }
241
242
243 #endif // __python_hh
This page took 0.044179 seconds and 4 git commands to generate.