gi-pango-1.0.25: Pango bindings
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

GI.Pango.Structs.AttrIterator

Description

A PangoAttrIterator is used to iterate through a PangoAttrList.

A new iterator is created with attrListGetIterator. Once the iterator is created, it can be advanced through the style changes in the text using attrIteratorNext. At each style change, the range of the current style segment and the attributes currently in effect can be queried.

Synopsis

Exported types

Methods

Click to display all available methods, including inherited ones

Expand

Methods

copy, destroy, get, next, range.

Getters

getAttrs, getFont.

Setters

None.

copy

attrIteratorCopy Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> AttrIterator

iterator: a PangoAttrIterator

-> m AttrIterator

Returns: the newly allocated PangoAttrIterator, which should be freed with attrIteratorDestroy

Copy a PangoAttrIterator.

destroy

attrIteratorDestroy Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> AttrIterator

iterator: a PangoAttrIterator

-> m () 

Destroy a PangoAttrIterator and free all associated memory.

get

attrIteratorGet Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> AttrIterator

iterator: a PangoAttrIterator

-> AttrType

type: the type of attribute to find

-> m (Maybe Attribute)

Returns: the current attribute of the given type, or Nothing if no attribute of that type applies to the current location.

Find the current attribute of a particular type at the iterator location.

When multiple attributes of the same type overlap, the attribute whose range starts closest to the current location is used.

getAttrs

attrIteratorGetAttrs Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> AttrIterator

iterator: a PangoAttrIterator

-> m [Attribute]

Returns: a list of all attributes for the current range. To free this value, call attributeDestroy on each value and g_slist_free() on the list.

Gets a list of all attributes at the current position of the iterator.

Since: 1.2

getFont

attrIteratorGetFont Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> AttrIterator

iterator: a PangoAttrIterator

-> FontDescription

desc: a PangoFontDescription to fill in with the current values. The family name in this structure will be set using fontDescriptionSetFamilyStatic using values from an attribute in the PangoAttrList associated with the iterator, so if you plan to keep it around, you must call: pango_font_description_set_family (desc, pango_font_description_get_family (desc)).

-> m (Maybe Language, [Attribute]) 

Get the font and other attributes at the current iterator position.

next

attrIteratorNext Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> AttrIterator

iterator: a PangoAttrIterator

-> m Bool

Returns: False if the iterator is at the end of the list, otherwise True

Advance the iterator until the next change of style.

range

attrIteratorRange Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> AttrIterator

iterator: a PangoAttrIterator

-> m (Int32, Int32) 

Get the range of the current segment.

Note that the stored return values are signed, not unsigned like the values in PangoAttribute. To deal with this API oversight, stored return values that wouldn't fit into a signed integer are clamped to G_MAXINT.