Xfce Foundation Classes
Main Page  | IndexNamespace List  |  Alphabetical List  |  Class List  |  File List


Public Member Functions
Xfc::Pango::TabArray Class Reference

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

#include <xfc/pango/tabs.hh>

Inheritance diagram for Xfc::Pango::TabArray:
Xfc::G::Boxed Xfc::Object Xfc::Trackable

List of all members.

Public Member Functions

Constructors

Detailed Description

A PangoTabArray C++ wrapper class.

TabArray is an object that stores Tab Stops.

Note: dynamically allocated objects must either be unreferenced or assigned to a smart pointer. Stack objects are automatically unreferenced when they go out of scope.


Constructor & Destructor Documentation

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

Construct an array of initial_size tab stops.

Parameters:
initial_sizeThe initial number of tab stops to allocate, can be 0.
positions_in_pixelsWhether 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. The TabArray is created with a reference count of 1 that the caller owns.

Xfc::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:
sizeThe number of tab stops in the array.
positions_in_pixelsWhether positions are in pixel units.
first_positionThe 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. The TabArray is created with a reference count of 1 that the caller owns.

Xfc::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:
sizeThe number of tab stops in the array.
positions_in_pixelsWhether positions are in pixel units.
first_alignmentThe alignment of first tab stop.
first_positionThe position of first tab stop.
...Additional alignment/position pairs.

You must provide an alignment and position for all size tab stops. The TabArray is created with a reference count of 1 that the caller owns.

Xfc::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:
tabsA reference to a vector of TabAlign/int pairs that holds the alignment and position of each tab stop.
positions_in_pixelsWhether positions are in pixel units.

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

Xfc::Pango::TabArray::TabArray ( PangoTabArray *  tab_array) [explicit]

Construct a new tab array from an existing PangoTabArray.

Parameters:
tab_arrayA 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.

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

Xfc::Pango::TabArray::TabArray ( PangoTabArray *  tab_array,
bool  copy 
)

Construct a new tab array from an existing PangoTabArray.

Parameters:
tab_arrayA pointer to a PangoTabArray.
copyWhether 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.

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

Copy constructor.

Parameters:
srcThe source TabArray.

Member Function Documentation

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

Returns:
Whether positions are in pixels.

Get the number of tab stops in the tab array.

Returns:
The number of tab stops in the array.
int Xfc::Pango::TabArray::get_tab ( int  tab_index,
TabAlign alignment = 0 
) const

Gets the alignment and position of a tab stop.

Parameters:
tab_indexThe tab stop index.
alignmentThe 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> > Xfc::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& Xfc::Pango::TabArray::operator= ( const TabArray src)

Assignment operator.

Parameters:
srcThe source TabArray.
void Xfc::Pango::TabArray::resize ( int  new_size)

Resizes a tab array.

Parameters:
new_sizeThe new size of the array.

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

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

Sets the location of a tab stop.

Parameters:
tab_indexThe index of a tab stop.
alignmentThe tab alignment
locationThe 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:
Xfce Foundation Classes
Copyright © 2004-2005 The XFC Development Team XFC