diff options
Diffstat (limited to 'libs/gtkmm2/pango/src/layout.ccg')
-rw-r--r-- | libs/gtkmm2/pango/src/layout.ccg | 132 |
1 files changed, 132 insertions, 0 deletions
diff --git a/libs/gtkmm2/pango/src/layout.ccg b/libs/gtkmm2/pango/src/layout.ccg new file mode 100644 index 0000000000..3151a10399 --- /dev/null +++ b/libs/gtkmm2/pango/src/layout.ccg @@ -0,0 +1,132 @@ +// -*- c++ -*- +/* $Id: layout.ccg,v 1.3 2006/05/30 17:14:21 murrayc Exp $ */ + +/* + * + * Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <pango/pangocairo.h> + +namespace Pango +{ + +Layout::Layout(const Glib::RefPtr<Context>& context) +: + Glib::Object(G_OBJECT(pango_layout_new(context->gobj()))) +{} + +Glib::RefPtr<Layout> Layout::create(const Cairo::RefPtr<Cairo::Context>& context) +{ + return Glib::wrap( pango_cairo_create_layout(context->cobj()) ); +} + +void Layout::update_from_cairo_context(const Cairo::RefPtr<Cairo::Context>& context) +{ + pango_cairo_update_layout(context->cobj(), gobj()); +} + +void Layout::set_text(const Glib::ustring& text) +{ + pango_layout_set_text(gobj(), text.c_str(), text.bytes()); +} + +void Layout::set_markup(const Glib::ustring& markup) +{ + return pango_layout_set_markup(gobj(), markup.c_str(), markup.bytes()); +} + +void Layout::set_markup(const Glib::ustring& markup, gunichar accel_marker, gunichar& accel_char) +{ + return pango_layout_set_markup_with_accel(gobj(), markup.c_str(), markup.bytes(), accel_marker, &accel_char); +} + +Glib::ArrayHandle<PangoLogAttr> Layout::get_log_attrs() const +{ + //Get array: + PangoLogAttr* pAttrs = 0; + int n_attrs = 0; + pango_layout_get_log_attrs(const_cast<PangoLayout*>(gobj()), &pAttrs, &n_attrs); + + return Glib::ArrayHandle<PangoLogAttr>(pAttrs, n_attrs, Glib::OWNERSHIP_SHALLOW); +} + +Rectangle Layout::index_to_pos(int index) const +{ + Rectangle pos; + pango_layout_index_to_pos(const_cast<PangoLayout*>(gobj()), index, pos.gobj()); + return pos; +} + +Rectangle Layout::get_cursor_strong_pos(int index) const +{ + Rectangle strong_pos; + pango_layout_get_cursor_pos(const_cast<PangoLayout*>(gobj()), index, strong_pos.gobj(), 0); + return strong_pos; +} + +Rectangle Layout::get_cursor_weak_pos(int index) const +{ + Rectangle weak_pos; + pango_layout_get_cursor_pos(const_cast<PangoLayout*>(gobj()), index, 0, weak_pos.gobj()); + return weak_pos; +} + +Rectangle Layout::get_ink_extents() const +{ + Rectangle ink_extents; + pango_layout_get_extents(const_cast<PangoLayout*>(gobj()), ink_extents.gobj(), 0); + return ink_extents; +} + +Rectangle Layout::get_logical_extents() const +{ + Rectangle logical_extents; + pango_layout_get_extents(const_cast<PangoLayout*>(gobj()), 0, logical_extents.gobj()); + return logical_extents; +} + +Rectangle Layout::get_pixel_ink_extents() const +{ + Rectangle ink_extents; + pango_layout_get_pixel_extents(const_cast<PangoLayout*>(gobj()), ink_extents.gobj(), 0); + return ink_extents; +} + +Rectangle Layout::get_pixel_logical_extents() const +{ + Rectangle logical_extents; + pango_layout_get_pixel_extents(const_cast<PangoLayout*>(gobj()), 0, logical_extents.gobj()); + return logical_extents; +} + +void Layout::get_iter(LayoutIter& iter) +{ + iter.assign_gobj(pango_layout_get_iter(gobj())); +} + +void Layout::unset_font_description() +{ + pango_layout_set_font_description(gobj(), 0); +} + +void Layout::add_to_cairo_context(const Cairo::RefPtr<Cairo::Context>& context) +{ + pango_cairo_layout_path(context->cobj(), gobj()); +} + +} /* namespace Pango */ |