// -*- 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 Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include namespace Pango { Layout::Layout(const Glib::RefPtr& context) : Glib::Object(G_OBJECT(pango_layout_new(context->gobj()))) {} Glib::RefPtr Layout::create(const Cairo::RefPtr& context) { return Glib::wrap( pango_cairo_create_layout(context->cobj()) ); } void Layout::update_from_cairo_context(const Cairo::RefPtr& 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 Layout::get_log_attrs() const { //Get array: PangoLogAttr* pAttrs = 0; int n_attrs = 0; pango_layout_get_log_attrs(const_cast(gobj()), &pAttrs, &n_attrs); return Glib::ArrayHandle(pAttrs, n_attrs, Glib::OWNERSHIP_SHALLOW); } Rectangle Layout::index_to_pos(int index) const { Rectangle pos; pango_layout_index_to_pos(const_cast(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(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(gobj()), index, 0, weak_pos.gobj()); return weak_pos; } Rectangle Layout::get_ink_extents() const { Rectangle ink_extents; pango_layout_get_extents(const_cast(gobj()), ink_extents.gobj(), 0); return ink_extents; } Rectangle Layout::get_logical_extents() const { Rectangle logical_extents; pango_layout_get_extents(const_cast(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(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(gobj()), 0, logical_extents.gobj()); return logical_extents; } void Layout::get_iter(LayoutIter& iter) { PangoLayoutIter* cobject = pango_layout_get_iter(gobj()); iter = Glib::wrap(cobject, false /* don't take_copy */); } _DEPRECATE_IFDEF_START LayoutIter Layout::get_iter() { PangoLayoutIter* cobject = pango_layout_get_iter(gobj()); return Glib::wrap(cobject, false /* don't take_copy */); } _DEPRECATE_IFDEF_END void Layout::unset_font_description() { pango_layout_set_font_description(gobj(), 0); } void Layout::add_to_cairo_context(const Cairo::RefPtr& context) { pango_cairo_layout_path(context->cobj(), gobj()); } void Layout::show_in_cairo_context(const Cairo::RefPtr& context) { pango_cairo_show_layout(context->cobj(), gobj()); } } /* namespace Pango */