Reference Manual

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

# Inti::Pango::TabArray Class Reference

A PangoTabArray C++ wrapper class. More...

`#include <inti/pango/tabs.h>`

Inheritance diagram for Inti::Pango::TabArray:

List of all members.

## Public Member Functions

Constructors

- TabArray (int initial_size, bool positions_in_pixels=true)
    Construct an array of initial_size tab stops.
- TabArray (int size, bool positions_in_pixels, int first_position,...)
    This is a convenience constructor that creates a tab array with left alignment and allows you to specify the position of each tab stop.
- TabArray (int size, bool positions_in_pixels, TabAlign first_alignment, int first_position,...)
    This is a convenience constructor that creates a tab array and allows you to specify the alignment and position of each tab stop.
- TabArray (const std::vector< std::pair< TabAlign, int > > &tabs, bool positions_in_pixels=true)
    This is a convenience constructor that creates a tab array and allows you to specify the alignment and position of each tab stop.
- TabArray (PangoTabArray *tab_array)
    Construct a new tab array from an existing PangoTabArray.
- TabArray (PangoTabArray *tab_array, bool copy)
    Construct a new tab array from an existing PangoTabArray.
- TabArray (const TabArray &src)
    Copy constructor.
- virtual ~TabArray ()
    Destructor.
- TabArray & operator= (const TabArray &src)
    Assignment operator.

Accessors

- PangoTabArray * pango_tab_array () const
    Get a pointer to the PangoTabArray structure.
- operator PangoTabArray * () const
    Conversion operator; safely converts a TabArray to a PangoTabArray pointer.
- int get_size () const
    Get the number of tab stops in the tab array.
- int get_tab (int tab_index, TabAlign *alignment=0) const
    Gets the alignment and position of a tab stop.
- std::vector< std::pair< TabAlign,
  int > > get_tabs () const
    Returns a vector of alignment/locations pairs (see Pango::LayoutLine::get_x_ranges() for an example of using a vector of pairs).
- bool get_positions_in_pixels () const
    Returns true if the tab positions are in pixels, false if they are in Pango units.

Methods

- void resize (int new_size)
    Resizes a tab array.
- void set_tab (int tab_index, int location, TabAlign alignment=TAB_LEFT)
    Sets the location of a tab stop.

## Detailed Description

A PangoTabArray C++ wrapper class.

TabArray is an object that stores Tab Stops.

## Constructor & Destructor Documentation

Inti::Pango::TabArray::TabArray | ( | int | initial_size,
|  | bool | positions_in_pixels = true
| ) |

Construct an array of initial_size tab stops.

Parameters:

  initial_size | The initial number of tab stops to allocate, can be 0.
  positions_in_pixels | Whether positions are in pixel units.

Tab stops are specified in pixel units if positions_in_pixels is true, otherwise in Pango units. All stops are initially at position 0.

Inti::Pango::TabArray::TabArray | ( | int | size,
|  | bool | positions_in_pixels,
|  | int | first_position,
|  | ... |
| ) |

This is a convenience constructor that creates a tab array with left alignment and allows you to specify the position of each tab stop.

Parameters:

  size | The number of tab stops in the array.
  positions_in_pixels | Whether positions are in pixel units.
  first_position | The position of first tab stop.
  ... | Additional positions.

You must provide a position for all size tab stops. This constructor is the same as the next, but uses the default tab alignment TAB_LEFT.

Inti::Pango::TabArray::TabArray | ( | int | size,
|  | bool | positions_in_pixels,
|  | TabAlign | first_alignment,
|  | int | first_position,
|  | ... |
| ) |

This is a convenience constructor that creates a tab array and allows you to specify the alignment and position of each tab stop.

Parameters:

  size | The number of tab stops in the array.
  positions_in_pixels | Whether positions are in pixel units.
  first_alignment | The alignment of first tab stop.
  first_position | The position of first tab stop.
  ... | Additional alignment/position pairs.

You must provide an alignment and position for all size tab stops.

Inti::Pango::TabArray::TabArray | ( | const std::vector< std::pair< TabAlign, int > > & | tabs,
|  | bool | positions_in_pixels = true
| ) |

This is a convenience constructor that creates a tab array and allows you to specify the alignment and position of each tab stop.

Parameters:

  tabs | A reference to a vector of TabAlign/int pairs that holds the alignment and position of each tab stop.
  positions_in_pixels | Whether positions are in pixel units.

Inti::Pango::TabArray::TabArray | ( | PangoTabArray * | tab_array | ) | `[explicit]`

Construct a new tab array from an existing PangoTabArray.

Parameters:

  tab_array | A pointer to a PangoTabArray.

The tab_array can be a newly created PangoTabArray or an existing PangoTabArray. The TabArray object created is a temporary object. It doesn't take over the ownership of PangoTabArray and PangoTabArray is not freed by the destructor.

Inti::Pango::TabArray::TabArray | ( | PangoTabArray * | tab_array,
|  | bool | copy
| ) |

Construct a new tab array from an existing PangoTabArray.

Parameters:

  tab_array | A pointer to a PangoTabArray.
  copy | Whether the TabArray object should make a copy of PangoTabArray or not.

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

Inti::Pango::TabArray::TabArray | ( | const TabArray & | src | ) |

Copy constructor.

Parameters:

  src | The source TabArray.

## Member Function Documentation

bool Inti::Pango::TabArray::get_positions_in_pixels | ( |  | ) | const

Returns true if the tab positions are in pixels, false if they are in Pango units.

Returns:
  Whether positions are in pixels.

int Inti::Pango::TabArray::get_size | ( |  | ) | const

Get the number of tab stops in the tab array.

Returns:
  The number of tab stops in the array.

int Inti::Pango::TabArray::get_tab | ( | int | tab_index,
|  | TabAlign * | alignment = 0
| ) | const

Gets the alignment and position of a tab stop.

Parameters:

  tab_index | The tab stop index.
  alignment | The location to store the alignment, or null.

Returns:
  The tab position.

The alignment may be null if you aren't interested in the value.

std::vector<std::pair<TabAlign, int> > Inti::Pango::TabArray::get_tabs | ( |  | ) | const

Returns a vector of alignment/locations pairs (see Pango::LayoutLine::get_x_ranges() for an example of using a vector of pairs).

Returns:
  A vector of TabAlign/int pairs.

In the current implementation TabAlign is always TAB_LEFT and so can be ignored.

TabArray& Inti::Pango::TabArray::operator= | ( | const TabArray & | src | ) |

Assignment operator.

Parameters:

  src | The source TabArray.

void Inti::Pango::TabArray::resize | ( | int | new_size | ) |

Resizes a tab array.

Parameters:

  new_size | The new size of the array.

You must subsequently initialize any tabs that were added as a result of growing the array.

void Inti::Pango::TabArray::set_tab | ( | int | tab_index,
|  | int | location,
|  | TabAlign | alignment = TAB_LEFT
| ) |

Sets the location of a tab stop.

Parameters:

  tab_index | The index of a tab stop.
  alignment | The tab alignment
  location | The tab location in pango units.

The alignment must always be TAB_LEFT in the current implementation.

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

- tabs.h

Main Page - Footer