gi-pango-1.0.22: Pango bindings

CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellNone
LanguageHaskell2010

GI.Pango.Structs.AttrList

Contents

Description

The tAttrList structure represents a list of attributes that apply to a section of text. The attributes are, in general, allowed to overlap in an arbitrary fashion, however, if the attributes are manipulated only through attrListChange, the overlap between properties will meet stricter criteria.

Since the tAttrList structure is stored as a linear list, it is not suitable for storing attributes for large amounts of text. In general, you should not use a single tAttrList for more than one paragraph of text.

Synopsis

Exported types

newtype AttrList Source #

Memory-managed wrapper type.

Constructors

AttrList (ManagedPtr AttrList) 
Instances
Eq AttrList Source # 
Instance details

Defined in GI.Pango.Structs.AttrList

Methods

(==) :: AttrList -> AttrList -> Bool

(/=) :: AttrList -> AttrList -> Bool

BoxedObject AttrList Source # 
Instance details

Defined in GI.Pango.Structs.AttrList

Methods

boxedType :: AttrList -> IO GType

IsGValue AttrList Source #

Convert AttrList to and from GValue with toGValue and fromGValue.

Instance details

Defined in GI.Pango.Structs.AttrList

Methods

toGValue :: AttrList -> IO GValue

fromGValue :: GValue -> IO AttrList

noAttrList :: Maybe AttrList Source #

A convenience alias for Nothing :: Maybe AttrList.

Methods

Overloaded methods

change

attrListChange Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> AttrList

list: a tAttrList

-> Attribute

attr: the attribute to insert. Ownership of this value is assumed by the list.

-> m () 

Insert the given attribute into the tAttrList. It will replace any attributes of the same type on that segment and be merged with any adjoining attributes that are identical.

This function is slower than attrListInsert for creating a attribute list in order (potentially much slower for large lists). However, attrListInsert is not suitable for continually changing a set of attributes since it never removes or combines existing attributes.

copy

attrListCopy Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> AttrList

list: a tAttrList, may be Nothing

-> m (Maybe AttrList)

Returns: the newly allocated tAttrList, with a reference count of one, which should be freed with attrListUnref. Returns Nothing if list was Nothing.

Copy list and return an identical new list.

filter

attrListFilter Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> AttrList

list: a tAttrList

-> AttrFilterFunc

func: callback function; returns True if an attribute should be filtered out.

-> m (Maybe AttrList)

Returns: the new tAttrList or Nothing if no attributes of the given types were found.

Given a tAttrList and callback function, removes any elements of list for which func returns True and inserts them into a new list.

Since: 1.2

getAttributes

attrListGetAttributes Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> AttrList

list: a tAttrList

-> m [Attribute]

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

Gets a list of all attributes in list.

Since: 1.44

getIterator

attrListGetIterator Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> AttrList

list: a tAttrList

-> m AttrIterator

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

Create a iterator initialized to the beginning of the list. list must not be modified until this iterator is freed.

insert

attrListInsert Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> AttrList

list: a tAttrList

-> Attribute

attr: the attribute to insert. Ownership of this value is assumed by the list.

-> m () 

Insert the given attribute into the tAttrList. It will be inserted after all other attributes with a matching startIndex.

insertBefore

attrListInsertBefore Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> AttrList

list: a tAttrList

-> Attribute

attr: the attribute to insert. Ownership of this value is assumed by the list.

-> m () 

Insert the given attribute into the tAttrList. It will be inserted before all other attributes with a matching startIndex.

new

attrListNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m AttrList

Returns: the newly allocated tAttrList, which should be freed with attrListUnref.

Create a new empty attribute list with a reference count of one.

ref

attrListRef Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> AttrList

list: a tAttrList, may be Nothing

-> m AttrList

Returns: The attribute list passed in

Increase the reference count of the given attribute list by one.

Since: 1.10

splice

attrListSplice Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> AttrList

list: a tAttrList

-> AttrList

other: another tAttrList

-> Int32

pos: the position in list at which to insert other

-> Int32

len: the length of the spliced segment. (Note that this must be specified since the attributes in other may only be present at some subsection of this range)

-> m () 

This function opens up a hole in list, fills it in with attributes from the left, and then merges other on top of the hole.

This operation is equivalent to stretching every attribute that applies at position pos in list by an amount len, and then calling attrListChange with a copy of each attribute in other in sequence (offset in position by pos).

This operation proves useful for, for instance, inserting a pre-edit string in the middle of an edit buffer.

unref

attrListUnref Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> AttrList

list: a tAttrList, may be Nothing

-> m () 

Decrease the reference count of the given attribute list by one. If the result is zero, free the attribute list and the attributes it contains.

update

attrListUpdate Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> AttrList

list: a tAttrList

-> Int32

pos: the position of the change

-> Int32

remove: the number of removed bytes

-> Int32

add: the number of added bytes

-> m () 

Update indices of attributes in list for a change in the text they refer to.

The change that this function applies is removing remove bytes at position pos and inserting add bytes instead.

Attributes that fall entirely in the (pos, pos + remove) range are removed.

Attributes that start or end inside the (pos, pos + remove) range are shortened to reflect the removal.

Attributes start and end positions are updated if they are behind pos + remove.

Since: 1.44