|
Packit |
78284e |
// Generated by gmmproc 2.49.5 -- DO NOT MODIFY!
|
|
Packit |
78284e |
#ifndef _PANGOMM_LAYOUTITER_H
|
|
Packit |
78284e |
#define _PANGOMM_LAYOUTITER_H
|
|
Packit |
78284e |
|
|
Packit |
78284e |
|
|
Packit |
78284e |
#include <glibmm/ustring.h>
|
|
Packit |
78284e |
#include <sigc++/sigc++.h>
|
|
Packit |
78284e |
|
|
Packit |
78284e |
/* $Id: layoutiter.hg,v 1.2 2003/12/14 11:54:05 murrayc Exp $ */
|
|
Packit |
78284e |
|
|
Packit |
78284e |
/* layoutiter.h
|
|
Packit |
78284e |
*
|
|
Packit |
78284e |
* Copyright 2001-2002 The gtkmm Development Team
|
|
Packit |
78284e |
*
|
|
Packit |
78284e |
* This library is free software; you can redistribute it and/or
|
|
Packit |
78284e |
* modify it under the terms of the GNU Lesser General Public
|
|
Packit |
78284e |
* License as published by the Free Software Foundation; either
|
|
Packit |
78284e |
* version 2.1 of the License, or (at your option) any later version.
|
|
Packit |
78284e |
*
|
|
Packit |
78284e |
* This library is distributed in the hope that it will be useful,
|
|
Packit |
78284e |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
78284e |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
78284e |
* Lesser General Public License for more details.
|
|
Packit |
78284e |
*
|
|
Packit |
78284e |
* You should have received a copy of the GNU Lesser General Public
|
|
Packit |
78284e |
* License along with this library; if not, write to the Free
|
|
Packit |
78284e |
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
Packit |
78284e |
*/
|
|
Packit |
78284e |
|
|
Packit |
78284e |
#include <pangomm/layoutline.h>
|
|
Packit |
78284e |
#include <pangomm/layoutrun.h>
|
|
Packit |
78284e |
#include <pango/pango-layout.h>
|
|
Packit |
78284e |
|
|
Packit |
78284e |
|
|
Packit |
78284e |
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
|
Packit |
78284e |
extern "C" { typedef struct _PangoLayoutIter PangoLayoutIter; }
|
|
Packit |
78284e |
#endif
|
|
Packit |
78284e |
|
|
Packit |
78284e |
namespace Pango
|
|
Packit |
78284e |
{
|
|
Packit |
78284e |
|
|
Packit |
78284e |
/** A Pango::LayoutIter can be used to iterate over the visual extents of a Pango::Layout.
|
|
Packit |
78284e |
*/
|
|
Packit |
78284e |
class LayoutIter
|
|
Packit |
78284e |
{
|
|
Packit |
78284e |
public:
|
|
Packit |
78284e |
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
|
Packit |
78284e |
using CppObjectType = LayoutIter;
|
|
Packit |
78284e |
using BaseObjectType = PangoLayoutIter;
|
|
Packit |
78284e |
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
|
|
Packit |
78284e |
|
|
Packit |
78284e |
/** Get the GType for this class, for use with the underlying GObject type system.
|
|
Packit |
78284e |
*/
|
|
Packit |
78284e |
static GType get_type() G_GNUC_CONST;
|
|
Packit |
78284e |
|
|
Packit |
78284e |
LayoutIter();
|
|
Packit |
78284e |
|
|
Packit |
78284e |
explicit LayoutIter(PangoLayoutIter* gobject, bool make_a_copy = true);
|
|
Packit |
78284e |
|
|
Packit |
78284e |
LayoutIter(const LayoutIter& other);
|
|
Packit |
78284e |
LayoutIter& operator=(const LayoutIter& other);
|
|
Packit |
78284e |
|
|
Packit |
78284e |
LayoutIter(LayoutIter&& other) noexcept;
|
|
Packit |
78284e |
LayoutIter& operator=(LayoutIter&& other) noexcept;
|
|
Packit |
78284e |
|
|
Packit |
78284e |
~LayoutIter() noexcept;
|
|
Packit |
78284e |
|
|
Packit |
78284e |
void swap(LayoutIter& other) noexcept;
|
|
Packit |
78284e |
|
|
Packit |
78284e |
///Provides access to the underlying C instance.
|
|
Packit |
78284e |
PangoLayoutIter* gobj() { return gobject_; }
|
|
Packit |
78284e |
|
|
Packit |
78284e |
///Provides access to the underlying C instance.
|
|
Packit |
78284e |
const PangoLayoutIter* gobj() const { return gobject_; }
|
|
Packit |
78284e |
|
|
Packit |
78284e |
///Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs.
|
|
Packit |
78284e |
PangoLayoutIter* gobj_copy() const;
|
|
Packit |
78284e |
|
|
Packit |
78284e |
protected:
|
|
Packit |
78284e |
PangoLayoutIter* gobject_;
|
|
Packit |
78284e |
|
|
Packit |
78284e |
private:
|
|
Packit |
78284e |
|
|
Packit |
78284e |
|
|
Packit |
78284e |
public:
|
|
Packit |
78284e |
|
|
Packit |
78284e |
|
|
Packit |
78284e |
/** Gets the current byte index. Note that iterating forward by char
|
|
Packit |
78284e |
* moves in visual order, not logical order, so indexes may not be
|
|
Packit |
78284e |
* sequential. Also, the index may be equal to the length of the text
|
|
Packit |
78284e |
* in the layout, if on the <tt>nullptr</tt> run (see get_run()).
|
|
Packit |
78284e |
*
|
|
Packit |
78284e |
* @return Current byte index.
|
|
Packit |
78284e |
*/
|
|
Packit |
78284e |
int get_index() const;
|
|
Packit |
78284e |
|
|
Packit |
78284e |
/** Gets the current run. When iterating by run, at the end of each
|
|
Packit |
78284e |
* line, there's a position with a <tt>nullptr</tt> run, so this function can return
|
|
Packit |
78284e |
* <tt>nullptr</tt>. The <tt>nullptr</tt> run at the end of each line ensures that all lines have
|
|
Packit |
78284e |
* at least one run, even lines consisting of only a newline.
|
|
Packit |
78284e |
*
|
|
Packit |
78284e |
* Use the faster get_run_readonly() if you do not plan
|
|
Packit |
78284e |
* to modify the contents of the run (glyphs, glyph widths, etc.).
|
|
Packit |
78284e |
*
|
|
Packit |
78284e |
* @return The current run.
|
|
Packit |
78284e |
*/
|
|
Packit |
78284e |
LayoutRun get_run() const;
|
|
Packit |
78284e |
//TODO: Use pango_layout_iter_get_run_readonly()?
|
|
Packit |
78284e |
|
|
Packit |
78284e |
|
|
Packit |
78284e |
/** Gets the current line.
|
|
Packit |
78284e |
*
|
|
Packit |
78284e |
* Use the faster get_line_readonly() if you do not plan
|
|
Packit |
78284e |
* to modify the contents of the line (glyphs, glyph widths, etc.).
|
|
Packit |
78284e |
*
|
|
Packit |
78284e |
* @return The current line.
|
|
Packit |
78284e |
*/
|
|
Packit |
78284e |
Glib::RefPtr<LayoutLine> get_line() const;
|
|
Packit |
78284e |
//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)
|
|
Packit |
78284e |
|
|
Packit |
78284e |
|
|
Packit |
78284e |
/** Determines whether @a iter is on the last line of the layout.
|
|
Packit |
78284e |
*
|
|
Packit |
78284e |
* @return <tt>true</tt> if @a iter is on the last line.
|
|
Packit |
78284e |
*/
|
|
Packit |
78284e |
bool at_last_line() const;
|
|
Packit |
78284e |
|
|
Packit |
78284e |
|
|
Packit |
78284e |
/** Gets the layout associated with a Pango::LayoutIter.
|
|
Packit |
78284e |
*
|
|
Packit |
78284e |
* @newin{1,20}
|
|
Packit |
78284e |
*
|
|
Packit |
78284e |
* @return The layout associated with @a iter.
|
|
Packit |
78284e |
*/
|
|
Packit |
78284e |
Glib::RefPtr<Layout> get_layout();
|
|
Packit |
78284e |
|
|
Packit |
78284e |
/** Gets the layout associated with a Pango::LayoutIter.
|
|
Packit |
78284e |
*
|
|
Packit |
78284e |
* @newin{1,20}
|
|
Packit |
78284e |
*
|
|
Packit |
78284e |
* @return The layout associated with @a iter.
|
|
Packit |
78284e |
*/
|
|
Packit |
78284e |
Glib::RefPtr<const Layout> get_layout() const;
|
|
Packit |
78284e |
|
|
Packit |
78284e |
|
|
Packit |
78284e |
/** Moves @a iter forward to the next character in visual order. If @a iter was already at
|
|
Packit |
78284e |
* the end of the layout, returns <tt>false</tt>.
|
|
Packit |
78284e |
*
|
|
Packit |
78284e |
* @return Whether motion was possible.
|
|
Packit |
78284e |
*/
|
|
Packit |
78284e |
bool next_char();
|
|
Packit |
78284e |
|
|
Packit |
78284e |
/** Moves @a iter forward to the next cluster in visual order. If @a iter
|
|
Packit |
78284e |
* was already at the end of the layout, returns <tt>false</tt>.
|
|
Packit |
78284e |
*
|
|
Packit |
78284e |
* @return Whether motion was possible.
|
|
Packit |
78284e |
*/
|
|
Packit |
78284e |
bool next_cluster();
|
|
Packit |
78284e |
|
|
Packit |
78284e |
/** Moves @a iter forward to the next run in visual order. If @a iter was
|
|
Packit |
78284e |
* already at the end of the layout, returns <tt>false</tt>.
|
|
Packit |
78284e |
*
|
|
Packit |
78284e |
* @return Whether motion was possible.
|
|
Packit |
78284e |
*/
|
|
Packit |
78284e |
bool next_run();
|
|
Packit |
78284e |
|
|
Packit |
78284e |
/** Moves @a iter forward to the start of the next line. If @a iter is
|
|
Packit |
78284e |
* already on the last line, returns <tt>false</tt>.
|
|
Packit |
78284e |
*
|
|
Packit |
78284e |
* @return Whether motion was possible.
|
|
Packit |
78284e |
*/
|
|
Packit |
78284e |
bool next_line();
|
|
Packit |
78284e |
|
|
Packit |
78284e |
/** Gets the extents of the current character, in layout coordinates (origin is the top left of the entire layout).
|
|
Packit |
78284e |
* Only logical extents can sensibly be obtained for characters; ink extents make sense only down to the level of clusters.
|
|
Packit |
78284e |
* @return The logical extents of the current character.
|
|
Packit |
78284e |
*/
|
|
Packit |
78284e |
Rectangle get_char_extents() const;
|
|
Packit |
78284e |
|
|
Packit |
78284e |
|
|
Packit |
78284e |
/** Gets the extents of the current cluster, in layout coordinates
|
|
Packit |
78284e |
* (origin is the top left of the entire layout).
|
|
Packit |
78284e |
*
|
|
Packit |
78284e |
* @param ink_rect Rectangle to fill with ink extents, or <tt>nullptr</tt>.
|
|
Packit |
78284e |
* @param logical_rect Rectangle to fill with logical extents, or <tt>nullptr</tt>.
|
|
Packit |
78284e |
*/
|
|
Packit |
78284e |
void get_cluster_extents(Rectangle& ink_rect, Rectangle& logical_rect) const;
|
|
Packit |
78284e |
|
|
Packit |
78284e |
/** Gets the ink extents of the current cluster, in layout coordinates (origin is the top left of the entire layout).
|
|
Packit |
78284e |
* @return The extents of the current cluster as drawn.
|
|
Packit |
78284e |
*/
|
|
Packit |
78284e |
Rectangle get_cluster_ink_extents() const;
|
|
Packit |
78284e |
|
|
Packit |
78284e |
/** Gets the logical extents of the current cluster, in layout coordinates (origin is the top left of the entire layout).
|
|
Packit |
78284e |
* @return The logical extents of the current cluster.
|
|
Packit |
78284e |
*/
|
|
Packit |
78284e |
Rectangle get_cluster_logical_extents() const;
|
|
Packit |
78284e |
|
|
Packit |
78284e |
|
|
Packit |
78284e |
/** Gets the extents of the current run in layout coordinates
|
|
Packit |
78284e |
* (origin is the top left of the entire layout).
|
|
Packit |
78284e |
*
|
|
Packit |
78284e |
* @param ink_rect Rectangle to fill with ink extents, or <tt>nullptr</tt>.
|
|
Packit |
78284e |
* @param logical_rect Rectangle to fill with logical extents, or <tt>nullptr</tt>.
|
|
Packit |
78284e |
*/
|
|
Packit |
78284e |
void get_run_extents(Rectangle& ink_rect, Rectangle& logical_rect) const;
|
|
Packit |
78284e |
|
|
Packit |
78284e |
/** Gets the ink extents of the current run in layout coordinates (origin is the top left of the entire layout).
|
|
Packit |
78284e |
* @return The extents of the current run as drawn.
|
|
Packit |
78284e |
*/
|
|
Packit |
78284e |
Rectangle get_run_ink_extents() const;
|
|
Packit |
78284e |
|
|
Packit |
78284e |
/** Gets the logical extents of the current run in layout coordinates (origin is the top left of the entire layout).
|
|
Packit |
78284e |
* @return The logical extents of the current run.
|
|
Packit |
78284e |
*/
|
|
Packit |
78284e |
Rectangle get_run_logical_extents() const;
|
|
Packit |
78284e |
|
|
Packit |
78284e |
|
|
Packit |
78284e |
/** Obtains the extents of the current line. @a ink_rect or @a logical_rect
|
|
Packit |
78284e |
* can be <tt>nullptr</tt> if you aren't interested in them. Extents are in layout
|
|
Packit |
78284e |
* coordinates (origin is the top-left corner of the entire
|
|
Packit |
78284e |
* Pango::Layout). Thus the extents returned by this function will be
|
|
Packit |
78284e |
* the same width/height but not at the same x/y as the extents
|
|
Packit |
78284e |
* returned from Pango::LayoutLine::get_extents().
|
|
Packit |
78284e |
*
|
|
Packit |
78284e |
* @param ink_rect Rectangle to fill with ink extents, or <tt>nullptr</tt>.
|
|
Packit |
78284e |
* @param logical_rect Rectangle to fill with logical extents, or <tt>nullptr</tt>.
|
|
Packit |
78284e |
*/
|
|
Packit |
78284e |
void get_line_extents(Rectangle& ink_rect, Rectangle& logical_rect) const;
|
|
Packit |
78284e |
|
|
Packit |
78284e |
/** Obtains the ink extents of the current line.
|
|
Packit |
78284e |
* @return The extents of the current line as drawn.
|
|
Packit |
78284e |
*/
|
|
Packit |
78284e |
Rectangle get_line_ink_extents() const;
|
|
Packit |
78284e |
|
|
Packit |
78284e |
/** Obtains the logical extents of the current line.
|
|
Packit |
78284e |
* @return The logical extents of the current line.
|
|
Packit |
78284e |
*/
|
|
Packit |
78284e |
Rectangle get_line_logical_extents() const;
|
|
Packit |
78284e |
|
|
Packit |
78284e |
|
|
Packit |
78284e |
/** Divides the vertical space in the Pango::Layout being iterated over
|
|
Packit |
78284e |
* between the lines in the layout, and returns the space belonging to
|
|
Packit |
78284e |
* the current line. A line's range includes the line's logical
|
|
Packit |
78284e |
* extents, plus half of the spacing above and below the line, if
|
|
Packit |
78284e |
* set_spacing() has been called to set layout spacing.
|
|
Packit |
78284e |
* The Y positions are in layout coordinates (origin at top left of the
|
|
Packit |
78284e |
* entire layout).
|
|
Packit |
78284e |
*
|
|
Packit |
78284e |
* @param y0 Start of line, or <tt>nullptr</tt>.
|
|
Packit |
78284e |
* @param y1 End of line, or <tt>nullptr</tt>.
|
|
Packit |
78284e |
*/
|
|
Packit |
78284e |
void get_line_yrange(int& y0, int& y1) const;
|
|
Packit |
78284e |
|
|
Packit |
78284e |
|
|
Packit |
78284e |
/** Obtains the extents of the Pango::Layout being iterated
|
|
Packit |
78284e |
* over. @a ink_rect or @a logical_rect can be <tt>nullptr</tt> if you
|
|
Packit |
78284e |
* aren't interested in them.
|
|
Packit |
78284e |
*
|
|
Packit |
78284e |
* @param ink_rect Rectangle to fill with ink extents,
|
|
Packit |
78284e |
* or <tt>nullptr</tt>.
|
|
Packit |
78284e |
* @param logical_rect Rectangle to fill with logical
|
|
Packit |
78284e |
* extents, or <tt>nullptr</tt>.
|
|
Packit |
78284e |
*/
|
|
Packit |
78284e |
void get_layout_extents(Rectangle& ink_rect, Rectangle& logical_rect) const;
|
|
Packit |
78284e |
|
|
Packit |
78284e |
/** Obtains the ink extents of the Pango::Layout being iterated over.
|
|
Packit |
78284e |
* @return The extents of the layout as drawn.
|
|
Packit |
78284e |
*/
|
|
Packit |
78284e |
Rectangle get_layout_ink_extents() const;
|
|
Packit |
78284e |
|
|
Packit |
78284e |
/** Obtains the logical extents of the Pango::Layout being iterated over.
|
|
Packit |
78284e |
* @return The logical extents of the layout.
|
|
Packit |
78284e |
*/
|
|
Packit |
78284e |
Rectangle get_layout_logical_extents() const;
|
|
Packit |
78284e |
|
|
Packit |
78284e |
|
|
Packit |
78284e |
/** Gets the Y position of the current line's baseline, in layout
|
|
Packit |
78284e |
* coordinates (origin at top left of the entire layout).
|
|
Packit |
78284e |
*
|
|
Packit |
78284e |
* @return Baseline of current line.
|
|
Packit |
78284e |
*/
|
|
Packit |
78284e |
int get_baseline() const;
|
|
Packit |
78284e |
|
|
Packit |
78284e |
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
|
Packit |
78284e |
/** @deprecated Use the copy constructor instead.
|
|
Packit |
78284e |
* This was only ever for internal use anyway.
|
|
Packit |
78284e |
*/
|
|
Packit |
78284e |
void assign_gobj(PangoLayoutIter* src);
|
|
Packit |
78284e |
#endif
|
|
Packit |
78284e |
|
|
Packit |
78284e |
|
|
Packit |
78284e |
};
|
|
Packit |
78284e |
|
|
Packit |
78284e |
} //namespace Pango
|
|
Packit |
78284e |
|
|
Packit |
78284e |
|
|
Packit |
78284e |
namespace Pango
|
|
Packit |
78284e |
{
|
|
Packit |
78284e |
|
|
Packit |
78284e |
/** @relates Pango::LayoutIter
|
|
Packit |
78284e |
* @param lhs The left-hand side
|
|
Packit |
78284e |
* @param rhs The right-hand side
|
|
Packit |
78284e |
*/
|
|
Packit |
78284e |
inline void swap(LayoutIter& lhs, LayoutIter& rhs) noexcept
|
|
Packit |
78284e |
{ lhs.swap(rhs); }
|
|
Packit |
78284e |
|
|
Packit |
78284e |
} // namespace Pango
|
|
Packit |
78284e |
|
|
Packit |
78284e |
namespace Glib
|
|
Packit |
78284e |
{
|
|
Packit |
78284e |
|
|
Packit |
78284e |
/** A Glib::wrap() method for this object.
|
|
Packit |
78284e |
*
|
|
Packit |
78284e |
* @param object The C instance.
|
|
Packit |
78284e |
* @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
|
|
Packit |
78284e |
* @result A C++ instance that wraps this C instance.
|
|
Packit |
78284e |
*
|
|
Packit |
78284e |
* @relates Pango::LayoutIter
|
|
Packit |
78284e |
*/
|
|
Packit |
78284e |
Pango::LayoutIter wrap(PangoLayoutIter* object, bool take_copy = false);
|
|
Packit |
78284e |
|
|
Packit |
78284e |
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
|
Packit |
78284e |
template <>
|
|
Packit |
78284e |
class Value<Pango::LayoutIter> : public Glib::Value_Boxed<Pango::LayoutIter>
|
|
Packit |
78284e |
{};
|
|
Packit |
78284e |
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
|
|
Packit |
78284e |
|
|
Packit |
78284e |
} // namespace Glib
|
|
Packit |
78284e |
|
|
Packit |
78284e |
|
|
Packit |
78284e |
#endif /* _PANGOMM_LAYOUTITER_H */
|
|
Packit |
78284e |
|