N-TabArray
#------------------------------------------------------------------------------- #--[Class Description]---------------------------------------------------------- #-------------------------------------------------------------------------------
Gnome::Pango::N-TabArray
Description
A Gnome::Pango::N-TabArray contains an array of tab stops.
Gnome::Pango::N-TabArray can be used to set tab stops in a Gnome::Pango::Layout. Each tab stop has an alignment, a position, and optionally a character to use as decimal point.
#------------------------------------------------------------------------------- #--[Record Structure]----------------------------------------------------------- #-------------------------------------------------------------------------------
Record N-TabArray
This is an opaque type of which fields are not available.
class N-TabArray:auth<github:MARTIMM>:api<2> is export is repr('CStruct') { }
#------------------------------------------------------------------------------- #--[Class Initialization]------------------------------------------------------- #-------------------------------------------------------------------------------
Class initialization
new
:native-object
Create an object using a native object from an object of the same type found elsewhere. See also Gnome::N::TopLevelSupportClass.
multi method new ( N-Object() :$native-object! )
#-------------------------------------------------------------------------------
new-tabarray
Creates an array of $initial-size tab stops.
Tab stops are specified in pixel units if $positions-in-pixels is True,
otherwise in Pango units. All stops are initially at position 0.
method new-tabarray ( Int() $initial-size, Bool() $positions-in-pixels --> Gnome::Pango::TabArray \)
$initial-size; Initial number of tab stops to allocate, can be 0.
$positions-in-pixels; whether positions are in pixel units.
#-------------------------------------------------------------------------------
new-with-positions This function is not yet available
Creates a Gnome::Pango::N-TabArray and allows you to specify the alignment and position of each tab stop.
You **must** provide an alignment and position for $size tab stops.
method new-with-positions ( Int() $size, Bool() $positions-in-pixels, PangoTabAlign $first-alignment, Int() $first-position, ⦠--> Gnome::Pango::TabArray \)
$size; number of tab stops in the array.
$positions-in-pixels; whether positions are in pixel units.
$first-alignment; alignment of first tab stop.
$first-position; position of first tab stop.
ā¦; ā¦. Note that each argument must be specified as a type followed by its value!
#------------------------------------------------------------------------------- #--[Methods]-------------------------------------------------------------------- #-------------------------------------------------------------------------------
Methods
#-------------------------------------------------------------------------------
copy
Copies a Gnome::Pango::N-TabArray.
method copy (--> CArray[N-TabArray] )
Return value; the newly allocated Gnome::Pango::N-TabArray, which should
be freed with .free()..
#-------------------------------------------------------------------------------
free
Frees a tab array and associated resources.
method free ( )
#-------------------------------------------------------------------------------
get-decimal-point
Gets the Unicode character to use as decimal point.
This is only relevant for tabs with PANGO_TAB_DECIMAL alignment,
which align content at the first occurrence of the decimal point
character.
The default value of 0 means that Pango will use the decimal point according to the current locale.
method get-decimal-point ( Int() $tab-index --> UInt )
$tab-index; the index of a tab stop.
Return value; No documentation about its value and use.
#-------------------------------------------------------------------------------
get-positions-in-pixels
Returns True if the tab positions are in pixels,
False if they are in Pango units.
method get-positions-in-pixels (--> Bool )
Return value; whether positions are in pixels..
#-------------------------------------------------------------------------------
get-size
Gets the number of tab stops in $tab-array.
method get-size (--> Int )
Return value; the number of tab stops in the array..
#-------------------------------------------------------------------------------
get-tab
Gets the alignment and position of a tab stop.
method get-tab ( Int() $tab-index, PangoTabAlign $alignment, Array[Int] $location )
$tab-index; tab stop index.
$alignment; (transfer ownership: full) location to store alignment.
$location; (transfer ownership: full) location to store tab position.
#-------------------------------------------------------------------------------
get-tabs
If non-undefined, $alignments and $locations are filled with allocated
arrays.
The arrays are of length .get-size().
You must free the returned array.
method get-tabs ( PangoTabAlign $alignments, Array[Int] $locations )
$alignments; (transfer ownership: full) location to store an array of tab stop alignments.
$locations; (transfer ownership: full) location to store an array of tab positions.
#-------------------------------------------------------------------------------
resize
Resizes a tab array.
You must subsequently initialize any tabs that were added as a result of growing the array.
method resize ( Int() $new-size )
$new-size; new size of the array.
#-------------------------------------------------------------------------------
set-decimal-point
Sets the Unicode character to use as decimal point.
This is only relevant for tabs with PANGO_TAB_DECIMAL alignment,
which align content at the first occurrence of the decimal point
character.
By default, Pango uses the decimal point according to the current locale.
method set-decimal-point ( Int() $tab-index, UInt() $decimal-point )
$tab-index; the index of a tab stop.
$decimal-point; the decimal point to use.
#-------------------------------------------------------------------------------
set-positions-in-pixels
Sets whether positions in this array are specified in pixels.
method set-positions-in-pixels ( Bool() $positions-in-pixels )
$positions-in-pixels; whether positions are in pixels.
#-------------------------------------------------------------------------------
set-tab
Sets the alignment and location of a tab stop.
method set-tab ( Int() $tab-index, PangoTabAlign $alignment, Int() $location )
$tab-index; the index of a tab stop.
$alignment; tab alignment.
$location; tab location in Pango units.
#-------------------------------------------------------------------------------
sort
Utility function to ensure that the tab stops are in increasing order.
method sort ( )
#-------------------------------------------------------------------------------
to-string
Serializes a Gnome::Pango::N-TabArray to a string.
No guarantees are made about the format of the string, it may change between Pango versions.
The intended use of this function is testing and debugging. The format is not meant as a permanent storage format.
method to-string (--> Str )
Return value; a newly allocated string.
#------------------------------------------------------------------------------- #--[Functions]------------------------------------------------------------------ #-------------------------------------------------------------------------------
Functions
#-------------------------------------------------------------------------------
from-string
Deserializes a Gnome::Pango::N-TabArray from a string.
This is the counterpart to .to-string().
See that functions for details about the format.
method from-string ( Str $text --> CArray[N-TabArray] )
$text; a string.
Return value; a new Gnome::Pango::N-TabArray.