File: GdkPango.xs

package info (click to toggle)
libgtk2-perl 2:1.2499-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 4,668 kB
  • ctags: 594
  • sloc: perl: 22,100; ansic: 122; makefile: 17
file content (141 lines) | stat: -rw-r--r-- 4,494 bytes parent folder | download | duplicates (7)
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
/*
 * Copyright (c) 2005-2006 by the gtk2-perl team (see the file AUTHORS)
 *
 * Licensed under the LGPL, see LICENSE file for more information.
 *
 * $Id$
 */

#include "gtk2perl.h"

#define GTK2PERL_PANGO_ATTR_REGISTER_CUSTOM_TYPE(attr, package)	\
{								\
	static gboolean type_registered_already = FALSE;	\
	if (!type_registered_already) {				\
		gtk2perl_pango_attribute_register_custom_type	\
			((attr)->klass->type, package);		\
		type_registered_already = TRUE;			\
	}							\
}

#define GTK2PERL_PANGO_ATTR_STORE_INDICES(offset, attr)	\
	if (items == offset + 2) {			\
		guint start = SvUV (ST (offset));	\
		guint end = SvUV (ST (offset + 1));	\
		attr->start_index = start;		\
		attr->end_index = end;			\
	}

MODULE = Gtk2::Gdk::Pango	PACKAGE = Gtk2::Gdk::PangoRenderer	PREFIX = gdk_pango_renderer_

# We own the reference.
# PangoRenderer *gdk_pango_renderer_new (GdkScreen *screen);
PangoRenderer_noinc *
gdk_pango_renderer_new (class, screen)
	GdkScreen *screen
    C_ARGS:
	screen

# gtk+ owns the reference.
# PangoRenderer *gdk_pango_renderer_get_default (GdkScreen *screen);
PangoRenderer *
gdk_pango_renderer_get_default (class, screen)
	GdkScreen *screen
    C_ARGS:
	screen

void gdk_pango_renderer_set_drawable (GdkPangoRenderer *gdk_renderer, GdkDrawable_ornull *drawable);

void gdk_pango_renderer_set_gc (GdkPangoRenderer *gdk_renderer, GdkGC_ornull *gc);

void gdk_pango_renderer_set_stipple (GdkPangoRenderer *gdk_renderer, PangoRenderPart part, GdkBitmap_ornull *stipple);

void gdk_pango_renderer_set_override_color (GdkPangoRenderer *gdk_renderer, PangoRenderPart part, const GdkColor_ornull *color);

# FIXME: Do we need this?  The docs say to use gtk_widget_get_pango_context()
#        instead.
# PangoContext *gdk_pango_context_get_for_screen (GdkScreen *screen);

# FIXME: How to bind these?  Class static method or function?
# GdkRegion *gdk_pango_layout_line_get_clip_region (PangoLayoutLine *line, gint x_origin, gint y_origin, gint *index_ranges, gint n_ranges);
# GdkRegion *gdk_pango_layout_get_clip_region (PangoLayout *layout, gint x_origin, gint y_origin, gint *index_ranges, gint n_ranges);

# --------------------------------------------------------------------------- #

MODULE = Gtk2::Gdk::Pango	PACKAGE = Gtk2::Gdk::Pango::AttrStipple	PREFIX = gdk_pango_attr_stipple_

BOOT:
	gperl_set_isa ("Gtk2::Gdk::Pango::AttrStipple", "Gtk2::Pango::Attribute");

PangoAttribute_own *
gdk_pango_attr_stipple_new (class, GdkBitmap_ornull *stipple, ...);
    C_ARGS:
	stipple
    POSTCALL:
	GTK2PERL_PANGO_ATTR_REGISTER_CUSTOM_TYPE (RETVAL, "Gtk2::Gdk::Pango::AttrStipple");
	GTK2PERL_PANGO_ATTR_STORE_INDICES (2, RETVAL);

GdkBitmap_noinc *
stipple (PangoAttribute * attr, ...)
    CODE:
	RETVAL = ((GdkPangoAttrStipple*) attr)->stipple;
	if (items > 1)
		((GdkPangoAttrStipple*) attr)->stipple =
			g_object_ref (SvGdkBitmap_ornull (ST (1)));
    OUTPUT:
	RETVAL

# --------------------------------------------------------------------------- #

MODULE = Gtk2::Gdk::Pango	PACKAGE = Gtk2::Gdk::Pango::AttrEmbossed	PREFIX = gdk_pango_attr_embossed_

BOOT:
	gperl_set_isa ("Gtk2::Gdk::Pango::AttrEmbossed", "Gtk2::Pango::Attribute");

PangoAttribute_own *
gdk_pango_attr_embossed_new (class, gboolean embossed, ...);
    C_ARGS:
	embossed
    POSTCALL:
	GTK2PERL_PANGO_ATTR_REGISTER_CUSTOM_TYPE (RETVAL, "Gtk2::Gdk::Pango::AttrEmbossed");
	GTK2PERL_PANGO_ATTR_STORE_INDICES (2, RETVAL);

gboolean
embossed (PangoAttribute * attr, ...)
    CODE:
	RETVAL = ((GdkPangoAttrEmbossed*) attr)->embossed;
	if (items > 1)
		((GdkPangoAttrEmbossed*) attr)->embossed = SvTRUE (ST (1));
    OUTPUT:
	RETVAL

# --------------------------------------------------------------------------- #

#if GTK_CHECK_VERSION (2, 12, 0)

MODULE = Gtk2::Gdk::Pango	PACKAGE = Gtk2::Gdk::Pango::AttrEmbossColor	PREFIX = gdk_pango_attr_emboss_color_

BOOT:
	gperl_set_isa ("Gtk2::Gdk::Pango::AttrEmbossColor", "Gtk2::Pango::Attribute");

PangoAttribute_own *
gdk_pango_attr_emboss_color_new (class, const GdkColor *color, ...);
    C_ARGS:
	color
    POSTCALL:
	GTK2PERL_PANGO_ATTR_REGISTER_CUSTOM_TYPE (RETVAL, "Gtk2::Gdk::Pango::AttrEmbossColor");
	GTK2PERL_PANGO_ATTR_STORE_INDICES (2, RETVAL);

PangoColor *
color (PangoAttribute * attr, ...)
    PREINIT:
	PangoColor color;
    CODE:
	color = ((GdkPangoAttrEmbossColor*) attr)->color;
	RETVAL = &color;
	if (items > 1)
		((GdkPangoAttrEmbossColor*) attr)->color = *((PangoColor *) SvPangoColor (ST (1)));
    OUTPUT:
	RETVAL

#endif