alternative to assert
[gtkD.git] / gtkD / src / pango / PgAttribute.d
blob3a4f0dbf23f94cba5ef0784bf26c07ca8569d61e
1 /*
2 * This file is part of gtkD.
4 * gtkD is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * gtkD is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with gtkD; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = pango-Text-Attributes.html
26 * outPack = pango
27 * outFile = PgAttribute
28 * strct = PangoAttribute
29 * realStrct=
30 * ctorStrct=
31 * clss = PgAttribute
32 * interf =
33 * class Code: No
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - pango_attr_
40 * omit structs:
41 * omit prefixes:
42 * - pango_language_
43 * omit code:
44 * imports:
45 * - glib.ListSG
46 * - glib.Str
47 * - pango.PgContext
48 * - pango.PgItem
49 * - pango.PgLayout
50 * - pango.PgFontDescription
51 * - pango.PgFontMetrics
52 * - pango.PgFontFamily
53 * - pango.PgFontFace
54 * - pango.PgFontMap
55 * - pango.PgFontsetSimple
56 * - pango.PgAttributeList
57 * - pango.PgLanguage
58 * - pango.PgTabArray
59 * - pango.PgLayout
60 * - pango.PgLayoutIter
61 * - pango.PgScriptIter
62 * structWrap:
63 * - GSList* -> ListSG
64 * - PangoAttributeList* -> PgAttributeList
65 * - PangoContext* -> PgContext
66 * - PangoFontDescription* -> PgFontDescription
67 * - PangoFontFace* -> PgFontFace
68 * - PangoFontFamily* -> PgFontFamily
69 * - PangoFontMap* -> PgFontMap
70 * - PangoFontMetrics* -> PgFontMetrics
71 * - PangoFontsetSimple* -> PgFontsetSimple
72 * - PangoItem* -> PgItem
73 * - PangoLanguage* -> PgLanguage
74 * - PangoLayout* -> PgLayout
75 * - PangoLayoutIter* -> PgLayoutIter
76 * - PangoScriptIter* -> PgScriptIter
77 * - PangoTabArray* -> PgTabArray
78 * module aliases:
79 * local aliases:
82 module pango.PgAttribute;
84 version(noAssert)
86 version(Tango)
88 import tango.io.Stdout; // use the tango loging?
92 private import gtkc.pangotypes;
94 private import gtkc.pango;
97 private import glib.ListSG;
98 private import glib.Str;
99 private import pango.PgContext;
100 private import pango.PgItem;
101 private import pango.PgLayout;
102 private import pango.PgFontDescription;
103 private import pango.PgFontMetrics;
104 private import pango.PgFontFamily;
105 private import pango.PgFontFace;
106 private import pango.PgFontMap;
107 private import pango.PgFontsetSimple;
108 private import pango.PgAttributeList;
109 private import pango.PgLanguage;
110 private import pango.PgTabArray;
111 private import pango.PgLayout;
112 private import pango.PgLayoutIter;
113 private import pango.PgScriptIter;
119 * Description
120 * Attributed text is used in a number of places in Pango. It
121 * is used as the input to the itemization process and also when
122 * creating a PangoLayout. The data types and functions in
123 * this section are used to represent and manipulate sets
124 * of attributes applied to a portion of text.
126 public class PgAttribute
129 /** the main Gtk struct */
130 protected PangoAttribute* pangoAttribute;
133 public PangoAttribute* getPgAttributeStruct()
135 return pangoAttribute;
139 /** the main Gtk struct as a void* */
140 protected void* getStruct()
142 return cast(void*)pangoAttribute;
146 * Sets our main struct and passes it to the parent class
148 public this (PangoAttribute* pangoAttribute)
150 version(noAssert)
152 if ( pangoAttribute is null )
154 int zero = 0;
155 version(Tango)
157 Stdout("struct pangoAttribute is null on constructor").newline;
159 else
161 printf("struct pangoAttribute is null on constructor");
163 zero = zero / zero;
166 else
168 assert(pangoAttribute !is null, "struct pangoAttribute is null on constructor");
170 this.pangoAttribute = pangoAttribute;
189 * Parses marked-up text (see
190 * markup format) to create
191 * a plain-text string and an attribute list.
192 * If accel_marker is nonzero, the given character will mark the
193 * character following it as an accelerator. For example, accel_marker
194 * might be an ampersand or underscore. All characters marked
195 * as an accelerator will receive a PANGO_UNDERLINE_LOW attribute,
196 * and the first character so marked will be returned in accel_char.
197 * Two accel_marker characters following each other produce a single
198 * literal accel_marker character.
199 * markup_text:
200 * markup to parse (see markup format)
201 * length:
202 * length of markup_text, or -1 if nul-terminated
203 * accel_marker:
204 * character that precedes an accelerator, or 0 for none
205 * attr_list:
206 * address of return location for a PangoAttrList, or NULL
207 * text:
208 * address of return location for text with tags stripped, or NULL
209 * accel_char:
210 * address of return location for accelerator char, or NULL
211 * error:
212 * address of return location for errors, or NULL
213 * Returns:
214 * FALSE if error is set, otherwise TRUE
216 public static int pangoParseMarkup(char[] markupText, int length, gunichar accelMarker, PangoAttrList** attrList, char** text, gunichar* accelChar, GError** error)
218 // gboolean pango_parse_markup (const char *markup_text, int length, gunichar accel_marker, PangoAttrList **attr_list, char **text, gunichar *accel_char, GError **error);
219 return pango_parse_markup(Str.toStringz(markupText), length, accelMarker, attrList, text, accelChar, error);
223 * Allocate a new attribute type ID.
224 * name:
225 * an identifier for the type (currently unused.)
226 * Returns:
227 * the new type ID.
229 public static PangoAttrType typeRegister(char[] name)
231 // PangoAttrType pango_attr_type_register (const gchar *name);
232 return pango_attr_type_register(Str.toStringz(name));
236 * Make a copy of an attribute.
237 * attr:
238 * a PangoAttribute
239 * Returns:
240 * the newly allocated PangoAttribute, which should be
241 * freed with pango_attribute_destroy().
243 public PangoAttribute* pangoAttributeCopy()
245 // PangoAttribute* pango_attribute_copy (const PangoAttribute *attr);
246 return pango_attribute_copy(pangoAttribute);
250 * Compare two attributes for equality. This compares only the
251 * actual value of the two attributes and not the ranges that the
252 * attributes apply to.
253 * attr1:
254 * a PangoAttribute
255 * attr2:
256 * another PangoAttribute
257 * Returns:
258 * TRUE if the two attributes have the same value.
260 public int pangoAttributeEqual(PangoAttribute* attr2)
262 // gboolean pango_attribute_equal (const PangoAttribute *attr1, const PangoAttribute *attr2);
263 return pango_attribute_equal(pangoAttribute, attr2);
267 * Destroy a PangoAttribute and free all associated memory.
268 * attr:
269 * a PangoAttribute.
271 public void pangoAttributeDestroy()
273 // void pango_attribute_destroy (PangoAttribute *attr);
274 pango_attribute_destroy(pangoAttribute);
278 * Create a new language tag attribute.
279 * language:
280 * language tag
281 * Returns:
282 * the newly allocated PangoAttribute, which should be
283 * freed with pango_attribute_destroy().
285 public static PangoAttribute* languageNew(PgLanguage language)
287 // PangoAttribute* pango_attr_language_new (PangoLanguage *language);
288 return pango_attr_language_new((language is null) ? null : language.getPgLanguageStruct());
292 * Create a new font family attribute.
293 * family:
294 * the family or comma separated list of families
295 * Returns:
296 * the newly allocated PangoAttribute, which should be
297 * freed with pango_attribute_destroy().
299 public static PangoAttribute* familyNew(char[] family)
301 // PangoAttribute* pango_attr_family_new (const char *family);
302 return pango_attr_family_new(Str.toStringz(family));
306 * Create a new font slant style attribute.
307 * style:
308 * the slant style
309 * Returns:
310 * the newly allocated PangoAttribute, which should be
311 * freed with pango_attribute_destroy().
313 public static PangoAttribute* styleNew(PangoStyle style)
315 // PangoAttribute* pango_attr_style_new (PangoStyle style);
316 return pango_attr_style_new(style);
320 * Create a new font variant attribute (normal or small caps)
321 * variant:
322 * the variant
323 * Returns:
324 * the newly allocated PangoAttribute, which should be
325 * freed with pango_attribute_destroy().
327 public static PangoAttribute* variantNew(PangoVariant variant)
329 // PangoAttribute* pango_attr_variant_new (PangoVariant variant);
330 return pango_attr_variant_new(variant);
334 * Create a new font stretch attribute
335 * stretch:
336 * the stretch
337 * Returns:
338 * the newly allocated PangoAttribute, which should be
339 * freed with pango_attribute_destroy().
341 public static PangoAttribute* stretchNew(PangoStretch stretch)
343 // PangoAttribute* pango_attr_stretch_new (PangoStretch stretch);
344 return pango_attr_stretch_new(stretch);
348 * Create a new font weight attribute.
349 * weight:
350 * the weight
351 * Returns:
352 * the newly allocated PangoAttribute, which should be
353 * freed with pango_attribute_destroy().
355 public static PangoAttribute* weightNew(PangoWeight weight)
357 // PangoAttribute* pango_attr_weight_new (PangoWeight weight);
358 return pango_attr_weight_new(weight);
362 * Create a new font-size attribute in fractional points.
363 * size:
364 * the font size, in PANGO_SCALEths of a point.
365 * Returns:
366 * the newly allocated PangoAttribute, which should be
367 * freed with pango_attribute_destroy().
369 public static PangoAttribute* sizeNew(int size)
371 // PangoAttribute* pango_attr_size_new (int size);
372 return pango_attr_size_new(size);
376 * Create a new font-size attribute in device units.
377 * size:
378 * the font size, in PANGO_SCALEths of a device unit.
379 * Returns:
380 * the newly allocated PangoAttribute, which should be
381 * freed with pango_attribute_destroy().
382 * Since 1.8
384 public static PangoAttribute* sizeNewAbsolute(int size)
386 // PangoAttribute* pango_attr_size_new_absolute (int size);
387 return pango_attr_size_new_absolute(size);
391 * Create a new font description attribute. This attribute
392 * allows setting family, style, weight, variant, stretch,
393 * and size simultaneously.
394 * desc:
395 * the font description
396 * Returns:
397 * the newly allocated PangoAttribute, which should be
398 * freed with pango_attribute_destroy().
400 public static PangoAttribute* fontDescNew(PgFontDescription desc)
402 // PangoAttribute* pango_attr_font_desc_new (const PangoFontDescription *desc);
403 return pango_attr_font_desc_new((desc is null) ? null : desc.getPgFontDescriptionStruct());
407 * Create a new foreground color attribute.
408 * red:
409 * the red value (ranging from 0 to 65535)
410 * green:
411 * the green value
412 * blue:
413 * the blue value
414 * Returns:
415 * the newly allocated PangoAttribute, which should be
416 * freed with pango_attribute_destroy().
418 public static PangoAttribute* foregroundNew(ushort red, ushort green, ushort blue)
420 // PangoAttribute* pango_attr_foreground_new (guint16 red, guint16 green, guint16 blue);
421 return pango_attr_foreground_new(red, green, blue);
425 * Create a new background color attribute.
426 * red:
427 * the red value (ranging from 0 to 65535)
428 * green:
429 * the green value
430 * blue:
431 * the blue value
432 * Returns:
433 * the newly allocated PangoAttribute, which should be
434 * freed with pango_attribute_destroy().
436 public static PangoAttribute* backgroundNew(ushort red, ushort green, ushort blue)
438 // PangoAttribute* pango_attr_background_new (guint16 red, guint16 green, guint16 blue);
439 return pango_attr_background_new(red, green, blue);
443 * Create a new strike-through attribute.
444 * strikethrough:
445 * TRUE if the text should be struck-through.
446 * Returns:
447 * the newly allocated PangoAttribute, which should be
448 * freed with pango_attribute_destroy().
450 public static PangoAttribute* strikethroughNew(int strikethrough)
452 // PangoAttribute* pango_attr_strikethrough_new (gboolean strikethrough);
453 return pango_attr_strikethrough_new(strikethrough);
457 * Create a new strikethrough color attribute. This attribute
458 * modifies the color of strikethrough lines. If not set, strikethrough
459 * lines will use the foreground color.
460 * red:
461 * the red value (ranging from 0 to 65535)
462 * green:
463 * the green value
464 * blue:
465 * the blue value
466 * Returns:
467 * the newly allocated PangoAttribute, which should be
468 * freed with pango_attribute_destroy().
469 * Since 1.8
471 public static PangoAttribute* strikethroughColorNew(ushort red, ushort green, ushort blue)
473 // PangoAttribute* pango_attr_strikethrough_color_new (guint16 red, guint16 green, guint16 blue);
474 return pango_attr_strikethrough_color_new(red, green, blue);
478 * Create a new underline-style attribute.
479 * underline:
480 * the underline style.
481 * Returns:
482 * the newly allocated PangoAttribute, which should be
483 * freed with pango_attribute_destroy().
485 public static PangoAttribute* underlineNew(PangoUnderline underline)
487 // PangoAttribute* pango_attr_underline_new (PangoUnderline underline);
488 return pango_attr_underline_new(underline);
492 * Create a new underline color attribute. This attribute
493 * modifies the color of underlines. If not set, underlines
494 * will use the foreground color.
495 * red:
496 * the red value (ranging from 0 to 65535)
497 * green:
498 * the green value
499 * blue:
500 * the blue value
501 * Returns:
502 * the newly allocated PangoAttribute, which should be
503 * freed with pango_attribute_destroy().
504 * Since 1.8
506 public static PangoAttribute* underlineColorNew(ushort red, ushort green, ushort blue)
508 // PangoAttribute* pango_attr_underline_color_new (guint16 red, guint16 green, guint16 blue);
509 return pango_attr_underline_color_new(red, green, blue);
515 * Create a new shape attribute. A shape is used to impose a
516 * particular ink and logical rectangle on the result of shaping a
517 * particular glyph. This might be used, for instance, for
518 * embedding a picture or a widget inside a PangoLayout.
519 * ink_rect:
520 * ink rectangle to assign to each character
521 * logical_rect:
522 * logical rectangle to assign to each character
523 * Returns:
524 * the newly allocated PangoAttribute, which should be
525 * freed with pango_attribute_destroy().
527 public static PangoAttribute* shapeNew(PangoRectangle* inkRect, PangoRectangle* logicalRect)
529 // PangoAttribute* pango_attr_shape_new (const PangoRectangle *ink_rect, const PangoRectangle *logical_rect);
530 return pango_attr_shape_new(inkRect, logicalRect);
534 * Like pango_attr_shape_new(), but a user data pointer is also
535 * provided; this pointer can be accessed when later
536 * rendering the glyph.
537 * ink_rect:
538 * ink rectangle to assign to each character
539 * logical_rect:
540 * logical rectangle to assign to each character
541 * data:
542 * user data pointer
543 * copy_func:
544 * function to copy data when the attribute
545 * is copied. If NULL, data is simply copied
546 * as a pointer.
547 * destroy_func:
548 * function to free data when the attribute
549 * is freed, or NULL
550 * Returns:
551 * the newly allocated PangoAttribute, which should be
552 * freed with pango_attribute_destroy().
553 * Since 1.8
555 public static PangoAttribute* shapeNewWithData(PangoRectangle* inkRect, PangoRectangle* logicalRect, void* data, PangoAttrDataCopyFunc copyFunc, GDestroyNotify destroyFunc)
557 // PangoAttribute* pango_attr_shape_new_with_data (const PangoRectangle *ink_rect, const PangoRectangle *logical_rect, gpointer data, PangoAttrDataCopyFunc copy_func, GDestroyNotify destroy_func);
558 return pango_attr_shape_new_with_data(inkRect, logicalRect, data, copyFunc, destroyFunc);
563 * Create a new font size scale attribute. The base font for the
564 * affected text will have its size multiplied by scale_factor.
565 * scale_factor:
566 * factor to scale the font
567 * Returns:
568 * the newly allocated PangoAttribute, which should be
569 * freed with pango_attribute_destroy().
571 public static PangoAttribute* scaleNew(double scaleFactor)
573 // PangoAttribute* pango_attr_scale_new (double scale_factor);
574 return pango_attr_scale_new(scaleFactor);
585 * Create a new baseline displacement attribute.
586 * rise:
587 * the amount that the text should be displaced vertically,
588 * in Pango units. Positive values displace the text upwards.
589 * Returns:
590 * the newly allocated PangoAttribute, which should be
591 * freed with pango_attribute_destroy().
593 public static PangoAttribute* riseNew(int rise)
595 // PangoAttribute* pango_attr_rise_new (int rise);
596 return pango_attr_rise_new(rise);
600 * Create a new letter-spacing attribute.
601 * letter_spacing:
602 * amount of extra space to add between graphemes
603 * of the text, in Pango units.
604 * Returns:
605 * the newly allocated PangoAttribute, which should be
606 * freed with pango_attribute_destroy().
607 * Since 1.6
609 public static PangoAttribute* letterSpacingNew(int letterSpacing)
611 // PangoAttribute* pango_attr_letter_spacing_new (int letter_spacing);
612 return pango_attr_letter_spacing_new(letterSpacing);
616 * Create a new font fallback attribute.
617 * If fallback is disabled, characters will only be used from the
618 * closest matching font on the system. No fallback will be done to
619 * other fonts on the system that might contain the characters in the
620 * text.
621 * enable_fallback:
622 * TRUE if we should fall back on other fonts
623 * for characters the active font is missing.
624 * Returns:
625 * the newly allocated PangoAttribute, which should be
626 * freed with pango_attribute_destroy().
627 * Since 1.4
629 public static PangoAttribute* fallbackNew(int enableFallback)
631 // PangoAttribute* pango_attr_fallback_new (gboolean enable_fallback);
632 return pango_attr_fallback_new(enableFallback);
636 * Create a new gravity attribute.
637 * gravity:
638 * the gravity value; should not be PANGO_GRAVITY_AUTO.
639 * Returns:
640 * the newly allocated PangoAttribute, which should be
641 * freed with pango_attribute_destroy().
642 * Since 1.16
644 public static PangoAttribute* gravityNew(PangoGravity gravity)
646 // PangoAttribute* pango_attr_gravity_new (PangoGravity gravity);
647 return pango_attr_gravity_new(gravity);
651 * Create a new gravity hint attribute.
652 * hint:
653 * the gravity hint value.
654 * Returns:
655 * the newly allocated PangoAttribute, which should be
656 * freed with pango_attribute_destroy().
657 * Since 1.16
659 public static PangoAttribute* gravityHintNew(PangoGravityHint hint)
661 // PangoAttribute* pango_attr_gravity_hint_new (PangoGravityHint hint);
662 return pango_attr_gravity_hint_new(hint);
668 * Fill in the fields of a color from a string specification. The
669 * string can either one of a large set of standard names. (Taken
670 * from the X11 rgb.txt file), or it can be a hex value in the
671 * form '#rgb' '#rrggbb' '#rrrgggbbb' or '#rrrrggggbbbb' where
672 * 'r', 'g' and 'b' are hex digits of the red, green, and blue
673 * components of the color, respectively. (White in the four
674 * forms is '#fff' '#ffffff' '#fffffffff' and '#ffffffffffff')
675 * color:
676 * a PangoColor structure in which to store the result
677 * spec:
678 * a string specifying the new color
679 * Returns:
680 * TRUE if parsing of the specifier succeeded,
681 * otherwise false.
683 public static int pangoColorParse(PangoColor* color, char[] spec)
685 // gboolean pango_color_parse (PangoColor *color, const char *spec);
686 return pango_color_parse(color, Str.toStringz(spec));
690 * Creates a copy of src, which should be freed with
691 * pango_color_free(). Primarily used by language bindings,
692 * not that useful otherwise (since colors can just be copied
693 * by assignment in C).
694 * src:
695 * color to copy
696 * Returns:
697 * the newly allocated PangoColor, which should
698 * be freed with pango_color_free().
700 public static PangoColor* pangoColorCopy(PangoColor* src)
702 // PangoColor* pango_color_copy (const PangoColor *src);
703 return pango_color_copy(src);
707 * Frees a color allocated by pango_color_copy().
708 * color:
709 * an allocated PangoColor
711 public static void pangoColorFree(PangoColor* color)
713 // void pango_color_free (PangoColor *color);
714 pango_color_free(color);
718 * Returns a textual specification of color in the hexadecimal form
719 * #rrrrggggbbbb, where r,
720 * g and b are hex digits representing
721 * the red, green, and blue components respectively.
722 * color:
723 * a PangoColor
724 * Returns:
725 * a newly-allocated text string that must be freed with g_free().
726 * Since 1.16
728 public static char[] pangoColorToString(PangoColor* color)
730 // gchar* pango_color_to_string (const PangoColor *color);
731 return Str.toString(pango_color_to_string(color) );
742 * Create a new empty attribute list with a reference count of one.
743 * Returns:
744 * the newly allocated PangoAttrList, which should
745 * be freed with pango_attr_list_unref().
747 public static PangoAttrList* listNew()
749 // PangoAttrList* pango_attr_list_new (void);
750 return pango_attr_list_new();
754 * Increase the reference count of the given attribute list by one.
755 * list:
756 * a PangoAttrList
757 * Returns:
758 * The attribute list passed in
759 * Since 1.10
761 public static PangoAttrList* listRef(PangoAttrList* list)
763 // PangoAttrList* pango_attr_list_ref (PangoAttrList *list);
764 return pango_attr_list_ref(list);
768 * Decrease the reference count of the given attribute list by one.
769 * If the result is zero, free the attribute list and the attributes
770 * it contains.
771 * list:
772 * a PangoAttrList
774 public static void listUnref(PangoAttrList* list)
776 // void pango_attr_list_unref (PangoAttrList *list);
777 pango_attr_list_unref(list);
781 * Copy list and return an identical new list.
782 * list:
783 * a PangoAttrList
784 * Returns:
785 * the newly allocated PangoAttrList, with a
786 * reference count of one, which should
787 * be freed with pango_attr_list_unref().
789 public static PangoAttrList* listCopy(PangoAttrList* list)
791 // PangoAttrList* pango_attr_list_copy (PangoAttrList *list);
792 return pango_attr_list_copy(list);
796 * Insert the given attribute into the PangoAttrList. It will
797 * be inserted after all other attributes with a matching
798 * start_index.
799 * list:
800 * a PangoAttrList
801 * attr:
802 * the attribute to insert. Ownership of this value is
803 * assumed by the list.
805 public static void listInsert(PangoAttrList* list, PangoAttribute* attr)
807 // void pango_attr_list_insert (PangoAttrList *list, PangoAttribute *attr);
808 pango_attr_list_insert(list, attr);
812 * Insert the given attribute into the PangoAttrList. It will
813 * be inserted before all other attributes with a matching
814 * start_index.
815 * list:
816 * a PangoAttrList
817 * attr:
818 * the attribute to insert. Ownership of this value is
819 * assumed by the list.
821 public static void listInsertBefore(PangoAttrList* list, PangoAttribute* attr)
823 // void pango_attr_list_insert_before (PangoAttrList *list, PangoAttribute *attr);
824 pango_attr_list_insert_before(list, attr);
828 * Insert the given attribute into the PangoAttrList. It will
829 * replace any attributes of the same type on that segment
830 * and be merged with any adjoining attributes that are identical.
831 * This function is slower than pango_attr_list_insert() for
832 * creating a attribute list in order (potentially much slower
833 * for large lists). However, pango_attr_list_insert() is not
834 * suitable for continually changing a set of attributes
835 * since it never removes or combines existing attributes.
836 * list:
837 * a PangoAttrList
838 * attr:
839 * the attribute to insert. Ownership of this value is
840 * assumed by the list.
842 public static void listChange(PangoAttrList* list, PangoAttribute* attr)
844 // void pango_attr_list_change (PangoAttrList *list, PangoAttribute *attr);
845 pango_attr_list_change(list, attr);
849 * This function opens up a hole in list, fills it in with attributes from
850 * the left, and then merges other on top of the hole.
851 * This operation is equivalent to stretching every attribute
852 * that applies at position pos in list by an amount len,
853 * and then calling pango_attr_list_change() with a copy
854 * of each attribute in other in sequence (offset in position by pos).
855 * This operation proves useful for, for instance, inserting
856 * a pre-edit string in the middle of an edit buffer.
857 * list:
858 * a PangoAttrList
859 * other:
860 * another PangoAttrList
861 * pos:
862 * the position in list at which to insert other
863 * len:
864 * the length of the spliced segment. (Note that this
865 * must be specified since the attributes in other
866 * may only be present at some subsection of this range)
868 public static void listSplice(PangoAttrList* list, PangoAttrList* other, int pos, int len)
870 // void pango_attr_list_splice (PangoAttrList *list, PangoAttrList *other, gint pos, gint len);
871 pango_attr_list_splice(list, other, pos, len);
875 * Given a PangoAttrList and callback function, removes any elements
876 * of list for which func returns TRUE and inserts them into
877 * a new list.
878 * list:
879 * a PangoAttrList
880 * func:
881 * callback function; returns TRUE if an attribute
882 * should be filtered out.
883 * data:
884 * Data to be passed to func
885 * Returns:
886 * the new PangoAttrList or NULL if
887 * no attributes of the given types were found.
888 * Since 1.2
890 public static PangoAttrList* listFilter(PangoAttrList* list, PangoAttrFilterFunc func, void* data)
892 // PangoAttrList* pango_attr_list_filter (PangoAttrList *list, PangoAttrFilterFunc func, gpointer data);
893 return pango_attr_list_filter(list, func, data);
898 * Create a iterator initialized to the beginning of the list.
899 * list must not be modified until this iterator is freed.
900 * list:
901 * a PangoAttrList
902 * Returns:
903 * the newly allocated PangoAttrIterator, which should
904 * be freed with pango_attr_iterator_destroy().
906 public static PangoAttrIterator* listGetIterator(PangoAttrList* list)
908 // PangoAttrIterator* pango_attr_list_get_iterator (PangoAttrList *list);
909 return pango_attr_list_get_iterator(list);
914 * Copy a PangoAttrIterator
915 * iterator:
916 * a PangoAttrIterator.
917 * Returns:
918 * the newly allocated PangoAttrIterator, which should
919 * be freed with pango_attr_iterator_destroy().
921 public static PangoAttrIterator* iteratorCopy(PangoAttrIterator* iterator)
923 // PangoAttrIterator* pango_attr_iterator_copy (PangoAttrIterator *iterator);
924 return pango_attr_iterator_copy(iterator);
928 * Advance the iterator until the next change of style.
929 * iterator:
930 * a PangoAttrIterator
931 * Returns:
932 * FALSE if the iterator is at the end of the list, otherwise TRUE
934 public static int iteratorNext(PangoAttrIterator* iterator)
936 // gboolean pango_attr_iterator_next (PangoAttrIterator *iterator);
937 return pango_attr_iterator_next(iterator);
941 * Get the range of the current segment. Note that the
942 * stored return values are signed, not unsigned like
943 * the values in PangoAttribute. To deal with this API
944 * oversight, stored return values that wouldn't fit into
945 * a signed integer are clamped to G_MAXINT.
946 * iterator:
947 * a PangoAttrIterator
948 * start:
949 * location to store the start of the range
950 * end:
951 * location to store the end of the range
953 public static void iteratorRange(PangoAttrIterator* iterator, int* start, int* end)
955 // void pango_attr_iterator_range (PangoAttrIterator *iterator, gint *start, gint *end);
956 pango_attr_iterator_range(iterator, start, end);
960 * Find the current attribute of a particular type at the iterator
961 * location. When multiple attributes of the same type overlap,
962 * the attribute whose range starts closest to the current location
963 * is used.
964 * iterator:
965 * a PangoAttrIterator
966 * type:
967 * the type of attribute to find.
968 * Returns:
969 * the current attribute of the given type, or NULL
970 * if no attribute of that type applies to the current
971 * location.
973 public static PangoAttribute* iteratorGet(PangoAttrIterator* iterator, PangoAttrType type)
975 // PangoAttribute* pango_attr_iterator_get (PangoAttrIterator *iterator, PangoAttrType type);
976 return pango_attr_iterator_get(iterator, type);
980 * Get the font and other attributes at the current iterator position.
981 * iterator:
982 * a PangoAttrIterator
983 * desc:
984 * a PangoFontDescription to fill in with the current values.
985 * The family name in this structure will be set using
986 * pango_font_description_set_family_static() using values from
987 * an attribute in the PangoAttrList associated with the iterator,
988 * so if you plan to keep it around, you must call:
989 * pango_font_description_set_family (desc, pango_font_description_get_family (desc)).
990 * language:
991 * if non-NULL, location to store language tag for item, or NULL
992 * if none is found.
993 * extra_attrs:
994 * if non-NULL, location in which to store a list of non-font
995 * attributes at the the current position; only the highest priority
996 * value of each attribute will be added to this list. In order
997 * to free this value, you must call pango_attribute_destroy() on
998 * each member.
1000 public static void iteratorGetFont(PangoAttrIterator* iterator, PgFontDescription desc, PangoLanguage** language, GSList** extraAttrs)
1002 // void pango_attr_iterator_get_font (PangoAttrIterator *iterator, PangoFontDescription *desc, PangoLanguage **language, GSList **extra_attrs);
1003 pango_attr_iterator_get_font(iterator, (desc is null) ? null : desc.getPgFontDescriptionStruct(), language, extraAttrs);
1007 * Gets a list of all attributes at the current position of the
1008 * iterator.
1009 * iterator:
1010 * a PangoAttrIterator
1011 * Returns:
1012 * a list of all attributes for the current range.
1013 * To free this value, call pango_attribute_destroy() on
1014 * each value and g_slist_free() on the list.
1015 * Since 1.2
1017 public static ListSG iteratorGetAttrs(PangoAttrIterator* iterator)
1019 // GSList* pango_attr_iterator_get_attrs (PangoAttrIterator *iterator);
1020 return new ListSG( pango_attr_iterator_get_attrs(iterator) );
1024 * Destroy a PangoAttrIterator and free all associated memory.
1025 * iterator:
1026 * a PangoAttrIterator.
1028 public static void iteratorDestroy(PangoAttrIterator* iterator)
1030 // void pango_attr_iterator_destroy (PangoAttrIterator *iterator);
1031 pango_attr_iterator_destroy(iterator);