ekg2  GIT master
python-window.h
Idź do dokumentacji tego pliku.
1 /* $Id$ */
2 
3 /*
4  * (C) Copyright 2004-2005 Leszek Krupiński <leafnode@pld-linux.org>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License Version 2 as
8  * published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  */
19 
20 #ifndef __PYTHON_WINDOW_H_
21 
22 #define __PYTHON_WINDOW_H_
23 
24 #include <Python.h>
25 
26 typedef struct
27 {
31 
33 PyObject * ekg_window_repr(ekg_windowObj * self);
34 PyObject * ekg_window_str(ekg_windowObj * self);
35 int ekg_window_init(ekg_windowObj *self, PyObject *args, PyObject *kwds);
36 PyObject* ekg_window_switch_to(ekg_windowObj *self, PyObject *args);
37 PyObject* ekg_window_echo(ekg_windowObj * self, PyObject *args);
38 PyObject* ekg_window_echo_format(ekg_windowObj * self, PyObject *args);
39 PyObject* ekg_window_kill(ekg_windowObj * self, PyObject *args);
40 PyObject* ekg_window_get_attr(ekg_windowObj * self, char * attr);
41 PyObject* ekg_window_next(ekg_windowObj *self, PyObject *args);
42 PyObject* ekg_window_prev(ekg_windowObj *self, PyObject *args);
43 
44 staticforward PyMethodDef ekg_window_methods[] = {
45  {"switch_to", (PyCFunction)ekg_window_switch_to, METH_VARARGS, "Switch to this window"},
46  {"echo", (PyCFunction)ekg_window_echo, METH_VARARGS, "Print string on this window"},
47  {"echo_format", (PyCFunction)ekg_window_echo_format, METH_VARARGS, "Print formatted string on this window"},
48  {"kill", (PyCFunction)ekg_window_kill, METH_VARARGS, "Kill window"},
49  {"next", (PyCFunction)ekg_window_next, METH_VARARGS, "Return next window" },
50  {"prev", (PyCFunction)ekg_window_prev, METH_VARARGS, "Return previous window" },
51  {NULL, NULL, 0, NULL}
52 };
53 
54 static PyTypeObject ekg_window_type = {
55  PyObject_HEAD_INIT(NULL)
56  0,
57  "window",
58  sizeof(ekg_windowObj),
59  0,
60  (destructor)ekg_window_dealloc,
61  0,
62  (getattrfunc)ekg_window_get_attr,
63  0,
64  0,
65  (reprfunc)ekg_window_repr,
66  0,
67  0,
68  0,
69  0, /*tp_hash */
70  0, /*tp_call*/
71  (reprfunc)ekg_window_str, /*tp_str*/
72  0, /*tp_getattro*/
73  0, /*tp_setattro*/
74  0, /*tp_as_buffer*/
75  Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
76  "Window object", /* tp_doc */
77  0, /* tp_traverse */
78  0, /* tp_clear */
79  0, /* tp_richcompare */
80  0, /* tp_weaklistoffset */
81  0, /* tp_iter */
82  0, /* tp_iternext */
83  ekg_window_methods, /* tp_methods */
84  0, /* tp_members */
85  0, /* tp_getset */
86  0, /* tp_base */
87  0, /* tp_dict */
88  0, /* tp_descr_get */
89  0, /* tp_descr_set */
90  0, /* tp_dictoffset */
91  (initproc)ekg_window_init, /* tp_init */
92  0, /* tp_alloc */
93  0, /* tp_new */
94 };
95 
96 
97 #endif
98 
99 /*
100  * Local Variables:
101  * mode: c
102  * c-file-style: "k&r"
103  * c-basic-offset: 8
104  * indent-tabs-mode: t
105  * End:
106  * vim: sts=8 sw=8
107  */
PyObject * ekg_window_echo_format(ekg_windowObj *self, PyObject *args)
Definition: python-window.c:183
PyObject * ekg_window_repr(ekg_windowObj *self)
Definition: python-window.c:101
staticforward PyMethodDef ekg_window_methods[]
Definition: python-window.h:44
void ekg_window_dealloc(ekg_windowObj *o)
Definition: python-window.c:90
PyObject * ekg_window_prev(ekg_windowObj *self, PyObject *args)
Definition: python-window.c:256
PyObject * ekg_window_get_attr(ekg_windowObj *self, char *attr)
Definition: python-window.c:78
static PyTypeObject ekg_window_type
Definition: python-window.h:54
int ekg_window_init(ekg_windowObj *self, PyObject *args, PyObject *kwds)
Definition: python-window.c:50
#define NULL
Definition: oralog.c:49
PyObject * ekg_window_next(ekg_windowObj *self, PyObject *args)
Definition: python-window.c:229
PyObject_HEAD
Definition: python-window.h:28
PyObject * ekg_window_echo(ekg_windowObj *self, PyObject *args)
Definition: python-window.c:156
PyObject * ekg_window_kill(ekg_windowObj *self, PyObject *args)
Definition: python-window.c:211
Definition: python-window.h:26
Definition: windows.h:67
PyObject * ekg_window_switch_to(ekg_windowObj *self, PyObject *args)
Definition: python-window.c:135
window_t * w
Definition: python-window.h:29
PyObject * ekg_window_str(ekg_windowObj *self)
Definition: python-window.c:119