Xfce Foundation Classes
Main Page | Index | Namespace List | Alphabetical List | Class List | File List

# Xfc::Pango::LayoutIter Class Reference

A PangoLayoutIter C++ wrapper class. More...

`#include <xfc/pango/layout.hh>`

Inheritance diagram for Xfc::Pango::LayoutIter:

List of all members.

## Public Member Functions

Constructors

- LayoutIter (PangoLayoutIter *iter)
    Construct a new LayoutIter from an existing PangoLayoutIter.
- LayoutIter (PangoLayoutIter *iter, bool copy)
    Construct a new layout iterator from an existing PangoLayoutIter.
- LayoutIter (const LayoutIter &src)
    Copy constructor.
- virtual ~LayoutIter ()
    Destructor.
- LayoutIter & operator= (const LayoutIter &src)
    Assignment operator.

Accessors

- PangoLayoutIter * pango_layout_iter () const
    Get a pointer to the PangoLayoutIter structure.
- operator PangoLayoutIter * () const
    Conversion operator; safely converts a LayoutIter to a PangoLayoutIter pointer.
- int get_index () const
    Gets the current byte index.
- LayoutRun * get_run () const
    Gets the current run.
- Pointer< LayoutLine > get_line () const
    Gets the current line.
- bool at_last_line () const
    Returns true if the iterator is on the last line of the layout.
- void get_char_extents (Rectangle &logical_rect) const
    Gets the extents of the current character, in layout coordinates (origin is the top left of the entire layout).
- Rectangle get_char_extents () const
    Returns the extents of the current character, in layout coordinates (see get_char_extents(Rectangle&) const).
- void get_cluster_extents (Rectangle *ink_rect, Rectangle *logical_rect) const
    Gets the extents of the current cluster, in layout coordinates (origin is the top left of the entire layout).
- void get_run_extents (Rectangle *ink_rect, Rectangle *logical_rect) const
    Gets the extents of the current run in layout coordinates (origin is the top left of the entire layout).
- void get_line_extents (Rectangle *ink_rect, Rectangle *logical_rect) const
    Obtains the extents of the current line.
- void get_line_yrange (int *y0, int *y1) const
    Divides the vertical space in the Layout being iterated over between the lines in the layout, and returns the space belonging to the current line.
- void get_layout_extents (Rectangle *ink_rect, Rectangle *logical_rect) const
    Obtains the extents of the Layout being iterated over.
- int get_baseline () const
    Gets the y position of the current line's baseline, in layout coordinates (origin at top left of the entire layout).

Methods

- bool next_char ()
    Moves the iterator forward to the next character in visual order.
- bool next_cluster ()
    Moves the iterator forward to the next cluster in visual order.
- bool next_run ()
    Moves the iterator forward to the next run in visual order.
- bool next_line ()
    Moves the iterator forward to the next line in visual order.

## Detailed Description

A PangoLayoutIter C++ wrapper class.

LayoutIter can be used to iterate over the visual extents of a Layout.

## Constructor & Destructor Documentation

Xfc::Pango::LayoutIter::LayoutIter | ( | PangoLayoutIter * | iter | ) | `[explicit]`

Construct a new LayoutIter from an existing PangoLayoutIter.

Parameters:

  | iter | A pointer to a PangoLayoutIter.

LayoutIter takes over the ownership of PangoLayoutIter and frees it when it's no longer required.

Xfc::Pango::LayoutIter::LayoutIter | ( | PangoLayoutIter * | iter,
|  | bool | copy
| ) |

Construct a new layout iterator from an existing PangoLayoutIter.

Parameters:

  | iter | A pointer to a PangoLayoutIter.
  | copy | Whether the LayoutIter object should make a copy of PangoLayoutIter or not.

The iter can be a newly created PangoLayoutIter or an existing PangoLayoutIter. If copy is true LayoutIter will make a copy of PangoLayoutIter. If copy is false LayoutIter wont make a copy but instead takes over the ownership of PangoLayoutIter. Either way, the destructor will free PangoLayoutIter when the LayoutIter object is destroyed. This constructor is used by G::Boxed::wrap() to wrap PangoLayoutIter objects in a C++ wrapper.

The FontDescription is created with a reference count of 1 that the caller owns.

Xfc::Pango::LayoutIter::LayoutIter | ( | const LayoutIter & | src | ) |

Copy constructor.

Parameters:

  | src | The source LayoutIter.

## Member Function Documentation

int Xfc::Pango::LayoutIter::get_baseline | ( |  | ) | const

Gets the y position of the current line's baseline, in layout coordinates (origin at top left of the entire layout).

Returns:
  The baseline of the current line.

void Xfc::Pango::LayoutIter::get_char_extents | ( | Rectangle & | logical_rect | ) | const

