Upgrade gtkmm to 2.10.8, glibmm to 2.13.3 and add cairomm 1.2.4
[ardour.git] / libs / gtkmm2 / pango / pangomm / layoutiter.h
1 // -*- c++ -*-
2 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #ifndef _PANGOMM_LAYOUTITER_H
4 #define _PANGOMM_LAYOUTITER_H
5
6
7 #include <glibmm.h>
8
9 /* $Id$ */
10
11 /* layoutiter.h
12  *
13  * Copyright 2001-2002 The gtkmm Development Team
14  *
15  * This library is free software; you can redistribute it and/or
16  * modify it under the terms of the GNU Library General Public
17  * License as published by the Free Software Foundation; either
18  * version 2 of the License, or (at your option) any later version.
19  *
20  * This library is distributed in the hope that it will be useful,
21  * but WITHOUT ANY WARRANTY; without even the implied warranty of
22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
23  * Library General Public License for more details.
24  *
25  * You should have received a copy of the GNU Library General Public
26  * License along with this library; if not, write to the Free
27  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28  */
29
30 #include <pangomm/layoutline.h>
31 #include <pangomm/layoutrun.h>
32 #include <pango/pango-layout.h>
33
34
35 namespace Pango
36 {
37
38 /** A Pango::LayoutIter can be used to iterate over the visual extents of a Pango::Layout.
39  */
40 class LayoutIter
41 {
42   public:
43 #ifndef DOXYGEN_SHOULD_SKIP_THIS
44   typedef LayoutIter CppObjectType;
45   typedef PangoLayoutIter BaseObjectType;
46 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
47
48 private:
49
50   
51 public:
52   // There's no other ctor, and the default ctor creates an invalid object.
53   // Therefore, Pango::LayoutIter is usable only as output argument.
54   LayoutIter();
55   ~LayoutIter();
56
57   
58   /** Gets the current byte index. Note that iterating forward by char
59    * moves in visual order, not logical order, so indexes may not be
60    * sequential. Also, the index may be equal to the length of the text
61    * in the layout, if on the <tt>0</tt> run (see pango_layout_iter_get_run()).
62    * @return Current byte index.
63    */
64   int get_index() const;
65   
66   /** Gets the current run. When iterating by run, at the end of each
67    * line, there's a position with a <tt>0</tt> run, so this function can return
68    * <tt>0</tt>. The <tt>0</tt> run at the end of each line ensures that all lines have
69    * at least one run, even lines consisting of only a newline.
70    * @return The current run.
71    */
72   LayoutRun get_run() const;
73   
74   /** Gets the current line.
75    * @return The current line.
76    */
77   Glib::RefPtr<LayoutLine> get_line() const;
78   
79   /** Determines whether @a iter  is on the last line of the layout.
80    * @return <tt>true</tt> if @a iter  is on the last line.
81    */
82   bool at_last_line() const;
83
84   
85   /** Moves @a iter  forward to the next character in visual order. If @a iter  was already at
86    * the end of the layout, returns <tt>false</tt>.
87    * @return Whether motion was possible.
88    */
89   bool next_char();
90   
91   /** Moves @a iter  forward to the next cluster in visual order. If @a iter 
92    * was already at the end of the layout, returns <tt>false</tt>.
93    * @return Whether motion was possible.
94    */
95   bool next_cluster();
96   
97   /** Moves @a iter  forward to the next run in visual order. If @a iter  was
98    * already at the end of the layout, returns <tt>false</tt>.
99    * @return Whether motion was possible.
100    */
101   bool next_run();
102   
103   /** Moves @a iter  forward to the start of the next line. If @a iter  is
104    * already on the last line, returns <tt>false</tt>.
105    * @return Whether motion was possible.
106    */
107   bool next_line();
108
109   /** Gets the extents of the current character, in layout coordinates (origin is the top left of the entire layout).
110    * Only logical extents can sensibly be obtained for characters; ink extents make sense only down to the level of clusters.
111    * @return The logical extents of the current character.
112    */
113   Rectangle get_char_extents() const;
114
115   
116   /** Gets the extents of the current cluster, in layout coordinates
117    * (origin is the top left of the entire layout).
118    * @param ink_rect Rectangle to fill with ink extents.
119    * @param logical_rect Rectangle to fill with logical extents.
120    */
121   void get_cluster_extents(Rectangle& ink_rect, Rectangle& logical_rect) const;
122
123   /** Gets the ink extents of the current cluster, in layout coordinates (origin is the top left of the entire layout).
124    * @return The extents of the current cluster as drawn.
125    */
126   Rectangle get_cluster_ink_extents() const;
127
128   /** Gets the logical extents of the current cluster, in layout coordinates (origin is the top left of the entire layout).
129    * @return The logical extents of the current cluster.
130    */
131   Rectangle get_cluster_logical_extents() const;
132
133   
134   /** Gets the extents of the current run in layout coordinates
135    * (origin is the top left of the entire layout).
136    * @param ink_rect Rectangle to fill with ink extents.
137    * @param logical_rect Rectangle to fill with logical extents.
138    */
139   void get_run_extents(Rectangle& ink_rect, Rectangle& logical_rect) const;
140
141   /** Gets the ink extents of the current run in layout coordinates (origin is the top left of the entire layout).
142    * @return The extents of the current run as drawn.
143    */
144   Rectangle get_run_ink_extents() const;
145
146   /** Gets the logical extents of the current run in layout coordinates (origin is the top left of the entire layout).
147    * @return The logical extents of the current run.
148    */
149   Rectangle get_run_logical_extents() const;
150
151   
152   /** Obtains the extents of the current line. @a ink_rect  or @a logical_rect 
153    * can be <tt>0</tt> if you aren't interested in them. Extents are in layout
154    * coordinates (origin is the top-left corner of the entire
155    * Pango::Layout).  Thus the extents returned by this function will be
156    * the same width/height but not at the same x/y as the extents
157    * returned from pango_layout_line_get_extents().
158    * @param ink_rect Rectangle to fill with ink extents.
159    * @param logical_rect Rectangle to fill with logical extents.
160    */
161   void get_line_extents(Rectangle& ink_rect, Rectangle& logical_rect) const;
162
163   /** Obtains the ink extents of the current line.
164    * @return The extents of the current line as drawn.
165    */
166   Rectangle get_line_ink_extents() const;
167
168   /** Obtains the logical extents of the current line.
169    * @return The logical extents of the current line.
170    */
171   Rectangle get_line_logical_extents() const;
172
173   
174   /** Divides the vertical space in the Pango::Layout being iterated over
175    * between the lines in the layout, and returns the space belonging to
176    * the current line.  A line's range includes the line's logical
177    * extents, plus half of the spacing above and below the line, if
178    * pango_layout_set_spacing() has been called to set layout spacing.
179    * The y positions are in layout coordinates (origin at top left of the
180    * entire layout).
181    * @param y0 Start of line.
182    * @param y1 End of line.
183    */
184   void get_line_yrange(int& y0, int& y1) const;
185
186   
187   /** Obtains the extents of the Pango::Layout being iterated
188    * over. @a ink_rect  or @a logical_rect  can be <tt>0</tt> if you
189    * aren't interested in them.
190    * @param ink_rect Rectangle to fill with ink extents.
191    * @param logical_rect Rectangle to fill with logical extents.
192    */
193   void get_layout_extents(Rectangle& ink_rect, Rectangle& logical_rect) const;
194
195   /** Obtains the ink extents of the Pango::Layout being iterated over.
196    * @return The extents of the layout as drawn.
197    */
198   Rectangle get_layout_ink_extents() const;
199
200   /** Obtains the logical extents of the Pango::Layout being iterated over.
201    * @return The logical extents of the layout.
202    */
203   Rectangle get_layout_logical_extents() const;
204
205   
206   /** Gets the y position of the current line's baseline, in layout
207    * coordinates (origin at top left of the entire layout).
208    * @return Baseline of current line.
209    */
210   int get_baseline() const;
211
212   /// Provides access to the underlying C GObject.  
213   PangoLayoutIter*       gobj()       { return gobject_; }
214   /// Provides access to the underlying C GObject.
215   const PangoLayoutIter* gobj() const { return gobject_; }
216
217 #ifndef DOXYGEN_SHOULD_SKIP_THIS
218   void assign_gobj(PangoLayoutIter* src);
219 #endif
220
221 protected:
222   PangoLayoutIter* gobject_;
223
224 private:
225   // noncopyable
226   LayoutIter(const LayoutIter&);
227   LayoutIter& operator=(const LayoutIter&);
228
229
230 };
231
232 } //namespace Pango
233
234
235 #endif /* _PANGOMM_LAYOUTITER_H */
236