1/* $Id: layoutiter.hg,v 1.2 2003/12/14 11:54:05 murrayc Exp $ */
2
3/* layoutiter.h
4 *
5 * Copyright 2001-2002 The gtkmm Development Team
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free
19 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */
21
22#include <pangomm/layoutline.h>
23#include <pangomm/layoutrun.h>
24#include <pango/pango-layout.h>
25
26_DEFS(pangomm,pango)
27
28namespace Pango
29{
30
31/** A Pango::LayoutIter can be used to iterate over the visual extents of a Pango::Layout.
32 */
33class LayoutIter
34{
35  _CLASS_BOXEDTYPE(LayoutIter, PangoLayoutIter, NONE, pango_layout_iter_copy, pango_layout_iter_free)
36  _IGNORE(pango_layout_iter_copy, pango_layout_iter_free)
37
38public:
39
40  _WRAP_METHOD(int get_index() const, pango_layout_iter_get_index)
41  _WRAP_METHOD(LayoutRun get_run() const, pango_layout_iter_get_run)
42  //TODO: Use pango_layout_iter_get_run_readonly()?
43
44  _WRAP_METHOD(Glib::RefPtr<LayoutLine> get_line() const, pango_layout_iter_get_line, refreturn)
45  //TODO: We should really have a const and non-const version: _WRAP_METHOD(Glib::RefPtr<const LayoutLine> get_line() const, pango_layout_iter_get_line_readonly, refreturn)
46
47
48  _WRAP_METHOD(bool at_last_line() const, pango_layout_iter_at_last_line)
49
50  _WRAP_METHOD(Glib::RefPtr<Layout> get_layout(), pango_layout_iter_get_layout, refreturn)
51  _WRAP_METHOD(Glib::RefPtr<const Layout> get_layout() const, pango_layout_iter_get_layout, refreturn, constversion)
52
53  _WRAP_METHOD(bool next_char(), pango_layout_iter_next_char)
54  _WRAP_METHOD(bool next_cluster(), pango_layout_iter_next_cluster)
55  _WRAP_METHOD(bool next_run(), pango_layout_iter_next_run)
56  _WRAP_METHOD(bool next_line(), pango_layout_iter_next_line)
57
58  /** Gets the extents of the current character, in layout coordinates (origin is the top left of the entire layout).
59   * Only logical extents can sensibly be obtained for characters; ink extents make sense only down to the level of clusters.
60   * @return The logical extents of the current character.
61   */
62  Rectangle get_char_extents() const;
63  _IGNORE(pango_layout_iter_get_char_extents)
64
65  _WRAP_METHOD(void get_cluster_extents(Rectangle& ink_rect, Rectangle& logical_rect) const, pango_layout_iter_get_cluster_extents)
66
67  /** Gets the ink extents of the current cluster, in layout coordinates (origin is the top left of the entire layout).
68   * @return The extents of the current cluster as drawn.
69   */
70  Rectangle get_cluster_ink_extents() const;
71
72  /** Gets the logical extents of the current cluster, in layout coordinates (origin is the top left of the entire layout).
73   * @return The logical extents of the current cluster.
74   */
75  Rectangle get_cluster_logical_extents() const;
76
77  _WRAP_METHOD(void get_run_extents(Rectangle& ink_rect, Rectangle& logical_rect) const, pango_layout_iter_get_run_extents)
78
79  /** Gets the ink extents of the current run in layout coordinates (origin is the top left of the entire layout).
80   * @return The extents of the current run as drawn.
81   */
82  Rectangle get_run_ink_extents() const;
83
84  /** Gets the logical extents of the current run in layout coordinates (origin is the top left of the entire layout).
85   * @return The logical extents of the current run.
86   */
87  Rectangle get_run_logical_extents() const;
88
89  _WRAP_METHOD(void get_line_extents(Rectangle& ink_rect, Rectangle& logical_rect) const,   pango_layout_iter_get_line_extents)
90
91  /** Obtains the ink extents of the current line.
92   * @return The extents of the current line as drawn.
93   */
94  Rectangle get_line_ink_extents() const;
95
96  /** Obtains the logical extents of the current line.
97   * @return The logical extents of the current line.
98   */
99  Rectangle get_line_logical_extents() const;
100
101  _WRAP_METHOD(void get_line_yrange(int& y0, int& y1) const, pango_layout_iter_get_line_yrange)
102
103  _WRAP_METHOD(void get_layout_extents(Rectangle& ink_rect, Rectangle& logical_rect) const, pango_layout_iter_get_layout_extents)
104
105  /** Obtains the ink extents of the Pango::Layout being iterated over.
106   * @return The extents of the layout as drawn.
107   */
108  Rectangle get_layout_ink_extents() const;
109
110  /** Obtains the logical extents of the Pango::Layout being iterated over.
111   * @return The logical extents of the layout.
112   */
113  Rectangle get_layout_logical_extents() const;
114
115  _WRAP_METHOD(int get_baseline() const, pango_layout_iter_get_baseline)
116
117#ifndef DOXYGEN_SHOULD_SKIP_THIS
118  /** @deprecated Use the copy constructor instead.
119   * This was only ever for internal use anyway.
120   */
121  void assign_gobj(PangoLayoutIter* src);
122#endif
123};
124
125} //namespace Pango
126
127