File: PangoAttributes.xs

package info (click to toggle)
libgtk2-perl 1%3A1.140-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 3,808 kB
  • ctags: 609
  • sloc: perl: 14,245; ansic: 118; makefile: 70
file content (698 lines) | stat: -rw-r--r-- 22,179 bytes parent folder | download | duplicates (2)
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
/*
 * Copyright (c) 2005 by the gtk2-perl team (see the file AUTHORS)
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library 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
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the 
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 
 * Boston, MA  02111-1307  USA.
 *
 * $Header: /cvsroot/gtk2-perl/gtk2-perl-xs/Gtk2/xs/PangoAttributes.xs,v 1.1 2005/02/08 05:03:08 muppetman Exp $
 */
#include "gtk2perl.h"

#if 0
##typedef struct {
##	PangoAttribute * attr;
##	gboolean         own;
##} Gtk2PerlPangoAttrBox;
##
##static Gtk2PerlPangoAttrBox *
##gtk2perl_pango_attr_box_new (PangoAttribute * attr,
##			     gboolean         own)
##{
##	Gtk2PerlPangoAttrBox * box = g_new (Gtk2PerlPangoAttrBox, 1);
##	box->attr = attr;
##	box->own  = own;
##	return box;
##}
##
##static void
##gtk2perl_pango_attr_box_free (Gtk2PerlPangoAttrBox * box)
##{
##	if (box) {
##		if (box->own)
##			pango_attribute_destroy (box->attr);
##		g_free (box);
##	}
##}
##
##static SV *
##gtk2perl_sv_from_pango_attribute (PangoAttribute * attr,
##				  gboolean         own)
##{
##	Gtk2PerlPangoAttrBox * box =
##		gtk2perl_pango_attr_box_new (attr, own);
##	const char * pkg;
##	/* the interface is designed to allow extensibility by registering
##	 * new PangoAttrType values, but pango doesn't allow us to query
##	 * those.  so, we'll just hardcode these for now. */
##	switch (attr->klass->type) {
##	    case PANGO_ATTR_INVALID:
##		/* er, what to do here? */
##		break;
##	    case PANGO_ATTR_LANGUAGE:      pkg = "Gtk2::Pango::AttrLanguage"; break;
##	    case PANGO_ATTR_FAMILY:        pkg = "Gtk2::Pango::AttrFamily"; break;
##	    case PANGO_ATTR_STYLE:         pkg = "Gtk2::Pango::AttrStyle"; break;
##	    case PANGO_ATTR_WEIGHT:        pkg = "Gtk2::Pango::AttrWeight"; break;
##	    case PANGO_ATTR_VARIANT:       pkg = "Gtk2::Pango::AttrVariant"; break;
##	    case PANGO_ATTR_STRETCH:       pkg = "Gtk2::Pango::AttrStretch"; break;
##	    case PANGO_ATTR_SIZE:          pkg = "Gtk2::Pango::AttrSize"; break;
##	    case PANGO_ATTR_FONT_DESC:     pkg = "Gtk2::Pango::AttrFontDesc"; break;
##	    case PANGO_ATTR_FOREGROUND:    pkg = "Gtk2::Pango::AttrForeground"; break;
##	    case PANGO_ATTR_BACKGROUND:    pkg = "Gtk2::Pango::AttrForeground"; break;
##	    case PANGO_ATTR_UNDERLINE:     pkg = "Gtk2::Pango::AttrUnderline"; break;
##	    case PANGO_ATTR_STRIKETHROUGH: pkg = "Gtk2::Pango::AttrStrikethrough"; break;
##	    case PANGO_ATTR_RISE:          pkg = "Gtk2::Pango::AttrInt"; break;
##	    case PANGO_ATTR_SHAPE:         pkg = "Gtk2::Pango::AttrShape"; break;
##	    case PANGO_ATTR_SCALE:         pkg = "Gtk2::Pango::AttrFloat"; break;
##	    default:
##		warn ("unknown PangoAttribute class %d, using base class",
##		      attr->klass->type);
##		pkg = "Gtk2::Pango::Attribute";
##		break;
##	}
##
##	return sv_setref_pv (newSV(0), pkg, box);
##}
##
##static PangoAttribute *
##gtk2perl_pango_attribute_from_sv (SV * sv)
##{
##	Gtk2PerlPangoAttrBox * box;
##
##	if (!sv || !SvOK (sv))
##		return NULL;
##
##	if ((!SvRV (sv)) || (!sv_derived_from (sv, "Gtk2::Pango::Attribute")))
##		croak ("%s is not a Gtk2::Pango::Attribute",
##		       gperl_format_variable_for_output (sv));
##
##	box = INT2PTR (Gtk2PerlPangoAttrBox*, SvIV (SvRV (sv)));
##	return box->attr;	
##}
##
##
##typedef PangoAttribute PangoAttribute_own;
##
###define SvPangoAttribute(sv)  gtk2perl_pango_attribute_from_sv ((sv))
###define newSVPangoAttribute(attr)  gtk2perl_sv_from_pango_attribute ((attr), FALSE)
###define newSVPangoAttribute_own(attr)  gtk2perl_sv_from_pango_attribute ((attr), TRUE)
##
##
##MODULE = Gtk2::Pango::Attributes	PACKAGE = Gtk2::Pango::Color	PREFIX = pango_color_
##
####
####/* PangoColor */
####
#### these are automatic, thanks to Glib::Boxed
#####define PANGO_TYPE_COLOR pango_color_get_type ()
####GType       pango_color_get_type (void) G_GNUC_CONST;
####PangoColor *pango_color_copy     (const PangoColor *src);
####void        pango_color_free     (PangoColor       *color);
##
##PangoColor_copy *
##new (class, ...)
##    PREINIT:
##	PangoColor color = {0, 0, 0};
##    CODE:
##	if (items == 1) {
##		/* that's cool */
##	} else if (items == 4) {
##		/* initializers */
##		color.red   = (guint16) SvIV (ST (1));
##		color.green = (guint16) SvIV (ST (2));
##		color.blue  = (guint16) SvIV (ST (3));
##	} else {
##		/* that's not cool. */
##		croak ("Usage:  $color = Gtk2::Pango::Color->new\n"
##		       "        $color = Gtk2::Pango::Color->new ($red, $green, $blue)\n"
##		       "    ");
##	}
##	RETVAL = &color;
##    OUTPUT:
##	RETVAL
##
####gboolean pango_color_parse (PangoColor *color, const char *spec);
##PangoColor_copy *
##pango_color_parse (class, const gchar * spec)
##    PREINIT:
##	PangoColor color;
##    CODE:
##	if (! pango_color_parse (&color, spec))
##		XSRETURN_UNDEF;
##	RETVAL = &color;
##    OUTPUT:
##	RETVAL
##
#### FIXME pod for both signatures of all three methods...
##guint16
##red (PangoColor * color, ...)
##    ALIAS:
##	green = 1
##	blue = 2
##    CODE:
##	switch (ix) {
##	    case 0: RETVAL = color->red; break;
##	    case 1: RETVAL = color->green; break;
##	    case 2: RETVAL = color->blue; break;
##	    default:
##		g_assert_not_reached ();
##	}
##	if (items > 1) {
##		guint16 newval = SvIV (ST (1));
##		switch (ix) {
##		    case 0: color->red = newval; break;
##		    case 1: color->green = newval; break;
##		    case 2: color->blue = newval; break;
##		}
##	}
##    OUTPUT:
##	RETVAL
##
##
##MODULE = Gtk2::Pango::Attributes	PACKAGE = Gtk2::Pango::Attribute	PREFIX = pango_attribute_
##
####=for enum Gtk2::Pango::AttrType;
####=cut
####
####=for enum Gtk2::Pango::Underline;
####=cut
####
####/* Attributes */
####
#### FIXME
#### FIXME  the attributes are a bunch of small types without GTypes.
#### FIXME  bindings here will be "interesting".
#### FIXME
##
##void
##DESTROY (SV * sv)
##    PREINIT:
##	Gtk2PerlPangoAttrBox * box;
##    CODE:
##	box = INT2PTR (Gtk2PerlPangoAttrBox*, SvIV (SvRV (sv)));
##	gtk2perl_pango_attr_box_free (box);
##
####typedef struct _PangoAttribute    PangoAttribute;
####typedef struct _PangoAttrClass    PangoAttrClass;
####				  
####typedef struct _PangoAttrString   PangoAttrString;
####typedef struct _PangoAttrLanguage PangoAttrLanguage;
####typedef struct _PangoAttrInt      PangoAttrInt;
####typedef struct _PangoAttrFloat    PangoAttrFloat;
####typedef struct _PangoAttrColor    PangoAttrColor;
####typedef struct _PangoAttrFontDesc PangoAttrFontDesc;
####typedef struct _PangoAttrShape    PangoAttrShape;
####
####struct _PangoAttribute
####{
####  const PangoAttrClass *klass;
####  guint start_index;
####  guint end_index;
####};
##
##guint
##start_index (PangoAttribute * attr, ...)
##    ALIAS:
##	end_index = 1
##    CODE:
##	RETVAL = ix == 0 ? attr->start_index : attr->end_index;
##	if (items > 1) {
##		guint new_index = SvIV (ST (1));
##		if (ix == 0)
##			attr->start_index = new_index;
##		else
##			attr->end_index = new_index;
##	}
##    OUTPUT:
##	RETVAL
##
####typedef gboolean (*PangoAttrFilterFunc) (PangoAttribute *attribute,
####					 gpointer        data);
##
##
#### FIXME  not sure what to do with this
####PangoAttrType    pango_attr_type_register (const gchar          *name);
##
##PangoAttribute_own * pango_attribute_copy (PangoAttribute * attr)
##
#### this is automatic
####void             pango_attribute_destroy       (PangoAttribute       *attr);
##
##gboolean pango_attribute_equal (PangoAttribute * attr1, PangoAttribute * attr2)
##
##
##MODULE = Gtk2::Pango::Attributes	PACKAGE = Gtk2::Pango::AttrLanguage	PREFIX = pango_attr_language_
##
##BOOT:
##	gperl_set_isa ("Gtk2::Pango::AttrLanguage", "Gtk2::Pango::Attribute");
##
##PangoAttribute_own * pango_attr_language_new (class, PangoLanguage *language);
##    C_ARGS:
##	language
##
##PangoLanguage *
##value (PangoAttribute * attr, ...)
##    CODE:
##	RETVAL = ((PangoAttrLanguage*)attr)->value;
##	if (items > 1) {
##		/* from the pango source, this is all we need to do. */
##		((PangoAttrLanguage*)attr)->value = SvPangoLanguage (ST (1));
##	}
##    OUTPUT:
##	RETVAL
##
##
##MODULE = Gtk2::Pango::Attributes	PACKAGE = Gtk2::Pango::AttrString
##
##BOOT:
##	gperl_set_isa ("Gtk2::Pango::AttrString", "Gtk2::Pango::Attribute");
##
##gchar *
##value (PangoAttribute * attr, ...)
##    CODE:
##	RETVAL = ((PangoAttrString*)attr)->value;
##	if (items > 1) {
##		/* this feels evil... */
##		g_free (((PangoAttrString*)attr)->value);
##		((PangoAttrString*)attr)->value = g_strdup (SvGChar (ST (1)));
##	}
##    OUTPUT:
##	RETVAL
##
##MODULE = Gtk2::Pango::Attributes	PACKAGE = Gtk2::Pango::AttrFamily	PREFIX = pango_attr_family_
##
##BOOT:
##	gperl_set_isa ("Gtk2::Pango::AttrFamily", "Gtk2::Pango::AttrString");
##
##
##PangoAttribute_own * pango_attr_family_new (class, const char *family);
##    C_ARGS:
##	family
##
##
##
##MODULE = Gtk2::Pango::Attributes	PACKAGE = Gtk2::Pango::AttrColor
##
##BOOT:
##	gperl_set_isa ("Gtk2::Pango::AttrColor", "Gtk2::Pango::Attribute");
##
####struct _PangoAttrColor
####{
####  PangoAttribute attr;
####  PangoColor color;
####};
##
## ##
## ## the PangoAttrColor holds an actual color, not a pointer...
## ## how can we make it editable from perl?  you can replace it,
## ## but you get a copy back and editing it does nothing...
## ##
##PangoColor_copy *
##value (PangoAttribute * attr, ...)
##    CODE:
##	RETVAL = &((PangoAttrColor*)attr)->color;
##	if (items > 1) {
##		PangoColor * color = SvPangoColor (ST (1));
##		((PangoAttrColor*)attr)->color = *color;
##	}
##    OUTPUT:
##	RETVAL
##
##MODULE = Gtk2::Pango::Attributes	PACKAGE = Gtk2::Pango::AttrForeground	PREFIX = pango_attr_foreground_
##
##BOOT:
##	gperl_set_isa ("Gtk2::Pango::AttrForeground", "Gtk2::Pango::AttrColor");
##
##PangoAttribute_own * pango_attr_foreground_new (class, guint16 red, guint green, guint16 blue);
##    C_ARGS:
##	red, green, blue
##
##MODULE = Gtk2::Pango::Attributes	PACKAGE = Gtk2::Pango::AttrBackground	PREFIX = pango_attr_background_
##
##BOOT:
##	gperl_set_isa ("Gtk2::Pango::AttrBackground", "Gtk2::Pango::AttrColor");
##
##PangoAttribute_own * pango_attr_background_new (class, guint16 red, guint green, guint16 blue);
##    C_ARGS:
##	red, green, blue
##
##
##MODULE = Gtk2::Pango::Attributes	PACKAGE = Gtk2::Pango::AttrSize	PREFIX = pango_attr_size_
##
##BOOT:
##	gperl_set_isa ("Gtk2::Pango::AttrSize", "Gtk2::Pango::Attribute");
##
##PangoAttribute_own * pango_attr_size_new (class, int size)
##    C_ARGS:
##	size
##
##int
##value (PangoAttribute * attr, ...)
##    ALIAS:
##	absolute = 1
##    PREINIT:
##	/* later versions of pango use PangoAttrSize rather than
##	 * PangoAttrInt... */
##	PangoAttrInt * attrsize;
##    CODE:
##	attrsize = (PangoAttrInt *) attr;
##	RETVAL = attrsize->value;
##	if (items > 1)
##		attrsize->value = SvIV (ST (1));
##    OUTPUT:
##	RETVAL
##
##
##MODULE = Gtk2::Pango::Attributes	PACKAGE = Gtk2::Pango::AttrStyle	PREFIX = pango_attr_style_
##
##BOOT:
##	gperl_set_isa ("Gtk2::Pango::AttrStyle", "Gtk2::Pango::Attribute");
##
##PangoAttribute_own * pango_attr_style_new (class, PangoStyle style)
##    C_ARGS:
##	style
##
##PangoStyle
##value (PangoAttribute * attr, ...)
##    CODE:
##	RETVAL = ((PangoAttrInt*) attr)->value;
##	if (items > 1)
##		((PangoAttrInt*) attr)->value = SvPangoStyle (ST (1));
##    OUTPUT:
##	RETVAL
##
##MODULE = Gtk2::Pango::Attributes	PACKAGE = Gtk2::Pango::AttrWeight	PREFIX = pango_attr_weight_
##
##BOOT:
##	gperl_set_isa ("Gtk2::Pango::AttrWeight", "Gtk2::Pango::Attribute");
##
##PangoAttribute_own * pango_attr_weight_new (class, PangoWeight weight)
##    C_ARGS:
##	weight
##
##PangoWeight
##value (PangoAttribute * attr, ...)
##    CODE:
##	RETVAL = ((PangoAttrInt*) attr)->value;
##	if (items > 1)
##		((PangoAttrInt*) attr)->value = SvPangoWeight (ST (1));
##    OUTPUT:
##	RETVAL
##
##MODULE = Gtk2::Pango::Attributes	PACKAGE = Gtk2::Pango::AttrVariant	PREFIX = pango_attr_variant_
##
##BOOT:
##	gperl_set_isa ("Gtk2::Pango::AttrVariant", "Gtk2::Pango::Attribute");
##
##PangoAttribute_own * pango_attr_variant_new (class, PangoVariant variant)
##    C_ARGS:
##	variant
##
##PangoVariant
##value (PangoAttribute * attr, ...)
##    CODE:
##	RETVAL = ((PangoAttrInt*) attr)->value;
##	if (items > 1)
##		((PangoAttrInt*) attr)->value = SvPangoVariant (ST (1));
##    OUTPUT:
##	RETVAL
##
##MODULE = Gtk2::Pango::Attributes	PACKAGE = Gtk2::Pango::AttrStretch	PREFIX = pango_attr_stretch_
##
##BOOT:
##	gperl_set_isa ("Gtk2::Pango::AttrStretch", "Gtk2::Pango::Attribute");
##
##PangoAttribute_own * pango_attr_stretch_new (class, PangoStretch stretch)
##    C_ARGS:
##	stretch
##
##PangoStretch
##value (PangoAttribute * attr, ...)
##    CODE:
##	RETVAL = ((PangoAttrInt*) attr)->value;
##	if (items > 1)
##		((PangoAttrInt*) attr)->value = SvPangoStretch (ST (1));
##    OUTPUT:
##	RETVAL
##
##MODULE = Gtk2::Pango::Attributes	PACKAGE = Gtk2::Pango::AttrUnderline	PREFIX = pango_attr_underline_
##
##BOOT:
##	gperl_set_isa ("Gtk2::Pango::AttrUnderline", "Gtk2::Pango::Attribute");
##
##PangoAttribute_own * pango_attr_underline_new (class, PangoUnderline underline)
##    C_ARGS:
##	underline
##
##PangoUnderline
##value (PangoAttribute * attr, ...)
##    CODE:
##	RETVAL = ((PangoAttrInt*) attr)->value;
##	if (items > 1)
##		((PangoAttrInt*) attr)->value = SvPangoUnderline (ST (1));
##    OUTPUT:
##	RETVAL
##
##MODULE = Gtk2::Pango::Attributes	PACKAGE = Gtk2::Pango::AttrStrikethrough	PREFIX = pango_attr_strikethrough_
##
##BOOT:
##	gperl_set_isa ("Gtk2::Pango::AttrStrikethrough", "Gtk2::Pango::Attribute");
##
##PangoAttribute_own * pango_attr_strikethrough_new (class, gboolean strikethrough)
##    C_ARGS:
##	strikethrough
##
##gboolean
##value (PangoAttribute * attr, ...)
##    CODE:
##	RETVAL = ((PangoAttrInt*) attr)->value;
##	if (items > 1)
##		((PangoAttrInt*) attr)->value = SvTRUE (ST (1));
##    OUTPUT:
##	RETVAL
##
##MODULE = Gtk2::Pango::Attributes	PACKAGE = Gtk2::Pango::AttrFontDesc	PREFIX = pango_attr_font_desc_
##
##BOOT:
##	gperl_set_isa ("Gtk2::Pango::AttrFontDesc", "Gtk2::Pango::Attribute");
##
##PangoAttribute_own * pango_attr_font_desc_new (class, PangoFontDescription * font_desc)
##    C_ARGS:
##	font_desc
##
##PangoFontDescription *
##desc (PangoAttribute * attr, ...)
##    CODE:
##	RETVAL = ((PangoAttrFontDesc*) attr)->desc;
##	if (items > 1) {
##		pango_font_description_free (((PangoAttrFontDesc*) attr)->desc);
##		((PangoAttrFontDesc*) attr)->desc =
##			pango_font_description_copy (SvPangoFontDescription (ST (1)));
##	}
##    OUTPUT:
##	RETVAL
##
##MODULE = Gtk2::Pango::Attributes	PACKAGE = Gtk2::Pango::AttrScale	PREFIX = pango_attr_scale_
##
##BOOT:
##	gperl_set_isa ("Gtk2::Pango::AttrScale", "Gtk2::Pango::Attribute");
##
##PangoAttribute_own * pango_attr_scale_new (class, float scale)
##    C_ARGS:
##	scale
##
##float
##value (PangoAttribute * attr, ...)
##    CODE:
##	RETVAL = ((PangoAttrFloat*) attr)->value;
##	if (items > 1)
##		((PangoAttrFloat*) attr)->value = SvNV (ST (1));
##    OUTPUT:
##	RETVAL
##
##MODULE = Gtk2::Pango::Attributes	PACKAGE = Gtk2::Pango::AttrRise	PREFIX = pango_attr_rise_
##
##BOOT:
##	gperl_set_isa ("Gtk2::Pango::AttrRise", "Gtk2::Pango::Attribute");
##
##PangoAttribute_own * pango_attr_rise_new (class, int rise)
##    C_ARGS:
##	rise
##
##int
##value (PangoAttribute * attr, ...)
##    PREINIT:
##	PangoAttrInt * attrint;
##    CODE:
##	attrint = (PangoAttrInt *) attr;
##	RETVAL = attrint->value;
##	if (items > 1)
##		attrint->value = SvIV (ST (1));
##    OUTPUT:
##	RETVAL
##
##
##MODULE = Gtk2::Pango::Attributes	PACKAGE = Gtk2::Pango::AttrShape	PREFIX = pango_attr_shape_
##
##BOOT:
##	gperl_set_isa ("Gtk2::Pango::AttrShape", "Gtk2::Pango::Attribute");
##
#### FIXME  SvPangoRectangle is not currently implemented
##
######PangoAttribute *pango_attr_shape_new         (const PangoRectangle       *ink_rect,
######					      const PangoRectangle       *logical_rect);
####PangoAttribute_own *
####pango_attr_shape_new (class, PangoRectangle *ink_rect, PangoRectangle *logical_rect)
####    C_ARGS:
####	ink_rect, logical_rect
##
####struct _PangoAttrShape
####{
####  PangoAttribute attr;
####  PangoRectangle ink_rect;
####  PangoRectangle logical_rect;
####};
##PangoRectangle *
##ink_rect (PangoAttribute * attr, ...)
##    ALIAS:
##	logical_rect = 1
##    PREINIT:
##	PangoAttrShape * attrshape;
##    CODE:
##	attrshape = (PangoAttrShape *) attr;
##	RETVAL = ix == 0 ? &(attrshape->ink_rect) : &(attrshape->logical_rect);
##	/*
##	if (items > 1) {
##		PangoRectangle * rect = SvPangoRectangle (ST (1));
##		if (ix == 0)
##			attrshape->ink_rect = *rect;
##		else
##			attrshape->logical_rect = *rect;
##	}
##	*/
##    OUTPUT:
##	RETVAL
##
##
##
##MODULE = Gtk2::Pango::Attributes	PACKAGE = Gtk2::Pango::AttrList	PREFIX = pango_attr_list_
##
#### FIXME  cant meaningfully bind PangoAttrList until we bind PangoAttribute.
##
##=for position DESCRIPTION
##
##=head1 DESCRIPTION
##
##Gtk2::Pango::AttrList is a collection of Gtk2::Pango::Attributes.  These
##attributes annotate text with styles.
##
##NOTE:  The various PangoAttribute types are not yet bound, so it is not
##possible at this time to create and manipulate a Gtk2::Pango::AttrList
##directly.  You can, however, use AttrLists you get from other functions,
##and can create an AttrList with C<Gtk2::Pango::parse_markup>.
##
##=cut
##
####  PangoAttrList is a registered boxed type, so these are handled
####  automatically by Glib::Boxed.
####GType              pango_attr_list_get_type      (void) G_GNUC_CONST;
####PangoAttrList *    pango_attr_list_copy          (PangoAttrList  *list);
####void               pango_attr_list_ref           (PangoAttrList  *list);
####void               pango_attr_list_unref         (PangoAttrList  *list);
##
##PangoAttrList_own * pango_attr_list_new (class)
##    C_ARGS:
##	/*void*/
##   
##void pango_attr_list_insert (PangoAttrList *list, PangoAttribute *attr);
##
##void pango_attr_list_insert_before (PangoAttrList *list, PangoAttribute *attr);
##
##void pango_attr_list_change (PangoAttrList *list, PangoAttribute *attr);
##
##void pango_attr_list_splice (PangoAttrList *list, PangoAttrList *other, gint pos, gint len);
##
####PangoAttrList *pango_attr_list_filter (PangoAttrList       *list,
####				       PangoAttrFilterFunc  func,
####				       gpointer             data);
####
####
####  FIXME  PangoAttrIterator is not a boxed type, but is an opaque type.
####typedef struct _PangoAttrIterator PangoAttrIterator;
####PangoAttrIterator *pango_attr_list_get_iterator  (PangoAttrList  *list);
####
####void               pango_attr_iterator_range    (PangoAttrIterator     *iterator,
####                                                 gint                  *start,
####                                                 gint                  *end);
####gboolean           pango_attr_iterator_next     (PangoAttrIterator     *iterator);
####PangoAttrIterator *pango_attr_iterator_copy     (PangoAttrIterator     *iterator);
####void               pango_attr_iterator_destroy  (PangoAttrIterator     *iterator);
####PangoAttribute *   pango_attr_iterator_get      (PangoAttrIterator     *iterator,
####                                                 PangoAttrType          type);
####void               pango_attr_iterator_get_font (PangoAttrIterator     *iterator,
####                                                 PangoFontDescription  *desc,
####						 PangoLanguage        **language,
####                                                 GSList               **extra_attrs);
####GSList *          pango_attr_iterator_get_attrs (PangoAttrIterator     *iterator);
#endif

