ekg2
|
00001 /* $Id$ */ 00002 00003 /* 00004 * (C) Copyright 2004-2005 Leszek Krupiński <leafnode@pld-linux.org> 00005 * 00006 * This program is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License Version 2 as 00008 * published by the Free Software Foundation. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00018 */ 00019 00020 #ifndef __PYTHON_WINDOW_H_ 00021 00022 #define __PYTHON_WINDOW_H_ 00023 00024 #include <Python.h> 00025 #include <ekg/windows.h> 00026 00027 typedef struct 00028 { 00029 PyObject_HEAD; 00030 window_t *w; 00031 } ekg_windowObj; 00032 00033 void ekg_window_dealloc(ekg_windowObj *o); 00034 PyObject * ekg_window_repr(ekg_windowObj * self); 00035 PyObject * ekg_window_str(ekg_windowObj * self); 00036 int ekg_window_init(ekg_windowObj *self, PyObject *args, PyObject *kwds); 00037 PyObject* ekg_window_switch_to(ekg_windowObj *self, PyObject *args); 00038 PyObject* ekg_window_echo(ekg_windowObj * self, PyObject *args); 00039 PyObject* ekg_window_echo_format(ekg_windowObj * self, PyObject *args); 00040 PyObject* ekg_window_kill(ekg_windowObj * self, PyObject *args); 00041 PyObject* ekg_window_get_attr(ekg_windowObj * self, char * attr); 00042 PyObject* ekg_window_next(ekg_windowObj *self, PyObject *args); 00043 PyObject* ekg_window_prev(ekg_windowObj *self, PyObject *args); 00044 00045 staticforward PyMethodDef ekg_window_methods[] = { 00046 {"switch_to", (PyCFunction)ekg_window_switch_to, METH_VARARGS, "Switch to this window"}, 00047 {"echo", (PyCFunction)ekg_window_echo, METH_VARARGS, "Print string on this window"}, 00048 {"echo_format", (PyCFunction)ekg_window_echo_format, METH_VARARGS, "Print formatted string on this window"}, 00049 {"kill", (PyCFunction)ekg_window_kill, METH_VARARGS, "Kill window"}, 00050 {"next", (PyCFunction)ekg_window_next, METH_VARARGS, "Return next window" }, 00051 {"prev", (PyCFunction)ekg_window_prev, METH_VARARGS, "Return previous window" }, 00052 {NULL, NULL, 0, NULL} 00053 }; 00054 00055 static PyTypeObject ekg_window_type = { 00056 PyObject_HEAD_INIT(NULL) 00057 0, 00058 "window", 00059 sizeof(ekg_windowObj), 00060 0, 00061 (destructor)ekg_window_dealloc, 00062 0, 00063 (getattrfunc)ekg_window_get_attr, 00064 0, 00065 0, 00066 (reprfunc)ekg_window_repr, 00067 0, 00068 0, 00069 0, 00070 0, /*tp_hash */ 00071 0, /*tp_call*/ 00072 (reprfunc)ekg_window_str, /*tp_str*/ 00073 0, /*tp_getattro*/ 00074 0, /*tp_setattro*/ 00075 0, /*tp_as_buffer*/ 00076 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ 00077 "Window object", /* tp_doc */ 00078 0, /* tp_traverse */ 00079 0, /* tp_clear */ 00080 0, /* tp_richcompare */ 00081 0, /* tp_weaklistoffset */ 00082 0, /* tp_iter */ 00083 0, /* tp_iternext */ 00084 ekg_window_methods, /* tp_methods */ 00085 0, /* tp_members */ 00086 0, /* tp_getset */ 00087 0, /* tp_base */ 00088 0, /* tp_dict */ 00089 0, /* tp_descr_get */ 00090 0, /* tp_descr_set */ 00091 0, /* tp_dictoffset */ 00092 (initproc)ekg_window_init, /* tp_init */ 00093 0, /* tp_alloc */ 00094 0, /* tp_new */ 00095 }; 00096 00097 00098 #endif 00099 00100 /* 00101 * Local Variables: 00102 * mode: c 00103 * c-file-style: "k&r" 00104 * c-basic-offset: 8 00105 * indent-tabs-mode: t 00106 * End: 00107 * vim: sts=8 sw=8 00108 */