summaryrefslogtreecommitdiff
path: root/gi/pygi-type.h
blob: c7e1a45c990d7b956bf39e6e8142b02f53d720e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/* -*- Mode: C; c-basic-offset: 4 -*-
 * pygtk- Python bindings for the GTK toolkit.
 * Copyright (C) 1998-2003  James Henstridge
 *               2004-2008  Johan Dahlin
 *   pyginterface.c: wrapper for the gobject library.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */

#ifndef __PYGI_TYPE_H__ 
#define __PYGI_TYPE_H__

#include <Python.h>
#include <glib-object.h>
#include <girepository.h>
#include "pygobject-internal.h"

extern PyTypeObject PyGTypeWrapper_Type;

typedef PyObject *(* fromvaluefunc)(const GValue *value);
typedef int (*tovaluefunc)(GValue *value, PyObject *obj);

typedef struct {
    fromvaluefunc fromvalue;
    tovaluefunc tovalue;
} PyGTypeMarshal;

PyGTypeMarshal *pyg_type_lookup(GType type);

gboolean pyg_gtype_is_custom (GType gtype);

void pyg_register_gtype_custom(GType gtype,
                               fromvaluefunc from_func,
                               tovaluefunc to_func);

int pygi_type_register_types(PyObject *d);

PyObject *pyg_object_descr_doc_get(void);
PyObject *pyg_type_wrapper_new (GType type);
GType     pyg_type_from_object_strict (PyObject *obj, gboolean strict);
GType     pyg_type_from_object (PyObject *obj);

int pyg_pyobj_to_unichar_conv (PyObject* py_obj, void* ptr);

GClosure *pyg_closure_new(PyObject *callback, PyObject *extra_args, PyObject *swap_data);
GClosure *pyg_signal_class_closure_get(void);
void      pyg_closure_set_exception_handler(GClosure *closure,
                                            PyClosureExceptionHandler handler);

PyObject *pygi_type_import_by_g_type (GType g_type);
PyObject *pygi_type_import_by_name (const char *namespace_, const char *name);
PyObject *pygi_type_import_by_gi_info (GIBaseInfo *info);
PyObject *pygi_type_get_from_g_type (GType g_type);

#endif /* __PYGI_TYPE_H__ */