gi-pango-1.0.30: Pango bindings

Copyright | Will Thompson and Iñaki García Etxebarria
License | LGPL-2.1
Maintainer | Iñaki García Etxebarria
Safe Haskell | None
Language | Haskell2010

GI.Pango.Structs.AttrIterator

Contents

- Exported types
- Methods
  - copy
  - destroy
  - get
  - getAttrs
  - getFont
  - next
  - range

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

- newtype AttrIterator = AttrIterator (ManagedPtr AttrIterator)
- attrIteratorCopy :: (HasCallStack, MonadIO m) => AttrIterator -> m AttrIterator
- attrIteratorDestroy :: (HasCallStack, MonadIO m) => AttrIterator -> m ()
- attrIteratorGet :: (HasCallStack, MonadIO m) => AttrIterator -> AttrType -> m (Maybe Attribute)
- attrIteratorGetAttrs :: (HasCallStack, MonadIO m) => AttrIterator -> m [Attribute]
- attrIteratorGetFont :: (HasCallStack, MonadIO m) => AttrIterator -> FontDescription -> m (Maybe Language, [Attribute])
- attrIteratorNext :: (HasCallStack, MonadIO m) => AttrIterator -> m Bool
- attrIteratorRange :: (HasCallStack, MonadIO m) => AttrIterator -> m (Int32, Int32)

# Exported types

newtype AttrIterator Source #

Memory-managed wrapper type.

Constructors

AttrIterator (ManagedPtr AttrIterator) |

#### Instances

Instances details

Eq AttrIterator Source # |
Instance details Defined in GI.Pango.Structs.AttrIterator Methods (==) :: AttrIterator -> AttrIterator -> Bool Source # (/=) :: AttrIterator -> AttrIterator -> Bool Source #
GBoxed AttrIterator Source # |
Instance details Defined in GI.Pango.Structs.AttrIterator
ManagedPtrNewtype AttrIterator Source # |
Instance details Defined in GI.Pango.Structs.AttrIterator Methods toManagedPtr :: AttrIterator -> ManagedPtr AttrIterator Source #
TypedObject AttrIterator Source # |
Instance details Defined in GI.Pango.Structs.AttrIterator Methods glibType :: IO GType Source #
HasParentTypes AttrIterator Source # |
Instance details Defined in GI.Pango.Structs.AttrIterator
IsGValue (Maybe AttrIterator) Source # | Convert `AttrIterator` to and from `GValue`. See `toGValue` and `fromGValue`.
Instance details Defined in GI.Pango.Structs.AttrIterator Methods gvalueGType_ :: IO GType Source # gvalueSet_ :: Ptr GValue -> Maybe AttrIterator -> IO () Source # gvalueGet_ :: Ptr GValue -> IO (Maybe AttrIterator) Source #
type ParentTypes AttrIterator Source # |
Instance details Defined in GI.Pango.Structs.AttrIterator type ParentTypes AttrIterator = '[] :: [Type]

# 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`.