2 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #ifndef _PANGOMM_LAYOUTITER_H
4 #define _PANGOMM_LAYOUTITER_H
13 * Copyright 2001-2002 The gtkmm Development Team
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.
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.
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.
30 #include <pangomm/layoutline.h>
31 #include <pangomm/layoutrun.h>
32 #include <pango/pango-layout.h>
38 /** A Pango::LayoutIter can be used to iterate over the visual extents of a Pango::Layout.
43 #ifndef DOXYGEN_SHOULD_SKIP_THIS
44 typedef LayoutIter CppObjectType;
45 typedef PangoLayoutIter BaseObjectType;
46 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
52 // There's no other ctor, and the default ctor creates an invalid object.
53 // Therefore, Pango::LayoutIter is usable only as output argument.
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.
64 int get_index() const;
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.
72 LayoutRun get_run() const;
74 /** Gets the current line.
75 * @return The current line.
77 Glib::RefPtr<LayoutLine> get_line() const;
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.
82 bool at_last_line() const;
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.
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.
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.
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.
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.
113 Rectangle get_char_extents() const;
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.
121 void get_cluster_extents(Rectangle& ink_rect, Rectangle& logical_rect) const;
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.
126 Rectangle get_cluster_ink_extents() const;
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.
131 Rectangle get_cluster_logical_extents() const;
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.
139 void get_run_extents(Rectangle& ink_rect, Rectangle& logical_rect) const;
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.
144 Rectangle get_run_ink_extents() const;
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.
149 Rectangle get_run_logical_extents() const;
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.
161 void get_line_extents(Rectangle& ink_rect, Rectangle& logical_rect) const;
163 /** Obtains the ink extents of the current line.
164 * @return The extents of the current line as drawn.
166 Rectangle get_line_ink_extents() const;
168 /** Obtains the logical extents of the current line.
169 * @return The logical extents of the current line.
171 Rectangle get_line_logical_extents() const;
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
181 * @param y0 Start of line.
182 * @param y1 End of line.
184 void get_line_yrange(int& y0, int& y1) const;
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.
193 void get_layout_extents(Rectangle& ink_rect, Rectangle& logical_rect) const;
195 /** Obtains the ink extents of the Pango::Layout being iterated over.
196 * @return The extents of the layout as drawn.
198 Rectangle get_layout_ink_extents() const;
200 /** Obtains the logical extents of the Pango::Layout being iterated over.
201 * @return The logical extents of the layout.
203 Rectangle get_layout_logical_extents() const;
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.
210 int get_baseline() const;
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_; }
217 #ifndef DOXYGEN_SHOULD_SKIP_THIS
218 void assign_gobj(PangoLayoutIter* src);
222 PangoLayoutIter* gobject_;
226 LayoutIter(const LayoutIter&);
227 LayoutIter& operator=(const LayoutIter&);
235 #endif /* _PANGOMM_LAYOUTITER_H */