MODULE = Gtk2::Pango::Attributes	PACKAGE = Gtk2::Pango	PREFIX = pango_

# don't clobber the pod for Gtk2::Pango!
=for object Gtk2::Pango::AttrList
=cut

##gboolean pango_parse_markup (const char                 *markup_text,
##                             int                         length,
##                             gunichar                    accel_marker,
##                             PangoAttrList             **attr_list,
##                             char                      **text,
##                             gunichar                   *accel_char,
##                             GError                    **error);
##
=for apidoc __gerror__
=for signature ($attr_list, $text, $accel_char) = Gtk2::Pango->parse_markup ($markup_text, $accel_marker)
Parses marked-up text to create a plaintext string and an attribute list.

If I<$accel_marker> is supplied and nonzero, the given character will mark the
character following it as an accelerator.  For example, the accel marker might
be an ampersand or underscore.  All characters marked as an acclerator will
receive a PANGO_UNDERLINE_LOW attribute, and the first character so marked will
be returned in I<$accel_char>.  Two I<$accel_marker> characters following each
other reduce to a single literal I<$accel_marker> character.
=cut
void
pango_parse_markup (class, const gchar_length * markup_text, int length(markup_text), gunichar accel_marker=0)
    PREINIT:
	PangoAttrList * attr_list;
	char * text;
	gunichar accel_char;
	GError * error = NULL;
    PPCODE:
	if (! pango_parse_markup (markup_text, XSauto_length_of_markup_text,
				  accel_marker, &attr_list, &text,
				  &accel_char, &error))
		gperl_croak_gerror (NULL, error);
	EXTEND (SP, 3);
	PUSHs (sv_2mortal (newSVPangoAttrList (attr_list)));
	PUSHs (sv_2mortal (newSVGChar (text)));
	g_free (text);
	if (accel_char) {
		/* adapted from Glib/typemap */
		gchar temp[6];
		gint length = g_unichar_to_utf8 (accel_char, temp);
		PUSHs (sv_2mortal (newSVpv (temp, length)));
		SvUTF8_on (ST (2));
	}