Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
A PangoAttrList
represents a list of attributes that apply to a section
of text.
The attributes in a PangoAttrList
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 PangoAttrList
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 PangoAttrList
for more than one paragraph of text.
Synopsis
- newtype AttrList = AttrList (ManagedPtr AttrList)
- attrListChange :: (HasCallStack, MonadIO m) => AttrList -> Attribute -> m ()
- attrListCopy :: (HasCallStack, MonadIO m) => AttrList -> m (Maybe AttrList)
- attrListEqual :: (HasCallStack, MonadIO m) => AttrList -> AttrList -> m Bool
- attrListFilter :: (HasCallStack, MonadIO m) => AttrList -> AttrFilterFunc -> m (Maybe AttrList)
- attrListFromString :: (HasCallStack, MonadIO m) => Text -> m (Maybe AttrList)
- attrListGetAttributes :: (HasCallStack, MonadIO m) => AttrList -> m [Attribute]
- attrListGetIterator :: (HasCallStack, MonadIO m) => AttrList -> m AttrIterator
- attrListInsert :: (HasCallStack, MonadIO m) => AttrList -> Attribute -> m ()
- attrListInsertBefore :: (HasCallStack, MonadIO m) => AttrList -> Attribute -> m ()
- attrListNew :: (HasCallStack, MonadIO m) => m AttrList
- attrListRef :: (HasCallStack, MonadIO m) => AttrList -> m AttrList
- attrListSplice :: (HasCallStack, MonadIO m) => AttrList -> AttrList -> Int32 -> Int32 -> m ()
- attrListToString :: (HasCallStack, MonadIO m) => AttrList -> m Text
- attrListUnref :: (HasCallStack, MonadIO m) => AttrList -> m ()
- attrListUpdate :: (HasCallStack, MonadIO m) => AttrList -> Int32 -> Int32 -> Int32 -> m ()
Exported types
Memory-managed wrapper type.
Instances
Eq AttrList Source # | |
GBoxed AttrList Source # | |
Defined in GI.Pango.Structs.AttrList | |
ManagedPtrNewtype AttrList Source # | |
Defined in GI.Pango.Structs.AttrList toManagedPtr :: AttrList -> ManagedPtr AttrList # | |
TypedObject AttrList Source # | |
Defined in GI.Pango.Structs.AttrList | |
HasParentTypes AttrList Source # | |
Defined in GI.Pango.Structs.AttrList | |
IsGValue (Maybe AttrList) Source # | Convert |
Defined in GI.Pango.Structs.AttrList | |
type ParentTypes AttrList Source # | |
Defined in GI.Pango.Structs.AttrList |
Methods
Click to display all available methods, including inherited ones
change
:: (HasCallStack, MonadIO m) | |
=> AttrList |
|
-> Attribute |
|
-> m () |
Insert the given attribute into the PangoAttrList
.
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 an 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
:: (HasCallStack, MonadIO m) | |
=> AttrList |
|
-> m (Maybe AttrList) | Returns: the newly allocated
|
Copy list
and return an identical new list.
equal
:: (HasCallStack, MonadIO m) | |
=> AttrList |
|
-> AttrList |
|
-> m Bool |
Checks whether list
and otherList
contain the same
attributes and whether those attributes apply to the
same ranges.
Beware that this will return wrong values if any list contains duplicates.
Since: 1.46
filter
:: (HasCallStack, MonadIO m) | |
=> AttrList |
|
-> AttrFilterFunc |
|
-> m (Maybe AttrList) | Returns: the new
|
Given a PangoAttrList
and callback function, removes
any elements of list
for which func
returns True
and
inserts them into a new list.
Since: 1.2
fromString
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m (Maybe AttrList) | Returns: a new |
Deserializes a PangoAttrList
from a string.
This is the counterpart to attrListToString
.
See that functions for details about the format.
Since: 1.50
getAttributes
attrListGetAttributes Source #
:: (HasCallStack, MonadIO m) | |
=> AttrList |
|
-> m [Attribute] | Returns:
a list of all attributes in |
Gets a list of all attributes in list
.
Since: 1.44
getIterator
:: (HasCallStack, MonadIO m) | |
=> AttrList |
|
-> m AttrIterator | Returns: the newly allocated
|
Create a iterator initialized to the beginning of the list.
list
must not be modified until this iterator is freed.
insert
:: (HasCallStack, MonadIO m) | |
=> AttrList |
|
-> Attribute |
|
-> m () |
Insert the given attribute into the PangoAttrList
.
It will be inserted after all other attributes with a
matching startIndex
.
insertBefore
:: (HasCallStack, MonadIO m) | |
=> AttrList |
|
-> Attribute |
|
-> m () |
Insert the given attribute into the PangoAttrList
.
It will be inserted before all other attributes with a
matching startIndex
.
new
:: (HasCallStack, MonadIO m) | |
=> m AttrList | Returns: the newly allocated
|
Create a new empty attribute list with a reference count of one.
ref
:: (HasCallStack, MonadIO m) | |
=> AttrList |
|
-> m AttrList | Returns: The attribute list passed in |
Increase the reference count of the given attribute list by one.
Since: 1.10
splice
:: (HasCallStack, MonadIO m) | |
=> AttrList |
|
-> AttrList |
|
-> Int32 |
|
-> Int32 |
|
-> 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.
toString
:: (HasCallStack, MonadIO m) | |
=> AttrList |
|
-> m Text | Returns: a newly allocated string |
Serializes a PangoAttrList
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.
Since: 1.50
unref
:: (HasCallStack, MonadIO m) | |
=> AttrList |
|
-> 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
:: (HasCallStack, MonadIO m) | |
=> AttrList |
|
-> Int32 |
|
-> Int32 |
|
-> Int32 |
|
-> 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