1 // Generated by gtkmmproc -- DO NOT MODIFY!
4 #include <pangomm/tabarray.h>
5 #include <pangomm/private/tabarray_p.h>
7 #include <pango/pango-enum-types.h>
13 * Copyright 2002 The gtkmm Development Team
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.
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.
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.
33 TabArray::TabArray(int initial_size, bool positions_in_pixels)
35 gobject_ = pango_tab_array_new(initial_size, (gboolean)positions_in_pixels);
38 std::pair<TabAlign,int> TabArray::get_tab(int tab_index) const
40 PangoTabAlign p_alignment;
43 pango_tab_array_get_tab(const_cast<PangoTabArray*>(gobj()), tab_index, &p_alignment, &location);
44 alignment = static_cast<TabAlign>(p_alignment);
45 return std::pair<TabAlign,int>(alignment, location);
48 Glib::ArrayHandle< std::pair<TabAlign,int> > TabArray::get_tabs() const
50 typedef std::pair<TabAlign,int> PairType;
52 PairType* pair_buffer = 0;
53 const int size = pango_tab_array_get_size(const_cast<PangoTabArray*>(gobj()));
58 PangoTabAlign* pAlignments = 0;
60 pango_tab_array_get_tabs(const_cast<PangoTabArray*>(gobj()), &pAlignments, &pLocations);
62 if(pAlignments && pLocations)
64 // Create temporary C array. Fortunately, the C++ type is POD,
65 // so we can safely store it in the array.
66 pair_buffer = g_new(PairType, size);
68 for(int i = 0; i < size; ++i)
70 pair_buffer[i].first = (TabAlign)(pAlignments[i]);
71 pair_buffer[i].second = pLocations[i];
79 return Glib::ArrayHandle<PairType>(pair_buffer, size, Glib::OWNERSHIP_SHALLOW);
82 } /* namespace Pango */
87 } // anonymous namespace
90 GType Glib::Value<Pango::TabAlign>::value_type()
92 return pango_tab_align_get_type();
99 Pango::TabArray wrap(PangoTabArray* object, bool take_copy)
101 return Pango::TabArray(object, take_copy);
112 GType TabArray::get_type()
114 return pango_tab_array_get_type();
119 gobject_ (0) // Allows creation of invalid wrapper, e.g. for output arguments to methods.
122 TabArray::TabArray(const TabArray& other)
124 gobject_ ((other.gobject_) ? pango_tab_array_copy(other.gobject_) : 0)
127 TabArray::TabArray(PangoTabArray* gobject, bool make_a_copy)
129 // For BoxedType wrappers, make_a_copy is true by default. The static
130 // BoxedType wrappers must always take a copy, thus make_a_copy = true
131 // ensures identical behaviour if the default argument is used.
132 gobject_ ((make_a_copy && gobject) ? pango_tab_array_copy(gobject) : gobject)
135 TabArray& TabArray::operator=(const TabArray& other)
137 TabArray temp (other);
142 TabArray::~TabArray()
145 pango_tab_array_free(gobject_);
148 void TabArray::swap(TabArray& other)
150 PangoTabArray *const temp = gobject_;
151 gobject_ = other.gobject_;
152 other.gobject_ = temp;
155 PangoTabArray* TabArray::gobj_copy() const
157 return pango_tab_array_copy(gobject_);
161 int TabArray::get_size() const
163 return pango_tab_array_get_size(const_cast<PangoTabArray*>(gobj()));
166 void TabArray::resize(int new_size)
168 pango_tab_array_resize(gobj(), new_size);
171 void TabArray::set_tab(int tab_index, TabAlign alignment, int location)
173 pango_tab_array_set_tab(gobj(), tab_index, ((PangoTabAlign)(alignment)), location);
176 bool TabArray::get_positions_in_pixels() const
178 return pango_tab_array_get_positions_in_pixels(const_cast<PangoTabArray*>(gobj()));