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


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.

Constructors

Public Member Functions

Accessors
Methods

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_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. 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:
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. 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:
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. 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:
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.
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_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.

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_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.

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

Xfc::Pango::TabArray::TabArray ( const TabArray src  ) 

Copy constructor.

Parameters:
src The source TabArray.


Member Function Documentation

TabArray& Xfc::Pango::TabArray::operator= ( const TabArray src  ) 

Assignment operator.

Parameters:
src The source TabArray.

int Xfc::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 Xfc::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> > 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.

bool Xfc::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.

void Xfc::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 Xfc::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: Xfce Foundation Classes
Copyright © 2004-2005 The XFC Development Team XFC 4.3