]> icculus.org git repositories - dana/openbox.git/blob - src/openbox.i
add an unregister_all for python callbacks
[dana/openbox.git] / src / openbox.i
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
2
3 %module openbox
4
5 %{
6 #ifdef HAVE_CONFIG_H
7 #  include "../config.h"
8 #endif
9
10 #include "openbox.hh"
11 #include "screen.hh"
12 #include "client.hh"
13 #include "python.hh"
14 %}
15
16
17 %include stl.i
18 //%include std_list.i
19 //%template(ClientList) std::list<OBClient*>;
20
21 %ignore ob::Openbox::instance;
22 %inline %{
23   ob::Openbox *Openbox_instance() { return ob::Openbox::instance; }
24 %};
25
26 // stuff for scripting callbacks!
27 %inline %{
28   enum ActionType {
29     Action_ButtonPress,
30     Action_ButtonRelease,
31     Action_Click,
32     Action_DoubleClick,
33     Action_EnterWindow,
34     Action_LeaveWindow,
35     Action_KeyPress,
36     Action_MouseMotion
37   };
38   enum WidgetType {
39     Type_Frame,
40     Type_Titlebar,
41     Type_Handle,
42     Type_Plate,
43     Type_Label,
44     Type_MaximizeButton,
45     Type_CloseButton,
46     Type_IconifyButton,
47     Type_StickyButton,
48     Type_LeftGrip,
49     Type_RightGrip,
50     Type_Client,
51     Type_Root
52   };
53 %}
54 %ignore ob::python_callback;
55 %rename(register) ob::python_register;
56 %rename(preregister) ob::python_preregister;
57 %rename(unregister) ob::python_unregister;
58 %rename(unregister_all) ob::python_unregister_all;
59
60 %ignore ob::OBScreen::clients;
61 %{
62   #include <iterator>
63 %}
64 %extend ob::OBScreen {
65   OBClient *client(int i) {
66     if (i >= (int)self->clients.size())
67       return NULL;
68     ob::OBScreen::ClientList::iterator it = self->clients.begin();
69     std::advance(it,i);
70     return *it;
71   }
72   int clientCount() const {
73     return (int) self->clients.size();
74   }
75 };
76
77 %import "../otk/eventdispatcher.hh"
78 %import "../otk/eventhandler.hh"
79 %import "widget.hh"
80
81 %include "openbox.hh"
82 %include "screen.hh"
83 %include "client.hh"
84 %include "python.hh"
85
86 // for Mod1Mask etc
87 %include "X11/X.h"