diff options
Diffstat (limited to 'libs/gtkmm2/pango')
79 files changed, 11424 insertions, 0 deletions
diff --git a/libs/gtkmm2/pango/SConscript b/libs/gtkmm2/pango/SConscript new file mode 100644 index 0000000000..f869598895 --- /dev/null +++ b/libs/gtkmm2/pango/SConscript @@ -0,0 +1,11 @@ +import glob +import os + +pangomm_files = glob.glob('pangomm/*.cc') + +Import('env libraries') +pangomm = env.Copy() +pangomm.Merge([libraries['glibmm2'], libraries['pango'], libraries['sigc2']]) + +libpangomm = pangomm.StaticLibrary('pangomm', pangomm_files) +Default(libpangomm) diff --git a/libs/gtkmm2/pango/pangomm.h b/libs/gtkmm2/pango/pangomm.h new file mode 100644 index 0000000000..f319c23f06 --- /dev/null +++ b/libs/gtkmm2/pango/pangomm.h @@ -0,0 +1,41 @@ +/* $Id$ */ + +/* pangomm - a C++ wrapper for the GLib toolkit + * + * Copyright 2002 Free Software Foundation + * + * 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. + */ + +#ifndef _PANGOMM_H +#define _PANGOMM_H + +#include <pangomm/attrlist.h> +#include <pangomm/context.h> +#include <pangomm/coverage.h> +#include <pangomm/fontdescription.h> +#include <pangomm/fontface.h> +#include <pangomm/fontfamily.h> +#include <pangomm/font.h> +#include <pangomm/fontmap.h> +#include <pangomm/fontmetrics.h> +#include <pangomm/fontset.h> +#include <pangomm/layout.h> +#include <pangomm/layoutiter.h> +#include <pangomm/layoutline.h> +#include <pangomm/tabarray.h> + +#endif /* _PANGOMM_H */ + diff --git a/libs/gtkmm2/pango/pangomm/attributes.cc b/libs/gtkmm2/pango/pangomm/attributes.cc new file mode 100644 index 0000000000..2d23e5d77b --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/attributes.cc @@ -0,0 +1,534 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include <pangomm/attributes.h> +#include <pangomm/private/attributes_p.h> + +#include <pango/pango-enum-types.h> +/* + * + * Copyright 2002 Free Software Foundation + * + * 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. + */ + +namespace Pango +{ + +Attribute::Attribute() +: + gobject_(0) +{} + +Attribute::Attribute(const Attribute& src) +: + gobject_(src.gobject_ ? pango_attribute_copy(src.gobject_) : 0) +{} + +Attribute::Attribute(PangoAttribute* castitem, bool take_copy) +{ + if(take_copy) + { + if(castitem) + gobject_ = pango_attribute_copy(castitem); + else + gobject_ = 0; + } + else + { + // It was given to us by a function which has already made a copy for us to keep. + gobject_ = castitem; + } +} + +Attribute::~Attribute() +{ + if(gobject_) + pango_attribute_destroy(gobject_); + gobject_ = 0; +} + +Attribute& Attribute::operator=(const Attribute& src) +{ + PangoAttribute *const new_gobject = (src.gobject_ ? pango_attribute_copy(src.gobject_) : 0); + + if(gobject_) + pango_attribute_destroy(gobject_); + gobject_ = new_gobject; + + return *this; +} + +AttrType Attribute::get_type() const +{ + return (AttrType) ((gobject_) ? gobj()->klass->type : PANGO_ATTR_INVALID); +} + +AttrType Attribute::register_type(const Glib::ustring& name) +{ + return (AttrType)pango_attr_type_register(name.c_str()); +} + +AttrString Attribute::create_attr_family(const Glib::ustring& family) +{ + return Glib::wrap((PangoAttrString*)pango_attr_family_new(family.c_str())); +} + +AttrLanguage Attribute::create_attr_language(const Language& language) +{ + return Glib::wrap((PangoAttrLanguage*)pango_attr_language_new(const_cast<PangoLanguage*>(language.gobj()))); +} + +AttrColor Attribute::create_attr_foreground(guint16 red, guint16 green, guint16 blue) +{ + return Glib::wrap((PangoAttrColor*)pango_attr_foreground_new(red, green, blue)); +} + +AttrColor Attribute::create_attr_background(guint16 red, guint16 green, guint16 blue) +{ + return Glib::wrap((PangoAttrColor*)pango_attr_background_new(red, green, blue)); +} + +AttrInt Attribute::create_attr_size(int size) +{ + return Glib::wrap((PangoAttrInt*)pango_attr_size_new(size)); +} + +AttrInt Attribute::create_attr_style(Style style) +{ + return Glib::wrap((PangoAttrInt*)pango_attr_style_new((PangoStyle)style)); +} + +AttrInt Attribute::create_attr_weight(Weight weight) +{ + return Glib::wrap((PangoAttrInt*)pango_attr_weight_new((PangoWeight)weight)); +} + +AttrInt Attribute::create_attr_variant(Variant variant) +{ + return Glib::wrap((PangoAttrInt*)pango_attr_variant_new((PangoVariant)variant)); +} + +AttrInt Attribute::create_attr_stretch(Stretch stretch) +{ + return Glib::wrap((PangoAttrInt*)pango_attr_stretch_new((PangoStretch)stretch)); +} + +AttrFontDesc Attribute::create_attr_font_desc(const FontDescription& desc) +{ + return Glib::wrap((PangoAttrFontDesc*)pango_attr_font_desc_new(desc.gobj())); +} + +AttrInt Attribute::create_attr_underline(Underline underline) +{ + return Glib::wrap((PangoAttrInt*)pango_attr_underline_new((PangoUnderline)underline)); +} + +AttrInt Attribute::create_attr_strikethrough(bool strikethrough) +{ + return Glib::wrap((PangoAttrInt*)pango_attr_strikethrough_new(strikethrough)); +} + +AttrInt Attribute::create_attr_rise(int rise) +{ + return Glib::wrap((PangoAttrInt*)pango_attr_rise_new(rise)); +} + +AttrFloat Attribute::create_attr_scale(double scale_factor) +{ + return Glib::wrap((PangoAttrFloat*)pango_attr_scale_new(scale_factor)); +} + +AttrShape Attribute::create_attr_shape(const Rectangle& ink_rect, const Rectangle& logical_rect) +{ + return Glib::wrap((PangoAttrShape*)pango_attr_shape_new(ink_rect.gobj(), logical_rect.gobj())); +} + + +AttrString::AttrString() +{} + +AttrString::AttrString(const AttrString& src) +: + Attribute(src) +{} + +AttrString::AttrString(PangoAttrString* castitem, bool take_copy) +: + Attribute((PangoAttribute*)castitem, take_copy) +{} + +AttrString& AttrString::operator=(const AttrString& src) +{ + Attribute::operator=(src); + return *this; +} + +void AttrString::set_string(const Glib::ustring& str) +{ + g_free(gobj()->value); + gobj()->value = g_strdup(str.c_str()); +} + + +AttrLanguage::AttrLanguage() +{} + +AttrLanguage::AttrLanguage(const AttrLanguage& src) +: + Attribute(src) +{} + +AttrLanguage::AttrLanguage(PangoAttrLanguage* castitem, bool take_copy) +: + Attribute((PangoAttribute*)castitem, take_copy) +{} + +AttrLanguage& AttrLanguage::operator=(const AttrLanguage& src) +{ + Attribute::operator=(src); + return *this; +} + + +AttrColor::AttrColor() +{} + +AttrColor::AttrColor(const AttrColor& src) +: + Attribute(src) +{} + +AttrColor::AttrColor(PangoAttrColor* castitem, bool take_copy) +: + Attribute((PangoAttribute*)castitem, take_copy) +{} + +AttrColor& AttrColor::operator=(const AttrColor& src) +{ + Attribute::operator=(src); + return *this; +} + + +AttrInt::AttrInt() +{} + +AttrInt::AttrInt(const AttrInt& src) +: + Attribute(src) +{} + +AttrInt::AttrInt(PangoAttrInt* castitem, bool take_copy) +: + Attribute((PangoAttribute*)castitem, take_copy) +{} + +AttrInt& AttrInt::operator=(const AttrInt& src) +{ + Attribute::operator=(src); + return *this; +} + + +AttrFloat::AttrFloat() +{} + +AttrFloat::AttrFloat(const AttrFloat& src) +: + Attribute(src) +{} + +AttrFloat::AttrFloat(PangoAttrFloat* castitem, bool take_copy) +: + Attribute((PangoAttribute*)castitem, take_copy) +{} + +AttrFloat& AttrFloat::operator=(const AttrFloat& src) +{ + Attribute::operator=(src); + return *this; +} + + +AttrFontDesc::AttrFontDesc() +{} + +AttrFontDesc::AttrFontDesc(const AttrFontDesc& src) +: + Attribute(src) +{} + +AttrFontDesc::AttrFontDesc(PangoAttrFontDesc* castitem, bool take_copy) +: + Attribute((PangoAttribute*)castitem, take_copy) +{} + +AttrFontDesc& AttrFontDesc::operator=(const AttrFontDesc& src) +{ + Attribute::operator=(src); + return *this; +} + +void AttrFontDesc::set_desc(const FontDescription& desc) +{ + pango_font_description_free(gobj()->desc); + gobj()->desc = pango_font_description_copy(desc.gobj()); +} + + +AttrShape::AttrShape() +{} + +AttrShape::AttrShape(const AttrShape& src) +: + Attribute(src) +{} + +AttrShape::AttrShape(PangoAttrShape* castitem, bool take_copy) +: + Attribute((PangoAttribute*)castitem, take_copy) +{} + +AttrShape& AttrShape::operator=(const AttrShape& src) +{ + Attribute::operator=(src); + return *this; +} + +} //namespace Pango + + +namespace Glib +{ + +Pango::Attribute wrap(PangoAttribute* object, bool take_copy) +{ + return Pango::Attribute(object, take_copy); +} + +Pango::AttrString wrap(PangoAttrString* object, bool take_copy) +{ + return Pango::AttrString(object, take_copy); +} + +Pango::AttrLanguage wrap(PangoAttrLanguage* object, bool take_copy) +{ + return Pango::AttrLanguage(object, take_copy); +} + +Pango::AttrColor wrap(PangoAttrColor* object, bool take_copy) +{ + return Pango::AttrColor(object, take_copy); +} + +Pango::AttrInt wrap(PangoAttrInt* object, bool take_copy) +{ + return Pango::AttrInt(object, take_copy); +} + +Pango::AttrFloat wrap(PangoAttrFloat* object, bool take_copy) +{ + return Pango::AttrFloat(object, take_copy); +} + +Pango::AttrFontDesc wrap(PangoAttrFontDesc* object, bool take_copy) +{ + return Pango::AttrFontDesc(object, take_copy); +} + +Pango::AttrShape wrap(PangoAttrShape* object, bool take_copy) +{ + return Pango::AttrShape(object, take_copy); +} + +} //namespace Glib + + +namespace +{ +} // anonymous namespace + +// static +GType Glib::Value<Pango::AttrType>::value_type() +{ + return pango_attr_type_get_type(); +} + +// static +GType Glib::Value<Pango::Underline>::value_type() +{ + return pango_underline_get_type(); +} + + +namespace Pango +{ + + +unsigned int Attribute::get_start_index() const +{ + return gobj()->start_index; +} + +unsigned int Attribute::get_end_index() const +{ + return gobj()->end_index; +} + +void Attribute::set_start_index(const unsigned int& value) +{ + gobj()->start_index = value; +} + +void Attribute::set_end_index(const unsigned int& value) +{ + gobj()->end_index = value; +} + +bool Attribute::equal(const Attribute& attr2) const +{ + return pango_attribute_equal(const_cast<PangoAttribute*>(gobj()), (attr2).gobj()); +} + + +} // namespace Pango + + +namespace Pango +{ + + +Glib::ustring AttrString::get_string() const +{ + return Glib::convert_const_gchar_ptr_to_ustring(gobj()->value); +} + + +} // namespace Pango + + +namespace Pango +{ + + +Language AttrLanguage::get_language() const +{ + return Language(gobj()->value); +} + +void AttrLanguage::set_language(const Language& value) +{ + gobj()->value = const_cast<PangoLanguage*>((value).gobj()); +} + + +} // namespace Pango + + +namespace Pango +{ + + +Color AttrColor::get_color() const +{ + return Color(&(gobj()->color)); +} + +void AttrColor::set_color(const Color& value) +{ + gobj()->color = *(value).gobj(); +} + + +} // namespace Pango + + +namespace Pango +{ + + +int AttrInt::get_value() const +{ + return gobj()->value; +} + +void AttrInt::set_value(const int& value) +{ + gobj()->value = value; +} + + +} // namespace Pango + + +namespace Pango +{ + + +double AttrFloat::get_value() const +{ + return gobj()->value; +} + +void AttrFloat::set_value(const double& value) +{ + gobj()->value = value; +} + + +} // namespace Pango + + +namespace Pango +{ + + +FontDescription AttrFontDesc::get_desc() const +{ + return FontDescription((gobj()->desc)); +} + + +} // namespace Pango + + +namespace Pango +{ + + +Rectangle AttrShape::get_ink_rect() const +{ + return Rectangle(&(gobj()->ink_rect)); +} + +Rectangle AttrShape::get_logical_rect() const +{ + return Rectangle(&(gobj()->logical_rect)); +} + +void AttrShape::set_ink_rect(const Rectangle& value) +{ + gobj()->ink_rect = *(value).gobj(); +} + +void AttrShape::set_logical_rect(const Rectangle& value) +{ + gobj()->logical_rect = *(value).gobj(); +} + + +} // namespace Pango + + diff --git a/libs/gtkmm2/pango/pangomm/attributes.h b/libs/gtkmm2/pango/pangomm/attributes.h new file mode 100644 index 0000000000..25baa96475 --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/attributes.h @@ -0,0 +1,669 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _PANGOMM_ATTRIBUTES_H +#define _PANGOMM_ATTRIBUTES_H + +#include <glibmm.h> + +/* attributes.h + * + * Copyright (C) 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 <pangomm/language.h> +#include <pangomm/rectangle.h> +#include <pangomm/color.h> +#include <pangomm/fontdescription.h> +#include <pango/pango-attributes.h> + + +namespace Pango +{ + + +/** @addtogroup pangommEnums Enums and Flags */ + +/** Pango::AttrType distinguishes between different types of attributes. + * Along with the predefined values, it is possible to allocate additional values for + * custom attributes using Pango::Attribute::register_type(). The predefined values + * are given below. + * @ingroup pangommEnums + */ +enum AttrType +{ + ATTR_INVALID, + ATTR_LANGUAGE, + ATTR_FAMILY, + ATTR_STYLE, + ATTR_WEIGHT, + ATTR_VARIANT, + ATTR_STRETCH, + ATTR_SIZE, + ATTR_FONT_DESC, + ATTR_FOREGROUND, + ATTR_BACKGROUND, + ATTR_UNDERLINE, + ATTR_STRIKETHROUGH, + ATTR_RISE, + ATTR_SHAPE, + ATTR_SCALE, + ATTR_FALLBACK, + ATTR_LETTER_SPACING, + ATTR_UNDERLINE_COLOR, + ATTR_STRIKETHROUGH_COLOR +}; + +} // namespace Pango + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value<Pango::AttrType> : public Glib::Value_Enum<Pango::AttrType> +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Pango +{ + + +/** A Pango::Underline is used to specify whether text should be underlined, and if so, the type of underlining. + * @ingroup pangommEnums + */ +enum Underline +{ + UNDERLINE_NONE, + UNDERLINE_SINGLE, + UNDERLINE_DOUBLE, + UNDERLINE_LOW, + UNDERLINE_ERROR +}; + +} // namespace Pango + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value<Pango::Underline> : public Glib::Value_Enum<Pango::Underline> +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Pango +{ + + +/** A Pango::LogAttr stores information about the attributes of a single character. + */ +typedef PangoLogAttr LogAttr; + + +class AttrString; +class AttrLanguage; +class AttrColor; +class AttrInt; +class AttrFloat; +class AttrFontDesc; +class AttrShape; + +/** The Pango::Attribute structure represents the common portions of all attributes. + * Particular types of attributes derive this class. It holds the range in which the + * value in the type-specific part of the attribute applies. + * + * Attributed text is used in a number of places in pango. It is used as the input to + * the itemization process and also when creating a Pango::Layout. + */ +class Attribute +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Attribute CppObjectType; + typedef PangoAttribute BaseObjectType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +private: + + +public: + /** Constructs an invalid attribute. + */ + Attribute(); + + Attribute(const Attribute& src); + explicit Attribute(PangoAttribute* castitem, bool take_copy=true); + ~Attribute(); + + Attribute& operator=(const Attribute& src); + + /** Gets the type ID for this attribute. + * @return The type ID for this attribute or ATTR_INVALID if the attribute is invalid. + */ + AttrType get_type() const; + + /** Allocate a new attribute type ID. + * @param name An identifier for the type (currently unused). + * @return The new type ID. + */ + static AttrType register_type(const Glib::ustring& name); + + /** Gets the start index of the range. + * @return The start index of the range. + */ + unsigned int get_start_index() const; + + /** Gets the end index of the range. The character at this index is not included in the range. + * @return The end index of the range. + */ + unsigned int get_end_index() const; + + /** Sets the start index of the range. + * @param value The new start index. + */ + void set_start_index(const unsigned int& value); + + /** Sets the end index of the range. The character at this index is not included in the range. + * @param value The new end index. + */ + void set_end_index(const unsigned int& value); + + + /** Compare two attributes for equality. This compares only the + * actual value of the two attributes and not the ranges that the + * attributes apply to. + * @param attr2 Another Pango::Attribute. + * @return <tt>true</tt> if the two attributes have the same value. + */ + bool equal(const Attribute& attr2) const; + + /// Provides access to the underlying C GObject. + PangoAttribute* gobj() { return gobject_; } + /// Provides access to the underlying C GObject. + PangoAttribute* const gobj() const { return gobject_; } + + /** Create a new font family attribute. + * @param family The family or comma separated list of families. + * @return An attribute of type AttrString. + */ + static AttrString create_attr_family(const Glib::ustring& family); + + /** Create a new language tag attribute + * @param language The language tag. + * @return An attribute of type AttrLanguage. + */ + static AttrLanguage create_attr_language(const Language& language); + + /** Create a new foreground color attribute. + * @param red The red value (ranging from 0 to 65535). + * @param green The green value (ranging from 0 to 65535). + * @param blue The blue value (ranging from 0 to 65535). + * @return An attribute of type AttrColor. + */ + static AttrColor create_attr_foreground(guint16 red, guint16 green, guint16 blue); + + /** Create a new background color attribute. + * @param red The red value (ranging from 0 to 65535). + * @param green The green value (ranging from 0 to 65535). + * @param blue The blue value (ranging from 0 to 65535). + * @return An attribute of type AttrColor. + */ + static AttrColor create_attr_background(guint16 red, guint16 green, guint16 blue); + + /** Create a new font-size attribute. + * @param size The font size, in 1000ths of a point. + * @return An attribute of type AttrInt. + */ + static AttrInt create_attr_size(int size); + + /** Create a new font slant style attribute. + * @param style The slant style. + * @return An attribute of type AttrInt. + */ + static AttrInt create_attr_style(Style style); + + /** Create a new font weight attribute. + * @param weight The weight. + * @return An attribute of type AttrInt. + */ + static AttrInt create_attr_weight(Weight weight); + + /** Create a new font variant attribute (normal or small caps). + * @param variant The variant. + * @return An attribute of type AttrInt. + */ + static AttrInt create_attr_variant(Variant variant); + + /** Create a new font stretch attribute. + * @param stretch The stretch. + * @return An attribute of type AttrInt. + */ + static AttrInt create_attr_stretch(Stretch stretch); + + /** Create a new font description attribute. + * This attribute allows setting family, style, weight, variant, stretch, and size simultaneously. + * @param desc The font description. + * @return An attribute of type AttrFontDesc. + */ + static AttrFontDesc create_attr_font_desc(const FontDescription& desc); + + /** Create a new underline-style object. + * @param underline The underline style. + * @return An attribute of type AttrInt. + */ + static AttrInt create_attr_underline(Underline underline); + + /** Create a new font strike-through attribute. + * @param strikethrough True indicates the text should be struck-through. + * @return An attribute of type AttrInt. + */ + static AttrInt create_attr_strikethrough(bool strikethrough); + + /** Create a new baseline displacement attribute. + * @param rise The amount that the text should be displaced vertically, in 10'000ths of an em. Positive values displace the text upwards. + * @return An attribute of type AttrInt. + */ + static AttrInt create_attr_rise(int rise); + + /** Create a new font size scale attribute. + * The base font for the affected text will have its size multiplied by scale_factor. + * @param scale_factor Factor to scale the font. + * @return An attribute of type AttrFloat. + */ + static AttrFloat create_attr_scale(double scale_factor); + + /** Create a new shape attribute. + * A shape is used to impose a particular ink and logical rect on the result of shaping a particular glyph. + * This might be used, for instance, for embedding a picture or a widget inside a PangoLayout. + * @param ink_rect Ink rectangle to assign to each character. + * @param logical_rect Logical rectangle assign to each character. + * @return An attribute of type AttrShape. + */ + static AttrShape create_attr_shape(const Rectangle& ink_rect, const Rectangle& logical_rect); + +protected: + PangoAttribute* gobject_; + + +}; + +/** @relates Pango::Attribute */ +inline bool operator==(const Attribute& lhs, const Attribute& rhs) +{ + return lhs.equal(rhs); +} + +/** @relates Pango::Attribute */ +inline bool operator!=(const Attribute& lhs, const Attribute& rhs) +{ + return lhs.equal(rhs); +} + + +/** A Pango::AttrString is used to represent an attribute with a string value. + */ +class AttrString : public Attribute +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef AttrString CppObjectType; + typedef PangoAttrString BaseObjectType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +private: + + +protected: + AttrString(); +public: + AttrString(const AttrString& src); + explicit AttrString(PangoAttrString* castitem, bool take_copy=true); + + AttrString& operator=(const AttrString& src); + + /** Gets the string which is the value of the attribute. + * @return The string value of the attribute. + */ + Glib::ustring get_string() const; + + /** Sets the string which is the value of the attribute. + * @param string The new string value for the attribute. + */ + void set_string(const Glib::ustring& string); + + /// Provides access to the underlying C GObject. + PangoAttrString* gobj() { return reinterpret_cast<PangoAttrString*>(gobject_); } + /// Provides access to the underlying C GObject. + const PangoAttrString* gobj() const { return reinterpret_cast<const PangoAttrString*>(gobject_); } + + +}; + + +/** A Pango::AttrLanguage is used to represent an attribute that is a language. + */ +class AttrLanguage : public Attribute +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef AttrLanguage CppObjectType; + typedef PangoAttrLanguage BaseObjectType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +private: + + +protected: + AttrLanguage(); +public: + AttrLanguage(const AttrLanguage& src); + explicit AttrLanguage(PangoAttrLanguage* castitem, bool take_copy=true); + + AttrLanguage& operator=(const AttrLanguage& src); + + /** Gets the language which is the value of the attribute. + * @return The language tag of the attribute. + */ + Language get_language() const; + + /** Sets the language which is the value of the attribute. + * @param value The new language tag for the attribute. + */ + void set_language(const Language& value); + + /// Provides access to the underlying C GObject. + PangoAttrLanguage* gobj() { return reinterpret_cast<PangoAttrLanguage*>(gobject_); } + /// Provides access to the underlying C GObject. + const PangoAttrLanguage* gobj() const { return reinterpret_cast<const PangoAttrLanguage*>(gobject_); } + + +}; + + +/** A Pango::AttrColor is used to represent an attribute which is a color. + */ +class AttrColor : public Attribute +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef AttrColor CppObjectType; + typedef PangoAttrColor BaseObjectType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +private: + + +protected: + AttrColor(); +public: + AttrColor(const AttrColor& src); + explicit AttrColor(PangoAttrColor* castitem, bool take_copy=true); + + AttrColor& operator=(const AttrColor& src); + + /** Gets the color which is the value of the attribute. + * @return The color value of the attribute. + */ + Color get_color() const; + + /** Sets the color which is the value of the attribute. + * @param value The new color value for the attribute. + */ + void set_color(const Color& value); + + /// Provides access to the underlying C GObject. + PangoAttrColor* gobj() { return reinterpret_cast<PangoAttrColor*>(gobject_); } + /// Provides access to the underlying C GObject. + const PangoAttrColor* gobj() const { return reinterpret_cast<const PangoAttrColor*>(gobject_); } + + +}; + + +/** A Pango::AttrInt is used to represent an attribute with an integer or enumeration value. + */ +class AttrInt : public Attribute +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef AttrInt CppObjectType; + typedef PangoAttrInt BaseObjectType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +private: + + +protected: + AttrInt(); +public: + AttrInt(const AttrInt& src); + explicit AttrInt(PangoAttrInt* castitem, bool take_copy=true); + + AttrInt& operator=(const AttrInt& src); + + /** Gets the integer value of the attribute. + * @return The integer value of the attribute. + */ + int get_value() const; + + /** Sets the integer value of the attribute. + * @param value The new integer value for the attribute. + */ + void set_value(const int& value); + + /// Provides access to the underlying C GObject. + PangoAttrInt* gobj() { return reinterpret_cast<PangoAttrInt*>(gobject_); } + /// Provides access to the underlying C GObject. + const PangoAttrInt* gobj() const { return reinterpret_cast<const PangoAttrInt*>(gobject_); } + + +}; + + +/** A Pango::AttrFloat is used to represent an attribute with a float or double value. + */ +class AttrFloat : public Attribute +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef AttrFloat CppObjectType; + typedef PangoAttrFloat BaseObjectType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +private: + + +protected: + AttrFloat(); +public: + AttrFloat(const AttrFloat& src); + explicit AttrFloat(PangoAttrFloat* castitem, bool take_copy=true); + + AttrFloat& operator=(const AttrFloat& src); + + /** Gets the floating point value of the attribute. + * @return The floating point value of the attribute. + */ + double get_value() const; + + /** Sets the floating point value of the attribute. + * @param value The new floating point value for the attribute. + */ + void set_value(const double& value); + + /// Provides access to the underlying C GObject. + PangoAttrFloat* gobj() { return reinterpret_cast<PangoAttrFloat*>(gobject_); } + /// Provides access to the underlying C GObject. + const PangoAttrFloat* gobj() const { return reinterpret_cast<const PangoAttrFloat*>(gobject_); } + + +}; + + +/** A Pango::AttrFontDesc is used to represent an attribute that sets all aspects of the font description at once. + */ +class AttrFontDesc : public Attribute +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef AttrFontDesc CppObjectType; + typedef PangoAttrFontDesc BaseObjectType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +private: + + +protected: + AttrFontDesc(); +public: + AttrFontDesc(const AttrFontDesc& src); + explicit AttrFontDesc(PangoAttrFontDesc* castitem, bool take_copy=true); + + AttrFontDesc& operator=(const AttrFontDesc& src); + + /** Gets the font description which is the value of the attribute. + * @return The font description of the attribute. + */ + FontDescription get_desc() const; + + /** Sets the font description which is the value of the attribute. + * @param desc The new font description for the attribute. + */ + void set_desc(const FontDescription& desc); + + /// Provides access to the underlying C GObject. + PangoAttrFontDesc* gobj() { return reinterpret_cast<PangoAttrFontDesc*>(gobject_); } + /// Provides access to the underlying C GObject. + const PangoAttrFontDesc* gobj() const { return reinterpret_cast<const PangoAttrFontDesc*>(gobject_); } + + +}; + + +/** A Pango::AttrShape structure is used to represent an attribute which imposes shape restrictions. + */ +class AttrShape : public Attribute +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef AttrShape CppObjectType; + typedef PangoAttrShape BaseObjectType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +private: + + +protected: + AttrShape(); +public: + AttrShape(const AttrShape& src); + explicit AttrShape(PangoAttrShape* castitem, bool take_copy=true); + + AttrShape& operator=(const AttrShape& src); + + /** Gets the ink rectangle to restrict to. + * @return The ink rectangle of the attribute. + */ + Rectangle get_ink_rect() const; + + /** Gets the logical rectangle to restrict to. + * @return The logical rectangle of the attribute. + */ + Rectangle get_logical_rect() const; + + /** Sets the ink rectangle to restrict to. + * @param value The new ink rectangle for the attribute. + */ + void set_ink_rect(const Rectangle& value); + + /** Sets the logical rectangle to restrict to. + * @param value The new logical rectangle for the attribute. + */ + void set_logical_rect(const Rectangle& value); + + /// Provides access to the underlying C GObject. + PangoAttrShape* gobj() { return reinterpret_cast<PangoAttrShape*>(gobject_); } + /// Provides access to the underlying C GObject. + const PangoAttrShape* gobj() const { return reinterpret_cast<const PangoAttrShape*>(gobject_); } + + +}; + + +struct AttributeTraits +{ + typedef Pango::Attribute CppType; + typedef const PangoAttribute* CType; + typedef PangoAttribute* CTypeNonConst; + + static CType to_c_type (const CppType& obj) { return obj.gobj(); } + static CType to_c_type (CType ptr) { return ptr; } + static CppType to_cpp_type (CType ptr) { return CppType(const_cast<CTypeNonConst>(ptr), true); } + static void release_c_type (CType ptr) { pango_attribute_destroy(const_cast<CTypeNonConst>(ptr)); } +}; + +typedef Glib::SListHandle<Attribute, AttributeTraits> SListHandle_Attribute; + +} // namespace Pango + + +namespace Glib +{ + +/** @relates Pango::Attribute */ +Pango::Attribute wrap(PangoAttribute* object, bool take_copy = false); + +/** @relates Pango::AttrString */ +Pango::AttrString wrap(PangoAttrString* object, bool take_copy = false); + +/** @relates Pango::AttrLanguage */ +Pango::AttrLanguage wrap(PangoAttrLanguage* object, bool take_copy = false); + +/** @relates Pango::AttrColor */ +Pango::AttrColor wrap(PangoAttrColor* object, bool take_copy = false); + +/** @relates Pango::AttrInt */ +Pango::AttrInt wrap(PangoAttrInt* object, bool take_copy = false); + +/** @relates Pango::AttrFloat */ +Pango::AttrFloat wrap(PangoAttrFloat* object, bool take_copy = false); + +/** @relates Pango::AttrFontDesc */ +Pango::AttrFontDesc wrap(PangoAttrFontDesc* object, bool take_copy = false); + +/** @relates Pango::AttrShape */ +Pango::AttrShape wrap(PangoAttrShape* object, bool take_copy = false); + +} //namespace Glib + + +#endif /* _PANGOMM_ATTRIBUTES_H */ + diff --git a/libs/gtkmm2/pango/pangomm/attriter.cc b/libs/gtkmm2/pango/pangomm/attriter.cc new file mode 100644 index 0000000000..71fa57052a --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/attriter.cc @@ -0,0 +1,180 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include <pangomm/attriter.h> +#include <pangomm/private/attriter_p.h> + +/* + * + * Copyright 1998-1999 The Gtk-- Development Team + * Copyright 2001 Free Software Foundation + * + * 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. + */ + +namespace Pango +{ + +AttrIter::AttrIter() +: + gobject_(0) +{} + +AttrIter::AttrIter(const AttrIter& src) +: + gobject_(src.gobject_ ? pango_attr_iterator_copy(src.gobject_) : 0) +{} + +AttrIter::AttrIter(PangoAttrIterator* castitem, bool take_copy) +{ + if(take_copy) + { + if(castitem) + gobject_ = pango_attr_iterator_copy(castitem); + else + gobject_ = 0; + } + else + { + gobject_ = castitem; + } +} + +AttrIter::~AttrIter() +{ + if(gobject_) + pango_attr_iterator_destroy(gobject_); +} + +AttrIter& AttrIter::operator=(const AttrIter& src) +{ + PangoAttrIterator *const new_gobject = (src.gobject_ ? pango_attr_iterator_copy(src.gobject_) : 0); + + if(gobject_) + pango_attr_iterator_destroy(gobject_); + gobject_ = new_gobject; + + return *this; +} + +AttrIter& AttrIter::operator++() +{ + next(); + return *this; +} + +const AttrIter AttrIter::operator++(int) +{ + AttrIter previous(*this); + next(); + return previous; +} + +/* operator bool() cannot be implemented to work properly if a Pango::AttrIter is created + * from an already invalid PangoAttrIterator* because there is no way to validate it. + * Otherwise the iterator can only become invalid after some call to Pango::AttrIter::next() + * in which case gobject_ is destroyed thus marking the iterator as invalid. + */ +AttrIter::operator bool() const +{ + return (gobject_ != 0); +} + +bool AttrIter::next() +{ + if(!pango_attr_iterator_next(gobj())) + { + pango_attr_iterator_destroy(gobject_); + gobject_ = 0; // Mark as invalid. There is no other way to determine whether the iterator is valid later. + return false; + } + else + return true; +} + +FontDescription AttrIter::get_font_desc() const +{ + FontDescription desc; + pango_attr_iterator_get_font(const_cast<PangoAttrIterator*>(gobj()), desc.gobj(), 0, 0); + + // See pango ref docs for pango_attr_iterator_get_font. + pango_font_description_set_family(desc.gobj(), pango_font_description_get_family(desc.gobj())); + + return desc; +} + +Language AttrIter::get_language() const +{ + FontDescription desc; + PangoLanguage* language = 0; + + pango_attr_iterator_get_font(const_cast<PangoAttrIterator*>(gobj()), desc.gobj(), &language, 0); + + return Language(language, true); +} + +SListHandle_Attribute AttrIter::get_extra_attrs() const +{ + FontDescription desc; + GSList* extra_attrs = 0; + + pango_attr_iterator_get_font(const_cast<PangoAttrIterator*>(gobj()), desc.gobj(), 0, &extra_attrs); + + return SListHandle_Attribute(extra_attrs, Glib::OWNERSHIP_DEEP); +} + +SListHandle_Attribute AttrIter::get_attrs() const +{ + GSList* attrs = pango_attr_iterator_get_attrs( const_cast<PangoAttrIterator*>(gobj()) ); + return SListHandle_Attribute(attrs, Glib::OWNERSHIP_DEEP); +} + + +} /* namespace Pango */ + + +namespace Glib +{ + +Pango::AttrIter wrap(PangoAttrIterator* object, bool take_copy) +{ + return Pango::AttrIter(object, take_copy); +} + +} /* namespace Glib */ + + +namespace +{ +} // anonymous namespace + + +namespace Pango +{ + + +void AttrIter::get_range(int& start, int& end) const +{ + pango_attr_iterator_range(const_cast<PangoAttrIterator*>(gobj()), &start, &end); +} + +Attribute AttrIter::get_attribute(AttrType type) const +{ + return Attribute((pango_attr_iterator_get(const_cast<PangoAttrIterator*>(gobj()), ((PangoAttrType)(type))))); +} + + +} // namespace Pango + + diff --git a/libs/gtkmm2/pango/pangomm/attriter.h b/libs/gtkmm2/pango/pangomm/attriter.h new file mode 100644 index 0000000000..ce654e92dd --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/attriter.h @@ -0,0 +1,147 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _PANGOMM_ATTRITER_H +#define _PANGOMM_ATTRITER_H + +#include <glibmm.h> + +/* attriter.h + * + * Copyright (C) 1998-1999 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 <glibmm/slisthandle.h> +#include <pangomm/attributes.h> + + +namespace Pango +{ + +/** A Pango::AttrIter is used to represent an iterator through a Pango::AttrList. + * A new iterator is created with Pango::AttrList::get_iter(). Once the iterator is created, + * it can be advanced through the style changes in the text using Pango::AttrIter::next(). + * At each style change, the range of the current style segment and the attributes currently in effect can be queried. + */ +class AttrIter +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef AttrIter CppObjectType; + typedef PangoAttrIterator BaseObjectType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +private: + + +public: + typedef std::forward_iterator_tag iterator_category; + typedef int difference_type; + +protected: + AttrIter(); + +public: + explicit AttrIter(PangoAttrIterator* castitem, bool take_copy=true); + AttrIter(const AttrIter& src); + + ~AttrIter(); + + AttrIter& operator=(const AttrIter& src); + + /** Advance the iterator until the next change of style. + * The iterator becomes invalid if the end of the list is reached. + * @return The iterator itself. + */ + AttrIter& operator++(); + + const AttrIter operator++(int); + + /** Check whether the iterator is valid. + * @return <tt>true</tt> if the iterator is valid. + */ + operator bool() const; + + /** The same as operator++(). + * @return <tt>false</tt> if the end of the list is reached. + */ + bool next(); + + + /** Get the range of the current segment. + * @param start Location to store the start of the range. + * @param end Location to store the end of the range. + */ + void get_range(int& start, int& end) const; + + /** Find the current attribute of a particular type at the iterator + * location. When multiple attributes of the same type overlap, + * the attribute whose range starts closest to the current location + * is used. + * @param type The type of attribute to find. + * @return The current attribute of the given type, or <tt>0</tt> + * if no attribute of that type applies to the current + * location. + */ + Attribute get_attribute(AttrType type) const; + + /** Get the font description used at the current iterator position. + * @return The font description used at the current iterator position. + */ + FontDescription get_font_desc() const; + + /** Gets the language tag used at current iterator position. + * @return The language tag or an empty Pango::Language object if non is found. + */ + Language get_language() const; + + /** Gets a list of non-font attributes at the the current iterator position. + * Only the highest priority value of each attribute will be added to this list. + * @return The list of non-font attributes at the current iterator position. + */ + SListHandle_Attribute get_extra_attrs() const; + + /** Gets a list all attributes a the current position of the + * iterator. + * + * @result A list of all attributes for the current range. + */ + SListHandle_Attribute get_attrs() const; + + + PangoAttrIterator* gobj() { return gobject_; } + const PangoAttrIterator* gobj() const { return gobject_; } + +protected: + PangoAttrIterator* gobject_; + + +}; + +} // namespace Pango + + +namespace Glib +{ + +/** @relates Pango::AttrIter */ +Pango::AttrIter wrap(PangoAttrIterator* object, bool take_copy=false); + +} // namespace Glib + + +#endif /* _PANGOMM_ATTRITER_H */ + diff --git a/libs/gtkmm2/pango/pangomm/attrlist.cc b/libs/gtkmm2/pango/pangomm/attrlist.cc new file mode 100644 index 0000000000..deba57a453 --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/attrlist.cc @@ -0,0 +1,161 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include <pangomm/attrlist.h> +#include <pangomm/private/attrlist_p.h> + +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 1998-1999 The Gtk-- Development Team + * Copyright 2001 Free Software Foundation + * + * 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. + */ + +namespace Pango +{ + +AttrList::AttrList(const Glib::ustring& markup_text, gunichar accel_marker) +{ + gboolean bTest = pango_parse_markup(markup_text.c_str(), -1 /* means null-terminated */, accel_marker, + &gobject_, 0, 0, 0); + if(bTest == FALSE) + gobject_ = 0; +} + +AttrList::AttrList(const Glib::ustring& markup_text, gunichar accel_marker, Glib::ustring& text, gunichar& accel_char) +{ + //initialize output parameters: + text.erase(); + accel_char = 0; + + gchar* pchText = 0; + gboolean bTest = pango_parse_markup(markup_text.c_str(), -1 /* means null-terminated */, accel_marker, + &gobject_, &pchText, &accel_char, 0); + if(bTest == FALSE) + { + gobject_ = 0; + } + else + { + text = pchText; + g_free(pchText); + } +} + +void AttrList::insert(Attribute& attr) +{ + pango_attr_list_insert(gobj(), pango_attribute_copy(attr.gobj())); +} + +void AttrList::insert_before(Attribute& attr) +{ + pango_attr_list_insert_before(gobj(), pango_attribute_copy(attr.gobj())); +} + +void AttrList::change(Attribute& attr) +{ + pango_attr_list_change(gobj(), pango_attribute_copy(attr.gobj())); +} + +} /* namespace Pango */ + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + +Pango::AttrList wrap(PangoAttrList* object, bool take_copy) +{ + return Pango::AttrList(object, take_copy); +} + +} // namespace Glib + + +namespace Pango +{ + + +// static +GType AttrList::get_type() +{ + return pango_attr_list_get_type(); +} + +AttrList::AttrList() +: + gobject_ (pango_attr_list_new()) +{} + +AttrList::AttrList(const AttrList& other) +: + gobject_ ((other.gobject_) ? pango_attr_list_copy(other.gobject_) : 0) +{} + +AttrList::AttrList(PangoAttrList* gobject, bool make_a_copy) +: + // For BoxedType wrappers, make_a_copy is true by default. The static + // BoxedType wrappers must always take a copy, thus make_a_copy = true + // ensures identical behaviour if the default argument is used. + gobject_ ((make_a_copy && gobject) ? pango_attr_list_copy(gobject) : gobject) +{} + +AttrList& AttrList::operator=(const AttrList& other) +{ + AttrList temp (other); + swap(temp); + return *this; +} + +AttrList::~AttrList() +{ + if(gobject_) + pango_attr_list_unref(gobject_); +} + +void AttrList::swap(AttrList& other) +{ + PangoAttrList *const temp = gobject_; + gobject_ = other.gobject_; + other.gobject_ = temp; +} + +PangoAttrList* AttrList::gobj_copy() const +{ + return pango_attr_list_copy(gobject_); +} + + +void AttrList::splice(AttrList& other, int pos, int len) +{ + pango_attr_list_splice(gobj(), (other).gobj(), pos, len); +} + +AttrIter AttrList::get_iter() +{ + return Glib::wrap((pango_attr_list_get_iterator(gobj()))); +} + + +} // namespace Pango + + diff --git a/libs/gtkmm2/pango/pangomm/attrlist.h b/libs/gtkmm2/pango/pangomm/attrlist.h new file mode 100644 index 0000000000..78d435e729 --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/attrlist.h @@ -0,0 +1,182 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _PANGOMM_ATTRLIST_H +#define _PANGOMM_ATTRLIST_H + +#include <glibmm.h> + +/* $Id$ */ + +/* attrlist.h + * + * Copyright (C) 1998-1999 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 <pangomm/attributes.h> +#include <pangomm/attriter.h> + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +extern "C" { typedef struct _PangoAttrList PangoAttrList; } +#endif + +namespace Pango +{ + +/** A Pango::AttrList represents a list of attributes that apply to a section of text. + * The attributes are, in general, allowed to overlap in an arbitrary fashion, however, + * if the attributes are manipulated only through Pango::AttrList::change(), the overlap between properties will meet stricter criteria. + * + * Since the Pango::AttrList structure is stored as a linear list, it is not suitable for storing attributes for large amounts of text. + * In general, you should not use a single Pango::AttrList for more than one paragraph of text. + */ +class AttrList +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef AttrList CppObjectType; + typedef PangoAttrList BaseObjectType; + + static GType get_type() G_GNUC_CONST; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + AttrList(); + + explicit AttrList(PangoAttrList* gobject, bool make_a_copy = true); + + AttrList(const AttrList& other); + AttrList& operator=(const AttrList& other); + + ~AttrList(); + + void swap(AttrList& other); + + ///Provides access to the underlying C instance. + PangoAttrList* gobj() { return gobject_; } + + ///Provides access to the underlying C instance. + const PangoAttrList* gobj() const { return gobject_; } + + ///Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs. + PangoAttrList* gobj_copy() const; + +protected: + PangoAttrList* gobject_; + +private: + + +public: + /** Constructs an attribute list by parsing a marked-up text (see markup format). + * If @a accel_marker is nonzero, the given character will mark the character + * following it as an accelerator. For example, the accel marker might be an + * ampersand or underscore. All characters marked as an accelerator will receive + * a Pango::UNDERLINE_LOW attribute. + * Two @a accel_marker characters following each other + * produce a single literal @a accel_marker character. + * + * @param markup_text Markup to parse (see markup format). + * @param accel_marker Character that precedes an accelerator, or <tt>0</tt> for none. + */ + explicit AttrList(const Glib::ustring& markup_text, gunichar accel_marker=0); + + /** Constructs an attribute list by parsing a marked-up text (see markup format). + * @a text is set to the plaintext string. + * If @a accel_marker is nonzero, the given character will mark the character + * following it as an accelerator. For example, the accel marker might be an + * ampersand or underscore. All characters marked as an accelerator will receive + * a Pango::UNDERLINE_LOW attribute. The first character so marked will be + * returned in @a accel_char. Two @a accel_marker characters following each other + * produce a single literal @a accel_marker character. + * + * @param markup_text Markup to parse (see markup format). + * @param accel_marker Character that precedes an accelerator, or <tt>0</tt> for none. + * @param text Return location for text with tags stripped. + * @param accel_char Return location for accelerator char. + */ + AttrList(const Glib::ustring& markup_text, gunichar accel_marker, Glib::ustring& text, gunichar& accel_char); + + void insert(Attribute& attr); + // hand code because we need to pass a copy of the attribute + void insert_before(Attribute& attr); + // hand code because we need to pass a copy of the attribute + void change(Attribute& attr); + // hand code because we need to pass a copy of the attribute + + /** This function splices attribute list @a other into @a list . + * This operation is equivalent to stretching every attribute + * applies at position @a pos in @a list by an amount @a len , + * and then calling pango_attr_list_change() with a copy + * of each attributes in @a other in sequence (offset in position by @a pos ). + * + * This operation proves useful for, for instance, inserting + * a preedit string in the middle of an edit buffer. + * @param other Another Pango::AttrList. + * @param pos The position in @a list at which to insert @a other . + * @param len The length of the spliced segment. (Note that this + * must be specified since the attributes in @a other + * may only be present at some subsection of this range). + */ + void splice(AttrList& other, int pos, int len); + + /** Create a iterator initialized to the beginning of the list. + * @return A new Pango::Iterator. @a list must not be modified + * until this iterator is freed with pango_attr_iterator_destroy(). + */ + AttrIter get_iter(); + + //TODO: Though it doesn't seem important: + //PangoAttrList* pango_attr_list_filter (PangoAttrList* list, PangoAttrFilterFunc func, gpointer data) + + +}; + +} //namespace Pango + + +namespace Pango +{ + +/** @relates Pango::AttrList + * @param lhs The left-hand side + * @param rhs The right-hand side + */ +inline void swap(AttrList& lhs, AttrList& rhs) + { lhs.swap(rhs); } + +} // namespace Pango + +namespace Glib +{ + +/** @relates Pango::AttrList + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ +Pango::AttrList wrap(PangoAttrList* object, bool take_copy = false); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +template <> +class Value<Pango::AttrList> : public Glib::Value_Boxed<Pango::AttrList> +{}; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +} // namespace Glib + +#endif /* _PANGOMM_ATTRLIST_H */ + diff --git a/libs/gtkmm2/pango/pangomm/color.cc b/libs/gtkmm2/pango/pangomm/color.cc new file mode 100644 index 0000000000..946d7fcc37 --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/color.cc @@ -0,0 +1,124 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include <pangomm/color.h> +#include <pangomm/private/color_p.h> + +/* Copyright (C) 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. + */ + +namespace Pango +{ + +/* For some unknown reason pango doesn't provide pango_color_new(). Let's define an + * equivalent function ourself! */ +PangoColor* _pango_color_new() +{ + return g_new(PangoColor, 1); +} + +Color::operator bool() +{ + return gobj() != 0; +} + +} /* namespace Pango */ + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + +Pango::Color& wrap(PangoColor* object) +{ + return *reinterpret_cast<Pango::Color*>(object); +} + +const Pango::Color& wrap(const PangoColor* object) +{ + return *reinterpret_cast<const Pango::Color*>(object); +} + +} // namespace Glib + + +namespace Pango +{ + + +// static +GType Color::get_type() +{ + return pango_color_get_type(); +} + +Color::Color() +{ + GLIBMM_INITIALIZE_STRUCT(gobject_, PangoColor); +} + +Color::Color(const PangoColor* gobject) +{ + if(gobject) + gobject_ = *gobject; + else + GLIBMM_INITIALIZE_STRUCT(gobject_, PangoColor); +} + + +guint16 Color::get_red() const +{ + return gobj()->red; +} + +guint16 Color::get_green() const +{ + return gobj()->green; +} + +guint16 Color::get_blue() const +{ + return gobj()->blue; +} + +void Color::set_red(const guint16& value) +{ + gobj()->red = value; +} + +void Color::set_green(const guint16& value) +{ + gobj()->green = value; +} + +void Color::set_blue(const guint16& value) +{ + gobj()->blue = value; +} + +bool Color::parse(const Glib::ustring& spec) +{ + return pango_color_parse(gobj(), spec.c_str()); +} + + +} // namespace Pango + + diff --git a/libs/gtkmm2/pango/pangomm/color.h b/libs/gtkmm2/pango/pangomm/color.h new file mode 100644 index 0000000000..07ce119896 --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/color.h @@ -0,0 +1,138 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _PANGOMM_COLOR_H +#define _PANGOMM_COLOR_H + +#include <glibmm.h> + +/* Copyright (C) 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/pango-attributes.h> + + +namespace Pango +{ + +/** A Pango::Color is used to represent a color in an uncalibrated RGB colorspace. + */ +class Color +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Color CppObjectType; + typedef PangoColor BaseObjectType; + + static GType get_type() G_GNUC_CONST; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + Color(); + + explicit Color(const PangoColor* gobject); // always takes a copy + + ///Provides access to the underlying C instance. + PangoColor* gobj() { return &gobject_; } + + ///Provides access to the underlying C instance. + const PangoColor* gobj() const { return &gobject_; } + +protected: + PangoColor gobject_; + +private: + + +public: + + /// Tests whether the Color is valid. + operator bool(); + + /** Gets the red component of the color. + * @return The red component of the color. This is a value between 0 and 65535, with 65535 indicating full intensity. + */ + guint16 get_red() const; + + /** Gets the green component of the color. + * @return The green component of the color. This is a value between 0 and 65535, with 65535 indicating full intensity. + */ + guint16 get_green() const; + + /** Gets the blue component of the color. + * @return The blue component of the color. This is a value between 0 and 65535, with 65535 indicating full intensity. + */ + guint16 get_blue() const; + + /** Sets the red component of the color. + * @param value The red component of the color. This is a value between 0 and 65535, with 65535 indicating full intensity. + */ + void set_red(const guint16& value); + + /** Sets the green component of the color. + * @param value The green component of the color. This is a value between 0 and 65535, with 65535 indicating full intensity. + */ + void set_green(const guint16& value); + + /** Sets the blue component of the color. + * @param value The blue component of the color. This is a value between 0 and 65535, with 65535 indicating full intensity. + */ + void set_blue(const guint16& value); + + + /** Fill in the fields of a color from a string specification. The + * string can either one of a large set of standard names. (Taken + * from the X11 <filename>rgb.txt</filename> file), or it can be a hex value in the + * form '#rgb' '#rrggbb' '#rrrgggbbb' or '#rrrrggggbbbb' where + * 'r', 'g' and 'b' are hex digits of the red, green, and blue + * components of the color, respectively. (White in the four + * forms is '#fff' '#ffffff' '#fffffffff' and '#ffffffffffff') + * @param spec A string specifying the new color. + * @return <tt>true</tt> if parsing of the specifier succeeded, + * otherwise false. + */ + bool parse(const Glib::ustring& spec); + + +}; + +} /* namespace Pango */ + + +namespace Glib +{ + +/** @relates Pango::Color + * @param object The C instance + * @result A C++ instance that wraps this C instance. + */ +Pango::Color& wrap(PangoColor* object); + +/** @relates Pango::Color + * @param object The C instance + * @result A C++ instance that wraps this C instance. + */ +const Pango::Color& wrap(const PangoColor* object); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +template <> +class Value<Pango::Color> : public Glib::Value_Boxed<Pango::Color> +{}; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +} // namespace Glib + +#endif /* _PANGOMM_COLOR_H */ + diff --git a/libs/gtkmm2/pango/pangomm/context.cc b/libs/gtkmm2/pango/pangomm/context.cc new file mode 100644 index 0000000000..5acd2cc9cf --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/context.cc @@ -0,0 +1,239 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include <pangomm/context.h> +#include <pangomm/private/context_p.h> + +#include <pango/pango-enum-types.h> +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 1998-1999 The Gtk-- Development Team + * Copyright 2001 Free Software Foundation + * + * 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. + */ + +namespace Pango +{ + +Glib::ArrayHandle< Glib::RefPtr<FontFamily> > Context::list_families() const +{ + //Get array: + PangoFontFamily** pFamilies = 0; + int n_families = 0; + pango_context_list_families(const_cast<PangoContext*>(gobj()), &pFamilies, &n_families); + + return Glib::ArrayHandle< Glib::RefPtr<FontFamily> > + (pFamilies, n_families, Glib::OWNERSHIP_SHALLOW); +} + +Pango::FontMetrics Context::get_metrics(const FontDescription& desc) const +{ + return FontMetrics(pango_context_get_metrics(const_cast<PangoContext*>(gobj()), desc.gobj(), 0)); +} + +ListHandle_Item Context::itemize(const Glib::ustring& text, const AttrList& attrs) const +{ + return ListHandle_Item( + pango_itemize(const_cast<PangoContext*>(gobj()), + text.c_str(), 0, text.bytes(), + const_cast<PangoAttrList*>(attrs.gobj()), 0), + Glib::OWNERSHIP_DEEP); +} + +ListHandle_Item Context::itemize(const Glib::ustring& text, int start_index, int length, + const AttrList& attrs, AttrIter& cached_iter) const +{ + return ListHandle_Item( + pango_itemize(const_cast<PangoContext*>(gobj()), + text.c_str(), start_index, length, + const_cast<PangoAttrList*>(attrs.gobj()), cached_iter.gobj()), + Glib::OWNERSHIP_DEEP); +} + +} /* namespace Pango */ + + +namespace +{ +} // anonymous namespace + +// static +GType Glib::Value<Pango::Direction>::value_type() +{ + return pango_direction_get_type(); +} + + +namespace Glib +{ + +Glib::RefPtr<Pango::Context> wrap(PangoContext* object, bool take_copy) +{ + return Glib::RefPtr<Pango::Context>( dynamic_cast<Pango::Context*> (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} /* namespace Glib */ + + +namespace Pango +{ + + +/* The *_Class implementation: */ + +const Glib::Class& Context_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &Context_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(pango_context_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void Context_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast<BaseClassType*>(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* Context_Class::wrap_new(GObject* object) +{ + return new Context((PangoContext*)object); +} + + +/* The implementation: */ + +PangoContext* Context::gobj_copy() +{ + reference(); + return gobj(); +} + +Context::Context(const Glib::ConstructParams& construct_params) +: + Glib::Object(construct_params) +{} + +Context::Context(PangoContext* castitem) +: + Glib::Object((GObject*)(castitem)) +{} + +Context::~Context() +{} + + +Context::CppClassType Context::context_class_; // initialize static member + +GType Context::get_type() +{ + return context_class_.init().get_type(); +} + +GType Context::get_base_type() +{ + return pango_context_get_type(); +} + + +Context::Context() +: + Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations. + Glib::Object(Glib::ConstructParams(context_class_.init())) +{ + } + +Glib::RefPtr<FontMap> Context::get_font_map() +{ + return Glib::wrap(pango_context_get_font_map(gobj())); +} + +Glib::RefPtr<const FontMap> Context::get_font_map() const +{ + return Glib::wrap(pango_context_get_font_map(const_cast<PangoContext*>(gobj()))); +} + +Glib::RefPtr<Font> Context::load_font(const FontDescription& desc) const +{ + return Glib::wrap(pango_context_load_font(const_cast<PangoContext*>(gobj()), (desc).gobj())); +} + +Glib::RefPtr<Fontset> Context::load_fontset(const FontDescription& desc, const Language& language) const +{ + return Glib::wrap(pango_context_load_fontset(const_cast<PangoContext*>(gobj()), (desc).gobj(), const_cast<PangoLanguage*>((language).gobj()))); +} + +FontMetrics Context::get_metrics(const FontDescription& desc, const Language& language) const +{ + return FontMetrics((pango_context_get_metrics(const_cast<PangoContext*>(gobj()), (desc).gobj(), const_cast<PangoLanguage*>((language).gobj())))); +} + +void Context::set_font_description(const FontDescription& desc) +{ + pango_context_set_font_description(gobj(), (desc).gobj()); +} + +FontDescription Context::get_font_description() const +{ + return FontDescription((pango_context_get_font_description(const_cast<PangoContext*>(gobj())))); +} + +Language Context::get_language() const +{ + return Language(pango_context_get_language(const_cast<PangoContext*>(gobj()))); +} + +void Context::set_language(const Language& language) +{ + pango_context_set_language(gobj(), const_cast<PangoLanguage*>((language).gobj())); +} + +void Context::set_base_dir(Direction direction) +{ + pango_context_set_base_dir(gobj(), ((PangoDirection)(direction))); +} + +Direction Context::get_base_dir() const +{ + return ((Direction)(pango_context_get_base_dir(const_cast<PangoContext*>(gobj())))); +} + +void Context::set_matrix(const Matrix& matrix) +{ + pango_context_set_matrix(gobj(), &(matrix)); +} + + +} // namespace Pango + + diff --git a/libs/gtkmm2/pango/pangomm/context.h b/libs/gtkmm2/pango/pangomm/context.h new file mode 100644 index 0000000000..6ce379ff89 --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/context.h @@ -0,0 +1,349 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _PANGOMM_CONTEXT_H +#define _PANGOMM_CONTEXT_H + +#include <glibmm.h> + +/* $Id$ */ + +/* context.h + * + * Copyright (C) 1998-1999 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 <glibmm/object.h> +#include <glibmm/arrayhandle.h> +#include <glibmm/listhandle.h> +#include <pangomm/fontdescription.h> +#include <pangomm/fontmetrics.h> +#include <pangomm/fontset.h> +#include <pangomm/fontmap.h> +#include <pangomm/item.h> +#include <pangomm/attrlist.h> +#include <pangomm/types.h> //For Matrix +#include <pango/pango-context.h> + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _PangoContext PangoContext; +typedef struct _PangoContextClass PangoContextClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Pango +{ class Context_Class; } // namespace Pango +namespace Pango +{ + + +/** @addtogroup pangommEnums Enums and Flags */ + +/** + * @ingroup pangommEnums + */ +enum Direction +{ + DIRECTION_LTR, + DIRECTION_RTL, + DIRECTION_TTB_LTR, + DIRECTION_TTB_RTL, + DIRECTION_WEAK_LTR, + DIRECTION_WEAK_RTL, + DIRECTION_NEUTRAL +}; + +} // namespace Pango + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value<Pango::Direction> : public Glib::Value_Enum<Pango::Direction> +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Pango +{ + + +/** A Pango::Context stores global information used to control the itemization process. + * You can retrieve a Pango::Context object with Gtk::Widget::create_pango_context() or + * Gtk::Widget::get_pango_context(). If you don't use gtkmm call some c function of the + * pango backend you intend to use and create a wrapper for the returned context, + * e.g. Glib::wrap(pango_x_get_context()). + * + * Creating a Pango::Context object is the starting point of every rendering process. + * You can either use it to create a high level Pango::Layout object which does all + * the hard work for you by passing it into + * Pango::Layout::create() or to generate glyph strings from character strings with + * the help of itemize() and Pango::Item::shape() subsequently. + * + * Which fonts are used for rendering can be influenced by setting the default + * font description, language and base direction of the context. + * + * If you want to calculate the space some text will need to be displayed you + * might find the functions of Pango::FontMetrics useful. Use get_metrics() to + * obtain the Pango::FontMetrics object for a specific Pango::FontDescription. + * For more detailed calculations in a rendering-system-independant manner + * and to determine whether specific characters can be represented by the + * font that would be used for a specific Pango::FontDescription load a + * Pango::Fontset with load_fontset() (load_font() returns the Pango::Font + * that is the closest match for a Pango::FontDescription; however that's not + * necessarily the font that will be used for rendering). + */ + +class Context : public Glib::Object +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef Context CppObjectType; + typedef Context_Class CppClassType; + typedef PangoContext BaseObjectType; + typedef PangoContextClass BaseClassType; + +private: friend class Context_Class; + static CppClassType context_class_; + +private: + // noncopyable + Context(const Context&); + Context& operator=(const Context&); + +protected: + explicit Context(const Glib::ConstructParams& construct_params); + explicit Context(PangoContext* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~Context(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + PangoContext* gobj() { return reinterpret_cast<PangoContext*>(gobject_); } + + ///Provides access to the underlying C GObject. + const PangoContext* gobj() const { return reinterpret_cast<PangoContext*>(gobject_); } + + ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. + PangoContext* gobj_copy(); + +private: + + //PANGO_ENABLE_BACKEND + +protected: + Context(); + +public: + /** List all available font families for a context. + * You can specify one of these as your desired font family in the Pango::FontDesciption + * objects you use, e.g. in the default font description of the context. + * @return An array of Pango::FontFamily objects. + */ + Glib::ArrayHandle< Glib::RefPtr<FontFamily> > list_families() const; + + + /** Gets the Pango::Fontmap used to look up fonts for this context. + * @return The font map for the Pango::Context. This value + * is owned by Pango and should not be unreferenced. + * + * Since: 1.6. + */ + Glib::RefPtr<FontMap> get_font_map(); + + /** Gets the Pango::Fontmap used to look up fonts for this context. + * @return The font map for the Pango::Context. This value + * is owned by Pango and should not be unreferenced. + * + * Since: 1.6. + */ + Glib::RefPtr<const FontMap> get_font_map() const; + + + /** Loads the font in one of the fontmaps in the context + * that is the closest match for @a desc . + * @param desc A Pango::FontDescription describing the font to load. + * @return The font loaded, or <tt>0</tt> if no font matched. + */ + Glib::RefPtr<Font> load_font(const FontDescription& desc) const; + + /** Load a set of fonts in the context that can be used to render + * a font matching @a desc . + * @param desc A Pango::FontDescription describing the fonts to load. + * @param language A Pango::Language the fonts will be used for. + * @return The fontset, or <tt>0</tt> if no font matched. + */ + Glib::RefPtr<Fontset> load_fontset(const FontDescription& desc, const Language& language) const; + + /** Get overall metric information for a particular font description. + * The metrics may be substantially different for different scripts. However this + * function overload returns the metrics of the entire font. + * @param desc A Pango::FontDescription object. + * @return A Pango::FontMetrics object. + */ + FontMetrics get_metrics(const FontDescription& desc) const; + + /** Get overall metric information for a font particular font + * description. Since the metrics may be substantially different for + * different scripts, a language tag can be provided to indicate that + * the metrics should be retrieved that correspond to the script(s) + * used by that language. + * + * The Pango::FontDescription is interpreted in the same way as + * by pango_itemize(), and the family name may be a comma separated + * list of figures. If characters from multiple of these families + * would be used to render the string, then the returned fonts would + * be a composite of the metrics for the fonts loaded for the + * individual families. + * @param desc A Pango::FontDescription structure. + * @param language Language tag used to determine which script to get the metrics + * for. + * @return A Pango::Metrics object. + */ + FontMetrics get_metrics(const FontDescription& desc, const Language& language) const; + + /** Set the default font description for the context + * @param desc The new pango font description. + */ + void set_font_description(const FontDescription& desc); + + /** Retrieve the default font description for the context. + * @return A pointer to the context's default font description. + * This value must not be modified or freed. + */ + FontDescription get_font_description() const; + + /** Retrieves the global language tag for the context. + * @return The global language tag. + */ + Language get_language() const; + + /** Sets the global language tag for the context. + * @param language The new language tag. + */ + void set_language(const Language& language); + + /** Sets the base direction for the context. + * + * The base direction is used in applying the Unicode bidirectional + * algorithm; if the @a direction is Pango::DIRECTION_LTR or + * Pango::DIRECTION_RTL, then the value will be used as the paragraph + * direction in the Unicode bidirectional algorithm. A value of + * Pango::DIRECTION_WEAK_LTR or Pango::DIRECTION_WEAK_RTL is used only + * for paragraphs that do not contain any strong characters themselves. + * @param direction The new base direction. + */ + void set_base_dir(Direction direction); + + /** Retrieves the base direction for the context. See + * pango_context_set_base_dir(). + * @return The base direction for the context. + */ + Direction get_base_dir() const; + + + /** Sets the transformation matrix that will be applied when rendering + * with this context. Note that reported metrics are in the user space + * coordinates before the application of the matrix, not device-space + * coordiantes after the application of the matrix. So, they don't scale + * with the matrix, though they may change slightly for different + * matrices, depending on how the text is fit to the pixel grid. + * + * Since: 1.6 + * @param matrix A Pango::Matrix, or <tt>0</tt> to unset any existing matrix. + * (No matrix set is the same as setting the identity matrix.). + */ + void set_matrix(const Matrix& matrix); + //TODO: _WRAP_METHOD(Matrix get_matrix() const, pango_context_get_matrix) + + /** Breaks a piece of text into segments with consistent directional level and shaping engine. + * Each byte of @a text will be contained in exactly one of the items in the returned list. + * The generated list of items will be in logical order (the start offsets of the items + * are ascending). + * @param text The text to itemize. + * @param attrs The set of attributes that apply. + * @return A list of Pango::Item objects. + */ + ListHandle_Item itemize(const Glib::ustring& text, const AttrList& attrs) const; + + /** Breaks a piece of text into segments with consistent directional level and shaping engine. + * Each byte of @a text will be contained in exactly one of the items in the returned list. + * The generated list of items will be in logical order (the start offsets of the items + * are ascending). + * + * @a cached_iter should be an iterator over @a attrs currently positioned at a range before + * or containing @a start_index. @a cached_iter will be advanced to the range covering the + * position just after @a start_index + @a length. (i.e. if itemizing in a loop, just keep + * passing in the same @a cached_iter). + * + * @param text The text to itemize. + * @param start_index First byte in @a text to process. + * @param length The number of bytes (not characters) to process after @a start_index. This must be >= <tt>0</tt>. + * @param attrs The set of attributes that apply to @a text. + * @param cached_iter Cached attribute iterator. + * @return A list of Pango::Item structures. + */ + ListHandle_Item itemize(const Glib::ustring& text, int start_index, int length, + const AttrList& attrs, AttrIter& cached_iter) const; + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +}; + +} /* namespace Pango */ + + +namespace Glib +{ + /** @relates Pango::Context + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr<Pango::Context> wrap(PangoContext* object, bool take_copy = false); +} + + +#endif /* _PANGOMM_CONTEXT_H */ + diff --git a/libs/gtkmm2/pango/pangomm/coverage.cc b/libs/gtkmm2/pango/pangomm/coverage.cc new file mode 100644 index 0000000000..e755994012 --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/coverage.cc @@ -0,0 +1,151 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include <pangomm/coverage.h> +#include <pangomm/private/coverage_p.h> + +#include <pango/pango-enum-types.h> +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 1998-1999 The Gtk-- Development Team + * Copyright 2001 Free Software Foundation + * + * 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. + */ + +namespace Pango +{ + +Glib::ArrayHandle<unsigned char> Coverage::to_bytes() const +{ + guchar* bytes = 0; + int n_bytes = 0; + pango_coverage_to_bytes(const_cast<PangoCoverage*>(gobj()), &bytes, &n_bytes); + return Glib::ArrayHandle<unsigned char>(bytes, n_bytes, Glib::OWNERSHIP_SHALLOW); +} + +} /* namespace Pango */ + + +namespace +{ +} // anonymous namespace + +// static +GType Glib::Value<Pango::CoverageLevel>::value_type() +{ + return pango_coverage_level_get_type(); +} + + +/* Why reinterpret_cast<Coverage*>(gobject) is needed: + * + * A Coverage instance is in fact always a PangoCoverage instance. + * Unfortunately, PangoCoverage cannot be a member of Coverage, + * 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 Coverage 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<Pango::Coverage> wrap(PangoCoverage* object, bool take_copy) +{ + if(take_copy && object) + pango_coverage_ref(object); + + // See the comment at the top of this file, if you want to know why the cast works. + return Glib::RefPtr<Pango::Coverage>(reinterpret_cast<Pango::Coverage*>(object)); +} + +} // namespace Glib + + +namespace Pango +{ + + +// static +Glib::RefPtr<Coverage> Coverage::create() +{ + // See the comment at the top of this file, if you want to know why the cast works. + return Glib::RefPtr<Coverage>(reinterpret_cast<Coverage*>(pango_coverage_new())); +} + +void Coverage::reference() const +{ + // See the comment at the top of this file, if you want to know why the cast works. + pango_coverage_ref(reinterpret_cast<PangoCoverage*>(const_cast<Coverage*>(this))); +} + +void Coverage::unreference() const +{ + // See the comment at the top of this file, if you want to know why the cast works. + pango_coverage_unref(reinterpret_cast<PangoCoverage*>(const_cast<Coverage*>(this))); +} + +PangoCoverage* Coverage::gobj() +{ + // See the comment at the top of this file, if you want to know why the cast works. + return reinterpret_cast<PangoCoverage*>(this); +} + +const PangoCoverage* Coverage::gobj() const +{ + // See the comment at the top of this file, if you want to know why the cast works. + return reinterpret_cast<const PangoCoverage*>(this); +} + +PangoCoverage* Coverage::gobj_copy() const +{ + // See the comment at the top of this file, if you want to know why the cast works. + PangoCoverage *const gobject = reinterpret_cast<PangoCoverage*>(const_cast<Coverage*>(this)); + pango_coverage_ref(gobject); + return gobject; +} + + +Glib::RefPtr<Coverage> Coverage::create(const guchar* bytes, int n_bytes) +{ + return Glib::wrap(pango_coverage_from_bytes(const_cast<guchar*>(bytes), n_bytes)); +} + +CoverageLevel Coverage::get(int index) const +{ + return ((CoverageLevel)(pango_coverage_get(const_cast<PangoCoverage*>(gobj()), index))); +} + +void Coverage::set(int index, CoverageLevel level) +{ + pango_coverage_set(gobj(), index, ((PangoCoverageLevel)(level))); +} + +void Coverage::max(const Glib::RefPtr<Coverage>& other) const +{ + pango_coverage_max(const_cast<PangoCoverage*>(gobj()), Glib::unwrap(other)); +} + + +} // namespace Pango + + diff --git a/libs/gtkmm2/pango/pangomm/coverage.h b/libs/gtkmm2/pango/pangomm/coverage.h new file mode 100644 index 0000000000..eebbffd628 --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/coverage.h @@ -0,0 +1,169 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _PANGOMM_COVERAGE_H +#define _PANGOMM_COVERAGE_H + +#include <glibmm.h> + +/* $Id$ */ + +/* coverage.h + * + * Copyright (C) 1998-1999 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 <glibmm/arrayhandle.h> +#include <pango/pango-font.h> + + +namespace Pango +{ + + +/** @addtogroup pangommEnums Enums and Flags */ + +/** + * @ingroup pangommEnums + */ +enum CoverageLevel +{ + COVERAGE_NONE, + COVERAGE_FALLBACK, + COVERAGE_APPROXIMATE, + COVERAGE_EXACT +}; + +} // namespace Pango + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value<Pango::CoverageLevel> : public Glib::Value_Enum<Pango::CoverageLevel> +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Pango +{ + + +/** A Pango::Coverage represents a map from ISO-10646 character point to Pango::CoverageLevel. + * It is often necessary in pango to determine if a particular font can represent a particular character, + * and also how well it can represent that character. Pango::Coverage holds this information. + */ +class Coverage +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Coverage CppObjectType; + typedef PangoCoverage BaseObjectType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + static Glib::RefPtr<Coverage> create(); + + // For use with Glib::RefPtr<> only. + void reference() const; + void unreference() const; + + ///Provides access to the underlying C instance. + PangoCoverage* gobj(); + + ///Provides access to the underlying C instance. + const PangoCoverage* gobj() const; + + ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. + PangoCoverage* gobj_copy() const; + +protected: + // Do not derive this. Pango::Coverage can neither be constructed nor deleted. + Coverage(); + void operator delete(void*, size_t); + +private: + // noncopyable + Coverage(const Coverage&); + Coverage& operator=(const Coverage&); + + + //pango ref doc: "This function may now be unecessary since we refcount the structure. Mail otaylor redhat.com if you use it." + + +public: + + /** Convert data generated from pango_converage_to_bytes() back + * to a Pango::Coverage + * @param bytes Binary data representing a Pango::Coverage. + * @param n_bytes The size of @a bytes in bytes. + * @return A newly allocated Pango::Coverage, or <tt>0</tt> if + * the data was invalid. + */ + static Glib::RefPtr<Coverage> create(const guchar* bytes, int n_bytes); + + //_WRAP_METHOD(Glib::RefPtr<Coverage> copy() const, pango_coverage_copy) //see above + + + /** Determine whether a particular index is covered by @a coverage + * @param index The index to check. + */ + CoverageLevel get(int index) const; + + /** Modify a particular index within @a coverage + * @param index The index to modify. + * @param level The new level for @a index . + */ + void set(int index, CoverageLevel level); + + /** Set the coverage for each index in @a coverage to be the max (better) + * value of the current coverage for the index and the coverage for + * the corresponding index in @a other . + * @param other Another Pango::Coverage. + */ + void max(const Glib::RefPtr<Coverage>& other) const; + + /** Convert the coverage map into a flat binary format. + * @return An array of bytes representing the coverage map. + */ + Glib::ArrayHandle<unsigned char> to_bytes() const; + + +}; + +} // namespace Pango + + +namespace Glib +{ + + /** @relates Pango::Coverage + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr<Pango::Coverage> wrap(PangoCoverage* object, bool take_copy = false); + +} // namespace Glib + +#endif /* _PANGOMM_COVERAGE_H */ + diff --git a/libs/gtkmm2/pango/pangomm/font.cc b/libs/gtkmm2/pango/pangomm/font.cc new file mode 100644 index 0000000000..b126931536 --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/font.cc @@ -0,0 +1,169 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include <pangomm/font.h> +#include <pangomm/private/font_p.h> + +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 1998-1999 The Gtk-- Development Team + * Copyright 2001 Free Software Foundation + * + * 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. + */ + +namespace Pango +{ + +FontMetrics Font::get_metrics() const +{ + return FontMetrics(pango_font_get_metrics(const_cast<PangoFont*>(gobj()), 0)); +} + +Rectangle Font::get_glyph_ink_extents(Glyph glyph) const +{ + Rectangle ink_rect; + pango_font_get_glyph_extents(const_cast<PangoFont*>(gobj()), glyph, ink_rect.gobj(), 0); + return ink_rect; +} + +Rectangle Font::get_glyph_logical_extents(Glyph glyph) const +{ + Rectangle logical_rect; + pango_font_get_glyph_extents(const_cast<PangoFont*>(gobj()), glyph, 0, logical_rect.gobj()); + return logical_rect; +} + +} /* namespace Pango */ + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + +Glib::RefPtr<Pango::Font> wrap(PangoFont* object, bool take_copy) +{ + return Glib::RefPtr<Pango::Font>( dynamic_cast<Pango::Font*> (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} /* namespace Glib */ + + +namespace Pango +{ + + +/* The *_Class implementation: */ + +const Glib::Class& Font_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &Font_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(pango_font_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void Font_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast<BaseClassType*>(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* Font_Class::wrap_new(GObject* object) +{ + return new Font((PangoFont*)object); +} + + +/* The implementation: */ + +PangoFont* Font::gobj_copy() +{ + reference(); + return gobj(); +} + +Font::Font(const Glib::ConstructParams& construct_params) +: + Glib::Object(construct_params) +{} + +Font::Font(PangoFont* castitem) +: + Glib::Object((GObject*)(castitem)) +{} + +Font::~Font() +{} + + +Font::CppClassType Font::font_class_; // initialize static member + +GType Font::get_type() +{ + return font_class_.init().get_type(); +} + +GType Font::get_base_type() +{ + return pango_font_get_type(); +} + + +FontDescription Font::describe() const +{ + return FontDescription((pango_font_describe(const_cast<PangoFont*>(gobj())))); +} + +Glib::RefPtr<Coverage> Font::get_coverage(const Language& language) const +{ + return Glib::wrap(pango_font_get_coverage(const_cast<PangoFont*>(gobj()), const_cast<PangoLanguage*>((language).gobj()))); +} + +FontMetrics Font::get_metrics(const Language& language) const +{ + return FontMetrics((pango_font_get_metrics(const_cast<PangoFont*>(gobj()), const_cast<PangoLanguage*>((language).gobj())))); +} + +void Font::get_glyph_extents(Glyph glyph, Rectangle& ink_rect, Rectangle& logical_rect) const +{ + pango_font_get_glyph_extents(const_cast<PangoFont*>(gobj()), glyph, (ink_rect).gobj(), (logical_rect).gobj()); +} + + +} // namespace Pango + + diff --git a/libs/gtkmm2/pango/pangomm/font.h b/libs/gtkmm2/pango/pangomm/font.h new file mode 100644 index 0000000000..6aa53a1629 --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/font.h @@ -0,0 +1,194 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _PANGOMM_FONT_H +#define _PANGOMM_FONT_H + +#include <glibmm.h> + +/* $Id$ */ + +/* font.h + * + * Copyright (C) 1998-1999 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 <glibmm/object.h> +#include <pangomm/rectangle.h> +#include <pangomm/language.h> +#include <pangomm/glyph.h> +#include <pangomm/fontdescription.h> +#include <pangomm/fontmetrics.h> +#include <pangomm/coverage.h> +#include <pango/pango-font.h> + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _PangoFont PangoFont; +typedef struct _PangoFontClass PangoFontClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Pango +{ class Font_Class; } // namespace Pango +namespace Pango +{ + +const int SCALE = 1024; +const double SCALE_XX_SMALL = 0.5787037037037; +const double SCALE_X_SMALL = 0.6444444444444; +const double SCALE_SMALL = 0.8333333333333; +const double SCALE_MEDIUM = 1.0; +const double SCALE_LARGE = 1.2; +const double SCALE_X_LARGE = 1.4399999999999; +const double SCALE_XX_LARGE = 1.728; + + +/** A Pango::Font is used to represent a font in a rendering-system-independent matter. + */ + +class Font : public Glib::Object +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef Font CppObjectType; + typedef Font_Class CppClassType; + typedef PangoFont BaseObjectType; + typedef PangoFontClass BaseClassType; + +private: friend class Font_Class; + static CppClassType font_class_; + +private: + // noncopyable + Font(const Font&); + Font& operator=(const Font&); + +protected: + explicit Font(const Glib::ConstructParams& construct_params); + explicit Font(PangoFont* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~Font(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + PangoFont* gobj() { return reinterpret_cast<PangoFont*>(gobject_); } + + ///Provides access to the underlying C GObject. + const PangoFont* gobj() const { return reinterpret_cast<PangoFont*>(gobject_); } + + ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. + PangoFont* gobj_copy(); + +private: + + //This would return a PangoEngineShape* but the definition of the struct is surrounded by #define PANGO_ENABLE_BACKEND [...] #endif. So don't wrap it. + +public: + + /** Returns a description of the font. + * @return A newly-allocated Pango::FontDescription object. + */ + FontDescription describe() const; + + /** Computes the coverage map for a given font and language tag. + * @param language The language tag. + * @return A newly-allocated Pango::Coverage object. + */ + Glib::RefPtr<Coverage> get_coverage(const Language& language) const; + + /** Gets overall metric information for a font. + * The metrics may be substantially different for different scripts. + * However, this function overload returns the metrics for the entire font. + */ + FontMetrics get_metrics() const; + + /** Gets overall metric information for a font. Since the metrics may be + * substantially different for different scripts, a language tag can + * be provided to indicate that the metrics should be retrieved that + * correspond to the script(s) used by that language. + * @param language Language tag used to determine which script to get the metrics + * for. + * @return A Pango::Metrics object. + */ + FontMetrics get_metrics(const Language& language) const; + + + /** Gets the logical and ink extents of a glyph within a font. The + * coordinate system for each rectangle has its origin at the + * base line and horizontal origin of the character with increasing + * coordinates extending to the right and down. The macros PANGO_ASCENT(), + * PANGO_DESCENT(), PANGO_LBEARING(), and PANGO_RBEARING can be used to convert + * from the extents rectangle to more traditional font metrics. The units + * of the rectangles are in 1/PANGO_SCALE of a device unit. + * @param glyph The glyph index. + * @param ink_rect Rectangle used to store the extents of the glyph as drawn. + * @param logical_rect Rectangle used to store the logical extents of the glyph. + */ + void get_glyph_extents(Glyph glyph, Rectangle& ink_rect, Rectangle& logical_rect) const; + + /** Get the ink extents of a glyph within the font. + * @param glyph The glyph index. + * @return The extents of the glyph as drawn. + */ + Rectangle get_glyph_ink_extents(Glyph glyph) const; + + /** Gets the logical extents of a glyph within the font. + * @param glyph The glyph index. + * @return The logical extents of the glyph. + */ + Rectangle get_glyph_logical_extents(Glyph glyph) const; + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +}; + +} /* namespace Pango */ + + +namespace Glib +{ + /** @relates Pango::Font + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr<Pango::Font> wrap(PangoFont* object, bool take_copy = false); +} + + +#endif /* _PANGOMM_FONT_H */ + diff --git a/libs/gtkmm2/pango/pangomm/fontdescription.cc b/libs/gtkmm2/pango/pangomm/fontdescription.cc new file mode 100644 index 0000000000..af866dc9cb --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/fontdescription.cc @@ -0,0 +1,252 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include <pangomm/fontdescription.h> +#include <pangomm/private/fontdescription_p.h> + +#include <pango/pango-enum-types.h> +// -*- 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 <glibmm/utility.h> + + +namespace Pango +{ + +FontDescription::FontDescription(const Glib::ustring& font_name) +{ + gobject_ = pango_font_description_from_string(font_name.c_str()); +} + +} // namespace Pango + + +namespace +{ +} // anonymous namespace + +// static +GType Glib::Value<Pango::Style>::value_type() +{ + return pango_style_get_type(); +} + +// static +GType Glib::Value<Pango::Variant>::value_type() +{ + return pango_variant_get_type(); +} + +// static +GType Glib::Value<Pango::Stretch>::value_type() +{ + return pango_stretch_get_type(); +} + +// static +GType Glib::Value<Pango::Weight>::value_type() +{ + return pango_weight_get_type(); +} + +// static +GType Glib::Value<Pango::FontMask>::value_type() +{ + return pango_font_mask_get_type(); +} + + +namespace Glib +{ + +Pango::FontDescription wrap(PangoFontDescription* object, bool take_copy) +{ + return Pango::FontDescription(object, take_copy); +} + +} // namespace Glib + + +namespace Pango +{ + + +// static +GType FontDescription::get_type() +{ + return pango_font_description_get_type(); +} + +FontDescription::FontDescription() +: + gobject_ (pango_font_description_new()) +{} + +FontDescription::FontDescription(const FontDescription& other) +: + gobject_ ((other.gobject_) ? pango_font_description_copy(other.gobject_) : 0) +{} + +FontDescription::FontDescription(PangoFontDescription* gobject, bool make_a_copy) +: + // For BoxedType wrappers, make_a_copy is true by default. The static + // BoxedType wrappers must always take a copy, thus make_a_copy = true + // ensures identical behaviour if the default argument is used. + gobject_ ((make_a_copy && gobject) ? pango_font_description_copy(gobject) : gobject) +{} + +FontDescription& FontDescription::operator=(const FontDescription& other) +{ + FontDescription temp (other); + swap(temp); + return *this; +} + +FontDescription::~FontDescription() +{ + if(gobject_) + pango_font_description_free(gobject_); +} + +void FontDescription::swap(FontDescription& other) +{ + PangoFontDescription *const temp = gobject_; + gobject_ = other.gobject_; + other.gobject_ = temp; +} + +PangoFontDescription* FontDescription::gobj_copy() const +{ + return pango_font_description_copy(gobject_); +} + + +guint FontDescription::hash() const +{ + return pango_font_description_hash(const_cast<PangoFontDescription*>(gobj())); +} + +void FontDescription::set_family(const Glib::ustring& family) +{ + pango_font_description_set_family(gobj(), family.c_str()); +} + +Glib::ustring FontDescription::get_family() const +{ + return Glib::convert_const_gchar_ptr_to_ustring(pango_font_description_get_family(const_cast<PangoFontDescription*>(gobj()))); +} + +void FontDescription::set_style(Style style) +{ + pango_font_description_set_style(gobj(), ((PangoStyle)(style))); +} + +Style FontDescription::get_style() const +{ + return ((Style)(pango_font_description_get_style(const_cast<PangoFontDescription*>(gobj())))); +} + +void FontDescription::set_variant(Variant variant) +{ + pango_font_description_set_variant(gobj(), ((PangoVariant)(variant))); +} + +Variant FontDescription::get_variant() const +{ + return ((Variant)(pango_font_description_get_variant(const_cast<PangoFontDescription*>(gobj())))); +} + +void FontDescription::set_weight(Weight weight) +{ + pango_font_description_set_weight(gobj(), ((PangoWeight)(weight))); +} + +Weight FontDescription::get_weight() const +{ + return ((Weight)(pango_font_description_get_weight(const_cast<PangoFontDescription*>(gobj())))); +} + +void FontDescription::set_stretch(Stretch stretch) +{ + pango_font_description_set_stretch(gobj(), ((PangoStretch)(stretch))); +} + +Stretch FontDescription::get_stretch() const +{ + return ((Stretch)(pango_font_description_get_stretch(const_cast<PangoFontDescription*>(gobj())))); +} + +void FontDescription::set_size(int size) +{ + pango_font_description_set_size(gobj(), size); +} + +int FontDescription::get_size() const +{ + return pango_font_description_get_size(const_cast<PangoFontDescription*>(gobj())); +} + +FontMask FontDescription::get_set_fields() const +{ + return ((FontMask)(pango_font_description_get_set_fields(const_cast<PangoFontDescription*>(gobj())))); +} + +void FontDescription::unset_fields(FontMask to_unset) +{ + pango_font_description_unset_fields(gobj(), ((PangoFontMask)(to_unset))); +} + +void FontDescription::merge(const FontDescription& desc_to_merge, bool replace_existing) +{ + pango_font_description_merge(gobj(), (desc_to_merge).gobj(), static_cast<int>(replace_existing)); +} + +bool FontDescription::better_match(const FontDescription& old_match, const FontDescription& new_match) const +{ + return pango_font_description_better_match(const_cast<PangoFontDescription*>(gobj()), (old_match).gobj(), (new_match).gobj()); +} + +Glib::ustring FontDescription::to_string() const +{ + return Glib::convert_return_gchar_ptr_to_ustring(pango_font_description_to_string(const_cast<PangoFontDescription*>(gobj()))); +} + +Glib::ustring FontDescription::to_filename() const +{ + return Glib::convert_return_gchar_ptr_to_ustring(pango_font_description_to_filename(const_cast<PangoFontDescription*>(gobj()))); +} + + +bool operator==(const FontDescription& lhs, const FontDescription& rhs) +{ + return (pango_font_description_equal(lhs.gobj(), rhs.gobj()) != 0); +} + +bool operator!=(const FontDescription& lhs, const FontDescription& rhs) +{ + return (pango_font_description_equal(lhs.gobj(), rhs.gobj()) == 0); +} + + +} // namespace Pango + + diff --git a/libs/gtkmm2/pango/pangomm/fontdescription.h b/libs/gtkmm2/pango/pangomm/fontdescription.h new file mode 100644 index 0000000000..1c51be840c --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/fontdescription.h @@ -0,0 +1,529 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _PANGOMM_FONTDESCRIPTION_H +#define _PANGOMM_FONTDESCRIPTION_H + +#include <glibmm.h> + +/* $Id$ */ + +/* fontdescription.h + * + * Copyright (C) 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/pango-font.h> + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +extern "C" { typedef struct _PangoFontDescription PangoFontDescription; } +#endif + +namespace Pango +{ + + +/** @addtogroup pangommEnums Enums and Flags */ + +/** + * @ingroup pangommEnums + */ +enum Style +{ + STYLE_NORMAL, + STYLE_OBLIQUE, + STYLE_ITALIC +}; + +} // namespace Pango + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value<Pango::Style> : public Glib::Value_Enum<Pango::Style> +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Pango +{ + +/** + * @ingroup pangommEnums + */ +enum Variant +{ + VARIANT_NORMAL, + VARIANT_SMALL_CAPS +}; + +} // namespace Pango + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value<Pango::Variant> : public Glib::Value_Enum<Pango::Variant> +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Pango +{ + +/** + * @ingroup pangommEnums + */ +enum Stretch +{ + STRETCH_ULTRA_CONDENSED, + STRETCH_EXTRA_CONDENSED, + STRETCH_CONDENSED, + STRETCH_SEMI_CONDENSED, + STRETCH_NORMAL, + STRETCH_SEMI_EXPANDED, + STRETCH_EXPANDED, + STRETCH_EXTRA_EXPANDED, + STRETCH_ULTRA_EXPANDED +}; + +} // namespace Pango + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value<Pango::Stretch> : public Glib::Value_Enum<Pango::Stretch> +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Pango +{ + +/** + * @ingroup pangommEnums + */ +enum Weight +{ + WEIGHT_ULTRALIGHT = 200, + WEIGHT_LIGHT = 300, + WEIGHT_NORMAL = 400, + WEIGHT_BOLD = 700, + WEIGHT_ULTRABOLD = 800, + WEIGHT_HEAVY = 900 +}; + +} // namespace Pango + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value<Pango::Weight> : public Glib::Value_Enum<Pango::Weight> +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Pango +{ + +/** + * @ingroup pangommEnums + * @par Bitwise operators: + * <tt>%FontMask operator|(FontMask, FontMask)</tt><br> + * <tt>%FontMask operator&(FontMask, FontMask)</tt><br> + * <tt>%FontMask operator^(FontMask, FontMask)</tt><br> + * <tt>%FontMask operator~(FontMask)</tt><br> + * <tt>%FontMask& operator|=(FontMask&, FontMask)</tt><br> + * <tt>%FontMask& operator&=(FontMask&, FontMask)</tt><br> + * <tt>%FontMask& operator^=(FontMask&, FontMask)</tt><br> + */ +enum FontMask +{ + FONT_MASK_FAMILY = 1 << 0, + FONT_MASK_STYLE = 1 << 1, + FONT_MASK_VARIANT = 1 << 2, + FONT_MASK_WEIGHT = 1 << 3, + FONT_MASK_STRETCH = 1 << 4, + FONT_MASK_SIZE = 1 << 5 +}; + +/** @ingroup pangommEnums */ +inline FontMask operator|(FontMask lhs, FontMask rhs) + { return static_cast<FontMask>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); } + +/** @ingroup pangommEnums */ +inline FontMask operator&(FontMask lhs, FontMask rhs) + { return static_cast<FontMask>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); } + +/** @ingroup pangommEnums */ +inline FontMask operator^(FontMask lhs, FontMask rhs) + { return static_cast<FontMask>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); } + +/** @ingroup pangommEnums */ +inline FontMask operator~(FontMask flags) + { return static_cast<FontMask>(~static_cast<unsigned>(flags)); } + +/** @ingroup pangommEnums */ +inline FontMask& operator|=(FontMask& lhs, FontMask rhs) + { return (lhs = static_cast<FontMask>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); } + +/** @ingroup pangommEnums */ +inline FontMask& operator&=(FontMask& lhs, FontMask rhs) + { return (lhs = static_cast<FontMask>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); } + +/** @ingroup pangommEnums */ +inline FontMask& operator^=(FontMask& lhs, FontMask rhs) + { return (lhs = static_cast<FontMask>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); } + +} // namespace Pango + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value<Pango::FontMask> : public Glib::Value_Flags<Pango::FontMask> +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Pango +{ + + +/** A Pango::FontDescription represents the description of an ideal font. + * It is used both to list what fonts are available on the system and also for specifying the characteristics of a font to load. + */ +class FontDescription +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef FontDescription CppObjectType; + typedef PangoFontDescription BaseObjectType; + + static GType get_type() G_GNUC_CONST; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + FontDescription(); + + explicit FontDescription(PangoFontDescription* gobject, bool make_a_copy = true); + + FontDescription(const FontDescription& other); + FontDescription& operator=(const FontDescription& other); + + ~FontDescription(); + + void swap(FontDescription& other); + + ///Provides access to the underlying C instance. + PangoFontDescription* gobj() { return gobject_; } + + ///Provides access to the underlying C instance. + const PangoFontDescription* gobj() const { return gobject_; } + + ///Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs. + PangoFontDescription* gobj_copy() const; + +protected: + PangoFontDescription* gobject_; + +private: + + + /* These functions are dangerous! The first casts the "const" from the parameter away + * copying the pointer and keep it hanging around. + * So desc.set_family_static("some_family") would lead to a segfault. + * The latter makes a shallow copy of the parameter's "family" data member. + * So if the FontDescription you passed in dies, a pointer to its (deleted) + * family data member still hangs around! + * This is why we can't wrap these functions! + */ + + +public: + /** Constructs a font description from a string representation. + * @a font_name must have the form + * "[FAMILY-LIST] [STYLE-OPTIONS] [SIZE]", where FAMILY-LIST is a comma separated + * list of families optionally terminated by a comma, STYLE_OPTIONS is a whitespace + * separated list of words where each WORD describes one of style, variant, weight, + * or stretch, and SIZE is an decimal number (size in points). Any one of the + * options may be absent. If FAMILY-LIST is absent, then the family_name field + * of the resulting font description will be initialized to 0. If STYLE-OPTIONS + * is missing, then all style options will be set to the default values. If SIZE + * is missing, the size in the resulting font description will be set to 0. + * @param font_name String representation of a font description. + */ + explicit FontDescription(const Glib::ustring& font_name); + + + /** Computes a hash of a Pango::FontDescription structure suitable + * to be used, for example, as an argument to Glib::hash_table_new(). + * @return The hash value. + */ + guint hash() const; + + /** Sets the family name field of a font description. The family + * name represents a family of related font styles, and will + * resolve to a particular Pango::FontFamily. In some uses of + * Pango::FontDescription, it is also possible to use a comma + * separated list of family names for this field. + * @param family A string representing the family name. + */ + void set_family(const Glib::ustring& family); + + /** Gets the family name field of a font description. See + * pango_font_description_set_family(). + * @return The family name field. (Will be <tt>0</tt> if not previously set.). + */ + Glib::ustring get_family() const; + + /** Sets the style field of a Pango::FontDescription. The + * Pango::Style enumeration describes whether the font is slanted and + * the manner in which it is slanted; it can be either + * Pango::STYLE_NORMAL, Pango::STYLE_ITALIC, or Pango::STYLE_OBLIQUE. + * Most fonts will either have a italic style or an oblique + * style, but not both, and font matching in Pango will + * match italic specifications with oblique fonts and vice-versa + * if an exact match is not found. + * @param style The style for the font description. + */ + void set_style(Style style); + + /** Gets the style field of a Pango::FontDescription. See + * pango_font_description_set_style(). + * @return The style field for the font description. + * Use pango_font_description_get_set_fields() to find out if + * the field was explicitely set or not. + */ + Style get_style() const; + + /** Sets the variant field of a font description. The Pango::Variant + * can either be Pango::VARIANT_NORMAL or Pango::VARIANT_SMALL_CAPS. + * @param variant The variant type for the font description. + */ + void set_variant(Variant variant); + + /** Gets the variant field of a Pango::FontDescription. See + * pango_font_description_set_variant(). + * @return The variant field for the font description. Use + * pango_font_description_get_set_fields() to find out if + * the field was explicitely set or not. + */ + Variant get_variant() const; + + /** Sets the weight field of a font description. The weight field + * specifies how bold or light the font should be. In addition + * to the values of the Pango::Weight enumeration, other intermediate + * numeric values are possible. + * @param weight The weight for the font description. + */ + void set_weight(Weight weight); + + /** Gets the weight field of a font description. See + * pango_font_description_set_weight(). + * @return The weight field for the font description. Use + * pango_font_description_get_set_fields() to find out if + * the field was explicitely set or not. + */ + Weight get_weight() const; + + /** Sets the stretch field of a font description. The stretch field + * specifies how narrow or wide the font should be. + * @param stretch The stretch for the font description. + */ + void set_stretch(Stretch stretch); + + /** Gets the stretch field of a font description. + * See pango_font_description_set_stretch(). + * @return The stretch field for the font description. Use + * pango_font_description_get_set_fields() to find out if + * the field was explicitely set or not. + */ + Stretch get_stretch() const; + + /** Sets the size field of a font description in fractional points. This is mutually + * exclusive with pango_font_description_set_absolute_size(). + * @param size The size of the font in points, scaled by PANGO_SCALE. (That is, + * a @a size value of 10 * PANGO_SCALE is a 10 point font. The conversion + * factor between points and device units depends on system configuration + * and the output device. For screen display, a logical DPI of 96 is + * common, in which case a 10 point font corresponds to a 10 * (96 / 72) = 13.3 + * pixel font. Use pango_font_description_set_absolute_size() if you need + * a particular size in device units. + */ + void set_size(int size); + + /** Gets the size field of a font description. + * See pango_font_description_get_size(). + * @return The size field for the font description in points or device units. + * You must call pango_font_description_get_size_is_absolute() + * to find out which is the case. Returns 0 if the size field has not + * previously been set. pango_font_description_get_set_fields() to + * find out if the field was explicitely set or not. + */ + int get_size() const; + + /** Determines which fields in a font description have been set. + * @return A bitmask with bits set corresponding to the + * fields in @a desc that have been set. + */ + FontMask get_set_fields() const; + + /** Unsets some of the fields in a Pango::FontDescription. Note that + * this merely marks the fields cleared, it does not clear the + * settings for those fields, to clear a family name set with + * pango_font_description_set_family_static() so that it won't + * be returned by subsequent calls to pango_font_description_get_family(), + * you must actually call pango_font_description_set_family (desc, <tt>0</tt>); + * @param to_unset Bitmask of fields in the @a desc to unset. + */ + void unset_fields(FontMask to_unset); + + /** Merges the fields that are set in @a desc_to_merge into the fields in + * @a desc . If @a replace_existing is <tt>false</tt>, only fields in @a desc that + * are not already set are affected. If <tt>true</tt>, then fields that are + * already set will be replaced as well. + * @param desc_to_merge The Pango::FontDescription to merge from. + * @param replace_existing If <tt>true</tt>, replace fields in @a desc with the + * corresponding values from @a desc_to_merge , even if they + * are already exist. + */ + void merge(const FontDescription& desc_to_merge, bool replace_existing); + + /** Determines if the style attributes of @a new_match are a closer match + * for @a desc than @a old_match , or if @a old_match is <tt>0</tt>, determines if + * @a new_match is a match at all. Approximate matching is done for + * weight and style; other attributes must match exactly. + * @param old_match A Pango::FontDescription, or <tt>0</tt>. + * @param new_match A Pango::FontDescription. + * @return <tt>true</tt> if @a new_match is a better match. + */ + bool better_match(const FontDescription& old_match, const FontDescription& new_match) const; + + /** Creates a string representation of a font description. See + * description_from_string() for a description of the + * format of the string representation. The family list in the + * string description will only have a terminating comma if the + * last word of the list is a valid style option. + * @return The string. + */ + Glib::ustring to_string() const; + + /** Creates a filename representation of a font description. The + * filename is identical to the result from calling + * pango_font_description_to_string(), but with underscores instead of + * characters that are untypical in filenames, and in lower case only. + * @return The filename. + */ + Glib::ustring to_filename() const; + + +}; + +} //namespace Pango + + +namespace Pango +{ + +/** @relates Pango::FontDescription + * @param lhs The left-hand side + * @param rhs The right-hand side + * @result The result + */ +bool operator==(const FontDescription& lhs, const FontDescription& rhs); + +/** @relates Pango::FontDescription + * @param lhs The left-hand side + * @param rhs The right-hand side + * @result The result + */ +bool operator!=(const FontDescription& lhs, const FontDescription& rhs); + + +} // namespace Pango + + +namespace Pango +{ + +/** @relates Pango::FontDescription + * @param lhs The left-hand side + * @param rhs The right-hand side + */ +inline void swap(FontDescription& lhs, FontDescription& rhs) + { lhs.swap(rhs); } + +} // namespace Pango + +namespace Glib +{ + +/** @relates Pango::FontDescription + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ +Pango::FontDescription wrap(PangoFontDescription* object, bool take_copy = false); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +template <> +class Value<Pango::FontDescription> : public Glib::Value_Boxed<Pango::FontDescription> +{}; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +} // namespace Glib + +#endif /* _PANGOMM_FONTDESCRIPTION_H */ + diff --git a/libs/gtkmm2/pango/pangomm/fontface.cc b/libs/gtkmm2/pango/pangomm/fontface.cc new file mode 100644 index 0000000000..44c087aaef --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/fontface.cc @@ -0,0 +1,148 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include <pangomm/fontface.h> +#include <pangomm/private/fontface_p.h> + +// -*- 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. + */ + +namespace Pango +{ + +Glib::ArrayHandle<int> FontFace::list_sizes() const +{ + int* sizes = 0; + int n_sizes = 0; + pango_font_face_list_sizes(const_cast<PangoFontFace*>(gobj()), &sizes, &n_sizes); + + return Glib::ArrayHandle<int>(sizes, n_sizes, Glib::OWNERSHIP_SHALLOW); //The ArrayHandle will free the array. +} + +} //namespace Pango + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + +Glib::RefPtr<Pango::FontFace> wrap(PangoFontFace* object, bool take_copy) +{ + return Glib::RefPtr<Pango::FontFace>( dynamic_cast<Pango::FontFace*> (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} /* namespace Glib */ + + +namespace Pango +{ + + +/* The *_Class implementation: */ + +const Glib::Class& FontFace_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &FontFace_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(pango_font_face_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void FontFace_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast<BaseClassType*>(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* FontFace_Class::wrap_new(GObject* object) +{ + return new FontFace((PangoFontFace*)object); +} + + +/* The implementation: */ + +PangoFontFace* FontFace::gobj_copy() +{ + reference(); + return gobj(); +} + +FontFace::FontFace(const Glib::ConstructParams& construct_params) +: + Glib::Object(construct_params) +{} + +FontFace::FontFace(PangoFontFace* castitem) +: + Glib::Object((GObject*)(castitem)) +{} + +FontFace::~FontFace() +{} + + +FontFace::CppClassType FontFace::fontface_class_; // initialize static member + +GType FontFace::get_type() +{ + return fontface_class_.init().get_type(); +} + +GType FontFace::get_base_type() +{ + return pango_font_face_get_type(); +} + + +FontDescription FontFace::describe() const +{ + return FontDescription((pango_font_face_describe(const_cast<PangoFontFace*>(gobj())))); +} + +Glib::ustring FontFace::get_name() const +{ + return Glib::convert_const_gchar_ptr_to_ustring(pango_font_face_get_face_name(const_cast<PangoFontFace*>(gobj()))); +} + + +} // namespace Pango + + diff --git a/libs/gtkmm2/pango/pangomm/fontface.h b/libs/gtkmm2/pango/pangomm/fontface.h new file mode 100644 index 0000000000..64b0317c7c --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/fontface.h @@ -0,0 +1,151 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _PANGOMM_FONTFACE_H +#define _PANGOMM_FONTFACE_H + +#include <glibmm.h> + +/* $Id$ */ + +/* fontface.h + * + * Copyright 2001 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 <glibmm/object.h> +#include <pangomm/fontdescription.h> +#include <pango/pango-font.h> + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _PangoFontFace PangoFontFace; +typedef struct _PangoFontFaceClass PangoFontFaceClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Pango +{ class FontFace_Class; } // namespace Pango +namespace Pango +{ + +/** A Pango::FontFace is used to represent a group of fonts with the same family, slant, weight, width, but varying sizes. + */ + +class FontFace : public Glib::Object +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef FontFace CppObjectType; + typedef FontFace_Class CppClassType; + typedef PangoFontFace BaseObjectType; + typedef PangoFontFaceClass BaseClassType; + +private: friend class FontFace_Class; + static CppClassType fontface_class_; + +private: + // noncopyable + FontFace(const FontFace&); + FontFace& operator=(const FontFace&); + +protected: + explicit FontFace(const Glib::ConstructParams& construct_params); + explicit FontFace(PangoFontFace* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~FontFace(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + PangoFontFace* gobj() { return reinterpret_cast<PangoFontFace*>(gobject_); } + + ///Provides access to the underlying C GObject. + const PangoFontFace* gobj() const { return reinterpret_cast<PangoFontFace*>(gobject_); } + + ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. + PangoFontFace* gobj_copy(); + +private: + + +public: + + /** Returns the family, style, variant, weight and stretch of + * a Pango::FontFace. The size field of the resulting font description + * will be unset. + * @return A Pango::FontDescription + * holding the description of the face. + */ + FontDescription describe() const; + + /** Gets a name representing the style of this face among the + * different faces in the Pango::FontFamily for the face. This + * name is unique among all faces in the family and is suitable + * for displaying to users. + * @return The face name for the face. This string is + * owned by the face object and must not be modified or freed. + */ + Glib::ustring get_name() const; + + Glib::ArrayHandle<int> list_sizes() const; + + +protected: + //We can't wrap the virtual functions because PangoFontFace has a hidden class. + //We probably don't need to subclass this anyway. + //_WRAP_VFUNC(const char* get_name() const, "get_face_name") + //_WRAP_VFUNC(PangoFontDescription* describe(), "describe") + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +}; + +} /* namespace Pango */ + + +namespace Glib +{ + /** @relates Pango::FontFace + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr<Pango::FontFace> wrap(PangoFontFace* object, bool take_copy = false); +} + + +#endif /* _PANGOMM_FONTFACE_H */ + diff --git a/libs/gtkmm2/pango/pangomm/fontfamily.cc b/libs/gtkmm2/pango/pangomm/fontfamily.cc new file mode 100644 index 0000000000..da7f0be452 --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/fontfamily.cc @@ -0,0 +1,149 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include <pangomm/fontfamily.h> +#include <pangomm/private/fontfamily_p.h> + +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 2001 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. + */ + +namespace Pango +{ + +Glib::ArrayHandle< Glib::RefPtr<FontFace> > FontFamily::list_faces() const +{ + //Get the array: + PangoFontFace** pFontFaces = 0; + int n_fonts = 0; + pango_font_family_list_faces(const_cast<PangoFontFamily*>(gobj()), &pFontFaces, &n_fonts); + + return Glib::ArrayHandle<Glib::RefPtr <FontFace> > (pFontFaces, n_fonts, Glib::OWNERSHIP_SHALLOW); +} + +} /* namespace Pango */ + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + +Glib::RefPtr<Pango::FontFamily> wrap(PangoFontFamily* object, bool take_copy) +{ + return Glib::RefPtr<Pango::FontFamily>( dynamic_cast<Pango::FontFamily*> (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} /* namespace Glib */ + + +namespace Pango +{ + + +/* The *_Class implementation: */ + +const Glib::Class& FontFamily_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &FontFamily_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(pango_font_family_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void FontFamily_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast<BaseClassType*>(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* FontFamily_Class::wrap_new(GObject* object) +{ + return new FontFamily((PangoFontFamily*)object); +} + + +/* The implementation: */ + +PangoFontFamily* FontFamily::gobj_copy() +{ + reference(); + return gobj(); +} + +FontFamily::FontFamily(const Glib::ConstructParams& construct_params) +: + Glib::Object(construct_params) +{} + +FontFamily::FontFamily(PangoFontFamily* castitem) +: + Glib::Object((GObject*)(castitem)) +{} + +FontFamily::~FontFamily() +{} + + +FontFamily::CppClassType FontFamily::fontfamily_class_; // initialize static member + +GType FontFamily::get_type() +{ + return fontfamily_class_.init().get_type(); +} + +GType FontFamily::get_base_type() +{ + return pango_font_family_get_type(); +} + + +Glib::ustring FontFamily::get_name() const +{ + return Glib::convert_const_gchar_ptr_to_ustring(pango_font_family_get_name(const_cast<PangoFontFamily*>(gobj()))); +} + +bool FontFamily::is_monospace() const +{ + return pango_font_family_is_monospace(const_cast<PangoFontFamily*>(gobj())); +} + + +} // namespace Pango + + diff --git a/libs/gtkmm2/pango/pangomm/fontfamily.h b/libs/gtkmm2/pango/pangomm/fontfamily.h new file mode 100644 index 0000000000..f763866a19 --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/fontfamily.h @@ -0,0 +1,171 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _PANGOMM_FONTFAMILY_H +#define _PANGOMM_FONTFAMILY_H + +#include <glibmm.h> + +/* $Id$ */ + +/* fontfamily.h + * + * Copyright 2001 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 <glibmm/object.h> +#include <glibmm/arrayhandle.h> +#include <pangomm/fontface.h> +#include <pango/pango-font.h> + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _PangoFontFamily PangoFontFamily; +typedef struct _PangoFontFamilyClass PangoFontFamilyClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Pango +{ class FontFamily_Class; } // namespace Pango +namespace Pango +{ + +/** A Pango::FontFamily is used to represent a family of related font faces. + * The faces in a family share a common design, but differ in slant, weight, width and other aspects. + */ + +class FontFamily : public Glib::Object +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef FontFamily CppObjectType; + typedef FontFamily_Class CppClassType; + typedef PangoFontFamily BaseObjectType; + typedef PangoFontFamilyClass BaseClassType; + +private: friend class FontFamily_Class; + static CppClassType fontfamily_class_; + +private: + // noncopyable + FontFamily(const FontFamily&); + FontFamily& operator=(const FontFamily&); + +protected: + explicit FontFamily(const Glib::ConstructParams& construct_params); + explicit FontFamily(PangoFontFamily* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~FontFamily(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + PangoFontFamily* gobj() { return reinterpret_cast<PangoFontFamily*>(gobject_); } + + ///Provides access to the underlying C GObject. + const PangoFontFamily* gobj() const { return reinterpret_cast<PangoFontFamily*>(gobject_); } + + ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. + PangoFontFamily* gobj_copy(); + +private: + + +public: + /** Lists the different font faces that make up family. + * The faces in a family share a common design, but differ in slant, weight, width and other aspects. + * @return an array of pointers to Pango::FontFace objects. + */ + Glib::ArrayHandle< Glib::RefPtr<FontFace> > list_faces() const; + + + /** Gets the name of the family. The name is unique among all + * fonts for the font backend and can be used in a Pango::FontDescription + * to specify that a face from this family is desired. + * @return The name of the family. This string is owned + * by the family object and must not be modified or freed. + */ + Glib::ustring get_name() const; + + /** A monospace font is a font designed for text display where the the + * characters form a regular grid. For Western languages this would + * mean that the advance width of all characters are the same, but + * this categorization also includes Asian fonts which include + * double-width characters: characters that occupy two grid cells. + * Glib::unichar_iswide() returns a result that indicates whether a + * character is typically double-width in a monospace font. + * + * The best way to find out the grid-cell size is to call + * pango_font_metrics_get_approximate_digit_width(), since the results + * of pango_font_metrics_get_approximate_char_width() may be affected + * by double-width characters. + * @return <tt>true</tt> if the family is monospace. + */ + bool is_monospace() const; + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +}; + +/* +struct FontFamilyRefPtrTraits +{ + typedef Glib::RefPtr<FontFamily> CppType; + typedef PangoFontFamily * CType; + typedef PangoFontFamily * CTypeNonConst; + + static CType to_c_type (const CppType& ptr) { return Glib::unwrap (ptr); } + static CType to_c_type (CType ptr) { return ptr; } + static CppType to_cpp_type (CType ptr) { return FontFamily::wrap_specific_type (ptr); } + static void release_c_type (CType ptr) { g_object_unref (ptr); } +}; +*/ + +} // namespace Pango + + +namespace Glib +{ + /** @relates Pango::FontFamily + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr<Pango::FontFamily> wrap(PangoFontFamily* object, bool take_copy = false); +} + + +#endif /* _PANGOMM_FONTFAMILY_H */ + diff --git a/libs/gtkmm2/pango/pangomm/fontmap.cc b/libs/gtkmm2/pango/pangomm/fontmap.cc new file mode 100644 index 0000000000..1e5caa8ab4 --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/fontmap.cc @@ -0,0 +1,153 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include <pangomm/fontmap.h> +#include <pangomm/private/fontmap_p.h> + +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 2001 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 <pangomm/context.h> +#include <pango/pango-fontmap.h> + +namespace Pango +{ + +Glib::ArrayHandle< Glib::RefPtr<FontFamily> > FontMap::list_families() const +{ + //Get the array: + PangoFontFamily** pFamilies = 0; + int n_families = 0; + pango_font_map_list_families(const_cast<PangoFontMap*>(gobj()), &pFamilies, &n_families); + + return Glib::ArrayHandle< Glib::RefPtr<FontFamily> > + (pFamilies, n_families, Glib::OWNERSHIP_SHALLOW); +} + +} /* namespace Pango */ + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + +Glib::RefPtr<Pango::FontMap> wrap(PangoFontMap* object, bool take_copy) +{ + return Glib::RefPtr<Pango::FontMap>( dynamic_cast<Pango::FontMap*> (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} /* namespace Glib */ + + +namespace Pango +{ + + +/* The *_Class implementation: */ + +const Glib::Class& FontMap_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &FontMap_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(pango_font_map_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void FontMap_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast<BaseClassType*>(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* FontMap_Class::wrap_new(GObject* object) +{ + return new FontMap((PangoFontMap*)object); +} + + +/* The implementation: */ + +PangoFontMap* FontMap::gobj_copy() +{ + reference(); + return gobj(); +} + +FontMap::FontMap(const Glib::ConstructParams& construct_params) +: + Glib::Object(construct_params) +{} + +FontMap::FontMap(PangoFontMap* castitem) +: + Glib::Object((GObject*)(castitem)) +{} + +FontMap::~FontMap() +{} + + +FontMap::CppClassType FontMap::fontmap_class_; // initialize static member + +GType FontMap::get_type() +{ + return fontmap_class_.init().get_type(); +} + +GType FontMap::get_base_type() +{ + return pango_font_map_get_type(); +} + + +Glib::RefPtr<Font> FontMap::load_font(const Glib::RefPtr<Context>& context, const FontDescription& desc) const +{ + return Glib::wrap(pango_font_map_load_font(const_cast<PangoFontMap*>(gobj()), Glib::unwrap(context), (desc).gobj())); +} + +Glib::RefPtr<Fontset> FontMap::load_fontset(const Glib::RefPtr<Context>& context, const FontDescription& desc, const Language& language) const +{ + return Glib::wrap(pango_font_map_load_fontset(const_cast<PangoFontMap*>(gobj()), Glib::unwrap(context), (desc).gobj(), const_cast<PangoLanguage*>((language).gobj()))); +} + + +} // namespace Pango + + diff --git a/libs/gtkmm2/pango/pangomm/fontmap.h b/libs/gtkmm2/pango/pangomm/fontmap.h new file mode 100644 index 0000000000..c05fe7cc44 --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/fontmap.h @@ -0,0 +1,153 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _PANGOMM_FONTMAP_H +#define _PANGOMM_FONTMAP_H + +#include <glibmm.h> + +/* $Id$ */ + +/* fontmap.h + * + * Copyright 2001 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 <glibmm/object.h> +#include <glibmm/arrayhandle.h> +#include <pangomm/font.h> +#include <pangomm/fontset.h> +#include <pangomm/fontfamily.h> +#include <pango/pango-fontmap.h> + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _PangoFontMap PangoFontMap; +typedef struct _PangoFontMapClass PangoFontMapClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Pango +{ class FontMap_Class; } // namespace Pango +namespace Pango +{ + +class Context; + +/** A Pango::FontMap represents the set of fonts available for a particular rendering system. + */ + +class FontMap : public Glib::Object +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef FontMap CppObjectType; + typedef FontMap_Class CppClassType; + typedef PangoFontMap BaseObjectType; + typedef PangoFontMapClass BaseClassType; + +private: friend class FontMap_Class; + static CppClassType fontmap_class_; + +private: + // noncopyable + FontMap(const FontMap&); + FontMap& operator=(const FontMap&); + +protected: + explicit FontMap(const Glib::ConstructParams& construct_params); + explicit FontMap(PangoFontMap* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~FontMap(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + PangoFontMap* gobj() { return reinterpret_cast<PangoFontMap*>(gobject_); } + + ///Provides access to the underlying C GObject. + const PangoFontMap* gobj() const { return reinterpret_cast<PangoFontMap*>(gobject_); } + + ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. + PangoFontMap* gobj_copy(); + +private: + + +public: + + /** Load the font in the fontmap that is the closest match for @a desc . + * @param context The Pango::Context the font will be used with. + * @param desc A Pango::FontDescription describing the font to load. + * @return The font loaded, or <tt>0</tt> if no font matched. + */ + Glib::RefPtr<Font> load_font(const Glib::RefPtr<Context>& context, const FontDescription& desc) const; + + /** Load a set of fonts in the fontmap that can be used to render + * a font matching @a desc . + * @param context The Pango::Context the font will be used with. + * @param desc A Pango::FontDescription describing the font to load. + * @param language A Pango::Language the fonts will be used for. + * @return The fontset, or <tt>0</tt> if no font matched. + */ + Glib::RefPtr<Fontset> load_fontset(const Glib::RefPtr<Context>& context, const FontDescription& desc, const Language& language) const; + + /** List all families for the fontmap. + * @return an array of pointers to Pango::FontFamily objects. + */ + Glib::ArrayHandle< Glib::RefPtr<FontFamily> > list_families() const; + + //This is not used unless ENABLE_BACKEND is defined: _WRAP_METHOD(Glib::ustring get_shape_engine_type() const, pango_font_map_get_shape_engine_type) + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +}; + +} /* namespace Pango */ + + +namespace Glib +{ + /** @relates Pango::FontMap + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr<Pango::FontMap> wrap(PangoFontMap* object, bool take_copy = false); +} + + +#endif /* _PANGOMM_FONTMAP_H */ + diff --git a/libs/gtkmm2/pango/pangomm/fontmetrics.cc b/libs/gtkmm2/pango/pangomm/fontmetrics.cc new file mode 100644 index 0000000000..d9ba904f5b --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/fontmetrics.cc @@ -0,0 +1,143 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include <pangomm/fontmetrics.h> +#include <pangomm/private/fontmetrics_p.h> + +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 1998-1999 The Gtk-- Development Team + * Copyright 2001 Free Software Foundation + * + * 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. + */ + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + +Pango::FontMetrics wrap(PangoFontMetrics* object, bool take_copy) +{ + return Pango::FontMetrics(object, take_copy); +} + +} // namespace Glib + + +namespace Pango +{ + + +// static +GType FontMetrics::get_type() +{ + return pango_font_metrics_get_type(); +} + +FontMetrics::FontMetrics() +: + gobject_ (0) // Allows creation of invalid wrapper, e.g. for output arguments to methods. +{} + +FontMetrics::FontMetrics(const FontMetrics& other) +: + gobject_ ((other.gobject_) ? pango_font_metrics_ref(other.gobject_) : 0) +{} + +FontMetrics::FontMetrics(PangoFontMetrics* gobject, bool make_a_copy) +: + // For BoxedType wrappers, make_a_copy is true by default. The static + // BoxedType wrappers must always take a copy, thus make_a_copy = true + // ensures identical behaviour if the default argument is used. + gobject_ ((make_a_copy && gobject) ? pango_font_metrics_ref(gobject) : gobject) +{} + +FontMetrics& FontMetrics::operator=(const FontMetrics& other) +{ + FontMetrics temp (other); + swap(temp); + return *this; +} + +FontMetrics::~FontMetrics() +{ + if(gobject_) + pango_font_metrics_unref(gobject_); +} + +void FontMetrics::swap(FontMetrics& other) +{ + PangoFontMetrics *const temp = gobject_; + gobject_ = other.gobject_; + other.gobject_ = temp; +} + +PangoFontMetrics* FontMetrics::gobj_copy() const +{ + return pango_font_metrics_ref(gobject_); +} + + +int FontMetrics::get_ascent() const +{ + return pango_font_metrics_get_ascent(const_cast<PangoFontMetrics*>(gobj())); +} + +int FontMetrics::get_descent() const +{ + return pango_font_metrics_get_descent(const_cast<PangoFontMetrics*>(gobj())); +} + +int FontMetrics::get_approximate_char_width() const +{ + return pango_font_metrics_get_approximate_char_width(const_cast<PangoFontMetrics*>(gobj())); +} + +int FontMetrics::get_approximate_digit_width() const +{ + return pango_font_metrics_get_approximate_digit_width(const_cast<PangoFontMetrics*>(gobj())); +} + +int FontMetrics::get_underline_position() const +{ + return pango_font_metrics_get_underline_position(const_cast<PangoFontMetrics*>(gobj())); +} + +int FontMetrics::get_underline_thickness() const +{ + return pango_font_metrics_get_underline_thickness(const_cast<PangoFontMetrics*>(gobj())); +} + +int FontMetrics::get_strikethrough_position() const +{ + return pango_font_metrics_get_strikethrough_position(const_cast<PangoFontMetrics*>(gobj())); +} + +int FontMetrics::get_strikethrough_thickness() const +{ + return pango_font_metrics_get_strikethrough_thickness(const_cast<PangoFontMetrics*>(gobj())); +} + + +} // namespace Pango + + diff --git a/libs/gtkmm2/pango/pangomm/fontmetrics.h b/libs/gtkmm2/pango/pangomm/fontmetrics.h new file mode 100644 index 0000000000..8b66669f81 --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/fontmetrics.h @@ -0,0 +1,187 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _PANGOMM_FONTMETRICS_H +#define _PANGOMM_FONTMETRICS_H + +#include <glibmm.h> + +/* $Id$ */ + +/* fontmetrics.h + * + * Copyright (C) 1998-1999 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/pango-font.h> + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +extern "C" { typedef struct _PangoFontMetrics PangoFontMetrics; } +#endif + +namespace Pango +{ + +/** A Pango::FontMetrics holds the overall metric information for a font (possibly restricted to a script). + */ +class FontMetrics +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef FontMetrics CppObjectType; + typedef PangoFontMetrics BaseObjectType; + + static GType get_type() G_GNUC_CONST; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + FontMetrics(); + + explicit FontMetrics(PangoFontMetrics* gobject, bool make_a_copy = true); + + FontMetrics(const FontMetrics& other); + FontMetrics& operator=(const FontMetrics& other); + + ~FontMetrics(); + + void swap(FontMetrics& other); + + ///Provides access to the underlying C instance. + PangoFontMetrics* gobj() { return gobject_; } + + ///Provides access to the underlying C instance. + const PangoFontMetrics* gobj() const { return gobject_; } + + ///Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs. + PangoFontMetrics* gobj_copy() const; + +protected: + PangoFontMetrics* gobject_; + +private: + + +public: + + /** Gets the ascent from a font metrics structure. The ascent is + * the distance from the baseline to the logical top of a line + * of text. (The logical top may be above or below the top of the + * actual drawn ink. It is necessary to lay out the text to figure + * where the ink will be.) + * @return The ascent, in pango units. (1 point == Pango::SCALE pango units.). + */ + int get_ascent() const; + + /** Gets the descent from a font metrics structure. The descent is + * the distance from the baseline to the logical bottom of a line + * of text. (The logical bottom may be above or below the bottom of the + * actual drawn ink. It is necessary to lay out the text to figure + * where the ink will be.) + * @return The descent, in pango units. (1 point == Pango::SCALE pango units.). + */ + int get_descent() const; + + /** Gets the approximate character width for a font metrics structure. + * This is merely a representative value useful, for example, for + * determining the initial size for a window. Actual characters in + * text will be wider and narrower than this. + * @return The character width, in pango units. (1 point == Pango::SCALE pango units.). + */ + int get_approximate_char_width() const; + + /** Gets the approximate digit width for a font metrics structure. + * This is merely a representative value useful, for example, for + * determining the initial size for a window. Actual digits in + * text can be wider and narrower than this, though this value + * is generally somewhat more accurate than the result of + * pango_font_metrics_get_approximate_digit_width(). + * @return The digit width, in pango units. (1 point == Pango::SCALE pango units.). + */ + int get_approximate_digit_width() const; + + + /** Gets the suggested position to draw the underline. + * The value returned is the distance <em>above</em> the + * baseline of the top of the underline. Since most fonts have + * underline positions beneath the baseline, this value is typically + * negative. + * @return The suggested underline position, in Pango units. + * + * Since: 1.6. + */ + int get_underline_position() const; + + /** Gets the suggested thickness to draw for the underline. + * @return The suggested underline thickness, in Pango units. + * + * Since: 1.6. + */ + int get_underline_thickness() const; + + /** Gets the suggested position to draw the strikethrough. + * The value returned is the distance <em>above</em> the + * baseline of the top of the strikethrough. + * @return The suggested strikethrough position, in Pango units. + * + * Since: 1.6. + */ + int get_strikethrough_position() const; + + /** Gets the suggested thickness to draw for the strikethrough. + * @return The suggested strikethrough thickness, in Pango units. + * + * Since: 1.6. + */ + int get_strikethrough_thickness() const; + + +}; + +} //namespace Pango + + +namespace Pango +{ + +/** @relates Pango::FontMetrics + * @param lhs The left-hand side + * @param rhs The right-hand side + */ +inline void swap(FontMetrics& lhs, FontMetrics& rhs) + { lhs.swap(rhs); } + +} // namespace Pango + +namespace Glib +{ + +/** @relates Pango::FontMetrics + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ +Pango::FontMetrics wrap(PangoFontMetrics* object, bool take_copy = false); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +template <> +class Value<Pango::FontMetrics> : public Glib::Value_Boxed<Pango::FontMetrics> +{}; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +} // namespace Glib + +#endif /* _PANGOMM_FONTMETRICS_H */ + diff --git a/libs/gtkmm2/pango/pangomm/fontset.cc b/libs/gtkmm2/pango/pangomm/fontset.cc new file mode 100644 index 0000000000..2d684bde16 --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/fontset.cc @@ -0,0 +1,166 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include <pangomm/fontset.h> +#include <pangomm/private/fontset_p.h> + +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 2001 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. + */ + +namespace { //anonymous + +gboolean fontset_foreach_callback(PangoFontset* /* fontset */, PangoFont* font, gpointer data) +{ + try + { + Pango::Fontset::ForeachSlot& slot = *static_cast<Pango::Fontset::ForeachSlot*>(data); + Glib::RefPtr<Pango::Font> cppFont = Glib::wrap(font, true /* take_copy */); + + return slot(cppFont); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + + return false; //arbitrary default +} + + +} //anonymous namespace + +namespace Pango +{ + +void Fontset::foreach(const ForeachSlot& slot) +{ + pango_fontset_foreach(gobj(), &fontset_foreach_callback, (void*)&slot); +} + +} //namespace + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + +Glib::RefPtr<Pango::Fontset> wrap(PangoFontset* object, bool take_copy) +{ + return Glib::RefPtr<Pango::Fontset>( dynamic_cast<Pango::Fontset*> (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} /* namespace Glib */ + + +namespace Pango +{ + + +/* The *_Class implementation: */ + +const Glib::Class& Fontset_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &Fontset_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(pango_fontset_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void Fontset_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast<BaseClassType*>(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* Fontset_Class::wrap_new(GObject* object) +{ + return new Fontset((PangoFontset*)object); +} + + +/* The implementation: */ + +PangoFontset* Fontset::gobj_copy() +{ + reference(); + return gobj(); +} + +Fontset::Fontset(const Glib::ConstructParams& construct_params) +: + Glib::Object(construct_params) +{} + +Fontset::Fontset(PangoFontset* castitem) +: + Glib::Object((GObject*)(castitem)) +{} + +Fontset::~Fontset() +{} + + +Fontset::CppClassType Fontset::fontset_class_; // initialize static member + +GType Fontset::get_type() +{ + return fontset_class_.init().get_type(); +} + +GType Fontset::get_base_type() +{ + return pango_fontset_get_type(); +} + + +Glib::RefPtr<Font> Fontset::get_font(guint wc) const +{ + return Glib::wrap(pango_fontset_get_font(const_cast<PangoFontset*>(gobj()), wc)); +} + +FontMetrics Fontset::get_metrics() const +{ + return FontMetrics((pango_fontset_get_metrics(const_cast<PangoFontset*>(gobj())))); +} + + +} // namespace Pango + + diff --git a/libs/gtkmm2/pango/pangomm/fontset.h b/libs/gtkmm2/pango/pangomm/fontset.h new file mode 100644 index 0000000000..d3baddfbea --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/fontset.h @@ -0,0 +1,154 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _PANGOMM_FONTSET_H +#define _PANGOMM_FONTSET_H + +#include <glibmm.h> + +/* $Id$ */ + +/* fontset.h + * + * Copyright 2001 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 <glibmm/object.h> +#include <pangomm/language.h> +#include <pangomm/font.h> +#include <pangomm/fontmetrics.h> +#include <pango/pango-fontset.h> + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _PangoFontset PangoFontset; +typedef struct _PangoFontsetClass PangoFontsetClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Pango +{ class Fontset_Class; } // namespace Pango +namespace Pango +{ + +/** A Pango::Fontset is used to represent a set of fonts. + */ + +class Fontset : public Glib::Object +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef Fontset CppObjectType; + typedef Fontset_Class CppClassType; + typedef PangoFontset BaseObjectType; + typedef PangoFontsetClass BaseClassType; + +private: friend class Fontset_Class; + static CppClassType fontset_class_; + +private: + // noncopyable + Fontset(const Fontset&); + Fontset& operator=(const Fontset&); + +protected: + explicit Fontset(const Glib::ConstructParams& construct_params); + explicit Fontset(PangoFontset* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~Fontset(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + PangoFontset* gobj() { return reinterpret_cast<PangoFontset*>(gobject_); } + + ///Provides access to the underlying C GObject. + const PangoFontset* gobj() const { return reinterpret_cast<PangoFontset*>(gobject_); } + + ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. + PangoFontset* gobj_copy(); + +private: + + +public: + + /** Returns the font in the fontset that contains the best glyph for the + * unicode character wc. + * @param wc A unicode character. + * @return A Pango::Font. The caller must call g_object_unref when finished + * with the font. + */ + Glib::RefPtr<Font> get_font(guint wc) const; + + /** Get overall metric information for the fonts in the fontset. + * @return A Pango::FontMetrics object. The caller must call pango_font_metrics_unref() + * when finished using the object. + */ + FontMetrics get_metrics() const; + + /** For instance, + * bool on_foreach(const Glib::RefPtr<Pango::Font>& font); + */ + typedef sigc::slot< bool, const Glib::RefPtr<Font>& > ForeachSlot; + + /** Iterates through all the fonts in a fontset, calling @a slot for + * each one. If @a slot returns true, that stops the iteration. + * + * Since: 1.4 + * + * @param slot Callback function + */ + void foreach(const ForeachSlot& slot); + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +}; + +} /* namespace Pango */ + + +namespace Glib +{ + /** @relates Pango::Fontset + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr<Pango::Fontset> wrap(PangoFontset* object, bool take_copy = false); +} + + +#endif /* _PANGOMM_FONTSET_H */ + diff --git a/libs/gtkmm2/pango/pangomm/glyph.cc b/libs/gtkmm2/pango/pangomm/glyph.cc new file mode 100644 index 0000000000..bf595ec5b0 --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/glyph.cc @@ -0,0 +1,145 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include <pangomm/glyph.h> +#include <pangomm/private/glyph_p.h> + +/* + * Copyright 2001 Free Software Foundation + * + * 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. + */ + +namespace Pango +{ + +GlyphInfo::GlyphInfo() +{ + gobject_.glyph = 0; +} + + +GlyphGeometry::GlyphGeometry() +{ + gobject_.width = gobject_.x_offset = gobject_.y_offset = 0; +} + +GlyphGeometry::GlyphGeometry(const PangoGlyphGeometry* src) +{ + gobject_.width = src->width; + gobject_.x_offset = src->x_offset; + gobject_.y_offset = src->y_offset; +} + + +/*GlyphVisAttr::GlyphVisAttr() +{ + gobject_.is_cluster_start = 0; +} + +GlyphVisAttr::GlyphVisAttr(const PangoGlyphVisAttr* src) +{ + gobject_.is_cluster_start = src->is_cluster_start; +}*/ + +} //namespace Pango + + +namespace Glib +{ + +Pango::GlyphInfo& wrap(PangoGlyphInfo* object) +{ + return *reinterpret_cast<Pango::GlyphInfo*>(object); +} + +const Pango::GlyphInfo& wrap(const PangoGlyphInfo* object) +{ + return *reinterpret_cast<const Pango::GlyphInfo*>(object); +} + +Pango::GlyphGeometry& wrap(PangoGlyphGeometry* object) +{ + return *reinterpret_cast<Pango::GlyphGeometry*>(object); +} + +const Pango::GlyphGeometry& wrap(const PangoGlyphGeometry* object) +{ + return *reinterpret_cast<const Pango::GlyphGeometry*>(object); +} + +/*Pango::GlyphVisAttr& wrap(PangoGlyphVisAttr* object) +{ + return *reinterpret_cast<Pango::GlyphVisAttr*>(object); +} + +const Pango::GlyphVisAttr& wrap(const PangoGlyphVisAttr* object) +{ + return *reinterpret_cast<const Pango::GlyphVisAttr*>(object); +}*/ + +} //namespace Glib + + +namespace +{ +} // anonymous namespace + + +namespace Pango +{ + + +Glyph GlyphInfo::get_glyph() const +{ + return gobj()->glyph; +} + +GlyphGeometry GlyphInfo::get_geometry() const +{ + return GlyphGeometry(&(gobj()->geometry)); +} + +GlyphVisAttr GlyphInfo::get_attr() const +{ + return gobj()->attr; +} + + +} // namespace Pango + + +namespace Pango +{ + + +GlyphUnit GlyphGeometry::get_width() const +{ + return gobj()->width; +} + +GlyphUnit GlyphGeometry::get_x_offset() const +{ + return gobj()->x_offset; +} + +GlyphUnit GlyphGeometry::get_y_offset() const +{ + return gobj()->y_offset; +} + + +} // namespace Pango + + diff --git a/libs/gtkmm2/pango/pangomm/glyph.h b/libs/gtkmm2/pango/pangomm/glyph.h new file mode 100644 index 0000000000..387999d306 --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/glyph.h @@ -0,0 +1,222 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _PANGOMM_GLYPH_H +#define _PANGOMM_GLYPH_H + +#include <glibmm.h> + +/* glyph.h + * + * Copyright (C) 1998-1999 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/pango-glyph.h> + + +namespace Pango +{ + +class GlyphInfo; +class GlyphGeometry; + + +/** A Pango::Glyph represents a single glyph in the output form of a string. + */ +typedef PangoGlyph Glyph; //This is defined as a guint32 + + +/** A Pango::GlyphUnit is used to store dimensions within Pango. Dimensions are stored in 1/64ths of a point. + */ +typedef PangoGlyphUnit GlyphUnit; + + +/** A Pango::GlyphVisAttr is used to communicate information between the shaping phase and the rendering phase. It's contents are still evolving. + */ +typedef PangoGlyphVisAttr GlyphVisAttr; + + +/** A Pango::GlyphInfo represents a single glyph together with positioning information and visual attributes. + */ +class GlyphInfo +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef GlyphInfo CppObjectType; + typedef PangoGlyphInfo BaseObjectType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +private: + + +public: + GlyphInfo(); + + /** Gets the glyph itself. + * @return The glyph. + */ + Glyph get_glyph() const; + + /** Gets the positional information about the glyph. + * @return A GylphGeometry object. + */ + GlyphGeometry get_geometry() const; + + /** Gets the visual attributes of the glyph. + * @return A GlyphVisAttr structure. + */ + GlyphVisAttr get_attr() const; + +//I don't think that we need these set_* functions! +//TODO: Who wrote this? Investigate. murrayc. + /* Sets the glyph itself. + * @param glyph The new glyph. + */ +// _MEMBER_SET(glyph, glyph, Glyph, PangoGlyph) + + /* Sets the positional information about the glyph. + * @param geometry A GlyphGeometry object. + */ +// _MEMBER_SET(geometry, geometry, GlyphGeometry, PangoGlyphGeometry) + + /* Sets the visual attributes of the glyph. + * @param attr A GylphVisAttr structure. + */ +// _MEMBER_SET(attr, attr, GlyphVisAttr, PangoGlyphVisAttr) + + /// Provides access to the underlying C GObject. + PangoGlyphInfo* gobj() { return &gobject_; } + /// Provides access to the underlying C GObject. + const PangoGlyphInfo* gobj() const { return &gobject_; } + +protected: + PangoGlyphInfo gobject_; + + +}; + + +/** A Pango::GlyphGeometry contains width and positioning information for a single glyph. Distances are in 1/64ths of a point. + */ +class GlyphGeometry +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef GlyphGeometry CppObjectType; + typedef PangoGlyphGeometry BaseObjectType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +private: + + +public: + GlyphGeometry(); + explicit GlyphGeometry(const PangoGlyphGeometry* src); + + /** Gets the logical width to use for the character. + * @return The logical width. + */ + GlyphUnit get_width() const; + + /** Gets the horizontal offset from nominal character position. + * @return The horizontal offset. + */ + GlyphUnit get_x_offset() const; + + /** Gets the vertical offset from nominal character position. + * @return The vertical offset. + */ + GlyphUnit get_y_offset() const; + +//I don't think that we need these set_* functions! + /* Sets the logical width to use for the character. + * @param width The new logical width. + */ +// _MEMBER_SET(width, width, GlyphUnit, PangoGlyphUnit) + + /* Sets the horizontal offset from nominal character position. + * @param x_offset The new horizontal offset. + */ +// _MEMBER_SET(x_offset, x_offset, GlyphUnit, PangoGlyphUnit) + + /* Sets the vertical offset from nominal character position. + * @param y_offset The new vertical offset. + */ +// _MEMBER_SET(y_offset, y_offset, GlyphUnit, PangoGlyphUnit) + + PangoGlyphGeometry* gobj() { return &gobject_; } + const PangoGlyphGeometry* gobj() const { return &gobject_; } + +protected: + PangoGlyphGeometry gobject_; + + +}; + + +/* Since "the contents [of this struct] are still evolving" it might get necessary + * to create a wrapper class for PangoGlyphVisAttr in future. Currently, however, + * PangoGlyphVisAttr just contains one simple data field (guint is_cluster_start). + */ +/*class GlyphVisAttr +{ + _CLASS_GENERIC(GlyphVisAttr, PangoGlyphVisAttr) + +public: + GlyphVisAttr(); + explicit GlyphVisAttr(const PangoGlyphVisAttr* src); + + _MEMBER_GET(cluster_start, is_cluster_start, bool, guint) + + _MEMBER_SET(cluster_start, is_cluster_start, bool, guint) + + /// Provides access to the underlying C GObject. + PangoGlyphVisAttr* gobj() { return &gobject_; } + /// Provides access to the underlying C GObject. + const PangoGlyphVisAttr* gobj() const { return &gobject_; } + +protected: + PangoGlyphVisAttr gobject_; +};*/ + +} //namespace Pango + + +namespace Glib +{ + +/** @relates Pango::GlyphInfo */ +Pango::GlyphInfo& wrap(PangoGlyphInfo* object); + +/** @relates Pango::GlyphInfo */ +const Pango::GlyphInfo& wrap(const PangoGlyphInfo* object); + +/** @relates Pango::GlyphGeometry */ +Pango::GlyphGeometry& wrap(PangoGlyphGeometry* object); + +/** @relates Pango::GlyphGeometry */ +const Pango::GlyphGeometry& wrap(const PangoGlyphGeometry* object); + +/* @relates Pango::GlyphVisAttr */ +//Pango::GlyphVisAttr& wrap(PangoGlyphVisAttr* object); + +/* @relates Pango::GlyphVisAttr */ +//const Pango::GlyphVisAttr& wrap(const PangoGlyphVisAttr* object); + +} //namespace Glib + +#endif /* _PANGOMM_GLYPH_H */ + diff --git a/libs/gtkmm2/pango/pangomm/glyphstring.cc b/libs/gtkmm2/pango/pangomm/glyphstring.cc new file mode 100644 index 0000000000..38ba283c70 --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/glyphstring.cc @@ -0,0 +1,186 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include <pangomm/glyphstring.h> +#include <pangomm/private/glyphstring_p.h> + +// -*- 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 <glibmm/utility.h> + + +namespace Pango +{ + +GlyphString::GlyphString(const Glib::ustring& text, const Analysis& analysis) +: + gobject_(pango_glyph_string_new()) +{ + pango_shape(text.c_str(), text.bytes(), const_cast<PangoAnalysis*>(analysis.gobj()), gobj()); +} + +Rectangle GlyphString::get_ink_extents(const Glib::RefPtr<const Font>& font) const +{ + Rectangle ink_rect; + pango_glyph_string_extents(const_cast<PangoGlyphString*>(gobj()), const_cast<PangoFont*>(font->gobj()), ink_rect.gobj(), 0); + return ink_rect; +} + +Rectangle GlyphString::get_ink_extents(int start, int end, const Glib::RefPtr<const Font>& font) const +{ + Rectangle ink_rect; + pango_glyph_string_extents_range(const_cast<PangoGlyphString*>(gobj()), start, end, const_cast<PangoFont*>(font->gobj()), ink_rect.gobj(), 0); + return ink_rect; +} + +Rectangle GlyphString::get_logical_extents(const Glib::RefPtr<const Font>& font) const +{ + Rectangle logical_rect; + pango_glyph_string_extents(const_cast<PangoGlyphString*>(gobj()), const_cast<PangoFont*>(font->gobj()), 0, logical_rect.gobj()); + return logical_rect; +} + +Rectangle GlyphString::get_logical_extents(int start, int end, const Glib::RefPtr<const Font>& font) const +{ + Rectangle logical_rect; + pango_glyph_string_extents_range(const_cast<PangoGlyphString*>(gobj()), start, end, const_cast<PangoFont*>(font->gobj()), 0, logical_rect.gobj()); + return logical_rect; +} + +Glib::ArrayHandle<int> GlyphString::get_logical_widths(const Glib::ustring& text, int embedding_level) const +{ + int* logical_widths = g_new(int, text.length()); + pango_glyph_string_get_logical_widths(const_cast<PangoGlyphString*>(gobj()), text.c_str(), text.bytes(), embedding_level, logical_widths); + return Glib::ArrayHandle<int>(logical_widths, text.length(), Glib::OWNERSHIP_SHALLOW); +} + +int GlyphString::index_to_x(const Glib::ustring& text, const Analysis& analysis, int index, bool trailing) const +{ + int x_pos; + pango_glyph_string_index_to_x(const_cast<PangoGlyphString*>(gobj()), const_cast<gchar*>(text.c_str()), text.bytes(), const_cast<PangoAnalysis*>(analysis.gobj()), index, static_cast<int>(trailing), &x_pos); + return x_pos; +} + +void GlyphString::x_to_index(const Glib::ustring& text, const Analysis& analysis, int x_pos, int& index, bool& trailing) const +{ + gboolean trailing_temp = FALSE; + pango_glyph_string_x_to_index(const_cast<PangoGlyphString*>(gobj()), const_cast<char*>(text.c_str()), text.bytes(), const_cast<PangoAnalysis*>(analysis.gobj()), x_pos, &index, &trailing_temp); + trailing = trailing_temp; +} + +Glib::ArrayHandle<GlyphInfo> GlyphString::get_glyphs() const +{ + return Glib::ArrayHandle<GlyphInfo>(reinterpret_cast<GlyphInfo*>(gobj()->glyphs), gobj()->num_glyphs, Glib::OWNERSHIP_NONE); +} + +} //namespace Pango + + +namespace +{ +} // anonymous namespace + + +namespace Glib +{ + +Pango::GlyphString wrap(PangoGlyphString* object, bool take_copy) +{ + return Pango::GlyphString(object, take_copy); +} + +} // namespace Glib + + +namespace Pango +{ + + +// static +GType GlyphString::get_type() +{ + return pango_glyph_string_get_type(); +} + +GlyphString::GlyphString() +: + gobject_ (pango_glyph_string_new()) +{} + +GlyphString::GlyphString(const GlyphString& other) +: + gobject_ ((other.gobject_) ? pango_glyph_string_copy(other.gobject_) : 0) +{} + +GlyphString::GlyphString(PangoGlyphString* gobject, bool make_a_copy) +: + // For BoxedType wrappers, make_a_copy is true by default. The static + // BoxedType wrappers must always take a copy, thus make_a_copy = true + // ensures identical behaviour if the default argument is used. + gobject_ ((make_a_copy && gobject) ? pango_glyph_string_copy(gobject) : gobject) +{} + +GlyphString& GlyphString::operator=(const GlyphString& other) +{ + GlyphString temp (other); + swap(temp); + return *this; +} + +GlyphString::~GlyphString() +{ + if(gobject_) + pango_glyph_string_free(gobject_); +} + +void GlyphString::swap(GlyphString& other) +{ + PangoGlyphString *const temp = gobject_; + gobject_ = other.gobject_; + other.gobject_ = temp; +} + +PangoGlyphString* GlyphString::gobj_copy() const +{ + return pango_glyph_string_copy(gobject_); +} + + +void GlyphString::set_size(int new_len) +{ + pango_glyph_string_set_size(gobj(), new_len); +} + +void GlyphString::get_extents(const Glib::RefPtr<const Font>& font, Rectangle& ink_rect, Rectangle& logical_rect) const +{ + pango_glyph_string_extents(const_cast<PangoGlyphString*>(gobj()), const_cast<PangoFont*>(Glib::unwrap<Font>(font)), (ink_rect).gobj(), (logical_rect).gobj()); +} + +void GlyphString::get_extents(int start, int end, const Glib::RefPtr<const Font>& font, Rectangle& ink_rect, Rectangle& logical_rect) const +{ + pango_glyph_string_extents_range(const_cast<PangoGlyphString*>(gobj()), start, end, const_cast<PangoFont*>(Glib::unwrap<Font>(font)), (ink_rect).gobj(), (logical_rect).gobj()); +} + + +} // namespace Pango + + diff --git a/libs/gtkmm2/pango/pangomm/glyphstring.h b/libs/gtkmm2/pango/pangomm/glyphstring.h new file mode 100644 index 0000000000..7313e41766 --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/glyphstring.h @@ -0,0 +1,223 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _PANGOMM_GLYPHSTRING_H +#define _PANGOMM_GLYPHSTRING_H + +#include <glibmm.h> + +/* $Id$ */ + +/* glyphstring.h + * + * Copyright (C) 1998-1999 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 <pangomm/font.h> +#include <pangomm/glyph.h> +#include <pangomm/item.h> +#include <pango/pango-glyph.h> +#include <pango/pango-item.h> //For PangoAnalysis. + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +extern "C" { typedef struct _PangoGlyphString PangoGlyphString; } +#endif + +namespace Pango +{ + +/** A Pango::GlyphString is used to store strings of glyphs with geometry and visual attribute information. + * It can be measured or drawn to the screen. + */ +class GlyphString +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef GlyphString CppObjectType; + typedef PangoGlyphString BaseObjectType; + + static GType get_type() G_GNUC_CONST; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + GlyphString(); + + explicit GlyphString(PangoGlyphString* gobject, bool make_a_copy = true); + + GlyphString(const GlyphString& other); + GlyphString& operator=(const GlyphString& other); + + ~GlyphString(); + + void swap(GlyphString& other); + + ///Provides access to the underlying C instance. + PangoGlyphString* gobj() { return gobject_; } + + ///Provides access to the underlying C instance. + const PangoGlyphString* gobj() const { return gobject_; } + + ///Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs. + PangoGlyphString* gobj_copy() const; + +protected: + PangoGlyphString* gobject_; + +private: + + +public: + /** Construct a string of glyphs from a string of characters. + * Given a segment of text and the corresponding Pango::Analysis structure + * returned from Pango::Context::itemize(), convert the characters into glyphs. + * You may also pass in only a sub-string of the item. + * @param text The text to process. You must pass the same string into those member functions expecting a const Glib::ustring&. + * @param analysis The analysis information return from Pango::Context::itemize(). + */ + GlyphString(const Glib::ustring& text, const Analysis& analysis); + + + /** Resize a glyph string to the given length. + * @param new_len The new length of the string. + */ + void set_size (int new_len); + + + /** Compute the logical and ink extents of a glyph string. See the documentation + * for Pango::Font::get_glyph_extents() for details about the interpretation + * of the rectangles. + * @param font A Pango::Font. + * @param ink_rect Rectangle used to store the extents of the glyph string as drawn. + * @param logical_rect Rectangle used to store the logical extents of the glyph string. + */ + void get_extents(const Glib::RefPtr<const Font>& font, Rectangle& ink_rect, Rectangle& logical_rect) const; + + /** Computes the extents of a sub-portion of a glyph string. The extents are + * relative to the start of the glyph string range (the origin of their + * coordinate system is at the start of the range, not at the start of the entire + * glyph string). + * @param start Start index. + * @param end End index (the range is the set of bytes with + * indices such that start <= index < end). + * @param font A Pango::Font. + * @param ink_rect Rectangle used to store the extents of the glyph string range as drawn. + * @param logical_rect Rectangle used to store the logical extents of the glyph string range. + */ + void get_extents(int start, int end, const Glib::RefPtr<const Font>& font, Rectangle& ink_rect, Rectangle& logical_rect) const; + + /** Computes the extents of the glyph string as drawn. + * @param font A Pango::Font. + * @return The extents of the glyph string as drawn. + */ + Rectangle get_ink_extents(const Glib::RefPtr<const Font>& font) const; + + /** Computes the extents of a sub-portion of the glyph string as drawn. + * @param start The start index. + * @param end The end index. + * @param font A Panog::Font + * @return The extents of the sub-portion of the glyph string as drawn. + */ + Rectangle get_ink_extents(int start, int end, const Glib::RefPtr<const Font>& font) const; + + /** Computes the logical extents of a sub-portion of the glyph string. + * @param font A Pango::Font. + * @return The logical extents of the glyph string. + */ + Rectangle get_logical_extents(const Glib::RefPtr<const Font>& font) const; + + /** Computes the logical extents of a sub-portion of the glyph string. + * @param start The start index. + * @param end The end index. + * @param font A Pango::Font. + * @return The logical extents of the sub-portion of the glyph string. + */ + Rectangle get_logical_extents(int start, int end, const Glib::RefPtr<const Font>& font) const; + + /** Determine the screen width corresponding to each character. + * When multiple characters compose a single cluster, the width of the entire cluster + * is divided equally among the characters. + * @param text The text corresponding to the glyphs. + * @param embedding_level The embedding level of the string. + * @return An array of integers representing the resulting character widths. + */ + Glib::ArrayHandle<int> get_logical_widths(const Glib::ustring& text, int embedding_level) const; + + /** Converts from character position to x position. + * (X position is measured from the left edge of the run). Character positions are computed by dividing up each cluster into equal portions. + * @param text The text corresponding to the glyphs. + * @param analysis The analysis information return from Pango::Context::itemize(). + * @param index The byte index within text. + * @param trailing Whether we should compute the result for the beginning or end of the character. + * @return The x position. + */ + int index_to_x(const Glib::ustring& text, const Analysis& analysis, int index, bool trailing) const; + + /** Convert from x offset to character position. + * Character positions are computed by dividing up each cluster into equal portions. + * In scripts where positioning within a cluster is not allowed (such as Thai), + * the returned value may not be a valid cursor position; the caller must combine the + * result with the logical attributes for the text to compute the valid cursor position. + * @param text The text corresponding to the glyphs. + * @param analysis The analysis information return from Pango::Context::itemize(). + * @param x_pos The x offset (in thousands of a device unit). + * @param index The location to store calculated byte index within. + * @param trailing The location to store a boolean indicating whether the user clicked on the leading or trailing edge of the character. + */ + void x_to_index(const Glib::ustring& text, const Analysis& analysis, int x_pos, int& index, bool& trailing) const; + + /** Gharacter positions are computed by dividing up each cluster into equal portions. + * @return An array of Pango::GlyphInfo objects. + */ + Glib::ArrayHandle<GlyphInfo> get_glyphs() const; + + +}; + +} //namespace Pango + + +namespace Pango +{ + +/** @relates Pango::GlyphString + * @param lhs The left-hand side + * @param rhs The right-hand side + */ +inline void swap(GlyphString& lhs, GlyphString& rhs) + { lhs.swap(rhs); } + +} // namespace Pango + +namespace Glib +{ + +/** @relates Pango::GlyphString + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ +Pango::GlyphString wrap(PangoGlyphString* object, bool take_copy = false); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +template <> +class Value<Pango::GlyphString> : public Glib::Value_Boxed<Pango::GlyphString> +{}; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +} // namespace Glib + +#endif /* _PANGOMM_GLYPHSTRING_H */ + diff --git a/libs/gtkmm2/pango/pangomm/init.cc b/libs/gtkmm2/pango/pangomm/init.cc new file mode 100644 index 0000000000..8ae697e967 --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/init.cc @@ -0,0 +1,34 @@ +// -*- c++ -*- +/* $Id$ */ + +/* Copyright (C) 2003 The pangomm 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 <glibmm/init.h> +#include <pangomm/wrap_init.h> + +namespace Pango +{ + +void init() +{ + Glib::init(); + Pango::wrap_init(); +} + +} // namespace Pango + diff --git a/libs/gtkmm2/pango/pangomm/init.h b/libs/gtkmm2/pango/pangomm/init.h new file mode 100644 index 0000000000..955b8c2d83 --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/init.h @@ -0,0 +1,40 @@ +// -*- c++ -*- +#ifndef _PANGOMM_INIT_H +#define _PANGOMM_INIT_H + +/* $Id$ */ + +/* Copyright (C) 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. + */ + +namespace Pango +{ + +/** Initialize pangomm. + * You may call this more than once. + * You do not need to call this if you are using Gtk::Main, + * because it calls it for you. + */ +void init(); + +} // namespace Pango + + + +#endif // _PANGOMM_INIT_H + + diff --git a/libs/gtkmm2/pango/pangomm/item.cc b/libs/gtkmm2/pango/pangomm/item.cc new file mode 100644 index 0000000000..f798552e1b --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/item.cc @@ -0,0 +1,201 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include <pangomm/item.h> +#include <pangomm/private/item_p.h> + +/* Copyright (C) 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 <pangomm/font.h> +#include <pangomm/attributes.h> +#include <pangomm/glyphstring.h> + +namespace Pango +{ + +Analysis::Analysis() +{} + +Analysis::Analysis(const PangoAnalysis* src) +: + gobject_ (*src) +{} + +SListHandle_Attribute Analysis::get_extra_attrs() const +{ + return SListHandle_Attribute(gobj()->extra_attrs, Glib::OWNERSHIP_NONE); +} + + +Item::Item(const Item& src) +: + gobject_ ((src.gobject_) ? pango_item_copy(src.gobject_) : 0) +{} + +Item::Item(PangoItem* castitem, bool make_a_copy) +{ + // For BoxedType wrappers, make_a_copy is true by default. The static + // BoxedType wrappers must always take a copy, thus make_a_copy = true + // ensures identical behaviour if the default argument is used. + + if(make_a_copy) + { + if(castitem) + gobject_ = pango_item_copy(castitem); + else + gobject_ = 0; + } + else + { + // It was given to us by a function which has already made a copy for us to keep. + gobject_ = castitem; + } +} + +Item& Item::operator=(const Item& src) +{ + PangoItem *const new_gobject = (src.gobject_) ? pango_item_copy(src.gobject_) : 0; + + if(gobject_) + pango_item_free(gobject_); + gobject_ = new_gobject; + + return *this; +} + +Item::~Item() +{ + if(gobject_) + pango_item_free(gobject_); +} + +PangoItem* Item::gobj_copy() const +{ + return pango_item_copy(gobject_); +} + +Analysis Item::get_analysis() const +{ + return Analysis(&gobj()->analysis); +} + +Glib::ustring Item::get_segment(const Glib::ustring& text) const +{ + const char *const start = text.data() + gobj()->offset; + return Glib::ustring(start, start + gobj()->length); +} + +Pango::GlyphString Item::shape(const Glib::ustring& text) const +{ + return GlyphString(text, get_analysis()); +} + +} /* namespace Pango */ + + +namespace Glib +{ + +Pango::Analysis& wrap(PangoAnalysis* object) +{ + return *reinterpret_cast<Pango::Analysis*>(object); +} + +const Pango::Analysis& wrap(const PangoAnalysis* object) +{ + return *reinterpret_cast<const Pango::Analysis*>(object); +} + +Pango::Item wrap(PangoItem* object, bool take_copy) +{ + return Pango::Item(object, take_copy); +} + +} /* namespace Glib */ + + +namespace +{ +} // anonymous namespace + + +namespace Pango +{ + + +Glib::RefPtr<Font> Analysis::get_font() +{ + Glib::RefPtr<Font> ref_ptr(Glib::wrap(gobj()->font)); + + if(ref_ptr) + ref_ptr->reference(); + + return ref_ptr; +} + +Glib::RefPtr<const Font> Analysis::get_font() const +{ + Glib::RefPtr<const Font> ref_ptr(Glib::wrap(gobj()->font)); + + if(ref_ptr) + ref_ptr->reference(); + + return ref_ptr; +} + +guint8 Analysis::get_level() const +{ + return gobj()->level; +} + +Language Analysis::get_language() const +{ + return Language(gobj()->language); +} + + +} // namespace Pango + + +namespace Pango +{ + + +Item Item::split(int split_index, int split_offset) +{ + return Item((pango_item_split(gobj(), split_index, split_offset))); +} + +int Item::get_offset() const +{ + return gobj()->offset; +} + +int Item::get_length() const +{ + return gobj()->length; +} + +int Item::get_num_chars() const +{ + return gobj()->num_chars; +} + + +} // namespace Pango + + diff --git a/libs/gtkmm2/pango/pangomm/item.h b/libs/gtkmm2/pango/pangomm/item.h new file mode 100644 index 0000000000..3e58b9a069 --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/item.h @@ -0,0 +1,225 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _PANGOMM_ITEM_H +#define _PANGOMM_ITEM_H + +#include <glibmm.h> + +/* Copyright (C) 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 <pangomm/attributes.h> +#include <pangomm/language.h> +#include <pango/pango-item.h> + + +namespace Pango +{ + +class Font; +class GlyphString; + +/** A Pango::Analysis stores information about the properties of a segment of text. + * Pango::Analysis is used as an output type only so there is no public default constructor. + * You can retrieve an object of this type from an object of type Pango::Item by + * calling Pango::Item::get_analysis(). Objects of this class can be used for some + * calculations in Pango::GlyphString. + */ +class Analysis +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Analysis CppObjectType; + typedef PangoAnalysis BaseObjectType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +private: + + +protected: + // This class is only used as an output type. + Analysis(); + +public: + explicit Analysis(const PangoAnalysis* src); + +public: +// _MEMBER_GET_PTR(engine_shape, shape_engine, EngineShape*, PangoEngineShape*) //We don't wrap the Engine* stuff. +// _MEMBER_GET_PTR(engine_lang, lang_engine, EngineLang*, PangoEngineLang*) + + /** Gets the font used to render this segment. + * @return The font used to render this segment. + */ + Glib::RefPtr<Font> get_font(); + Glib::RefPtr<const Font> get_font() const; + + /** Gets the bidrectional level for this segment. + * @return The bidirectional level for this segment. + */ + guint8 get_level() const; + + /** Gets the language of this segment. + * @return The language of this segment. + */ + Language get_language() const; + + /** Gets a list of non-font attributes for this segment. + * @return A list of non-font attributes for this segment. + */ + SListHandle_Attribute get_extra_attrs() const; + + /// Provides access to the underlying C GObject. + PangoAnalysis* gobj() { return &gobject_; } + /// Provides access to the underlying C GObject. + const PangoAnalysis* gobj() const { return &gobject_; } + +protected: + PangoAnalysis gobject_; + + +}; + + +/** A Pango::Item stores information about a segment of text. + * Pango::Item is used as an output type only so there is no public default constructor. + * You retrieve objects of this type by calling Pango::Context::itemize() with some text. + * The actual rendering of the segment of text that corresponds to a particular Pango::Item + * (or some sub-string) into a string of glyphs is done with shape(). + * The segment of text that corresponds to a Pango::Item can be computed from the + * text passed into Pango::Context::itemize() with get_segment(). Together with + * the Pango::Analysis data member that can be accessed with get_analysis() + * it is needed for further calculations in Pango::GlyphString. + */ +class Item +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Item CppObjectType; + typedef PangoItem BaseObjectType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +private: + //There is the whole set of functions for _CLASS_BOXEDTYPE but unfortunately PangoItem is not registered as a boxed type and lacks pango_item_get_type... + + +public: + // There is no default constructor. This class is only used as an output type. + explicit Item(PangoItem* castitem, bool make_a_copy = true); + + Item(const Item& src); + Item& operator=(const Item& src); + + ~Item(); + + /// Provides access to the underlying C GObject. The caller is responsible for freeing it. Use when directly setting fields in structs. + PangoItem* gobj_copy() const; + +public: + + /** Modifies @a orig to cover only the text after @a split_index , and + * returns a new item that covers the text before @a split_index that + * used to be in @a orig . You can think of @a split_index as the length of + * the returned item. @a split_index may not be 0, and it may not be + * greater than or equal to the length of @a orig (that is, there must + * be at least one byte assigned to each item, you can't create a + * zero-length item). @a split_offset is the length of the first item in + * chars, and must be provided because the text used to generate the + * item isn't available, so pango_item_split() can't count the char + * length of the split items itself. + * @param split_index Byte index of position to split item, relative to the start of the item. + * @param split_offset Number of chars between start of @a orig and @a split_index . + * @return New item representing text before @a split_index . + */ + Item split(int split_index, int split_offset); + + /** Gets the offset of the segment from the beginning of the string in bytes. + * @return The offset of the segment from the beginning of the string in bytes. + */ + int get_offset() const; + + /** Gets the length of the segment in bytes. + * @return The length of the segment in bytes. + */ + int get_length() const; + + /** Gets the length of the segment in characters. + * @return The length of the semgment in characters. + */ + int get_num_chars() const; + + /** Gets the properties of the segment. + * @return The properties of the segment. + */ + Analysis get_analysis() const; + + /** Computes the segment of text that is represented by the item. + * @param text The text that has been passed into Pango::Context::itemize(). + * @return The sub-string of @a text that corresponds to the item. + */ + Glib::ustring get_segment(const Glib::ustring& text) const; + + /** Convert a segment of text into a string of glyphs. + * @param text The text to process. This must either be the whole segment of text that corresponds to the item as returned by get_segment() or a sub-string of that segment. You need to pass the same text to the member functions of Pango::GlyphString for further calculations. + * @return A Pango::GlyphString object that can be measured or drawn. + */ + GlyphString shape(const Glib::ustring& text) const; + + /// Provides access to the underlying C GObject. + PangoItem* gobj() { return gobject_; } + /// Provides access to the underlying C GObject. + const PangoItem* gobj() const { return gobject_; } + +protected: + PangoItem* gobject_; + + +}; + +struct ItemTraits +{ + typedef Pango::Item CppType; + typedef const PangoItem* CType; + typedef PangoItem* CTypeNonConst; + + static CType to_c_type (const CppType& obj) { return obj.gobj(); } + static CType to_c_type (CType ptr) { return ptr; } + static CppType to_cpp_type (CType ptr) { return CppType(const_cast<CTypeNonConst>(ptr), true); } + static void release_c_type (CType ptr) { pango_item_free(const_cast<CTypeNonConst>(ptr)); } +}; + +typedef Glib::ListHandle<Item, ItemTraits> ListHandle_Item; + +} // namespace Pango + + +namespace Glib +{ + +/** @relates Pango::Analysis */ +Pango::Analysis& wrap(PangoAnalysis* object); + +/** @relates Pango::Analysis */ +const Pango::Analysis& wrap(const PangoAnalysis* object); + +/** @relates Pango::Item */ +Pango::Item wrap(PangoItem* object, bool take_copy=true); + +} // namespace Glib + + +#endif /* _PANGOMM_ITEM_H */ + diff --git a/libs/gtkmm2/pango/pangomm/language.cc b/libs/gtkmm2/pango/pangomm/language.cc new file mode 100644 index 0000000000..db2fd1fde4 --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/language.cc @@ -0,0 +1,158 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include <pangomm/language.h> +#include <pangomm/private/language_p.h> + +/* Copyright (C) 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/pango-enum-types.h> +#include <pango/pango-script.h> + +namespace Pango +{ + +/* PangoLanguage is just another example of inconsistent coding in atk/pango/gtk: + * on the one hand it is defined and registered as a boxed type, on the other + * hand it is always a pointer to some statically allocated string and thus + * neither allocated by itself, nor copied by value, nor freed. Similar dummy + * functions as below are defined in pango/pango-util.c but they are not exported. + * Compare with pango/pango-util.c for reference. */ + //(I wonder who wrote this - it wasn't me. murrayc) + +inline PangoLanguage* _pango_language_new() +{ + return 0; +} + +inline PangoLanguage* _pango_language_copy(const PangoLanguage* language) +{ + return const_cast<PangoLanguage*>(language); +} + +inline void _pango_language_free(PangoLanguage*) +{ + return; +} + +Language::Language() +: + gobject_(0) +{} + +Language::Language(const Glib::ustring& language) +: + gobject_(pango_language_from_string(language.c_str())) +{} + +Glib::ustring Language::get_string() const +{ + if (gobject_) + return pango_language_to_string(const_cast<PangoLanguage*>(gobj())); + else + return Glib::ustring(); +} + +} /* namespace Pango */ + + +namespace +{ +} // anonymous namespace + +// static +GType Glib::Value<Pango::Script>::value_type() +{ + return pango_script_get_type(); +} + + +namespace Glib +{ + +Pango::Language wrap(PangoLanguage* object, bool take_copy) +{ + return Pango::Language(object, take_copy); +} + +} // namespace Glib + + +namespace Pango +{ + + +// static +GType Language::get_type() +{ + return pango_language_get_type(); +} + + +Language::Language(const Language& other) +: + gobject_ ((other.gobject_) ? _pango_language_copy(other.gobject_) : 0) +{} + +Language::Language(PangoLanguage* gobject, bool make_a_copy) +: + // For BoxedType wrappers, make_a_copy is true by default. The static + // BoxedType wrappers must always take a copy, thus make_a_copy = true + // ensures identical behaviour if the default argument is used. + gobject_ ((make_a_copy && gobject) ? _pango_language_copy(gobject) : gobject) +{} + +Language& Language::operator=(const Language& other) +{ + Language temp (other); + swap(temp); + return *this; +} + +Language::~Language() +{ + if(gobject_) + _pango_language_free(gobject_); +} + +void Language::swap(Language& other) +{ + PangoLanguage *const temp = gobject_; + gobject_ = other.gobject_; + other.gobject_ = temp; +} + +PangoLanguage* Language::gobj_copy() const +{ + return _pango_language_copy(gobject_); +} + + +bool Language::matches(const Glib::ustring & range_list) const +{ + return pango_language_matches(const_cast<PangoLanguage*>(gobj()), range_list.c_str()); +} + +bool Language::includes_script(Script script) const +{ + return pango_language_includes_script(const_cast<PangoLanguage*>(gobj()), ((PangoScript)(script))); +} + + +} // namespace Pango + + diff --git a/libs/gtkmm2/pango/pangomm/language.h b/libs/gtkmm2/pango/pangomm/language.h new file mode 100644 index 0000000000..f4f762eb39 --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/language.h @@ -0,0 +1,245 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _PANGOMM_LANGUAGE_H +#define _PANGOMM_LANGUAGE_H + +#include <glibmm.h> + +/* Copyright (C) 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/pango-attributes.h> + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +extern "C" { typedef struct _PangoLanguage PangoLanguage; } +#endif + +namespace Pango +{ + +/** @addtogroup pangommEnums Enums and Flags */ + +/** + * @ingroup pangommEnums + */ +enum Script +{ + SCRIPT_INVALID_CODE = -1, + SCRIPT_COMMON, + SCRIPT_INHERITED, + SCRIPT_ARABIC, + SCRIPT_ARMENIAN, + SCRIPT_BENGALI, + SCRIPT_BOPOMOFO, + SCRIPT_CHEROKEE, + SCRIPT_COPTIC, + SCRIPT_CYRILLIC, + SCRIPT_DESERET, + SCRIPT_DEVANAGARI, + SCRIPT_ETHIOPIC, + SCRIPT_GEORGIAN, + SCRIPT_GOTHIC, + SCRIPT_GREEK, + SCRIPT_GUJARATI, + SCRIPT_GURMUKHI, + SCRIPT_HAN, + SCRIPT_HANGUL, + SCRIPT_HEBREW, + SCRIPT_HIRAGANA, + SCRIPT_KANNADA, + SCRIPT_KATAKANA, + SCRIPT_KHMER, + SCRIPT_LAO, + SCRIPT_LATIN, + SCRIPT_MALAYALAM, + SCRIPT_MONGOLIAN, + SCRIPT_MYANMAR, + SCRIPT_OGHAM, + SCRIPT_OLD_ITALIC, + SCRIPT_ORIYA, + SCRIPT_RUNIC, + SCRIPT_SINHALA, + SCRIPT_SYRIAC, + SCRIPT_TAMIL, + SCRIPT_TELUGU, + SCRIPT_THAANA, + SCRIPT_THAI, + SCRIPT_TIBETAN, + SCRIPT_CANADIAN_ABORIGINAL, + SCRIPT_YI, + SCRIPT_TAGALOG, + SCRIPT_HANUNOO, + SCRIPT_BUHID, + SCRIPT_TAGBANWA, + SCRIPT_BRAILLE, + SCRIPT_CYPRIOT, + SCRIPT_LIMBU, + SCRIPT_OSMANYA, + SCRIPT_SHAVIAN, + SCRIPT_LINEAR_B, + SCRIPT_TAI_LE, + SCRIPT_UGARITIC +}; + +} // namespace Pango + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value<Pango::Script> : public Glib::Value_Enum<Pango::Script> +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Pango +{ + + +/** A Pango::Language is used to represent a language. + */ +class Language +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Language CppObjectType; + typedef PangoLanguage BaseObjectType; + + static GType get_type() G_GNUC_CONST; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + + explicit Language(PangoLanguage* gobject, bool make_a_copy = true); + + Language(const Language& other); + Language& operator=(const Language& other); + + ~Language(); + + void swap(Language& other); + + ///Provides access to the underlying C instance. + PangoLanguage* gobj() { return gobject_; } + + ///Provides access to the underlying C instance. + const PangoLanguage* gobj() const { return gobject_; } + + ///Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs. + PangoLanguage* gobj_copy() const; + +protected: + PangoLanguage* gobject_; + +private: + + //This function is a bad hack for internal use by renderers and Pango (from pango/pango-utils.c) + //This is defined as a macro + + +public: + /** Constructs an empty language tag. + */ + Language(); + + /** Constructs a Pango::Language object from a RFC-3066 format language tag. + * This function first canonicalizes the string by converting it to lowercase, + * mapping '_' to '-', and stripping all characters other than letters and '-'. + */ + Language(const Glib::ustring& language); + + /** Gets a RFC-3066 format string representing the given language tag. + * @return A string representing the language tag. An empty string is returned if the language tag is empty. + */ + Glib::ustring get_string() const; + + + /** Checks if a language tag matches one of the elements in a list of + * language ranges. A language tag is considered to match a range + * in the list if the range is '*', the range is exactly the tag, + * or the range is a prefix of the tag, and the character after the + * tag is '-'. + * @param range_list A list of language ranges, separated by ';' characters. + * each element must either be '*', or a RFC 3066 language range + * canonicalized as by pango_language_from_string(). + * @return <tt>true</tt> if a match was found. + */ + bool matches(const Glib::ustring & range_list) const; + + /** Determines if @a script is one of the scripts used to + * write @a language . The returned value is conservative; + * if nothing is known about the language tag @a language , + * <tt>true</tt> will be returned, since, as far as Pango knows, + * @a script might be used to write @a language . + * + * This routine is used in Pango's itemization process when + * determining if a supplied language tag is relevant to + * a particular section of text. It probably is not useful for + * applications in most circumstances. + * @param script A Pango::Script. + * @return <tt>true</tt> if @a script is one of the scripts used + * to write @a language , or if nothing is known about @a language . + * + * Since: 1.4. + */ + bool includes_script(Script script) const; + + +}; + +} /* namespace Pango */ + + +namespace Pango +{ + +/** @relates Pango::Language + * @param lhs The left-hand side + * @param rhs The right-hand side + */ +inline void swap(Language& lhs, Language& rhs) + { lhs.swap(rhs); } + +} // namespace Pango + +namespace Glib +{ + +/** @relates Pango::Language + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ +Pango::Language wrap(PangoLanguage* object, bool take_copy = false); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +template <> +class Value<Pango::Language> : public Glib::Value_Boxed<Pango::Language> +{}; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +} // namespace Glib + +#endif /* _PANGOMM_LANGUAGE_H */ + diff --git a/libs/gtkmm2/pango/pangomm/layout.cc b/libs/gtkmm2/pango/pangomm/layout.cc new file mode 100644 index 0000000000..96d45e2037 --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/layout.cc @@ -0,0 +1,451 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include <pangomm/layout.h> +#include <pangomm/private/layout_p.h> + +#include <pango/pango-enum-types.h> +// -*- 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. + */ + +namespace Pango +{ + +Layout::Layout(const Glib::RefPtr<Context>& context) +: + Glib::Object(G_OBJECT(pango_layout_new(context->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); +} + +} /* namespace Pango */ + + +namespace +{ +} // anonymous namespace + +// static +GType Glib::Value<Pango::Alignment>::value_type() +{ + return pango_alignment_get_type(); +} + +// static +GType Glib::Value<Pango::WrapMode>::value_type() +{ + return pango_wrap_mode_get_type(); +} + +// static +GType Glib::Value<Pango::EllipsizeMode>::value_type() +{ + return pango_ellipsize_mode_get_type(); +} + + +namespace Glib +{ + +Glib::RefPtr<Pango::Layout> wrap(PangoLayout* object, bool take_copy) +{ + return Glib::RefPtr<Pango::Layout>( dynamic_cast<Pango::Layout*> (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} /* namespace Glib */ + + +namespace Pango +{ + + +/* The *_Class implementation: */ + +const Glib::Class& Layout_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &Layout_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(pango_layout_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void Layout_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast<BaseClassType*>(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* Layout_Class::wrap_new(GObject* object) +{ + return new Layout((PangoLayout*)object); +} + + +/* The implementation: */ + +PangoLayout* Layout::gobj_copy() +{ + reference(); + return gobj(); +} + +Layout::Layout(const Glib::ConstructParams& construct_params) +: + Glib::Object(construct_params) +{} + +Layout::Layout(PangoLayout* castitem) +: + Glib::Object((GObject*)(castitem)) +{} + +Layout::~Layout() +{} + + +Layout::CppClassType Layout::layout_class_; // initialize static member + +GType Layout::get_type() +{ + return layout_class_.init().get_type(); +} + +GType Layout::get_base_type() +{ + return pango_layout_get_type(); +} + + +Glib::RefPtr<Layout> Layout::create(const Glib::RefPtr<Context>& context) +{ + return Glib::RefPtr<Layout>( new Layout(context) ); +} +Glib::RefPtr<Layout> Layout::copy() +{ + return Glib::wrap(pango_layout_copy(gobj())); +} + +Glib::RefPtr<Context> Layout::get_context() const +{ + + Glib::RefPtr<Context> retvalue = Glib::wrap(pango_layout_get_context(const_cast<PangoLayout*>(gobj()))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +void Layout::set_attributes(AttrList& attrs) +{ + pango_layout_set_attributes(gobj(), (attrs).gobj()); +} + +AttrList Layout::get_attributes() const +{ + return AttrList((pango_layout_get_attributes(const_cast<PangoLayout*>(gobj())))); +} + +Glib::ustring Layout::get_text() const +{ + return Glib::convert_const_gchar_ptr_to_ustring(pango_layout_get_text(const_cast<PangoLayout*>(gobj()))); +} + +void Layout::set_font_description(const FontDescription& desc) +{ + pango_layout_set_font_description(gobj(), (desc).gobj()); +} + +void Layout::set_width(int width) +{ + pango_layout_set_width(gobj(), width); +} + +int Layout::get_width() const +{ + return pango_layout_get_width(const_cast<PangoLayout*>(gobj())); +} + +void Layout::set_wrap(WrapMode wrap) +{ + pango_layout_set_wrap(gobj(), ((PangoWrapMode)(wrap))); +} + +WrapMode Layout::get_wrap() const +{ + return ((WrapMode)(pango_layout_get_wrap(const_cast<PangoLayout*>(gobj())))); +} + +void Layout::set_indent(int indent) +{ + pango_layout_set_indent(gobj(), indent); +} + +int Layout::get_indent() const +{ + return pango_layout_get_indent(const_cast<PangoLayout*>(gobj())); +} + +void Layout::set_spacing(int spacing) +{ + pango_layout_set_spacing(gobj(), spacing); +} + +int Layout::get_spacing() const +{ + return pango_layout_get_spacing(const_cast<PangoLayout*>(gobj())); +} + +void Layout::set_justify(bool justify) +{ + pango_layout_set_justify(gobj(), static_cast<int>(justify)); +} + +bool Layout::get_justify() const +{ + return pango_layout_get_justify(const_cast<PangoLayout*>(gobj())); +} + +bool Layout::get_auto_dir() const +{ + return pango_layout_get_auto_dir(const_cast<PangoLayout*>(gobj())); +} + +void Layout::set_auto_dir(bool auto_dir) +{ + pango_layout_set_auto_dir(gobj(), static_cast<int>(auto_dir)); +} + +void Layout::set_alignment(Alignment alignment) +{ + pango_layout_set_alignment(gobj(), ((PangoAlignment)(alignment))); +} + +Alignment Layout::get_alignment() const +{ + return ((Alignment)(pango_layout_get_alignment(const_cast<PangoLayout*>(gobj())))); +} + +void Layout::set_tabs(TabArray& tabs) +{ + pango_layout_set_tabs(gobj(), (tabs).gobj()); +} + +TabArray Layout::get_tabs() const +{ + return TabArray((pango_layout_get_tabs(const_cast<PangoLayout*>(gobj())))); +} + +void Layout::set_single_paragraph_mode(bool setting) +{ + pango_layout_set_single_paragraph_mode(gobj(), static_cast<int>(setting)); +} + +bool Layout::get_single_paragraph_mode() const +{ + return pango_layout_get_single_paragraph_mode(const_cast<PangoLayout*>(gobj())); +} + +void Layout::set_ellipsize(EllipsizeMode ellipsize) +{ + pango_layout_set_ellipsize(gobj(), ((PangoEllipsizeMode)(ellipsize))); +} + +EllipsizeMode Layout::get_ellipsize() const +{ + return ((EllipsizeMode)(pango_layout_get_ellipsize(const_cast<PangoLayout*>(gobj())))); +} + +void Layout::context_changed() +{ + pango_layout_context_changed(gobj()); +} + +void Layout::get_cursor_pos(int index, Rectangle& strong_pos, Rectangle& weak_pos) const +{ + pango_layout_get_cursor_pos(const_cast<PangoLayout*>(gobj()), index, (strong_pos).gobj(), (weak_pos).gobj()); +} + +void Layout::move_cursor_visually(bool strong, int old_index, int old_trailing, int direction, int& new_index, int& new_trailing) const +{ + pango_layout_move_cursor_visually(const_cast<PangoLayout*>(gobj()), static_cast<int>(strong), old_index, old_trailing, direction, &new_index, &new_trailing); +} + +bool Layout::xy_to_index(int x, int y, int& index, int& trailing) const +{ + return pango_layout_xy_to_index(const_cast<PangoLayout*>(gobj()), x, y, &index, &trailing); +} + +void Layout::get_extents(Rectangle& ink_rect, Rectangle& logical_rect) const +{ + pango_layout_get_extents(const_cast<PangoLayout*>(gobj()), (ink_rect).gobj(), (logical_rect).gobj()); +} + +void Layout::get_pixel_extents(Rectangle& ink_rect, Rectangle& logical_rect) const +{ + pango_layout_get_pixel_extents(const_cast<PangoLayout*>(gobj()), (ink_rect).gobj(), (logical_rect).gobj()); +} + +void Layout::get_size(int& width, int& height) const +{ + pango_layout_get_size(const_cast<PangoLayout*>(gobj()), &width, &height); +} + +void Layout::get_pixel_size(int& width, int& height) const +{ + pango_layout_get_pixel_size(const_cast<PangoLayout*>(gobj()), &width, &height); +} + +int Layout::get_line_count() const +{ + return pango_layout_get_line_count(const_cast<PangoLayout*>(gobj())); +} + +Glib::RefPtr<LayoutLine> Layout::get_line(int line) +{ + + Glib::RefPtr<LayoutLine> retvalue = Glib::wrap(pango_layout_get_line(gobj(), line)); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +Glib::RefPtr<const LayoutLine> Layout::get_line(int line) const +{ + + Glib::RefPtr<const LayoutLine> retvalue = Glib::wrap(pango_layout_get_line(const_cast<PangoLayout*>(gobj()), line)); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +SListHandle_LayoutLine Layout::get_lines() +{ + return SListHandle_LayoutLine(pango_layout_get_lines(gobj()), Glib::OWNERSHIP_SHALLOW); +} + +SListHandle_ConstLayoutLine Layout::get_lines() const +{ + return SListHandle_ConstLayoutLine(pango_layout_get_lines(const_cast<PangoLayout*>(gobj())), Glib::OWNERSHIP_SHALLOW); +} + + +} // namespace Pango + + diff --git a/libs/gtkmm2/pango/pangomm/layout.h b/libs/gtkmm2/pango/pangomm/layout.h new file mode 100644 index 0000000000..dceee8c358 --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/layout.h @@ -0,0 +1,687 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _PANGOMM_LAYOUT_H +#define _PANGOMM_LAYOUT_H + +#include <glibmm.h> + +/* $Id$ */ + +/* layout.h + * + * Copyright(C) 1998-1999 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 <glibmm/object.h> +#include <glibmm/slisthandle.h> +#include <pangomm/font.h> +#include <pangomm/fontdescription.h> +#include <pangomm/context.h> +#include <pangomm/attrlist.h> +#include <pangomm/tabarray.h> +#include <pangomm/layoutline.h> +#include <pangomm/layoutiter.h> +#include <pango/pango-layout.h> + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _PangoLayout PangoLayout; +typedef struct _PangoLayoutClass PangoLayoutClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Pango +{ class Layout_Class; } // namespace Pango +namespace Pango +{ + + +/** @addtogroup pangommEnums Enums and Flags */ + +/** + * @ingroup pangommEnums + */ +enum Alignment +{ + ALIGN_LEFT, + ALIGN_CENTER, + ALIGN_RIGHT +}; + +} // namespace Pango + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value<Pango::Alignment> : public Glib::Value_Enum<Pango::Alignment> +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Pango +{ + +/** + * @ingroup pangommEnums + */ +enum WrapMode +{ + WRAP_WORD, + WRAP_CHAR, + WRAP_WORD_CHAR +}; + +} // namespace Pango + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value<Pango::WrapMode> : public Glib::Value_Enum<Pango::WrapMode> +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Pango +{ + +/** + * @ingroup pangommEnums + */ +enum EllipsizeMode +{ + ELLIPSIZE_NONE, + ELLIPSIZE_START, + ELLIPSIZE_MIDDLE, + ELLIPSIZE_END +}; + +} // namespace Pango + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value<Pango::EllipsizeMode> : public Glib::Value_Enum<Pango::EllipsizeMode> +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Pango +{ + + +/** A Pango::Layout represents an entire paragraph of text. + * It is initialized with a Pango::Context, UTF-8 string and set of attributes for that string. + * Once that is done, the set of formatted lines can be extracted from the object, + * the layout can be rendered, and conversion between logical character positions + * within the layout's text, and the physical position of the resulting glyphs can be made. + */ + +class Layout : public Glib::Object +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef Layout CppObjectType; + typedef Layout_Class CppClassType; + typedef PangoLayout BaseObjectType; + typedef PangoLayoutClass BaseClassType; + +private: friend class Layout_Class; + static CppClassType layout_class_; + +private: + // noncopyable + Layout(const Layout&); + Layout& operator=(const Layout&); + +protected: + explicit Layout(const Glib::ConstructParams& construct_params); + explicit Layout(PangoLayout* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~Layout(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + PangoLayout* gobj() { return reinterpret_cast<PangoLayout*>(gobject_); } + + ///Provides access to the underlying C GObject. + const PangoLayout* gobj() const { return reinterpret_cast<PangoLayout*>(gobject_); } + + ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. + PangoLayout* gobj_copy(); + +private: + + +protected: + explicit Layout(const Glib::RefPtr<Context>& context); + +public: + + static Glib::RefPtr<Layout> create(const Glib::RefPtr<Context>& context); + + + /** Does a deep copy-by-value of the @a src layout. The attribute list, + * tab array, and text from the original layout are all copied by + * value. + * @return A new Pango::Layout identical to @a src . + */ + Glib::RefPtr<Layout> copy(); + + /** Retrieves the Pango::Context used for this layout. + * @return The Pango::Context for the layout. This does not + * have an additional refcount added, so if you want to keep + * a copy of this around, you must reference it yourself. + */ + Glib::RefPtr<Context> get_context() const; + + /** Sets the text attributes for a layout object. + * @param attrs A Pango::AttrList. + */ + void set_attributes(AttrList& attrs); + + /** Gets the attribute list for the layout, if any. + * @return A Pango::AttrList. + */ + AttrList get_attributes() const; + + /** Set the text of the layout. + * @param text The text for the layout. + */ + void set_text(const Glib::ustring& text); + + + /** Gets the text in the layout. The returned text should not + * be freed or modified. + * @return The text in the @a layout . + */ + Glib::ustring get_text() const; + + /** Sets the layout text and attribute list from marked-up text (see markup format). + * Replaces the current text and attribute list. + * @param markup Some marked-up text. + */ + void set_markup(const Glib::ustring& markup); + + /** Sets the layout text and attribute list from marked-up text (see markup format). + * Replaces the current text and attribute list. + * + * If @a accel_marker is nonzero, the given character will mark the character following + * it as an accelerator. For example, the accel marker might be an ampersand or + * underscore. All characters marked as an accelerator will receive a + * Pango::UNDERLINE_LOW attribute, and the first character so marked will be returned + * in @a accel_char. Two @a accel_marker characters following each other produce a + * single literal @a accel_marker character. + * @param markup Some marked-up text. + * @param accel_marker Marker for accelerators in the text. + * @param accel_char Return location for any located accelerators. + */ + void set_markup(const Glib::ustring& markup, gunichar accel_marker, gunichar& accel_char); + + + /** Set the default font description for the layout. If no font + * description is set on the layout, the font description from + * the layout's context is used. + * @param desc The new pango font description. + */ + void set_font_description(const FontDescription& desc); + void unset_font_description(); + + + /** Sets the width to which the lines of the Pango::Layout should be wrapped. + * @param width The desired width, or -1 to indicate that no wrapping should be + * performed. + */ + void set_width(int width); + + /** Gets the width to which the lines of the Pango::Layout should be wrapped. + * @return The width. + */ + int get_width() const; + + /** Sets the wrap mode; the wrap mode only has an effect if a width + * is set on the layout with pango_layout_set_width(). To turn off wrapping, + * set the width to -1. + * @param wrap The wrap mode. + */ + void set_wrap(WrapMode wrap); + + /** Gets the wrap mode for the layout. + * @return Active wrap mode. + */ + WrapMode get_wrap() const; + + /** Sets the width in pango units to indent each paragraph. A negative value + * of @a indent will produce a hanging indent. That is, the first line will + * have the full width, and subsequent lines will be indented by the + * absolute value of @a indent . + * @param indent The amount by which to indentset. + */ + void set_indent(int indent); + + /** Gets the paragraph indent width in pango units. A negative value + * indicates a hanging indent. + * @return The indent. + */ + int get_indent() const; + + /** Sets the amount of spacing between the lines of the layout. + * @param spacing The amount of spacing. + */ + void set_spacing(int spacing); + + /** Gets the amount of spacing between the lines of the layout. + * @return The spacing (in Pango::GlyphUnit). + */ + int get_spacing() const; + + /** Sets whether or not each complete line should be stretched to + * fill the entire width of the layout. This stretching is typically + * done by adding whitespace, but for some scripts (such as Arabic), + * the justification is done by extending the characters. + * + * Note that as of Pango-1.4, this functionality is not yet implemented. + * @param justify Whether the lines in the layout should be justified. + */ + void set_justify(bool justify = true); + + /** Gets whether or not each complete line should be stretched to + * fill the entire width of the layout. + * @return The justify. + */ + bool get_justify() const; + + + /** Gets whether to calculate the bidirectional base direction + * for the layout according to the contents of the layout. + * See pango_layout_set_auto_dir(). + * @return If <tt>true</tt>, the bidirectional base direction + * is computed from the layout's contents. + */ + bool get_auto_dir() const; + + /** Sets whether to calculate the bidirectional base direction + * for the layout according to the contents of the layout; + * when this flag is on (the default), then paragraphs in + * @a layout that begin with strong right-to-left characters + * (Arabic and Hebrew principally), will have right-to-left + * layout, paragraphs with letters from other scripts will + * have left-to-right layout. Paragraphs with only neutral + * characters get their direction from the surrounding paragraphs. + * + * When <tt>false</tt>, the choice between left-to-right and + * right-to-left layout is done by according to the base direction + * of the layout's Pango::Context. (See pango_context_set_base_dir()). + * + * When the auto-computed direction or a paragraph differs from the + * base direction of the context, then the interpretation of + * Pango::ALIGN_LEFT and Pango::ALIGN_RIGHT are swapped. + * @param auto_dir If <tt>true</tt>, compute the bidirectional base direction + * from the layout's contents. + */ + void set_auto_dir(bool auto_dir = true); + + + /** Sets the alignment for the layout (how partial lines are + * positioned within the horizontal space available.) + * @param alignment The new alignment. + */ + void set_alignment(Alignment alignment); + + /** Sets the alignment for the layout (how partial lines are + * positioned within the horizontal space available.) + * @return The alignment value. + */ + Alignment get_alignment() const; + + + /** Sets the tabs to use for @a layout , overriding the default tabs + * (by default, tabs are every 8 spaces). If @a tabs is <tt>0</tt>, the default + * tabs are reinstated. @a tabs is copied into the layout; you must + * free your copy of @a tabs yourself. + * @param tabs A Pango::TabArray. + */ + void set_tabs(TabArray& tabs); + + /** Get the current Pango::TabArray used by this layout. If no + * Pango::TabArray has been set, then the default tabs are in use + * and an invalid instance is returned. Default tabs are every 8 spaces. + * @return A copy of the tabs for this layout. + */ + TabArray get_tabs() const; + + + /** If @a setting is <tt>true</tt>, do not treat newlines and similar characters + * as paragraph separators; instead, keep all text in a single paragraph, + * and display a glyph for paragraph separator characters. Used when + * you want to allow editing of newlines on a single text line. + * @param setting New setting. + */ + void set_single_paragraph_mode(bool setting = true); + + /** Obtains the value set by pango_layout_set_single_paragraph_mode(). + * @return <tt>true</tt> if the layout does not break paragraphs at + * paragraph separator characters. + */ + bool get_single_paragraph_mode() const; + + + /** Sets the type of ellipsization being performed for @a layout . + * Depending on the ellipsization mode @a ellipsize text is + * removed from the start, middle, or end of lines so they + * fit within the width of layout set with pango_layout_set_width(). + * + * If the layout contains characters such as newlines that + * force it to be layed out in multiple lines, then each line + * is ellipsized separately. + * + * Since: 1.6 + * @param ellipsize The new ellipsization mode for @a layout . + */ + void set_ellipsize(EllipsizeMode ellipsize); + + /** Gets the type of ellipsization being performed for @a layout . + * See pango_layout_set_ellipsize() + * @return The current ellipsization mode for @a layout + * + * Since: 1.6. + */ + EllipsizeMode get_ellipsize() const; + + + /** Forces recomputation of any state in the Pango::Layout that + * might depend on the layout's context. This function should + * be called if you make changes to the context subsequent + * to creating the layout. + */ + void context_changed(); + + /** Retrieve an array of logical attributes for each character in the layout. + * @return An array of logical attributes. + */ + Glib::ArrayHandle<LogAttr> get_log_attrs() const; + + /** Convert from an index within the layout to the onscreen position corresponding to the grapheme at that index, which is represented as rectangle. + * Note that @a x in the returned rectangle is always the leading edge of the grapheme + * and @a x + @a width the trailing edge of the grapheme. + * If the directionality of the grapheme is right-to-left, then @a width will be negative. + * @param index Byte index within layout. + * @return The position of the grapheme. + */ + Rectangle index_to_pos(int index) const; + + + /** Given an index within a layout, determines the positions that of the + * strong and weak cursors if the insertion point is at that + * index. The position of each cursor is stored as a zero-width + * rectangle. The strong cursor location is the location where + * characters of the directionality equal to the base direction of the + * layout are inserted. The weak cursor location is the location + * where characters of the directionality opposite to the base + * direction of the layout are inserted. + * @param index The byte index of the cursor. + * @param strong_pos Location to store the strong cursor position (may be <tt>0</tt>). + * @param weak_pos Location to store the weak cursor position (may be <tt>0</tt>). + */ + void get_cursor_pos(int index, Rectangle& strong_pos, Rectangle& weak_pos) const; + + /** Given an index within the layout, determine the positions that of the strong cursors if the insertion point is at that index. + * @param index The byte index of the cursor. + * @return The strong cursor position. + */ + Rectangle get_cursor_strong_pos(int index) const; + + /** Given an index within the layout, determine the positions that of the weak cursors if the insertion point is at that index. + * @param index The byte index of the cursor. + * @return The weak cursor position. + */ + Rectangle get_cursor_weak_pos(int index) const; + + + /** Computes a new cursor position from an old position and + * a count of positions to move visually. If @a count is positive, + * then the new strong cursor position will be one position + * to the right of the old cursor position. If @a count is position + * then the new strong cursor position will be one position + * to the left of the old cursor position. + * + * In the presence of bidirection text, the correspondence + * between logical and visual order will depend on the direction + * of the current run, and there may be jumps when the cursor + * is moved off of the end of a run. + * + * Motion here is in cursor positions, not in characters, so a + * single call to pango_layout_move_cursor_visually() may move the + * cursor over multiple characters when multiple characters combine + * to form a single grapheme. + * @param strong Whether the moving cursor is the strong cursor or the + * weak cursor. The strong cursor is the cursor corresponding + * to text insertion in the base direction for the layout. + * @param old_index The byte index of the grapheme for the old index. + * @param old_trailing If 0, the cursor was at the trailing edge of the + * grapheme indicated by @a old_index , if > 0, the cursor + * was at the leading edge. + * @param direction Direction to move cursor. A negative + * value indicates motion to the left. + * @param new_index Location to store the new cursor byte index. A value of -1 + * indicates that the cursor has been moved off the beginning + * of the layout. A value of G_MAXINT indicates that + * the cursor has been moved off the end of the layout. + * @param new_trailing Number of characters to move forward from the location returned + * for @a new_index to get the position where the cursor should + * be displayed. This allows distinguishing the position at + * the beginning of one line from the position at the end + * of the preceding line. @a new_index is always on the line + * where the cursor should be displayed. + */ + void move_cursor_visually(bool strong, + int old_index, int old_trailing, int direction, + int& new_index, int& new_trailing) const; + + + /** Converts from X and Y position within a layout to the byte + * index to the character at that logical position. If the + * Y position is not inside the layout, the closest position is chosen + * (the position will be clamped inside the layout). If the + * X position is not within the layout, then the start or the + * end of the line is chosen as described for pango_layout_x_to_index(). + * If either the X or Y positions were not inside the layout, then the + * function returns <tt>false</tt>; on an exact hit, it returns <tt>true</tt>. + * @param x The X offset (in Pango::GlyphUnit) + * from the left edge of the layout. + * @param y The Y offset (in Pango::GlyphUnit) + * from the top edge of the layout. + * @param index Location to store calculated byte index. + * @param trailing Location to store a integer indicating where + * in the grapheme the user clicked. It will either + * be zero, or the number of characters in the + * grapheme. 0 represents the trailing edge of the grapheme. + * @return <tt>true</tt> if the coordinates were inside text. + */ + bool xy_to_index(int x, int y, int& index, int& trailing) const; + + + /** Compute the logical and ink extents of @a layout . Logical extents + * are usually what you want for positioning things. The extents + * are given in layout coordinates; layout coordinates begin at the + * top left corner of the layout. + * @param ink_rect Rectangle used to store the extents of the layout as drawn. + * @param logical_rect Rectangle used to store the logical extents of the layout. + */ + void get_extents(Rectangle& ink_rect, Rectangle& logical_rect) const; + + /** Compute the ink extents of layout. + * @return The extents of the layout as drawn. + */ + Rectangle get_ink_extents() const; + + /** Compute the logical extents of layout. + * @return The logical extents of the layout. + */ + Rectangle get_logical_extents() const; + + + /** Compute the logical and ink extents of @a layout in device units. + * See pango_layout_get_extents(); this function just calls + * pango_layout_get_extents() and then converts the extents to + * pixels using the Pango::SCALE factor. + * @param ink_rect Rectangle used to store the extents of the layout as drawn. + * @param logical_rect Rectangle used to store the logical extents of the + * layout. + */ + void get_pixel_extents(Rectangle& ink_rect, Rectangle& logical_rect) const; + + /** Compute the ink extents of the layout in device units. + * @return The extents of the layout as drawn. + */ + Rectangle get_pixel_ink_extents() const; + + /** Compute the logical extents of the layout in device units. + * @return The logical extents of the layout. + */ + Rectangle get_pixel_logical_extents() const; + + + /** Determines the logical width and height of a Pango::Layout + * in Pango units. (device units divided by Pango::SCALE). This + * is simply a convenience function around pango_layout_get_extents(). + * @param width Location to store the logical width, or <tt>0</tt>. + * @param height Location to store the logical height, or <tt>0</tt>. + */ + void get_size(int& width, int& height) const; + + /** Determines the logical width and height of a Pango::Layout + * in device units. (pango_layout_get_size() returns the width + * and height in thousandths of a device unit.) This + * is simply a convenience function around pango_layout_get_extents(). + * @param width Location to store the logical width, or <tt>0</tt>. + * @param height Location to store the logical height, or <tt>0</tt>. + */ + void get_pixel_size(int& width, int& height) const; + + + /** Retrieves the count of lines for the @a layout . + * @return The line count. + */ + int get_line_count() const; + + + /** Retrieves a particular line from a Pango::Layout. + * @param line The index of a line, which must be between 0 and + * <tt>pango_layout_get_line_count(layout) - 1</tt>, inclusive. + * @return The requested Pango::LayoutLine, or <tt>0</tt> if the + * index is out of range. This layout line can + * be ref'ed and retained, but will become invalid + * if changes are made to the Pango::Layout. + */ + Glib::RefPtr<LayoutLine> get_line(int line); + + /** Retrieves a particular line from a Pango::Layout. + * @param line The index of a line, which must be between 0 and + * <tt>pango_layout_get_line_count(layout) - 1</tt>, inclusive. + * @return The requested Pango::LayoutLine, or <tt>0</tt> if the + * index is out of range. This layout line can + * be ref'ed and retained, but will become invalid + * if changes are made to the Pango::Layout. + */ + Glib::RefPtr<const LayoutLine> get_line(int line) const; + + + /** Returns the lines of the @a layout as a list. + * @return A G::SList containing the lines in the layout. This + * points to internal data of the Pango::Layout and must be used with + * care. It will become invalid on any change to the layout's + * text or properties. + */ + SListHandle_LayoutLine get_lines(); + + /** Returns the lines of the @a layout as a list. + * @return A G::SList containing the lines in the layout. This + * points to internal data of the Pango::Layout and must be used with + * care. It will become invalid on any change to the layout's + * text or properties. + */ + SListHandle_ConstLayoutLine get_lines() const; + + /** Gets an iterator to iterate over the visual extents of the layout. + * @param iter Location to store the iterator. + */ + void get_iter(LayoutIter& iter); + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +}; + +} /* namespace Pango */ + + +namespace Glib +{ + /** @relates Pango::Layout + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr<Pango::Layout> wrap(PangoLayout* object, bool take_copy = false); +} + + +#endif /* _PANGOMM_LAYOUT_H */ + diff --git a/libs/gtkmm2/pango/pangomm/layoutiter.cc b/libs/gtkmm2/pango/pangomm/layoutiter.cc new file mode 100644 index 0000000000..4ba4620c3e --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/layoutiter.cc @@ -0,0 +1,206 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include <pangomm/layoutiter.h> +#include <pangomm/private/layoutiter_p.h> + +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 2001-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. + */ + +namespace Pango +{ + +LayoutIter::LayoutIter() +: + gobject_ (0) +{} + +LayoutIter::~LayoutIter() +{ + if(gobject_) + pango_layout_iter_free(gobject_); +} + +void LayoutIter::assign_gobj(PangoLayoutIter* src) +{ + if(src != gobject_) + { + if(gobject_) + pango_layout_iter_free(gobject_); + + gobject_ = src; + } +} + +Rectangle LayoutIter::get_char_extents() const +{ + Rectangle logical_rect; + pango_layout_iter_get_char_extents(const_cast<PangoLayoutIter*>(gobj()), logical_rect.gobj()); + return logical_rect; +} + +Rectangle LayoutIter::get_cluster_ink_extents() const +{ + Rectangle ink_rect; + pango_layout_iter_get_cluster_extents(const_cast<PangoLayoutIter*>(gobj()), ink_rect.gobj(), 0); + return ink_rect; +} + +Rectangle LayoutIter::get_cluster_logical_extents() const +{ + Rectangle logical_rect; + pango_layout_iter_get_cluster_extents(const_cast<PangoLayoutIter*>(gobj()), 0, logical_rect.gobj()); + return logical_rect; +} + +Rectangle LayoutIter::get_run_ink_extents() const +{ + Rectangle ink_rect; + pango_layout_iter_get_run_extents(const_cast<PangoLayoutIter*>(gobj()), ink_rect.gobj(), 0); + return ink_rect; +} + +Rectangle LayoutIter::get_run_logical_extents() const +{ + Rectangle logical_rect; + pango_layout_iter_get_run_extents(const_cast<PangoLayoutIter*>(gobj()), 0, logical_rect.gobj()); + return logical_rect; +} + +Rectangle LayoutIter::get_line_ink_extents() const +{ + Rectangle ink_rect; + pango_layout_iter_get_line_extents(const_cast<PangoLayoutIter*>(gobj()), ink_rect.gobj(), 0); + return ink_rect; +} + +Rectangle LayoutIter::get_line_logical_extents() const +{ + Rectangle logical_rect; + pango_layout_iter_get_line_extents(const_cast<PangoLayoutIter*>(gobj()), 0, logical_rect.gobj()); + return logical_rect; +} + +Rectangle LayoutIter::get_layout_ink_extents() const +{ + Rectangle ink_rect; + pango_layout_iter_get_layout_extents(const_cast<PangoLayoutIter*>(gobj()), ink_rect.gobj(), 0); + return ink_rect; +} + +Rectangle LayoutIter::get_layout_logical_extents() const +{ + Rectangle logical_rect; + pango_layout_iter_get_layout_extents(const_cast<PangoLayoutIter*>(gobj()), 0, logical_rect.gobj()); + return logical_rect; +} + +} // namespace Pango + + +namespace +{ +} // anonymous namespace + + +namespace Pango +{ + + +int LayoutIter::get_index() const +{ + return pango_layout_iter_get_index(const_cast<PangoLayoutIter*>(gobj())); +} + +LayoutRun LayoutIter::get_run() const +{ + return Glib::wrap(pango_layout_iter_get_run(const_cast<PangoLayoutIter*>(gobj()))); +} + +Glib::RefPtr<LayoutLine> LayoutIter::get_line() const +{ + + Glib::RefPtr<LayoutLine> retvalue = Glib::wrap(pango_layout_iter_get_line(const_cast<PangoLayoutIter*>(gobj()))); + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +bool LayoutIter::at_last_line() const +{ + return pango_layout_iter_at_last_line(const_cast<PangoLayoutIter*>(gobj())); +} + +bool LayoutIter::next_char() +{ + return pango_layout_iter_next_char(gobj()); +} + +bool LayoutIter::next_cluster() +{ + return pango_layout_iter_next_cluster(gobj()); +} + +bool LayoutIter::next_run() +{ + return pango_layout_iter_next_run(gobj()); +} + +bool LayoutIter::next_line() +{ + return pango_layout_iter_next_line(gobj()); +} + +void LayoutIter::get_cluster_extents(Rectangle& ink_rect, Rectangle& logical_rect) const +{ + pango_layout_iter_get_cluster_extents(const_cast<PangoLayoutIter*>(gobj()), (ink_rect).gobj(), (logical_rect).gobj()); +} + +void LayoutIter::get_run_extents(Rectangle& ink_rect, Rectangle& logical_rect) const +{ + pango_layout_iter_get_run_extents(const_cast<PangoLayoutIter*>(gobj()), (ink_rect).gobj(), (logical_rect).gobj()); +} + +void LayoutIter::get_line_extents(Rectangle& ink_rect, Rectangle& logical_rect) const +{ + pango_layout_iter_get_line_extents(const_cast<PangoLayoutIter*>(gobj()), (ink_rect).gobj(), (logical_rect).gobj()); +} + +void LayoutIter::get_line_yrange(int& y0, int& y1) const +{ + pango_layout_iter_get_line_yrange(const_cast<PangoLayoutIter*>(gobj()), &y0, &y1); +} + +void LayoutIter::get_layout_extents(Rectangle& ink_rect, Rectangle& logical_rect) const +{ + pango_layout_iter_get_layout_extents(const_cast<PangoLayoutIter*>(gobj()), (ink_rect).gobj(), (logical_rect).gobj()); +} + +int LayoutIter::get_baseline() const +{ + return pango_layout_iter_get_baseline(const_cast<PangoLayoutIter*>(gobj())); +} + + +} // namespace Pango + + diff --git a/libs/gtkmm2/pango/pangomm/layoutiter.h b/libs/gtkmm2/pango/pangomm/layoutiter.h new file mode 100644 index 0000000000..ccb24ded81 --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/layoutiter.h @@ -0,0 +1,235 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _PANGOMM_LAYOUTITER_H +#define _PANGOMM_LAYOUTITER_H + +#include <glibmm.h> + +/* $Id$ */ + +/* layoutiter.h + * + * Copyright 2001-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 <pangomm/layoutline.h> +#include <pangomm/layoutrun.h> +#include <pango/pango-layout.h> + + +namespace Pango +{ + +/** A Pango::LayoutIter can be used to iterate over the visual extents of a Pango::Layout. + */ +class LayoutIter +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef LayoutIter CppObjectType; + typedef PangoLayoutIter BaseObjectType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +private: + + +public: + // There's no other ctor, and the default ctor creates an invalid object. + // Therefore, Pango::LayoutIter is usable only as output argument. + LayoutIter(); + ~LayoutIter(); + + + /** Gets the current byte index. Note that iterating forward by char + * moves in visual order, not logical order, so indexes may not be + * sequential. Also, the index may be equal to the length of the text + * in the layout, if on the <tt>0</tt> run (see pango_layout_iter_get_run()). + * @return Current byte index. + */ + int get_index() const; + + /** Gets the current run. When iterating by run, at the end of each + * line, there's a position with a <tt>0</tt> run, so this function can return + * <tt>0</tt>. The <tt>0</tt> run at the end of each line ensures that all lines have + * at least one run, even lines consisting of only a newline. + * @return The current run. + */ + LayoutRun get_run() const; + + /** Gets the current line. + * @return The current line. + */ + Glib::RefPtr<LayoutLine> get_line() const; + + /** Determines whether @a iter is on the last line of the layout. + * @return <tt>true</tt> if @a iter is on the last line. + */ + bool at_last_line() const; + + + /** Moves @a iter forward to the next character in visual order. If @a iter was already at + * the end of the layout, returns <tt>false</tt>. + * @return Whether motion was possible. + */ + bool next_char(); + + /** Moves @a iter forward to the next cluster in visual order. If @a iter + * was already at the end of the layout, returns <tt>false</tt>. + * @return Whether motion was possible. + */ + bool next_cluster(); + + /** Moves @a iter forward to the next run in visual order. If @a iter was + * already at the end of the layout, returns <tt>false</tt>. + * @return Whether motion was possible. + */ + bool next_run(); + + /** Moves @a iter forward to the start of the next line. If @a iter is + * already on the last line, returns <tt>false</tt>. + * @return Whether motion was possible. + */ + bool next_line(); + + /** Gets the extents of the current character, in layout coordinates (origin is the top left of the entire layout). + * Only logical extents can sensibly be obtained for characters; ink extents make sense only down to the level of clusters. + * @return The logical extents of the current character. + */ + Rectangle get_char_extents() const; + + + /** Gets the extents of the current cluster, in layout coordinates + * (origin is the top left of the entire layout). + * @param ink_rect Rectangle to fill with ink extents. + * @param logical_rect Rectangle to fill with logical extents. + */ + void get_cluster_extents(Rectangle& ink_rect, Rectangle& logical_rect) const; + + /** Gets the ink extents of the current cluster, in layout coordinates (origin is the top left of the entire layout). + * @return The extents of the current cluster as drawn. + */ + Rectangle get_cluster_ink_extents() const; + + /** Gets the logical extents of the current cluster, in layout coordinates (origin is the top left of the entire layout). + * @return The logical extents of the current cluster. + */ + Rectangle get_cluster_logical_extents() const; + + + /** Gets the extents of the current run in layout coordinates + * (origin is the top left of the entire layout). + * @param ink_rect Rectangle to fill with ink extents. + * @param logical_rect Rectangle to fill with logical extents. + */ + void get_run_extents(Rectangle& ink_rect, Rectangle& logical_rect) const; + + /** Gets the ink extents of the current run in layout coordinates (origin is the top left of the entire layout). + * @return The extents of the current run as drawn. + */ + Rectangle get_run_ink_extents() const; + + /** Gets the logical extents of the current run in layout coordinates (origin is the top left of the entire layout). + * @return The logical extents of the current run. + */ + Rectangle get_run_logical_extents() const; + + + /** Obtains the extents of the current line. @a ink_rect or @a logical_rect + * can be <tt>0</tt> if you aren't interested in them. Extents are in layout + * coordinates (origin is the top-left corner of the entire + * Pango::Layout). Thus the extents returned by this function will be + * the same width/height but not at the same x/y as the extents + * returned from pango_layout_line_get_extents(). + * @param ink_rect Rectangle to fill with ink extents. + * @param logical_rect Rectangle to fill with logical extents. + */ + void get_line_extents(Rectangle& ink_rect, Rectangle& logical_rect) const; + + /** Obtains the ink extents of the current line. + * @return The extents of the current line as drawn. + */ + Rectangle get_line_ink_extents() const; + + /** Obtains the logical extents of the current line. + * @return The logical extents of the current line. + */ + Rectangle get_line_logical_extents() const; + + + /** Divides the vertical space in the Pango::Layout being iterated over + * between the lines in the layout, and returns the space belonging to + * the current line. A line's range includes the line's logical + * extents, plus half of the spacing above and below the line, if + * pango_layout_set_spacing() has been called to set layout spacing. + * The y positions are in layout coordinates (origin at top left of the + * entire layout). + * @param y0 Start of line. + * @param y1 End of line. + */ + void get_line_yrange(int& y0, int& y1) const; + + + /** Obtains the extents of the Pango::Layout being iterated + * over. @a ink_rect or @a logical_rect can be <tt>0</tt> if you + * aren't interested in them. + * @param ink_rect Rectangle to fill with ink extents. + * @param logical_rect Rectangle to fill with logical extents. + */ + void get_layout_extents(Rectangle& ink_rect, Rectangle& logical_rect) const; + + /** Obtains the ink extents of the Pango::Layout being iterated over. + * @return The extents of the layout as drawn. + */ + Rectangle get_layout_ink_extents() const; + + /** Obtains the logical extents of the Pango::Layout being iterated over. + * @return The logical extents of the layout. + */ + Rectangle get_layout_logical_extents() const; + + + /** Gets the y position of the current line's baseline, in layout + * coordinates (origin at top left of the entire layout). + * @return Baseline of current line. + */ + int get_baseline() const; + + /// Provides access to the underlying C GObject. + PangoLayoutIter* gobj() { return gobject_; } + /// Provides access to the underlying C GObject. + const PangoLayoutIter* gobj() const { return gobject_; } + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + void assign_gobj(PangoLayoutIter* src); +#endif + +protected: + PangoLayoutIter* gobject_; + +private: + // noncopyable + LayoutIter(const LayoutIter&); + LayoutIter& operator=(const LayoutIter&); + + +}; + +} //namespace Pango + + +#endif /* _PANGOMM_LAYOUTITER_H */ + diff --git a/libs/gtkmm2/pango/pangomm/layoutline.cc b/libs/gtkmm2/pango/pangomm/layoutline.cc new file mode 100644 index 0000000000..f3ff372461 --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/layoutline.cc @@ -0,0 +1,197 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include <pangomm/layoutline.h> +#include <pangomm/private/layoutline_p.h> + +// -*- 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 <pangomm/layout.h> + +namespace Pango { + +Rectangle LayoutLine::get_ink_extents() const +{ + Rectangle ink_rect; + pango_layout_line_get_extents(const_cast<PangoLayoutLine*>(gobj()), ink_rect.gobj(), 0); + return ink_rect; +} + +Rectangle LayoutLine::get_logical_extents() const +{ + Rectangle logical_rect; + pango_layout_line_get_extents(const_cast<PangoLayoutLine*>(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<PangoLayoutLine*>(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<PangoLayoutLine*>(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<PangoLayoutLine*>(gobj()), index, trailing, &x_pos); + return x_pos; +} + +Glib::ArrayHandle<std::pair<int,int> > 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<PangoLayoutLine*>(gobj()), start_index, end_index, &ranges, &n_ranges); + return Glib::ArrayHandle<std::pair<int,int> >(reinterpret_cast<std::pair<int,int>*>(ranges), n_ranges, Glib::OWNERSHIP_SHALLOW); +} + +} /* namespace Pango */ + + +namespace +{ +} // anonymous namespace + + +/* Why reinterpret_cast<LayoutLine*>(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<Pango::LayoutLine> 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<Pango::LayoutLine>(reinterpret_cast<Pango::LayoutLine*>(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<PangoLayoutLine*>(const_cast<LayoutLine*>(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<PangoLayoutLine*>(const_cast<LayoutLine*>(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<PangoLayoutLine*>(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<const PangoLayoutLine*>(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<PangoLayoutLine*>(const_cast<LayoutLine*>(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<PangoLayoutLine*>(gobj()), x_pos, &index, &trailing); +} + +void LayoutLine::get_extents(Rectangle& ink_rect, Rectangle& logical_rect) const +{ + pango_layout_line_get_extents(const_cast<PangoLayoutLine*>(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<PangoLayoutLine*>(gobj()), (ink_rect).gobj(), (logical_rect).gobj()); +} + +Glib::RefPtr<Pango::Layout> LayoutLine::get_layout() +{ + Glib::RefPtr<Pango::Layout> ref_ptr(Glib::wrap(gobj()->layout)); + + if(ref_ptr) + ref_ptr->reference(); + + return ref_ptr; +} + +Glib::RefPtr<const Pango::Layout> LayoutLine::get_layout() const +{ + Glib::RefPtr<const Pango::Layout> 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 + + diff --git a/libs/gtkmm2/pango/pangomm/layoutline.h b/libs/gtkmm2/pango/pangomm/layoutline.h new file mode 100644 index 0000000000..594d5cc7a3 --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/layoutline.h @@ -0,0 +1,222 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _PANGOMM_LAYOUTLINE_H +#define _PANGOMM_LAYOUTLINE_H + +#include <glibmm.h> + +/* $Id$ */ + +/* layoutline.h + * + * Copyright (C) 1998-1999 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 <glibmm/slisthandle.h> // For the Glib::SListHandle typedef +#include <pangomm/rectangle.h> +#include <pango/pango-layout.h> + + +namespace Pango +{ + +class Layout; + +/** A Pango::LayoutLine represents one of the lines resulting from laying out a paragraph via Pango::Layout. + * Pango::LayoutLine objects are obtained by calling Pango::Layout::get_line() + * and are only valid until the text, attributes, or settings of the parent Pango::Layout are modified. + * Routines for rendering Pango::Layout objects are provided in code specific to each rendering system. + */ +class LayoutLine +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef LayoutLine CppObjectType; + typedef PangoLayoutLine BaseObjectType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + + // For use with Glib::RefPtr<> only. + void reference() const; + void unreference() const; + + ///Provides access to the underlying C instance. + PangoLayoutLine* gobj(); + + ///Provides access to the underlying C instance. + const PangoLayoutLine* gobj() const; + + ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. + PangoLayoutLine* gobj_copy() const; + +protected: + // Do not derive this. Pango::LayoutLine can neither be constructed nor deleted. + LayoutLine(); + void operator delete(void*, size_t); + +private: + // noncopyable + LayoutLine(const LayoutLine&); + LayoutLine& operator=(const LayoutLine&); + + +public: + + + /** Converts from x offset to the byte index of the corresponding + * character within the text of the layout. If @a x_pos is outside the line, + * @a index and @a trailing will point to the very first or very last position + * in the line. This determination is based on the resolved direction + * of the paragraph; for example, if the resolved direction is + * right-to-left, then an X position to the right of the line (after it) + * results in 0 being stored in @a index and @a trailing . An X position to the + * left of the line results in @a index pointing to the (logical) last + * grapheme in the line and @a trailing being set to the number of characters + * in that grapheme. The reverse is true for a left-to-right line. + * @param x_pos The x offset (in Pango::GlyphUnit) + * from the left edge of the line. + * @param index Location to store calculated byte index for + * the grapheme in which the user clicked. + * @param trailing Location to store a integer indicating where + * in the grapheme the user clicked. It will either + * be zero, or the number of characters in the + * grapheme. 0 represents the trailing edge of the grapheme. + * @return <tt>false</tt> if @a x_pos was outside the line, <tt>true</tt> if inside. + */ + bool x_to_index(int x_pos, int& index, int& trailing) const; + + /** Converts an index within a line to a @a x position. + * @param index Byte offset of a grapheme within the layout. + * @param trailing A boolean indicating the edge of the grapheme to retrieve the position of. If <tt>false</tt>, the trailing edge of the grapheme, if <tt>true</tt> the leading of the grapheme. + * @return The x offset (in thousands of a device unit). + */ + int index_to_x(int index, bool trailing) const; + + + /** Get a list of visual ranges corresponding to a given logical range. + * This list is not necessarily minimal - there may be consecutive ranges which are adjacent. + * The ranges will be sorted from left to right. The ranges are with respect to the + * left edge of the entire layout, not with respect to the line. + * @param start_index The start byte index of the logical range. + * If the value of @a start_index is less than the start index for the line, + * then the first range will extend all the way to the leading edge of the layout. + * Otherwise it will start at the leading edge of the first character. + * @param end_index The end byte index of the logical range. + * If the value of @a end_index is greater than the end index for the line, + * then the last range will extend all the way to the trailing edge of the layout. + * Otherwise, it will end at the trailing edge of the last character. + * @return An array of ranges represented by pairs of integers marking the start and end pixel coordinates of the ranges. + */ + Glib::ArrayHandle<std::pair<int,int> > get_x_ranges(int start_index, int end_index) const; + + + /** Compute the logical and ink extents of a layout line. See the documentation + * for Pango::Font::get_glyph_extents() for details about the interpretation + * of the rectangles. + * @param ink_rect Rectangle used to store the extents of the glyph string as drawn. + * @param logical_rect Rectangle used to store the logical extents of the glyph string. + */ + void get_extents(Rectangle& ink_rect, Rectangle& logical_rect) const; + + /** Compute the ink extents of a layout line. + * @return The extents of the layout line as drawn. + */ + Rectangle get_ink_extents() const; + + /** Compute the logical extents of a layout line. + * @return The logical extents of the layout line. + */ + Rectangle get_logical_extents() const; + + + /** Compute the logical and ink extents of a layout line. See the documentation + * for Pango::Font::get_glyph_extents() for details about the interpretation + * of the rectangles. The returned rectangles are in device units, as + * opposed to pango_layout_line_get_extents(), which returns the extents in + * units of device unit / PANGO_SCALE. + * @param ink_rect Rectangle used to store the extents of the glyph string as drawn. + * @param logical_rect Rectangle used to store the logical extents of the glyph string. + */ + void get_pixel_extents(Rectangle& ink_rect, Rectangle& logical_rect) const; + + /** Compute the ink extents of a layout line in device units. + * @return The extents of the layout line as drawn. + */ + Rectangle get_pixel_ink_extents() const; + + /** Compute the logical extents of a layout line in device units. + * @return The logical extents of the layout line. + */ + Rectangle get_pixel_logical_extents() const; + + Glib::RefPtr<Pango::Layout> get_layout(); + Glib::RefPtr<const Pango::Layout> get_layout() const; + //_MEMBER_SET_GOBJECT(layout, layout, Pango::Layout, PangoLayout*) + int get_length() const; + int get_start_index() const; + + +}; + +} // namespace Pango + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ +// forward declaration needed by LayoutLineTraits +Glib::RefPtr<Pango::LayoutLine> wrap(PangoLayoutLine* object, bool take_copy /* = false */); + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Pango +{ + +struct LayoutLineTraits +{ + typedef Glib::RefPtr<LayoutLine> CppType; + typedef PangoLayoutLine * CType; + typedef PangoLayoutLine * CTypeNonConst; + + static CType to_c_type (const CppType& ptr) { return Glib::unwrap(ptr); } + static CType to_c_type (CType ptr) { return ptr; } + static CppType to_cpp_type (CType ptr) { return Glib::wrap(ptr, true); } + static void release_c_type (CType ptr) { pango_layout_line_unref(ptr); } +}; + +typedef Glib::SListHandle< Glib::RefPtr<LayoutLine>, LayoutLineTraits > SListHandle_LayoutLine; +typedef Glib::SListHandle< Glib::RefPtr<const LayoutLine>, LayoutLineTraits > SListHandle_ConstLayoutLine; + +} // namespace Pango + + +namespace Glib +{ + + /** @relates Pango::LayoutLine + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr<Pango::LayoutLine> wrap(PangoLayoutLine* object, bool take_copy = false); + +} // namespace Glib + +#endif /* _PANGOMM_LAYOUTLINE_H */ + diff --git a/libs/gtkmm2/pango/pangomm/layoutrun.cc b/libs/gtkmm2/pango/pangomm/layoutrun.cc new file mode 100644 index 0000000000..6d797fc02c --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/layoutrun.cc @@ -0,0 +1,79 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include <pangomm/layoutrun.h> +#include <pangomm/private/layoutrun_p.h> + +/* + * Copyright 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 <pangomm/item.h> +#include <pangomm/glyphstring.h> + +namespace Pango +{ + +LayoutRun::LayoutRun() +{} + +LayoutRun::LayoutRun(const PangoLayoutRun* src) +{ + gobject_ = *src; +} + +} /* namespace Pango */ + + +namespace Glib +{ + +Pango::LayoutRun& wrap(PangoLayoutRun* object) +{ + return *reinterpret_cast<Pango::LayoutRun*>(object); +} + +const Pango::LayoutRun& wrap(const PangoLayoutRun* object) +{ + return *reinterpret_cast<const Pango::LayoutRun*>(object); +} + +} /* namespace Glib */ + + +namespace +{ +} // anonymous namespace + + +namespace Pango +{ + + +Item LayoutRun::get_item() const +{ + return Item((gobj()->item)); +} + +GlyphString LayoutRun::get_glyphs() const +{ + return GlyphString((gobj()->glyphs)); +} + + +} // namespace Pango + + diff --git a/libs/gtkmm2/pango/pangomm/layoutrun.h b/libs/gtkmm2/pango/pangomm/layoutrun.h new file mode 100644 index 0000000000..8a150646fa --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/layoutrun.h @@ -0,0 +1,92 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _PANGOMM_LAYOUTRUN_H +#define _PANGOMM_LAYOUTRUN_H + +#include <glibmm.h> + +/* layoutrun.h + * + * Copyright (C) 1998-1999 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/pango-layout.h> + + +namespace Pango +{ + +class Item; +class GlyphString; + +/** A Pango::LayoutRun represents a single run within a PangoLayoutLine. + */ +class LayoutRun +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef LayoutRun CppObjectType; + typedef PangoLayoutRun BaseObjectType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +private: + + +protected: + LayoutRun(); + +public: + explicit LayoutRun(const PangoLayoutRun* src); + + /** Gets the Pango::Item object that provides information about the segment of text in this run. + * @return A Pango::Item object. + */ + Item get_item() const; + + /** Gets the string of glyphs obtained by shaping the text for this item. + * @return A Pango::GlyphString object. + */ + GlyphString get_glyphs() const; + + /// Provides access to the underlying C GObject. + PangoLayoutRun* gobj() { return &gobject_; } + /// Provides access to the underlying C GObject. + const PangoLayoutRun* gobj() const { return &gobject_; } + +protected: + PangoLayoutRun gobject_; + + +}; + +} /* namespace Pango */ + + +namespace Glib +{ + +/** @relates Pango::LayoutRun */ +Pango::LayoutRun& wrap(PangoLayoutRun* object); + +/** @relates Pango::LayoutRun */ +const Pango::LayoutRun& wrap(const PangoLayoutRun* object); + +} /* namepspace Glib */ + + +#endif /* _PANGOMM_LAYOUTRUN_H */ + diff --git a/libs/gtkmm2/pango/pangomm/private/attributes_p.h b/libs/gtkmm2/pango/pangomm/private/attributes_p.h new file mode 100644 index 0000000000..a2c62c09a6 --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/private/attributes_p.h @@ -0,0 +1,6 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _PANGOMM_ATTRIBUTES_P_H +#define _PANGOMM_ATTRIBUTES_P_H +#endif /* _PANGOMM_ATTRIBUTES_P_H */ + diff --git a/libs/gtkmm2/pango/pangomm/private/attriter_p.h b/libs/gtkmm2/pango/pangomm/private/attriter_p.h new file mode 100644 index 0000000000..d8cc2fd346 --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/private/attriter_p.h @@ -0,0 +1,6 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _PANGOMM_ATTRITER_P_H +#define _PANGOMM_ATTRITER_P_H +#endif /* _PANGOMM_ATTRITER_P_H */ + diff --git a/libs/gtkmm2/pango/pangomm/private/attrlist_p.h b/libs/gtkmm2/pango/pangomm/private/attrlist_p.h new file mode 100644 index 0000000000..4c05d959d2 --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/private/attrlist_p.h @@ -0,0 +1,6 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _PANGOMM_ATTRLIST_P_H +#define _PANGOMM_ATTRLIST_P_H +#endif /* _PANGOMM_ATTRLIST_P_H */ + diff --git a/libs/gtkmm2/pango/pangomm/private/color_p.h b/libs/gtkmm2/pango/pangomm/private/color_p.h new file mode 100644 index 0000000000..945c38bedb --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/private/color_p.h @@ -0,0 +1,6 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _PANGOMM_COLOR_P_H +#define _PANGOMM_COLOR_P_H +#endif /* _PANGOMM_COLOR_P_H */ + diff --git a/libs/gtkmm2/pango/pangomm/private/context_p.h b/libs/gtkmm2/pango/pangomm/private/context_p.h new file mode 100644 index 0000000000..a54c181ffd --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/private/context_p.h @@ -0,0 +1,44 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _PANGOMM_CONTEXT_P_H +#define _PANGOMM_CONTEXT_P_H +#include <glibmm/private/object_p.h> + +#include <glibmm/class.h> + +namespace Pango +{ + +class Context_Class : public Glib::Class +{ +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Context CppObjectType; + typedef PangoContext BaseObjectType; + typedef PangoContextClass BaseClassType; + typedef Glib::Object_Class CppClassParent; + typedef GObjectClass BaseClassParent; + + friend class Context; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + const Glib::Class& init(); + + static void class_init_function(void* g_class, void* class_data); + + static Glib::ObjectBase* wrap_new(GObject*); + +protected: + + //Callbacks (default signal handlers): + //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. + //You could prevent the original default signal handlers being called by overriding the *_impl method. + + //Callbacks (virtual functions): +}; + + +} // namespace Pango + +#endif /* _PANGOMM_CONTEXT_P_H */ + diff --git a/libs/gtkmm2/pango/pangomm/private/coverage_p.h b/libs/gtkmm2/pango/pangomm/private/coverage_p.h new file mode 100644 index 0000000000..129cefb95d --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/private/coverage_p.h @@ -0,0 +1,6 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _PANGOMM_COVERAGE_P_H +#define _PANGOMM_COVERAGE_P_H +#endif /* _PANGOMM_COVERAGE_P_H */ + diff --git a/libs/gtkmm2/pango/pangomm/private/font_p.h b/libs/gtkmm2/pango/pangomm/private/font_p.h new file mode 100644 index 0000000000..6ff30d4ddf --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/private/font_p.h @@ -0,0 +1,44 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _PANGOMM_FONT_P_H +#define _PANGOMM_FONT_P_H +#include <glibmm/private/object_p.h> + +#include <glibmm/class.h> + +namespace Pango +{ + +class Font_Class : public Glib::Class +{ +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Font CppObjectType; + typedef PangoFont BaseObjectType; + typedef PangoFontClass BaseClassType; + typedef Glib::Object_Class CppClassParent; + typedef GObjectClass BaseClassParent; + + friend class Font; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + const Glib::Class& init(); + + static void class_init_function(void* g_class, void* class_data); + + static Glib::ObjectBase* wrap_new(GObject*); + +protected: + + //Callbacks (default signal handlers): + //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. + //You could prevent the original default signal handlers being called by overriding the *_impl method. + + //Callbacks (virtual functions): +}; + + +} // namespace Pango + +#endif /* _PANGOMM_FONT_P_H */ + diff --git a/libs/gtkmm2/pango/pangomm/private/fontdescription_p.h b/libs/gtkmm2/pango/pangomm/private/fontdescription_p.h new file mode 100644 index 0000000000..12ec7e662d --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/private/fontdescription_p.h @@ -0,0 +1,6 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _PANGOMM_FONTDESCRIPTION_P_H +#define _PANGOMM_FONTDESCRIPTION_P_H +#endif /* _PANGOMM_FONTDESCRIPTION_P_H */ + diff --git a/libs/gtkmm2/pango/pangomm/private/fontface_p.h b/libs/gtkmm2/pango/pangomm/private/fontface_p.h new file mode 100644 index 0000000000..66bddd9298 --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/private/fontface_p.h @@ -0,0 +1,44 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _PANGOMM_FONTFACE_P_H +#define _PANGOMM_FONTFACE_P_H +#include <glibmm/private/object_p.h> + +#include <glibmm/class.h> + +namespace Pango +{ + +class FontFace_Class : public Glib::Class +{ +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef FontFace CppObjectType; + typedef PangoFontFace BaseObjectType; + typedef PangoFontFaceClass BaseClassType; + typedef Glib::Object_Class CppClassParent; + typedef GObjectClass BaseClassParent; + + friend class FontFace; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + const Glib::Class& init(); + + static void class_init_function(void* g_class, void* class_data); + + static Glib::ObjectBase* wrap_new(GObject*); + +protected: + + //Callbacks (default signal handlers): + //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. + //You could prevent the original default signal handlers being called by overriding the *_impl method. + + //Callbacks (virtual functions): +}; + + +} // namespace Pango + +#endif /* _PANGOMM_FONTFACE_P_H */ + diff --git a/libs/gtkmm2/pango/pangomm/private/fontfamily_p.h b/libs/gtkmm2/pango/pangomm/private/fontfamily_p.h new file mode 100644 index 0000000000..657f7b266a --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/private/fontfamily_p.h @@ -0,0 +1,44 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _PANGOMM_FONTFAMILY_P_H +#define _PANGOMM_FONTFAMILY_P_H +#include <glibmm/private/object_p.h> + +#include <glibmm/class.h> + +namespace Pango +{ + +class FontFamily_Class : public Glib::Class +{ +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef FontFamily CppObjectType; + typedef PangoFontFamily BaseObjectType; + typedef PangoFontFamilyClass BaseClassType; + typedef Glib::Object_Class CppClassParent; + typedef GObjectClass BaseClassParent; + + friend class FontFamily; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + const Glib::Class& init(); + + static void class_init_function(void* g_class, void* class_data); + + static Glib::ObjectBase* wrap_new(GObject*); + +protected: + + //Callbacks (default signal handlers): + //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. + //You could prevent the original default signal handlers being called by overriding the *_impl method. + + //Callbacks (virtual functions): +}; + + +} // namespace Pango + +#endif /* _PANGOMM_FONTFAMILY_P_H */ + diff --git a/libs/gtkmm2/pango/pangomm/private/fontmap_p.h b/libs/gtkmm2/pango/pangomm/private/fontmap_p.h new file mode 100644 index 0000000000..88e898e016 --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/private/fontmap_p.h @@ -0,0 +1,44 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _PANGOMM_FONTMAP_P_H +#define _PANGOMM_FONTMAP_P_H +#include <glibmm/private/object_p.h> + +#include <glibmm/class.h> + +namespace Pango +{ + +class FontMap_Class : public Glib::Class +{ +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef FontMap CppObjectType; + typedef PangoFontMap BaseObjectType; + typedef PangoFontMapClass BaseClassType; + typedef Glib::Object_Class CppClassParent; + typedef GObjectClass BaseClassParent; + + friend class FontMap; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + const Glib::Class& init(); + + static void class_init_function(void* g_class, void* class_data); + + static Glib::ObjectBase* wrap_new(GObject*); + +protected: + + //Callbacks (default signal handlers): + //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. + //You could prevent the original default signal handlers being called by overriding the *_impl method. + + //Callbacks (virtual functions): +}; + + +} // namespace Pango + +#endif /* _PANGOMM_FONTMAP_P_H */ + diff --git a/libs/gtkmm2/pango/pangomm/private/fontmetrics_p.h b/libs/gtkmm2/pango/pangomm/private/fontmetrics_p.h new file mode 100644 index 0000000000..80670d0639 --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/private/fontmetrics_p.h @@ -0,0 +1,6 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _PANGOMM_FONTMETRICS_P_H +#define _PANGOMM_FONTMETRICS_P_H +#endif /* _PANGOMM_FONTMETRICS_P_H */ + diff --git a/libs/gtkmm2/pango/pangomm/private/fontset_p.h b/libs/gtkmm2/pango/pangomm/private/fontset_p.h new file mode 100644 index 0000000000..ed012a1cbb --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/private/fontset_p.h @@ -0,0 +1,44 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _PANGOMM_FONTSET_P_H +#define _PANGOMM_FONTSET_P_H +#include <glibmm/private/object_p.h> + +#include <glibmm/class.h> + +namespace Pango +{ + +class Fontset_Class : public Glib::Class +{ +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Fontset CppObjectType; + typedef PangoFontset BaseObjectType; + typedef PangoFontsetClass BaseClassType; + typedef Glib::Object_Class CppClassParent; + typedef GObjectClass BaseClassParent; + + friend class Fontset; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + const Glib::Class& init(); + + static void class_init_function(void* g_class, void* class_data); + + static Glib::ObjectBase* wrap_new(GObject*); + +protected: + + //Callbacks (default signal handlers): + //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. + //You could prevent the original default signal handlers being called by overriding the *_impl method. + + //Callbacks (virtual functions): +}; + + +} // namespace Pango + +#endif /* _PANGOMM_FONTSET_P_H */ + diff --git a/libs/gtkmm2/pango/pangomm/private/glyph_p.h b/libs/gtkmm2/pango/pangomm/private/glyph_p.h new file mode 100644 index 0000000000..8c4b42f6c7 --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/private/glyph_p.h @@ -0,0 +1,6 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _PANGOMM_GLYPH_P_H +#define _PANGOMM_GLYPH_P_H +#endif /* _PANGOMM_GLYPH_P_H */ + diff --git a/libs/gtkmm2/pango/pangomm/private/glyphstring_p.h b/libs/gtkmm2/pango/pangomm/private/glyphstring_p.h new file mode 100644 index 0000000000..6d9535bcda --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/private/glyphstring_p.h @@ -0,0 +1,6 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _PANGOMM_GLYPHSTRING_P_H +#define _PANGOMM_GLYPHSTRING_P_H +#endif /* _PANGOMM_GLYPHSTRING_P_H */ + diff --git a/libs/gtkmm2/pango/pangomm/private/item_p.h b/libs/gtkmm2/pango/pangomm/private/item_p.h new file mode 100644 index 0000000000..a2015d337d --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/private/item_p.h @@ -0,0 +1,6 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _PANGOMM_ITEM_P_H +#define _PANGOMM_ITEM_P_H +#endif /* _PANGOMM_ITEM_P_H */ + diff --git a/libs/gtkmm2/pango/pangomm/private/language_p.h b/libs/gtkmm2/pango/pangomm/private/language_p.h new file mode 100644 index 0000000000..f9921544be --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/private/language_p.h @@ -0,0 +1,6 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _PANGOMM_LANGUAGE_P_H +#define _PANGOMM_LANGUAGE_P_H +#endif /* _PANGOMM_LANGUAGE_P_H */ + diff --git a/libs/gtkmm2/pango/pangomm/private/layout_p.h b/libs/gtkmm2/pango/pangomm/private/layout_p.h new file mode 100644 index 0000000000..d87fb6de2f --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/private/layout_p.h @@ -0,0 +1,44 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _PANGOMM_LAYOUT_P_H +#define _PANGOMM_LAYOUT_P_H +#include <glibmm/private/object_p.h> + +#include <glibmm/class.h> + +namespace Pango +{ + +class Layout_Class : public Glib::Class +{ +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Layout CppObjectType; + typedef PangoLayout BaseObjectType; + typedef PangoLayoutClass BaseClassType; + typedef Glib::Object_Class CppClassParent; + typedef GObjectClass BaseClassParent; + + friend class Layout; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + const Glib::Class& init(); + + static void class_init_function(void* g_class, void* class_data); + + static Glib::ObjectBase* wrap_new(GObject*); + +protected: + + //Callbacks (default signal handlers): + //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. + //You could prevent the original default signal handlers being called by overriding the *_impl method. + + //Callbacks (virtual functions): +}; + + +} // namespace Pango + +#endif /* _PANGOMM_LAYOUT_P_H */ + diff --git a/libs/gtkmm2/pango/pangomm/private/layoutiter_p.h b/libs/gtkmm2/pango/pangomm/private/layoutiter_p.h new file mode 100644 index 0000000000..e43c4334d2 --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/private/layoutiter_p.h @@ -0,0 +1,6 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _PANGOMM_LAYOUTITER_P_H +#define _PANGOMM_LAYOUTITER_P_H +#endif /* _PANGOMM_LAYOUTITER_P_H */ + diff --git a/libs/gtkmm2/pango/pangomm/private/layoutline_p.h b/libs/gtkmm2/pango/pangomm/private/layoutline_p.h new file mode 100644 index 0000000000..2bccde57d1 --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/private/layoutline_p.h @@ -0,0 +1,6 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _PANGOMM_LAYOUTLINE_P_H +#define _PANGOMM_LAYOUTLINE_P_H +#endif /* _PANGOMM_LAYOUTLINE_P_H */ + diff --git a/libs/gtkmm2/pango/pangomm/private/layoutrun_p.h b/libs/gtkmm2/pango/pangomm/private/layoutrun_p.h new file mode 100644 index 0000000000..3d9bb774f1 --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/private/layoutrun_p.h @@ -0,0 +1,6 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _PANGOMM_LAYOUTRUN_P_H +#define _PANGOMM_LAYOUTRUN_P_H +#endif /* _PANGOMM_LAYOUTRUN_P_H */ + diff --git a/libs/gtkmm2/pango/pangomm/private/rectangle_p.h b/libs/gtkmm2/pango/pangomm/private/rectangle_p.h new file mode 100644 index 0000000000..4b3e6f2481 --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/private/rectangle_p.h @@ -0,0 +1,6 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _PANGOMM_RECTANGLE_P_H +#define _PANGOMM_RECTANGLE_P_H +#endif /* _PANGOMM_RECTANGLE_P_H */ + diff --git a/libs/gtkmm2/pango/pangomm/private/renderer_p.h b/libs/gtkmm2/pango/pangomm/private/renderer_p.h new file mode 100644 index 0000000000..1c24c86970 --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/private/renderer_p.h @@ -0,0 +1,44 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _PANGOMM_RENDERER_P_H +#define _PANGOMM_RENDERER_P_H +#include <glibmm/private/object_p.h> + +#include <glibmm/class.h> + +namespace Pango +{ + +class Renderer_Class : public Glib::Class +{ +public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Renderer CppObjectType; + typedef PangoRenderer BaseObjectType; + typedef PangoRendererClass BaseClassType; + typedef Glib::Object_Class CppClassParent; + typedef GObjectClass BaseClassParent; + + friend class Renderer; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + const Glib::Class& init(); + + static void class_init_function(void* g_class, void* class_data); + + static Glib::ObjectBase* wrap_new(GObject*); + +protected: + + //Callbacks (default signal handlers): + //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any. + //You could prevent the original default signal handlers being called by overriding the *_impl method. + + //Callbacks (virtual functions): +}; + + +} // namespace Pango + +#endif /* _PANGOMM_RENDERER_P_H */ + diff --git a/libs/gtkmm2/pango/pangomm/private/tabarray_p.h b/libs/gtkmm2/pango/pangomm/private/tabarray_p.h new file mode 100644 index 0000000000..d27ae8534a --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/private/tabarray_p.h @@ -0,0 +1,6 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _PANGOMM_TABARRAY_P_H +#define _PANGOMM_TABARRAY_P_H +#endif /* _PANGOMM_TABARRAY_P_H */ + diff --git a/libs/gtkmm2/pango/pangomm/rectangle.cc b/libs/gtkmm2/pango/pangomm/rectangle.cc new file mode 100644 index 0000000000..4686d3a7d0 --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/rectangle.cc @@ -0,0 +1,84 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include <pangomm/rectangle.h> +#include <pangomm/private/rectangle_p.h> + +/* Copyright (C) 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. + */ + +namespace Pango +{ + +Rectangle::Rectangle() +{ + gobject_.x = gobject_.y = 0; + gobject_.width = gobject_.height = 0; +} + +Rectangle::Rectangle(int x, int y, int width, int height) +{ + gobject_.x = x; + gobject_.y = y; + gobject_.width = width; + gobject_.height = height; +} + +Rectangle::Rectangle(const PangoRectangle* src) +{ + gobject_.x = src->x; + gobject_.y = src->y; + gobject_.width = src->width; + gobject_.height = src->height; +} + +bool Rectangle::equal(const Rectangle& rhs) const +{ + return (get_x() == rhs.get_x() && get_y() == rhs.get_y() && + get_width() == rhs.get_width() && get_height() == rhs.get_height()); +} + +} /* namespace Pango */ + + +namespace Glib +{ + +Pango::Rectangle& wrap(PangoRectangle* object) +{ + return *reinterpret_cast<Pango::Rectangle*>(object); +} + +const Pango::Rectangle& wrap(const PangoRectangle* object) +{ + return *reinterpret_cast<const Pango::Rectangle*>(object); +} + +} /* namespace Glib */ + + +namespace +{ +} // anonymous namespace + + +namespace Pango +{ + + +} // namespace Pango + + diff --git a/libs/gtkmm2/pango/pangomm/rectangle.h b/libs/gtkmm2/pango/pangomm/rectangle.h new file mode 100644 index 0000000000..beb6825406 --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/rectangle.h @@ -0,0 +1,163 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _PANGOMM_RECTANGLE_H +#define _PANGOMM_RECTANGLE_H + +#include <glibmm.h> + +/* Copyright (C) 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/pango-types.h> + + +namespace Pango +{ + +/** A Pango::Rectangle represents a rectangle. + * It is frequently used to represent the logical or ink extents of a single glyph or section of text. + * The coordinate system for each rectangle has its origin at the base line and the horizontal + * origin of the character with increasing coordinates extending to the right and down. + * get_ascent(), get_descent(), get_lbearing(), and get_rbearing() can be used to convert + * from the extents rectangle to more traditional font metrics. + * The units of rectangles usually are in 1/Pango::SCALE of a device unit. + */ +class Rectangle +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef Rectangle CppObjectType; + typedef PangoRectangle BaseObjectType; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +private: + + +public: + Rectangle(); + Rectangle(int x, int y, int width, int height); + explicit Rectangle(const PangoRectangle* src); + + /** Sets the X coordinate of the left side of the rectangle. + * @param x The new X coordinate. + */ + void set_x(int x) { gobject_.x = x; } + + /** Sets the Y coordinate of the top side of the rectangle. + * @param y The new Y coordinate. + */ + void set_y(int y) { gobject_.y = y; } + + /** Sets the width of the rectangle. + * @param w The new width. + */ + void set_width(int w) { gobject_.width = w; } + + /** Sets the height of the rectangle. + * @param h The new height. + */ + void set_height(int h) { gobject_.height = h; } + + /** Gets the X coordinate of the left side of the rectangle. + * @return The X coordinate. + */ + int get_x() const { return gobject_.x; } + + /** Gets the Y coordinate of the top side of the rectangle. + * @return The Y coordinate. + */ + int get_y() const { return gobject_.y; } + + /** Gets the width of the rectangle. + * @return The width. + */ + int get_width() const { return gobject_.width; } + + /** Gets the height of the rectangle. + * @return The height. + */ + int get_height() const { return gobject_.height; } + + /** Extracts the ascent from a Pango::Rectangle representing glyph extents. + * The ascent is the distance from the baseline to the highest point of the character. + * This is positive if the glyph ascends above the baseline. + * @return The ascent of the character. + */ + int get_ascent() const { return PANGO_ASCENT(*gobj()); } + + /** Extracts the descent from a Pango::Rectangle representing glyph extents. + * The descent is the distance from the baseline to the lowest point of the character. + * This is positive if the glyph descends below the baseline. + * @return The descent of the character. + */ + int get_descent() const { return PANGO_DESCENT(*gobj()); } + + /** Extracts the left bearing from a Pango::Rectangle representing glyph extents. + * The left bearing is the distance from the horizontal origin to the farthest left point of the character. + * This is positive for characters drawn completely to the right of the glyph origin. + * @return The left bearing of the character. + */ + int get_lbearing() const { return PANGO_LBEARING(*gobj()); } + + /** Extracts the right bearing from a Pango::Rectangle representing glyph extents. + * The right bearing is the distance from the horizontal origin to the farthest right point of the character. + * This is positive except for characters drawn completely to the left of the horizontal origin. + * @return The right bearing of the character. + */ + int get_rbearing() const { return PANGO_RBEARING(*gobj()); } + + /** Checks for equality of two Pango::Rectangles. + * @param rhs The Pango::Rectangle to compare with. + * @return true if @a rhs is equal with the rectangle. + */ + bool equal(const Rectangle& rhs) const; + + /// Provides access to the underlying C GObject. + PangoRectangle* gobj() { return &gobject_; } + /// Provides access to the underlying C GObject. + const PangoRectangle* gobj() const { return &gobject_; } + +protected: + PangoRectangle gobject_; + + +}; + +/** @relates Pango::Rectangle */ +inline bool operator==(const Rectangle& lhs, const Rectangle& rhs) + { return lhs.equal(rhs); } + +/** @relates Pango::Rectangle */ +inline bool operator!=(const Rectangle& lhs, const Rectangle& rhs) + { return !lhs.equal(rhs); } + +} /* namespace Pango */ + + +namespace Glib +{ + +/** @relates Pango::Rectangle */ +Pango::Rectangle& wrap(PangoRectangle* object); + +/** @relates Pango::Rectangle */ +const Pango::Rectangle& wrap(const PangoRectangle* object); + +} /* namespace Glib */ + +#endif /* _PANGOMM_RECTANGLE_H */ + diff --git a/libs/gtkmm2/pango/pangomm/renderer.cc b/libs/gtkmm2/pango/pangomm/renderer.cc new file mode 100644 index 0000000000..e456fc19cf --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/renderer.cc @@ -0,0 +1,203 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include <pangomm/renderer.h> +#include <pangomm/private/renderer_p.h> + +#include <pango/pango-enum-types.h> +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 2004 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/pango-renderer.h> + +namespace Pango +{ + +} /* namespace Pango */ + + +namespace +{ +} // anonymous namespace + +// static +GType Glib::Value<Pango::RenderPart>::value_type() +{ + return pango_render_part_get_type(); +} + + +namespace Glib +{ + +Glib::RefPtr<Pango::Renderer> wrap(PangoRenderer* object, bool take_copy) +{ + return Glib::RefPtr<Pango::Renderer>( dynamic_cast<Pango::Renderer*> (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} /* namespace Glib */ + + +namespace Pango +{ + + +/* The *_Class implementation: */ + +const Glib::Class& Renderer_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Class has to know the class init function to clone custom types. + class_init_func_ = &Renderer_Class::class_init_function; + + // This is actually just optimized away, apparently with no harm. + // Make sure that the parent type has been created. + //CppClassParent::CppObjectType::get_type(); + + // Create the wrapper type, with the same class/instance size as the base type. + register_derived_type(pango_renderer_get_type()); + + // Add derived versions of interfaces, if the C type implements any interfaces: + } + + return *this; +} + +void Renderer_Class::class_init_function(void* g_class, void* class_data) +{ + BaseClassType *const klass = static_cast<BaseClassType*>(g_class); + CppClassParent::class_init_function(klass, class_data); + +} + + +Glib::ObjectBase* Renderer_Class::wrap_new(GObject* object) +{ + return new Renderer((PangoRenderer*)object); +} + + +/* The implementation: */ + +PangoRenderer* Renderer::gobj_copy() +{ + reference(); + return gobj(); +} + +Renderer::Renderer(const Glib::ConstructParams& construct_params) +: + Glib::Object(construct_params) +{} + +Renderer::Renderer(PangoRenderer* castitem) +: + Glib::Object((GObject*)(castitem)) +{} + +Renderer::~Renderer() +{} + + +Renderer::CppClassType Renderer::renderer_class_; // initialize static member + +GType Renderer::get_type() +{ + return renderer_class_.init().get_type(); +} + +GType Renderer::get_base_type() +{ + return pango_renderer_get_type(); +} + + +void Renderer::draw_layout(const Glib::RefPtr<Layout>& layout, int x, int y) +{ + pango_renderer_draw_layout(gobj(), Glib::unwrap(layout), x, y); +} + +void Renderer::draw_layout_line(const Glib::RefPtr<LayoutLine>& line, int x, int y) +{ + pango_renderer_draw_layout_line(gobj(), Glib::unwrap(line), x, y); +} + +void Renderer::draw_glyphs(const Glib::RefPtr<Font>& font, const GlyphString& glyphs, int x, int y) +{ + pango_renderer_draw_glyphs(gobj(), Glib::unwrap(font), const_cast<PangoGlyphString*>(glyphs.gobj()), x, y); +} + +void Renderer::draw_rectangle(RenderPart part, int x, int y, int width, int height) +{ + pango_renderer_draw_rectangle(gobj(), ((PangoRenderPart)(part)), x, y, width, height); +} + +void Renderer::draw_error_underline(int x, int y, int width, int height) +{ + pango_renderer_draw_error_underline(gobj(), x, y, width, height); +} + +void Renderer::draw_trapezoid(RenderPart part, double y1, double x11, double x21, double y2, double x12, double x22) +{ + pango_renderer_draw_trapezoid(gobj(), ((PangoRenderPart)(part)), y1, x11, x21, y2, x12, x22); +} + +void Renderer::draw_glyph(const Glib::RefPtr<Font>& font, Glyph glyph, double x, double y) +{ + pango_renderer_draw_glyph(gobj(), Glib::unwrap(font), glyph, x, y); +} + +void Renderer::activate() +{ + pango_renderer_activate(gobj()); +} + +void Renderer::deactivate() +{ + pango_renderer_deactivate(gobj()); +} + +void Renderer::part_changed(RenderPart part) +{ + pango_renderer_part_changed(gobj(), ((PangoRenderPart)(part))); +} + +void Renderer::set_color(RenderPart part, const Color& color) +{ + pango_renderer_set_color(gobj(), ((PangoRenderPart)(part)), (color).gobj()); +} + +Color Renderer::get_color(RenderPart part) const +{ + return Color(pango_renderer_get_color(const_cast<PangoRenderer*>(gobj()), ((PangoRenderPart)(part)))); +} + +void Renderer::set_matrix(const Matrix& matrix) +{ + pango_renderer_set_matrix(gobj(), &(matrix)); +} + + +} // namespace Pango + + diff --git a/libs/gtkmm2/pango/pangomm/renderer.h b/libs/gtkmm2/pango/pangomm/renderer.h new file mode 100644 index 0000000000..8428c15b50 --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/renderer.h @@ -0,0 +1,322 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _PANGOMM_RENDERER_H +#define _PANGOMM_RENDERER_H + +#include <glibmm.h> + +/* $Id$ */ + +/* renderer.h + * + * Copyright(C) 2004 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 <glibmm/object.h> +#include <pangomm/context.h> +#include <pangomm/glyphstring.h> +#include <pangomm/layout.h> +#include <pangomm/layoutline.h> +#include <pangomm/types.h> //For Matrix. + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _PangoRenderer PangoRenderer; +typedef struct _PangoRendererClass PangoRendererClass; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Pango +{ class Renderer_Class; } // namespace Pango +namespace Pango +{ + + +/** @addtogroup pangommEnums Enums and Flags */ + +/** + * @ingroup pangommEnums + */ +enum RenderPart +{ + RENDER_PART_FOREGROUND, + RENDER_PART_BACKGROUND, + RENDER_PART_UNDERLINE, + RENDER_PART_STRIKETHROUGH +}; + +} // namespace Pango + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value<Pango::RenderPart> : public Glib::Value_Enum<Pango::RenderPart> +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Pango +{ + + +/** TODO. + */ + +class Renderer : public Glib::Object +{ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +public: + typedef Renderer CppObjectType; + typedef Renderer_Class CppClassType; + typedef PangoRenderer BaseObjectType; + typedef PangoRendererClass BaseClassType; + +private: friend class Renderer_Class; + static CppClassType renderer_class_; + +private: + // noncopyable + Renderer(const Renderer&); + Renderer& operator=(const Renderer&); + +protected: + explicit Renderer(const Glib::ConstructParams& construct_params); + explicit Renderer(PangoRenderer* castitem); + +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +public: + virtual ~Renderer(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + static GType get_type() G_GNUC_CONST; + static GType get_base_type() G_GNUC_CONST; +#endif + + ///Provides access to the underlying C GObject. + PangoRenderer* gobj() { return reinterpret_cast<PangoRenderer*>(gobject_); } + + ///Provides access to the underlying C GObject. + const PangoRenderer* gobj() const { return reinterpret_cast<PangoRenderer*>(gobject_); } + + ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. + PangoRenderer* gobj_copy(); + +private: + + +protected: + +public: + + + /** Draws @a layout with the specified Pango::Renderer. + * + * Since: 1.8 + * @param layout A Pango::Layout. + * @param x X position of left edge of baseline, in user space coordinates + * in Pango units. + * @param y X position of left edge of baseline, in user space coordinates + * in Pango units. + */ + void draw_layout(const Glib::RefPtr<Layout>& layout, int x, int y); + + /** Draws @a line with the specified Pango::Renderer. + * + * Since: 1.8 + * @param line A Pango::LayoutLine. + * @param x X position of left edge of baseline, in user space coordinates + * in Pango units. + * @param y X position of left edge of baseline, in user space coordinates + * in Pango units. + */ + void draw_layout_line(const Glib::RefPtr<LayoutLine>& line, int x, int y); + + /** Draws the glyphs in @a glyphs with the specified Pango::Renderer. + * + * Since: 1.8 + * @param font A Pango::Font. + * @param glyphs A Pango::GlyphString. + * @param x X position of left edge of baseline, in user space coordinates + * in Pango units. + * @param y X position of left edge of baseline, in user space coordinates + * in Pango units. + */ + void draw_glyphs(const Glib::RefPtr<Font>& font, const GlyphString& glyphs, int x, int y); + + /** Draws an axis-aligned rectangle in user space coordinates with the + * specified Pango::Renderer. + * + * Since: 1.8 + * @param part Type of object this rectangle is part of. + * @param x X position at which to draw rectangle, in user space coordinates in Pango units. + * @param y Y position at which to draw rectangle, in user space coordinates in Pango units. + * @param width Width of rectangle in PangoUnits in user space coordinates. + * @param height Height of rectangle in PangoUnits in user space coordinates. + */ + void draw_rectangle(RenderPart part, int x, int y, int width, int height); + + /** Draw a squiggly line that approximately covers the given rectangle + * in the style of an underline used to indicate a spelling error. + * (The width of the underline is rounded to an integer number + * of up/down segments and the resulting rectangle is centered + * in the original rectangle) + * + * Since: 1.8 + * @param x X coordinate of underline, in Pango units in user coordinate system. + * @param y Y coordinate of underline, in Pango units in user coordinate system. + * @param width Width of underline, in Pango units in user coordinate system. + * @param height Height of underline, in Pango units in user coordinate system. + */ + void draw_error_underline(int x, int y, int width, int height); + + /** Draws a trapezoid with the parallel sides aligned with the X axis + * using the given Pango::Renderer; coordinates are in device space. + * + * Since: 1.8 + * @param part Type of object this trapezoid is part of. + * @param y1 Y coordinate of top of trapezoid. + * @param x11 X coordinate of left end of top of trapezoid. + * @param x21 X coordinate of right end of top of trapezoid. + * @param y2 X coordinate of top of trapezoid. + * @param x12 X coordinate of left end of top of trapezoid. + * @param x22 Y coordinate of left end of top of trapezoid. + */ + void draw_trapezoid(RenderPart part, double y1, double x11, double x21, double y2, double x12, double x22); + + /** Draws a single glyph with coordinates in device space. + * + * Since: 1.8 + * @param font A Pango::Font. + * @param glyph The glyph index of a single glyph. + * @param x X coordinate of left edge of baseline of glyph. + * @param y Y coordinate of left edge of baseline of glyph. + */ + void draw_glyph(const Glib::RefPtr<Font>& font, Glyph glyph, double x, double y); + + + /** Does initial setup before rendering operations on @a renderer . + * deactivate() should be called when done drawing. + * Calls such as draw_layout() automatically + * activate the layout before drawing on it. Calls to + * activate() and deactivate() can + * be nested and the renderer will only be initialized and + * deinitialized once. + * + * Since: 1.8 + */ + void activate(); + + /** Cleans up after rendering operations on @a renderer . See + * docs for activate(). + * + * Since: 1.8 + */ + void deactivate(); + + + /** Informs Pango that the way that the renderering is done + * for @a part has changed in a way that would prevent multiple + * pieces being joined together into one drawing call. For + * instance, if a subclass of Pango::Renderer was to add a stipple + * option for drawing underlines, it needs to call + * + * @code + * pango_renderer_part_changed (render, PANGO_RENDER_PART_UNDERLINE); + * @endcode + * + * When the stipple changes or underlines with different stipples + * might be joined together. Pango automatically calls this for + * changes to colors. (See set_color()) + * + * Since: 1.8 + * @param part The part for which rendering has changed. + */ + void part_changed(RenderPart part); + + + /** Sets the color for part of the rendering. + * + * Since: 1.8 + * @param part The part to change the color of. + * @param color The new color or <tt>0</tt> to unset the current color. + */ + void set_color(RenderPart part, const Color& color); + + + /** Gets the current rendering color for the specified part. + * @param part The part to get the color for. + * @return The color for the specified part, or <tt>0</tt> + * if it hasn't been set and should be inherited from the + * environment. + * + * Since: 1.8. + */ + Color get_color(RenderPart part) const; + + + /** Sets the transformation matrix that will be applied when rendering. + * + * Since: 1.8 + * @param matrix A Pango::Matrix, or <tt>0</tt> to unset any existing matrix. + * (No matrix set is the same as setting the identity matrix.). + */ + void set_matrix(const Matrix& matrix); + //TOOD: _WRAP_METHOD(Matrix get_matrix(), pango_renderer_get_matrix) + //Note: The returned matrix is owned by Pango and must not be modified or freed. + + +public: + +public: + //C++ methods used to invoke GTK+ virtual functions: + +protected: + //GTK+ Virtual Functions (override these to change behaviour): + + //Default Signal Handlers:: + + +}; + +} /* namespace Pango */ + + +namespace Glib +{ + /** @relates Pango::Renderer + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ + Glib::RefPtr<Pango::Renderer> wrap(PangoRenderer* object, bool take_copy = false); +} + + +#endif /* _PANGOMM_RENDERER_H */ + diff --git a/libs/gtkmm2/pango/pangomm/tabarray.cc b/libs/gtkmm2/pango/pangomm/tabarray.cc new file mode 100644 index 0000000000..57353f418a --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/tabarray.cc @@ -0,0 +1,181 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include <pangomm/tabarray.h> +#include <pangomm/private/tabarray_p.h> + +#include <pango/pango-enum-types.h> +// -*- c++ -*- +/* $Id$ */ + +/* + * + * Copyright 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. + */ + +namespace Pango +{ + +TabArray::TabArray(int initial_size, bool positions_in_pixels) +{ + gobject_ = pango_tab_array_new(initial_size, (gboolean)positions_in_pixels); +} + +std::pair<TabAlign,int> TabArray::get_tab(int tab_index) const +{ + TabAlign alignment; + int location; + pango_tab_array_get_tab(const_cast<PangoTabArray*>(gobj()), tab_index, (PangoTabAlign*)&alignment, &location); + return std::pair<TabAlign,int>(alignment, location); +} + +Glib::ArrayHandle< std::pair<TabAlign,int> > TabArray::get_tabs() const +{ + typedef std::pair<TabAlign,int> PairType; + + PairType* pair_buffer = 0; + const int size = pango_tab_array_get_size(const_cast<PangoTabArray*>(gobj())); + + if(size > 0) + { + // Get arrays + PangoTabAlign* pAlignments = 0; + int* pLocations = 0; + pango_tab_array_get_tabs(const_cast<PangoTabArray*>(gobj()), &pAlignments, &pLocations); + + if(pAlignments && pLocations) + { + // Create temporary C array. Fortunately, the C++ type is POD, + // so we can safely store it in the array. + pair_buffer = g_new(PairType, size); + + for(int i = 0; i < size; ++i) + { + pair_buffer[i].first = (TabAlign)(pAlignments[i]); + pair_buffer[i].second = pLocations[i]; + } + } + + g_free(pAlignments); + g_free(pLocations); + } + + return Glib::ArrayHandle<PairType>(pair_buffer, size, Glib::OWNERSHIP_SHALLOW); +} + +} /* namespace Pango */ + + +namespace +{ +} // anonymous namespace + +// static +GType Glib::Value<Pango::TabAlign>::value_type() +{ + return pango_tab_align_get_type(); +} + + +namespace Glib +{ + +Pango::TabArray wrap(PangoTabArray* object, bool take_copy) +{ + return Pango::TabArray(object, take_copy); +} + +} // namespace Glib + + +namespace Pango +{ + + +// static +GType TabArray::get_type() +{ + return pango_tab_array_get_type(); +} + +TabArray::TabArray() +: + gobject_ (0) // Allows creation of invalid wrapper, e.g. for output arguments to methods. +{} + +TabArray::TabArray(const TabArray& other) +: + gobject_ ((other.gobject_) ? pango_tab_array_copy(other.gobject_) : 0) +{} + +TabArray::TabArray(PangoTabArray* gobject, bool make_a_copy) +: + // For BoxedType wrappers, make_a_copy is true by default. The static + // BoxedType wrappers must always take a copy, thus make_a_copy = true + // ensures identical behaviour if the default argument is used. + gobject_ ((make_a_copy && gobject) ? pango_tab_array_copy(gobject) : gobject) +{} + +TabArray& TabArray::operator=(const TabArray& other) +{ + TabArray temp (other); + swap(temp); + return *this; +} + +TabArray::~TabArray() +{ + if(gobject_) + pango_tab_array_free(gobject_); +} + +void TabArray::swap(TabArray& other) +{ + PangoTabArray *const temp = gobject_; + gobject_ = other.gobject_; + other.gobject_ = temp; +} + +PangoTabArray* TabArray::gobj_copy() const +{ + return pango_tab_array_copy(gobject_); +} + + +int TabArray::get_size() const +{ + return pango_tab_array_get_size(const_cast<PangoTabArray*>(gobj())); +} + +void TabArray::resize(int new_size) +{ + pango_tab_array_resize(gobj(), new_size); +} + +void TabArray::set_tab(int tab_index, TabAlign alignment, int location) +{ + pango_tab_array_set_tab(gobj(), tab_index, ((PangoTabAlign)(alignment)), location); +} + +bool TabArray::get_positions_in_pixels() const +{ + return pango_tab_array_get_positions_in_pixels(const_cast<PangoTabArray*>(gobj())); +} + + +} // namespace Pango + + diff --git a/libs/gtkmm2/pango/pangomm/tabarray.h b/libs/gtkmm2/pango/pangomm/tabarray.h new file mode 100644 index 0000000000..7a5850c663 --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/tabarray.h @@ -0,0 +1,195 @@ +// -*- c++ -*- +// Generated by gtkmmproc -- DO NOT MODIFY! +#ifndef _PANGOMM_TABARRAY_H +#define _PANGOMM_TABARRAY_H + +#include <glibmm.h> + +/* $Id$ */ + +/* tabarray.h + * + * Copyright (C) 1998-1999 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 <pangomm/attrlist.h> +#include <pango/pango-tabs.h> +#include <pango/pango-break.h> //For PangoLogAttrs. + +#include <utility> +#include <glibmmconfig.h> +GLIBMM_USING_STD(pair) + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +extern "C" { typedef struct _PangoTabArray PangoTabArray; } +#endif + +namespace Pango +{ + + +/** @addtogroup pangommEnums Enums and Flags */ + +/** + * @ingroup pangommEnums + */ +enum TabAlign +{ + TAB_LEFT +}; + +} // namespace Pango + + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +namespace Glib +{ + +template <> +class Value<Pango::TabAlign> : public Glib::Value_Enum<Pango::TabAlign> +{ +public: + static GType value_type() G_GNUC_CONST; +}; + +} // namespace Glib +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + +namespace Pango +{ + + +/** A Pango::TabArray contains an array of tab stops. + * Each tab stop has an alignment and a position. + */ +class TabArray +{ + public: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + typedef TabArray CppObjectType; + typedef PangoTabArray BaseObjectType; + + static GType get_type() G_GNUC_CONST; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + + TabArray(); + + explicit TabArray(PangoTabArray* gobject, bool make_a_copy = true); + + TabArray(const TabArray& other); + TabArray& operator=(const TabArray& other); + + ~TabArray(); + + void swap(TabArray& other); + + ///Provides access to the underlying C instance. + PangoTabArray* gobj() { return gobject_; } + + ///Provides access to the underlying C instance. + const PangoTabArray* gobj() const { return gobject_; } + + ///Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs. + PangoTabArray* gobj_copy() const; + +protected: + PangoTabArray* gobject_; + +private: + + +public: + explicit TabArray(int initial_size, bool positions_in_pixels = true); + + + /** Gets the number of tab stops in @a tab_array . + * @return The number of tab stops in the array. + */ + int get_size() const; + + /** Resizes a tab array. You must subsequently initialize any tabs that + * were added as a result of growing the array. + * @param new_size New size of the array. + */ + void resize(int new_size); + + /** Sets the alignment and location of a tab stop. + * @a alignment must always be Pango::TAB_LEFT in the current + * implementation. + * @param tab_index The index of a tab stop. + * @param alignment Tab alignment. + * @param location Tab location in pango units. + */ + void set_tab(int tab_index, TabAlign alignment, int location); + + /** Gets the alignment and position of a tab stop. + * @return An std::pair<TabAlign, int>. The first element represents the tab stop alignment, the second one is the tab position. + */ + std::pair<TabAlign,int> get_tab(int tab_index) const; + + /** Gets an array of std::pairs containing the tab stop alignments and tab positions. + * @return An array of std::pair<TabAlign, int>. The first element in each pair represents the tab stop alignment, the second one is the tab position. + */ + Glib::ArrayHandle< std::pair<TabAlign,int> > get_tabs() const; + + + /** Returns <tt>true</tt> if the tab positions are in pixels, <tt>false</tt> if they are + * in Pango units. + * @return Whether positions are in pixels. + */ + bool get_positions_in_pixels() const; + + +}; + +} //namespace Pango + + +namespace Pango +{ + +/** @relates Pango::TabArray + * @param lhs The left-hand side + * @param rhs The right-hand side + */ +inline void swap(TabArray& lhs, TabArray& rhs) + { lhs.swap(rhs); } + +} // namespace Pango + +namespace Glib +{ + +/** @relates Pango::TabArray + * @param object The C instance + * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. + * @result A C++ instance that wraps this C instance. + */ +Pango::TabArray wrap(PangoTabArray* object, bool take_copy = false); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +template <> +class Value<Pango::TabArray> : public Glib::Value_Boxed<Pango::TabArray> +{}; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +} // namespace Glib + +#endif /* _PANGOMM_TABARRAY_H */ + diff --git a/libs/gtkmm2/pango/pangomm/types.h b/libs/gtkmm2/pango/pangomm/types.h new file mode 100644 index 0000000000..4ed2f12783 --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/types.h @@ -0,0 +1,34 @@ +/* $Id$ */ + +/* Copyright (C) 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. + */ + +#ifndef _PANGOMM_TYPES_H +#define _PANGOMM_TYPES_H + +#include <pango/pango-types.h> + +namespace Pango +{ + +typedef PangoMatrix Matrix; + +} // namespace Pango + + +#endif /* _PANGOMM_TYPES_H */ + diff --git a/libs/gtkmm2/pango/pangomm/wrap_init.cc b/libs/gtkmm2/pango/pangomm/wrap_init.cc new file mode 100644 index 0000000000..348d28fabd --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/wrap_init.cc @@ -0,0 +1,100 @@ + +#include <glib.h> + +// Disable the 'const' function attribute of the get_type() functions. +// GCC would optimize them out because we don't use the return value. +#undef G_GNUC_CONST +#define G_GNUC_CONST /* empty */ + +#include <pangomm/wrap_init.h> +#include <glibmm/error.h> +#include <glibmm/object.h> + +// #include the widget headers so that we can call the get_type() static methods: + +#include "attributes.h" +#include "attriter.h" +#include "attrlist.h" +#include "color.h" +#include "context.h" +#include "coverage.h" +#include "font.h" +#include "fontdescription.h" +#include "fontface.h" +#include "fontfamily.h" +#include "fontmap.h" +#include "fontmetrics.h" +#include "fontset.h" +#include "glyph.h" +#include "glyphstring.h" +#include "item.h" +#include "language.h" +#include "layout.h" +#include "layoutiter.h" +#include "layoutline.h" +#include "layoutrun.h" +#include "rectangle.h" +#include "renderer.h" +#include "tabarray.h" + +extern "C" +{ + +//Declarations of the *_get_type() functions: + +GType pango_context_get_type(void); +GType pango_font_get_type(void); +GType pango_font_face_get_type(void); +GType pango_font_family_get_type(void); +GType pango_font_map_get_type(void); +GType pango_fontset_get_type(void); +GType pango_layout_get_type(void); +GType pango_renderer_get_type(void); + +//Declarations of the *_error_quark() functions: + +} // extern "C" + + +//Declarations of the *_Class::wrap_new() methods, instead of including all the private headers: + +namespace Pango { class Context_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; } +namespace Pango { class Font_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; } +namespace Pango { class FontFace_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; } +namespace Pango { class FontFamily_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; } +namespace Pango { class FontMap_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; } +namespace Pango { class Fontset_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; } +namespace Pango { class Layout_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; } +namespace Pango { class Renderer_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; } + +namespace Pango { + +void wrap_init() +{ + // Register Error domains: + +// Map gtypes to gtkmm wrapper-creation functions: + Glib::wrap_register(pango_context_get_type(), &Pango::Context_Class::wrap_new); + Glib::wrap_register(pango_font_get_type(), &Pango::Font_Class::wrap_new); + Glib::wrap_register(pango_font_face_get_type(), &Pango::FontFace_Class::wrap_new); + Glib::wrap_register(pango_font_family_get_type(), &Pango::FontFamily_Class::wrap_new); + Glib::wrap_register(pango_font_map_get_type(), &Pango::FontMap_Class::wrap_new); + Glib::wrap_register(pango_fontset_get_type(), &Pango::Fontset_Class::wrap_new); + Glib::wrap_register(pango_layout_get_type(), &Pango::Layout_Class::wrap_new); + Glib::wrap_register(pango_renderer_get_type(), &Pango::Renderer_Class::wrap_new); + + // Register the gtkmm gtypes: + Pango::Context::get_type(); + Pango::Font::get_type(); + Pango::FontFace::get_type(); + Pango::FontFamily::get_type(); + Pango::FontMap::get_type(); + Pango::Fontset::get_type(); + Pango::Layout::get_type(); + Pango::Renderer::get_type(); + +} // wrap_init() + +} //Pango + + diff --git a/libs/gtkmm2/pango/pangomm/wrap_init.h b/libs/gtkmm2/pango/pangomm/wrap_init.h new file mode 100644 index 0000000000..fd4cd217dd --- /dev/null +++ b/libs/gtkmm2/pango/pangomm/wrap_init.h @@ -0,0 +1,32 @@ +#ifndef _PANGOMM_WRAP_INIT_H +#define _PANGOMM_WRAP_INIT_H + +/* wrap_init.h + * + * Copyright (C) 1998-2001 The Gtk-- 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. + */ + +// wrap_init.cc is generated by tools/generate_wrap_init.pl + +namespace Pango +{ + +void wrap_init(); + +} /* namespace Pango */ + +#endif // _PANGOMM_WRAP_INIT_H |