Merged revisions 6293,6296-6306,6308 via svnmerge from
[ardour.git] / libs / gtkmm2 / pango / pangomm / attrlist.cc
1 // Generated by gtkmmproc -- DO NOT MODIFY!
2
3
4 #include <pangomm/attrlist.h>
5 #include <pangomm/private/attrlist_p.h>
6
7 // -*- c++ -*-
8 /* $Id$ */
9
10 /*
11  *
12  * Copyright 1998-1999 The Gtk-- Development Team
13  * Copyright 2001      Free Software Foundation
14  *
15  * This library is free software; you can redistribute it and/or
16  * modify it under the terms of the GNU Library General Public
17  * License as published by the Free Software Foundation; either
18  * version 2 of the License, or (at your option) any later version.
19  *
20  * This library is distributed in the hope that it will be useful,
21  * but WITHOUT ANY WARRANTY; without even the implied warranty of
22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
23  * Library General Public License for more details.
24  *
25  * You should have received a copy of the GNU Library General Public
26  * License along with this library; if not, write to the Free
27  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28  */
29
30 namespace Pango
31 {
32
33 AttrList::AttrList(const Glib::ustring& markup_text, gunichar accel_marker)
34 {
35   gboolean bTest = pango_parse_markup(markup_text.c_str(), -1 /* means null-terminated */, accel_marker,
36                                           &gobject_, 0, 0, 0);
37   if(bTest == FALSE)
38     gobject_ = 0;
39 }
40
41 AttrList::operator bool()
42 {
43   return gobj() != 0;
44 }
45
46 AttrList::AttrList(const Glib::ustring& markup_text, gunichar accel_marker, Glib::ustring& text, gunichar& accel_char)
47 {
48   //initialize output parameters:
49   text.erase();
50   accel_char = 0;
51
52   gchar* pchText = 0;
53   gboolean bTest = pango_parse_markup(markup_text.c_str(), -1 /* means null-terminated */, accel_marker,
54                                           &gobject_, &pchText, &accel_char, 0);
55   if(bTest == FALSE)
56   {
57     gobject_ = 0;
58   }
59   else
60   {
61     text = pchText;
62     g_free(pchText);
63   }
64 }
65
66 void AttrList::insert(Attribute& attr)
67 {
68   pango_attr_list_insert(gobj(), pango_attribute_copy(attr.gobj()));
69 }
70  
71 void AttrList::insert_before(Attribute& attr)
72 {
73   pango_attr_list_insert_before(gobj(), pango_attribute_copy(attr.gobj()));
74 }
75
76 void AttrList::change(Attribute& attr)
77 {
78   pango_attr_list_change(gobj(), pango_attribute_copy(attr.gobj()));
79 }
80  
81 } /* namespace Pango */
82
83 namespace
84 {
85 } // anonymous namespace
86
87
88 namespace Glib
89 {
90
91 Pango::AttrList wrap(PangoAttrList* object, bool take_copy)
92 {
93   return Pango::AttrList(object, take_copy);
94 }
95
96 } // namespace Glib
97
98
99 namespace Pango
100 {
101
102
103 // static
104 GType AttrList::get_type()
105 {
106   return pango_attr_list_get_type();
107 }
108
109 AttrList::AttrList()
110 :
111   gobject_ (pango_attr_list_new())
112 {}
113
114 AttrList::AttrList(const AttrList& other)
115 :
116   gobject_ ((other.gobject_) ? pango_attr_list_copy(other.gobject_) : 0)
117 {}
118
119 AttrList::AttrList(PangoAttrList* gobject, bool make_a_copy)
120 :
121   // For BoxedType wrappers, make_a_copy is true by default.  The static
122   // BoxedType wrappers must always take a copy, thus make_a_copy = true
123   // ensures identical behaviour if the default argument is used.
124   gobject_ ((make_a_copy && gobject) ? pango_attr_list_copy(gobject) : gobject)
125 {}
126
127 AttrList& AttrList::operator=(const AttrList& other)
128 {
129   AttrList temp (other);
130   swap(temp);
131   return *this;
132 }
133
134 AttrList::~AttrList()
135 {
136   if(gobject_)
137     pango_attr_list_unref(gobject_);
138 }
139
140 void AttrList::swap(AttrList& other)
141 {
142   PangoAttrList *const temp = gobject_;
143   gobject_ = other.gobject_;
144   other.gobject_ = temp;
145 }
146
147 PangoAttrList* AttrList::gobj_copy() const
148 {
149   return pango_attr_list_copy(gobject_);
150 }
151
152
153 void AttrList::splice(AttrList& other, int pos, int len)
154 {
155 pango_attr_list_splice(gobj(), (other).gobj(), pos, len); 
156 }
157
158 AttrIter AttrList::get_iter()
159 {
160   return Glib::wrap((pango_attr_list_get_iterator(gobj())));
161 }
162
163
164 } // namespace Pango
165
166