openbox/src/openbox.i

125 lines
2.7 KiB
OpenEdge ABL
Raw Normal View History

2002-12-23 00:04:32 +00:00
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
%module openbox
%{
#ifdef HAVE_CONFIG_H
# include "../config.h"
#endif
#include "openbox.hh"
#include "screen.hh"
#include "client.hh"
#include "bindings.hh"
#include "actions.hh"
#include "python.hh"
#include "otk/display.hh"
2002-12-23 00:04:32 +00:00
%}
%include "stl.i"
2002-12-24 19:16:38 +00:00
//%include std_list.i
//%template(ClientList) std::list<OBClient*>;
%ignore ob::Openbox::instance;
%inline %{
ob::Openbox *Openbox_instance() { return ob::Openbox::instance; }
%};
2002-12-23 00:04:32 +00:00
%{
namespace ob {
void python_callback(PyObject *func, MouseData *data)
{
PyObject *arglist;
PyObject *result;
arglist = Py_BuildValue("(O)", SWIG_NewPointerObj((void *) data,
SWIGTYPE_p_ob__MouseData,
0));
// call the callback
result = PyEval_CallObject(func, arglist);
if (!result || PyErr_Occurred()) {
// an exception occured in the script, display it
PyErr_Print();
}
Py_XDECREF(result);
Py_DECREF(arglist);
}
void python_callback(PyObject *func, EventData *data)
{
PyObject *arglist;
PyObject *result;
arglist = Py_BuildValue("(O)", SWIG_NewPointerObj((void *) data,
SWIGTYPE_p_ob__EventData,
0));
// call the callback
result = PyEval_CallObject(func, arglist);
if (!result || PyErr_Occurred()) {
// an exception occured in the script, display it
PyErr_Print();
}
Py_XDECREF(result);
Py_DECREF(arglist);
}
void python_callback(PyObject *func, KeyData *data)
{
PyObject *arglist;
PyObject *result;
arglist = Py_BuildValue("(O)", SWIG_NewPointerObj((void *) data,
SWIGTYPE_p_ob__KeyData,
0));
// call the callback
result = PyEval_CallObject(func, arglist);
if (!result || PyErr_Occurred()) {
// an exception occured in the script, display it
PyErr_Print();
}
Py_XDECREF(result);
Py_DECREF(arglist);
}
}
%}
2002-12-25 02:19:49 +00:00
%ignore ob::OBScreen::clients;
2002-12-23 00:04:32 +00:00
%{
2002-12-24 19:16:38 +00:00
#include <iterator>
2002-12-23 00:04:32 +00:00
%}
2002-12-24 19:16:38 +00:00
%extend ob::OBScreen {
OBClient *client(int i) {
2002-12-25 00:27:10 +00:00
if (i >= (int)self->clients.size())
return NULL;
2003-01-05 01:40:38 +00:00
ob::OBClient::List::iterator it = self->clients.begin();
2002-12-24 19:16:38 +00:00
std::advance(it,i);
return *it;
}
int clientCount() const {
return (int) self->clients.size();
}
};
2002-12-25 02:19:49 +00:00
%import "../otk/eventdispatcher.hh"
%import "../otk/eventhandler.hh"
%import "widget.hh"
%import "actions.hh"
2002-12-25 02:19:49 +00:00
%include "../otk/point.hh"
%include "../otk/rect.hh"
2002-12-25 02:19:49 +00:00
%include "openbox.hh"
%include "screen.hh"
%include "client.hh"
%include "python.hh"
2002-12-25 02:19:49 +00:00
// for Mod1Mask etc
%include "X11/X.h"