MIDI branch becomes trunk
[ardour.git] / libs / gtkmm2 / pango / pangomm / fontmetrics.h
1 // -*- c++ -*-
2 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #ifndef _PANGOMM_FONTMETRICS_H
4 #define _PANGOMM_FONTMETRICS_H
5
6 #include <glibmm.h>
7
8 /* $Id$ */
9
10 /* fontmetrics.h
11  *
12  * Copyright (C) 1998-1999 The gtkmm Development Team
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 #include <pango/pango-font.h>
30
31
32 #ifndef DOXYGEN_SHOULD_SKIP_THIS
33 extern "C" { typedef struct _PangoFontMetrics PangoFontMetrics; }
34 #endif
35
36 namespace Pango
37 {
38
39 /** A Pango::FontMetrics holds the overall metric information for a font (possibly restricted to a script).
40  */
41 class FontMetrics
42 {
43   public:
44 #ifndef DOXYGEN_SHOULD_SKIP_THIS
45   typedef FontMetrics CppObjectType;
46   typedef PangoFontMetrics BaseObjectType;
47
48   static GType get_type() G_GNUC_CONST;
49 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
50
51   FontMetrics();
52
53   explicit FontMetrics(PangoFontMetrics* gobject, bool make_a_copy = true);
54
55   FontMetrics(const FontMetrics& other);
56   FontMetrics& operator=(const FontMetrics& other);
57
58   ~FontMetrics();
59
60   void swap(FontMetrics& other);
61
62   ///Provides access to the underlying C instance.
63   PangoFontMetrics*       gobj()       { return gobject_; }
64
65   ///Provides access to the underlying C instance.
66   const PangoFontMetrics* gobj() const { return gobject_; }
67
68   ///Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs.
69   PangoFontMetrics* gobj_copy() const;
70
71 protected:
72   PangoFontMetrics* gobject_;
73
74 private:
75
76   
77 public:
78   
79   /** Gets the ascent from a font metrics structure. The ascent is
80    * the distance from the baseline to the logical top of a line
81    * of text. (The logical top may be above or below the top of the
82    * actual drawn ink. It is necessary to lay out the text to figure
83    * where the ink will be.)
84    * @return The ascent, in pango units. (1 point == Pango::SCALE pango units.).
85    */
86   int get_ascent() const;
87   
88   /** Gets the descent from a font metrics structure. The descent is
89    * the distance from the baseline to the logical bottom of a line
90    * of text. (The logical bottom may be above or below the bottom of the
91    * actual drawn ink. It is necessary to lay out the text to figure
92    * where the ink will be.)
93    * @return The descent, in pango units. (1 point == Pango::SCALE pango units.).
94    */
95   int get_descent() const;
96   
97   /** Gets the approximate character width for a font metrics structure.
98    * This is merely a representative value useful, for example, for
99    * determining the initial size for a window. Actual characters in
100    * text will be wider and narrower than this.
101    * @return The character width, in pango units. (1 point == Pango::SCALE pango units.).
102    */
103   int get_approximate_char_width() const;
104   
105   /** Gets the approximate digit width for a font metrics structure.
106    * This is merely a representative value useful, for example, for
107    * determining the initial size for a window. Actual digits in
108    * text can be wider and narrower than this, though this value
109    * is generally somewhat more accurate than the result of
110    * pango_font_metrics_get_approximate_digit_width().
111    * @return The digit width, in pango units. (1 point == Pango::SCALE pango units.).
112    */
113   int get_approximate_digit_width() const;
114
115   
116   /** Gets the suggested position to draw the underline.
117    * The value returned is the distance <em>above</em> the
118    * baseline of the top of the underline. Since most fonts have
119    * underline positions beneath the baseline, this value is typically
120    * negative.
121    * @return The suggested underline position, in Pango units.
122    * 
123    * Since: 1.6.
124    */
125   int get_underline_position() const;
126   
127   /** Gets the suggested thickness to draw for the underline.
128    * @return The suggested underline thickness, in Pango units.
129    * 
130    * Since: 1.6.
131    */
132   int get_underline_thickness() const;
133   
134   /** Gets the suggested position to draw the strikethrough.
135    * The value returned is the distance <em>above</em> the
136    * baseline of the top of the strikethrough.
137    * @return The suggested strikethrough position, in Pango units.
138    * 
139    * Since: 1.6.
140    */
141   int get_strikethrough_position() const;
142   
143   /** Gets the suggested thickness to draw for the strikethrough.
144    * @return The suggested strikethrough thickness, in Pango units.
145    * 
146    * Since: 1.6.
147    */
148   int get_strikethrough_thickness() const;
149
150
151 };
152
153 } //namespace Pango
154
155
156 namespace Pango
157 {
158
159 /** @relates Pango::FontMetrics
160  * @param lhs The left-hand side
161  * @param rhs The right-hand side
162  */
163 inline void swap(FontMetrics& lhs, FontMetrics& rhs)
164   { lhs.swap(rhs); }
165
166 } // namespace Pango
167
168 namespace Glib
169 {
170
171 /** @relates Pango::FontMetrics
172  * @param object The C instance
173  * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
174  * @result A C++ instance that wraps this C instance.
175  */
176 Pango::FontMetrics wrap(PangoFontMetrics* object, bool take_copy = false);
177
178 #ifndef DOXYGEN_SHOULD_SKIP_THIS
179 template <>
180 class Value<Pango::FontMetrics> : public Glib::Value_Boxed<Pango::FontMetrics>
181 {};
182 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
183
184 } // namespace Glib
185
186 #endif /* _PANGOMM_FONTMETRICS_H */
187