// Generated by gtkmmproc -- DO NOT MODIFY! #include #include // -*- c++ -*- /* $Id$ */ /* * * 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 namespace Pango { Rectangle LayoutLine::get_ink_extents() const { Rectangle ink_rect; pango_layout_line_get_extents(const_cast(gobj()), ink_rect.gobj(), 0); return ink_rect; } Rectangle LayoutLine::get_logical_extents() const { Rectangle logical_rect; pango_layout_line_get_extents(const_cast(gobj()), 0, logical_rect.gobj()); return logical_rect; } Rectangle LayoutLine::get_pixel_ink_extents() const { Rectangle ink_rect; pango_layout_line_get_pixel_extents(const_cast(gobj()), ink_rect.gobj(), 0); return ink_rect; } Rectangle LayoutLine::get_pixel_logical_extents() const { Rectangle logical_rect; pango_layout_line_get_pixel_extents(const_cast(gobj()), 0, logical_rect.gobj()); return logical_rect; } int LayoutLine::index_to_x(int index, bool trailing) const { int x_pos; pango_layout_line_index_to_x(const_cast(gobj()), index, trailing, &x_pos); return x_pos; } Glib::ArrayHandle > LayoutLine::get_x_ranges(int start_index, int end_index) const { int* ranges = 0; int n_ranges = 0; pango_layout_line_get_x_ranges(const_cast(gobj()), start_index, end_index, &ranges, &n_ranges); return Glib::ArrayHandle >(reinterpret_cast*>(ranges), n_ranges, Glib::OWNERSHIP_SHALLOW); } } /* namespace Pango */ namespace { } // anonymous namespace /* Why reinterpret_cast(gobject) is needed: * * A LayoutLine instance is in fact always a PangoLayoutLine instance. * Unfortunately, PangoLayoutLine cannot be a member of LayoutLine, * because it is an opaque struct. Also, the C interface does not provide * any hooks to install a destroy notification handler, thus we cannot * wrap it dynamically either. * * The cast works because LayoutLine does not have any member data, and * it is impossible to derive from it. This is ensured by not implementing * the (protected) default constructor. The ctor is protected rather than * private just to avoid a compile warning. */ namespace Glib { Glib::RefPtr wrap(PangoLayoutLine* object, bool take_copy) { if(take_copy && object) pango_layout_line_ref(object); // See the comment at the top of this file, if you want to know why the cast works. return Glib::RefPtr(reinterpret_cast(object)); } } // namespace Glib namespace Pango { void LayoutLine::reference() const { // See the comment at the top of this file, if you want to know why the cast works. pango_layout_line_ref(reinterpret_cast(const_cast(this))); } void LayoutLine::unreference() const { // See the comment at the top of this file, if you want to know why the cast works. pango_layout_line_unref(reinterpret_cast(const_cast(this))); } PangoLayoutLine* LayoutLine::gobj() { // See the comment at the top of this file, if you want to know why the cast works. return reinterpret_cast(this); } const PangoLayoutLine* LayoutLine::gobj() const { // See the comment at the top of this file, if you want to know why the cast works. return reinterpret_cast(this); } PangoLayoutLine* LayoutLine::gobj_copy() const { // See the comment at the top of this file, if you want to know why the cast works. PangoLayoutLine *const gobject = reinterpret_cast(const_cast(this)); pango_layout_line_ref(gobject); return gobject; } bool LayoutLine::x_to_index(int x_pos, int& index, int& trailing) const { return pango_layout_line_x_to_index(const_cast(gobj()), x_pos, &index, &trailing); } void LayoutLine::get_extents(Rectangle& ink_rect, Rectangle& logical_rect) const { pango_layout_line_get_extents(const_cast(gobj()), (ink_rect).gobj(), (logical_rect).gobj()); } void LayoutLine::get_pixel_extents(Rectangle& ink_rect, Rectangle& logical_rect) const { pango_layout_line_get_pixel_extents(const_cast(gobj()), (ink_rect).gobj(), (logical_rect).gobj()); } Glib::RefPtr LayoutLine::get_layout() { Glib::RefPtr ref_ptr(Glib::wrap(gobj()->layout)); if(ref_ptr) ref_ptr->reference(); return ref_ptr; } Glib::RefPtr LayoutLine::get_layout() const { Glib::RefPtr ref_ptr(Glib::wrap(gobj()->layout)); if(ref_ptr) ref_ptr->reference(); return ref_ptr; } int LayoutLine::get_length() const { return gobj()->length; } int LayoutLine::get_start_index() const { return gobj()->start_index; } } // namespace Pango