MIDI branch becomes trunk
[ardour.git] / libs / gtkmm2 / pango / pangomm / font.cc
1 // Generated by gtkmmproc -- DO NOT MODIFY!
2
3 #include <pangomm/font.h>
4 #include <pangomm/private/font_p.h>
5
6 // -*- c++ -*-
7 /* $Id$ */
8
9 /* 
10  *
11  * Copyright 1998-1999 The Gtk-- Development Team
12  * Copyright 2001      Free Software Foundation
13  *
14  * This library is free software; you can redistribute it and/or
15  * modify it under the terms of the GNU Library General Public
16  * License as published by the Free Software Foundation; either
17  * version 2 of the License, or (at your option) any later version.
18  *
19  * This library is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
22  * Library General Public License for more details.
23  *
24  * You should have received a copy of the GNU Library General Public
25  * License along with this library; if not, write to the Free
26  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27  */
28
29 namespace Pango
30 {
31
32 FontMetrics Font::get_metrics() const
33 {
34   return FontMetrics(pango_font_get_metrics(const_cast<PangoFont*>(gobj()), 0));
35 }
36
37 Rectangle Font::get_glyph_ink_extents(Glyph glyph) const
38 {
39   Rectangle ink_rect;
40   pango_font_get_glyph_extents(const_cast<PangoFont*>(gobj()), glyph, ink_rect.gobj(), 0);
41   return ink_rect;
42 }
43
44 Rectangle Font::get_glyph_logical_extents(Glyph glyph) const
45 {
46   Rectangle logical_rect;
47   pango_font_get_glyph_extents(const_cast<PangoFont*>(gobj()), glyph, 0, logical_rect.gobj());
48   return logical_rect;
49 }
50
51 } /* namespace Pango */
52
53
54 namespace
55 {
56 } // anonymous namespace
57
58
59 namespace Glib
60 {
61
62 Glib::RefPtr<Pango::Font> wrap(PangoFont* object, bool take_copy)
63 {
64   return Glib::RefPtr<Pango::Font>( dynamic_cast<Pango::Font*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
65   //We use dynamic_cast<> in case of multiple inheritance.
66 }
67
68 } /* namespace Glib */
69
70
71 namespace Pango
72 {
73
74
75 /* The *_Class implementation: */
76
77 const Glib::Class& Font_Class::init()
78 {
79   if(!gtype_) // create the GType if necessary
80   {
81     // Glib::Class has to know the class init function to clone custom types.
82     class_init_func_ = &Font_Class::class_init_function;
83
84     // This is actually just optimized away, apparently with no harm.
85     // Make sure that the parent type has been created.
86     //CppClassParent::CppObjectType::get_type();
87
88     // Create the wrapper type, with the same class/instance size as the base type.
89     register_derived_type(pango_font_get_type());
90
91     // Add derived versions of interfaces, if the C type implements any interfaces:
92   }
93
94   return *this;
95 }
96
97 void Font_Class::class_init_function(void* g_class, void* class_data)
98 {
99   BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
100   CppClassParent::class_init_function(klass, class_data);
101
102 }
103
104
105 Glib::ObjectBase* Font_Class::wrap_new(GObject* object)
106 {
107   return new Font((PangoFont*)object);
108 }
109
110
111 /* The implementation: */
112
113 PangoFont* Font::gobj_copy()
114 {
115   reference();
116   return gobj();
117 }
118
119 Font::Font(const Glib::ConstructParams& construct_params)
120 :
121   Glib::Object(construct_params)
122 {}
123
124 Font::Font(PangoFont* castitem)
125 :
126   Glib::Object((GObject*)(castitem))
127 {}
128
129 Font::~Font()
130 {}
131
132
133 Font::CppClassType Font::font_class_; // initialize static member
134
135 GType Font::get_type()
136 {
137   return font_class_.init().get_type();
138 }
139
140 GType Font::get_base_type()
141 {
142   return pango_font_get_type();
143 }
144
145
146 FontDescription Font::describe() const
147 {
148   return FontDescription((pango_font_describe(const_cast<PangoFont*>(gobj()))));
149 }
150
151 Glib::RefPtr<Coverage> Font::get_coverage(const Language& language) const
152 {
153   return Glib::wrap(pango_font_get_coverage(const_cast<PangoFont*>(gobj()), const_cast<PangoLanguage*>((language).gobj())));
154 }
155
156 FontMetrics Font::get_metrics(const Language& language) const
157 {
158   return FontMetrics((pango_font_get_metrics(const_cast<PangoFont*>(gobj()), const_cast<PangoLanguage*>((language).gobj()))));
159 }
160
161 void Font::get_glyph_extents(Glyph glyph, Rectangle& ink_rect, Rectangle& logical_rect) const
162 {
163   pango_font_get_glyph_extents(const_cast<PangoFont*>(gobj()), glyph, (ink_rect).gobj(), (logical_rect).gobj());
164 }
165
166
167 } // namespace Pango
168
169