1 /* $Id: attrlist.hg,v 1.4 2005/11/22 15:00:17 murrayc Exp $ */
5 * Copyright (C) 1998-1999 The gtkmm Development Team
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the Free
19 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #include <pangomm/attributes.h>
23 #include <pangomm/attriter.h>
30 /** A Pango::AttrList represents a list of attributes that apply to a section of text.
31 * The attributes are, in general, allowed to overlap in an arbitrary fashion, however,
32 * if the attributes are manipulated only through Pango::AttrList::change(), the overlap between properties will meet stricter criteria.
34 * Since the Pango::AttrList structure is stored as a linear list, it is not suitable for storing attributes for large amounts of text.
35 * In general, you should not use a single Pango::AttrList for more than one paragraph of text.
37 * When obtaining an AttrList, you should check that it is valid. For instance, if(attrlist).
41 _CLASS_BOXEDTYPE(AttrList, PangoAttrList, pango_attr_list_new, pango_attr_list_copy, pango_attr_list_unref)
42 _IGNORE(pango_attr_list_copy, pango_attr_list_ref, pango_attr_list_unref)
44 /** Constructs an attribute list by parsing a marked-up text (see markup format).
45 * If @a accel_marker is nonzero, the given character will mark the character
46 * following it as an accelerator. For example, the accel marker might be an
47 * ampersand or underscore. All characters marked as an accelerator will receive
48 * a Pango::UNDERLINE_LOW attribute.
49 * Two @a accel_marker characters following each other
50 * produce a single literal @a accel_marker character.
52 * @param markup_text Markup to parse (see markup format).
53 * @param accel_marker Character that precedes an accelerator, or <tt>0</tt> for none.
55 explicit AttrList(const Glib::ustring& markup_text, gunichar accel_marker=0);
57 /** Constructs an attribute list by parsing a marked-up text (see markup format).
58 * @a text is set to the plaintext string.
59 * If @a accel_marker is nonzero, the given character will mark the character
60 * following it as an accelerator. For example, the accel marker might be an
61 * ampersand or underscore. All characters marked as an accelerator will receive
62 * a Pango::UNDERLINE_LOW attribute. The first character so marked will be
63 * returned in @a accel_char. Two @a accel_marker characters following each other
64 * produce a single literal @a accel_marker character.
66 * @param markup_text Markup to parse (see markup format).
67 * @param accel_marker Character that precedes an accelerator, or <tt>0</tt> for none.
68 * @param text Return location for text with tags stripped.
69 * @param accel_char Return location for accelerator char.
71 AttrList(const Glib::ustring& markup_text, gunichar accel_marker, Glib::ustring& text, gunichar& accel_char);
73 ///Tests whether the AttrList is valid.
76 void insert(Attribute& attr);
77 _IGNORE(pango_attr_list_insert) // hand code because we need to pass a copy of the attribute
78 void insert_before(Attribute& attr);
79 _IGNORE(pango_attr_list_insert_before) // hand code because we need to pass a copy of the attribute
80 void change(Attribute& attr);
81 _IGNORE(pango_attr_list_change) // hand code because we need to pass a copy of the attribute
82 _WRAP_METHOD(void splice(AttrList& other, int pos, int len), pango_attr_list_splice)
83 _WRAP_METHOD(AttrIter get_iter(), pango_attr_list_get_iterator)
85 //TODO: Though it doesn't seem important:
86 //PangoAttrList* pango_attr_list_filter (PangoAttrList* list, PangoAttrFilterFunc func, gpointer data)