1
// Generated by gtkmmproc -- DO NOT MODIFY!
3
#include <pangomm/tabarray.h>
4
#include <pangomm/private/tabarray_p.h>
6
#include <pango/pango-enum-types.h>
12
* Copyright 2002 The gtkmm Development Team
14
* This library is free software; you can redistribute it and/or
15
* modify it under the terms of the GNU Library General Public
16
* License as published by the Free Software Foundation; either
17
* version 2 of the License, or (at your option) any later version.
19
* This library is distributed in the hope that it will be useful,
20
* but WITHOUT ANY WARRANTY; without even the implied warranty of
21
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22
* Library General Public License for more details.
24
* You should have received a copy of the GNU Library General Public
25
* License along with this library; if not, write to the Free
26
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
32
TabArray::TabArray(int initial_size, bool positions_in_pixels)
34
gobject_ = pango_tab_array_new(initial_size, (gboolean)positions_in_pixels);
37
std::pair<TabAlign,int> TabArray::get_tab(int tab_index) const
41
pango_tab_array_get_tab(const_cast<PangoTabArray*>(gobj()), tab_index, (PangoTabAlign*)&alignment, &location);
42
return std::pair<TabAlign,int>(alignment, location);
45
Glib::ArrayHandle< std::pair<TabAlign,int> > TabArray::get_tabs() const
47
typedef std::pair<TabAlign,int> PairType;
49
PairType* pair_buffer = 0;
50
const int size = pango_tab_array_get_size(const_cast<PangoTabArray*>(gobj()));
55
PangoTabAlign* pAlignments = 0;
57
pango_tab_array_get_tabs(const_cast<PangoTabArray*>(gobj()), &pAlignments, &pLocations);
59
if(pAlignments && pLocations)
61
// Create temporary C array. Fortunately, the C++ type is POD,
62
// so we can safely store it in the array.
63
pair_buffer = g_new(PairType, size);
65
for(int i = 0; i < size; ++i)
67
pair_buffer[i].first = (TabAlign)(pAlignments[i]);
68
pair_buffer[i].second = pLocations[i];
76
return Glib::ArrayHandle<PairType>(pair_buffer, size, Glib::OWNERSHIP_SHALLOW);
79
} /* namespace Pango */
84
} // anonymous namespace
87
GType Glib::Value<Pango::TabAlign>::value_type()
89
return pango_tab_align_get_type();
96
Pango::TabArray wrap(PangoTabArray* object, bool take_copy)
98
return Pango::TabArray(object, take_copy);
109
GType TabArray::get_type()
111
return pango_tab_array_get_type();
116
gobject_ (0) // Allows creation of invalid wrapper, e.g. for output arguments to methods.
119
TabArray::TabArray(const TabArray& other)
121
gobject_ ((other.gobject_) ? pango_tab_array_copy(other.gobject_) : 0)
124
TabArray::TabArray(PangoTabArray* gobject, bool make_a_copy)
126
// For BoxedType wrappers, make_a_copy is true by default. The static
127
// BoxedType wrappers must always take a copy, thus make_a_copy = true
128
// ensures identical behaviour if the default argument is used.
129
gobject_ ((make_a_copy && gobject) ? pango_tab_array_copy(gobject) : gobject)
132
TabArray& TabArray::operator=(const TabArray& other)
134
TabArray temp (other);
139
TabArray::~TabArray()
142
pango_tab_array_free(gobject_);
145
void TabArray::swap(TabArray& other)
147
PangoTabArray *const temp = gobject_;
148
gobject_ = other.gobject_;
149
other.gobject_ = temp;
152
PangoTabArray* TabArray::gobj_copy() const
154
return pango_tab_array_copy(gobject_);
158
int TabArray::get_size() const
160
return pango_tab_array_get_size(const_cast<PangoTabArray*>(gobj()));
163
void TabArray::resize(int new_size)
165
pango_tab_array_resize(gobj(), new_size);
168
void TabArray::set_tab(int tab_index, TabAlign alignment, int location)
170
pango_tab_array_set_tab(gobj(), tab_index, ((PangoTabAlign)(alignment)), location);
173
bool TabArray::get_positions_in_pixels() const
175
return pango_tab_array_get_positions_in_pixels(const_cast<PangoTabArray*>(gobj()));