Blame pango/src/layout.ccg

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