Gets the extents of the current character, in layout coordinates (origin is the top left of the entire layout).

Parameters:

  | logical_rect | The rectangle to fill with logical extents.

Only logical extents can sensibly be obtained for characters; ink extents make sense only down to the level of clusters.

Parameters:

  | logical_rect | The rectangle to fill with logical extents.

void Xfc::Pango::LayoutIter::get_cluster_extents | ( | Rectangle * | ink_rect,
|  | Rectangle * | logical_rect
| ) | const

Gets the extents of the current cluster, in layout coordinates (origin is the top left of the entire layout).

Parameters:

  | ink_rect | The rectangle to fill with the ink extents.
  | logical_rect | The rectangle to fill with the logical extents.

int Xfc::Pango::LayoutIter::get_index | ( |  | ) | const

Gets the current byte index.

Returns:
  The current byte index.

Note that iterating forward by char moves in visual order, not logical order, so indexes may not be sequential. Also, the index may be equal to the length of the text in the layout, if on the null run (see get_run()).

void Xfc::Pango::LayoutIter::get_layout_extents | ( | Rectangle * | ink_rect,
|  | Rectangle * | logical_rect
| ) | const

Obtains the extents of the Layout being iterated over.

Parameters:

  | ink_rect | The rectangle to fill with the ink extents.
  | logical_rect | The rectangle to fill with the logical extents.

ink_rect or logical_rect can be null if you aren't interested in them.

Pointer<LayoutLine> Xfc::Pango::LayoutIter::get_line | ( |  | ) | const

Gets the current line.

Returns:
  A smart pointer to the current line.

The layout line will become invalid if changes are made to the layout.

void Xfc::Pango::LayoutIter::get_line_extents | ( | Rectangle * | ink_rect,
|  | Rectangle * | logical_rect
| ) | const

Obtains the extents of the current line.

Parameters:

  | ink_rect | The rectangle to fill with the ink extents.
  | logical_rect | The rectangle to fill with the logical extents.

ink_rect or logical_rect can be null if you aren't interested in them. Extents are in layout coordinates (origin is the top-left corner of the entire Layout). Thus the extents returned by this method will be the same width/height but not at the same x/y as the extents returned from Pango::LayoutLine::get_extents().

void Xfc::Pango::LayoutIter::get_line_yrange | ( | int * | y0,
|  | int * | y1
| ) | const

Divides the vertical space in the Layout being iterated over between the lines in the layout, and returns the space belonging to the current line.

Parameters:

  | y0 | The start of the line.
  | y1 | The end of the line.

A line's range includes the line's logical extents, plus half of the spacing above and below the line, if Pango::Layout::set_spacing() has been called to set layout spacing. The y positions are in layout coordinates (origin at top left of the entire layout).

LayoutRun* Xfc::Pango::LayoutIter::get_run | ( |  | ) | const

Gets the current run.

Returns:
  The current run.

When iterating by run, at the end of each line, there's a position with a null run, so this method can return null. The null run at the end of each line ensures that all lines have at least one run, even lines consisting of only a newline.

void Xfc::Pango::LayoutIter::get_run_extents | ( | Rectangle * | ink_rect,
|  | Rectangle * | logical_rect
| ) | const

Gets the extents of the current run in layout coordinates (origin is the top left of the entire layout).

Parameters:

  | ink_rect | The rectangle to fill with the ink extents.
  | logical_rect | The rectangle to fill with the logical extents.

bool Xfc::Pango::LayoutIter::next_char | ( |  | ) |

Moves the iterator forward to the next character in visual order.

Returns:
  Whether motion was possible.

If the iterator was already at the end of the layout, false is returned.

bool Xfc::Pango::LayoutIter::next_cluster | ( |  | ) |

Moves the iterator forward to the next cluster in visual order.

Returns:
  Whether motion was possible.

If the iterator was already at the end of the layout, false is returned.

bool Xfc::Pango::LayoutIter::next_line | ( |  | ) |

Moves the iterator forward to the next line in visual order.

Returns:
  Whether motion was possible.

If the iterator was already at the end of the layout, false is returned.

bool Xfc::Pango::LayoutIter::next_run | ( |  | ) |

Moves the iterator forward to the next run in visual order.

Returns:
  Whether motion was possible.

If the iterator was already at the end of the layout, false is returned.

LayoutIter& Xfc::Pango::LayoutIter::operator= | ( | const LayoutIter & | src | ) |

Assignment operator.

Parameters:

  | src | The source LayoutIter.

The documentation for this class was generated from the following file:

- pango/layout.hh

Xfce Foundation Classes

Copyright © 2004-2005 The XFC Development Team | XFC 4.3