summaryrefslogtreecommitdiff
path: root/pango.override
blob: 03f740c64ed661503e9ca23b2e0e6bfe381e6971 (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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/* -*- Mode: C; c-basic-offset: 4 -*- */
%%
headers
#define NO_IMPORT_PYGOBJECT
#include <pygobject.h>
#include <pango/pango.h>

%%
modulename pango
%%
import gobject.GObject as PyGObject_Type
%%
ignore-glob *_get_type
%%
ignore
  pango_color_copy
  pango_color_free
  pango_attribute_copy
  pango_attribute_destroy
  pango_attribute_equal
  pango_attr_list_ref
  pango_attr_list_unref
  pango_coverage_ref
  pango_coverage_unref
  pango_font_description_copy
  pango_font_description_equal
  pango_font_description_free
  pango_font_descriptions_free
  pango_font_map_free_families
  pango_font_metrics_ref
  pango_font_metrics_unref
  pango_glyph_string_free
  pango_tab_array_free
%%
ignore
  pango_context_new
  pango_context_set_font_map
%%
ignore pango_font_description_from_string
%%
override pango_font_description_new kwargs
static int
_wrap_pango_font_description_new(PyGBoxed *self, PyObject *args,
				 PyObject *kwargs)
{
    static char *kwlist[] = { "str", NULL };
    char *str = NULL;

    if (!PyArg_ParseTupleAndKeywords(args, kwargs,
				     "|z:PangoFontDescription.__init__",
				     kwlist, &str))
	return -1;

    self->gtype = PANGO_TYPE_FONT_DESCRIPTION;
    self->free_on_dealloc = FALSE;
    if (str)
	self->boxed = pango_font_description_from_string(str);
    else
	self->boxed = pango_font_description_new();
    if (!self->boxed) {
	PyErr_SetString(PyExc_RuntimeError,
			"could not create PangoFontDescription object");
	return -1;
    }
    self->free_on_dealloc = TRUE;
    return 0;
}
%%
override-slot PangoFontDescription.tp_compare
static int
_wrap_pango_font_description_tp_compare(PyGBoxed *self, PyGBoxed *other)
{
    if (self->boxed == other->boxed ||
	pango_font_description_equal(pyg_boxed_get(self, PangoFontDescription),
				pyg_boxed_get(other, PangoFontDescription)))
	return 0;
    if (self->boxed > other->boxed)
	return -1;
    return 1;
}
%%
override-slot PangoFontDescription.tp_hash
static long
_wrap_pango_font_description_tp_hash(PyGBoxed *self)
{
    return (long)pango_font_description_hash(
		pyg_boxed_get(self, PangoFontDescription));
}