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 | Safe-Inferred
Language | Haskell2010

GI.Pango.Structs.Attribute

Contents

- Exported types
- Methods
  - asColor
  - asFloat
  - asFontDesc
  - asFontFeatures
  - asInt
  - asLanguage
  - asShape
  - asSize
  - asString
  - copy
  - destroy
  - equal
  - init
- Properties
  - endIndex
  - klass
  - startIndex

Description

The `PangoAttribute` structure represents the common portions of all attributes.

Particular types of attributes include this structure as their initial portion. The common portion of the attribute holds the range to which the value in the type-specific part of the attribute applies and should be initialized using `attributeInit`. By default, an attribute will have an all-inclusive range of [0,`G_MAXUINT`].

Synopsis

- newtype Attribute = Attribute (ManagedPtr Attribute)
- attributeAsColor :: (HasCallStack, MonadIO m) => Attribute -> m (Maybe AttrColor)
- attributeAsFloat :: (HasCallStack, MonadIO m) => Attribute -> m (Maybe AttrFloat)
- attributeAsFontDesc :: (HasCallStack, MonadIO m) => Attribute -> m (Maybe AttrFontDesc)
- attributeAsFontFeatures :: (HasCallStack, MonadIO m) => Attribute -> m (Maybe AttrFontFeatures)
- attributeAsInt :: (HasCallStack, MonadIO m) => Attribute -> m (Maybe AttrInt)
- attributeAsLanguage :: (HasCallStack, MonadIO m) => Attribute -> m (Maybe AttrLanguage)
- attributeAsShape :: (HasCallStack, MonadIO m) => Attribute -> m (Maybe AttrShape)
- attributeAsSize :: (HasCallStack, MonadIO m) => Attribute -> m (Maybe AttrSize)
- attributeAsString :: (HasCallStack, MonadIO m) => Attribute -> m (Maybe AttrString)
- attributeCopy :: (HasCallStack, MonadIO m) => Attribute -> m Attribute
- attributeDestroy :: (HasCallStack, MonadIO m) => Attribute -> m ()
- attributeEqual :: (HasCallStack, MonadIO m) => Attribute -> Attribute -> m Bool
- attributeInit :: (HasCallStack, MonadIO m) => Attribute -> AttrClass -> m ()
- getAttributeEndIndex :: MonadIO m => Attribute -> m Word32
- setAttributeEndIndex :: MonadIO m => Attribute -> Word32 -> m ()
- clearAttributeKlass :: MonadIO m => Attribute -> m ()
- getAttributeKlass :: MonadIO m => Attribute -> m (Maybe AttrClass)
- setAttributeKlass :: MonadIO m => Attribute -> Ptr AttrClass -> m ()
- getAttributeStartIndex :: MonadIO m => Attribute -> m Word32
- setAttributeStartIndex :: MonadIO m => Attribute -> Word32 -> m ()

# Exported types

newtype Attribute Source #

Memory-managed wrapper type.

Constructors

Attribute (ManagedPtr Attribute) |

#### Instances

Instances details

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

# Methods

### Click to display all available methods, including inherited ones

Expand

#### Methods

asColor, asFloat, asFontDesc, asFontFeatures, asInt, asLanguage, asShape, asSize, asString, copy, destroy, equal, init.

#### Getters

None.

#### Setters

None.

## asColor

attributeAsColor Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Attribute | `attr`: A `PangoAttribute` such as foreground
-> m (Maybe AttrColor) | Returns: The attribute as `PangoAttrColor`, or `Nothing` if it's not a color attribute

Returns the attribute cast to `PangoAttrColor`.

This is mainly useful for language bindings.

Since: 1.50

## asFloat

attributeAsFloat Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Attribute | `attr`: A `PangoAttribute` such as scale
-> m (Maybe AttrFloat) | Returns: The attribute as `PangoAttrFloat`, or `Nothing` if it's not a floating point attribute

Returns the attribute cast to `PangoAttrFloat`.

This is mainly useful for language bindings.

Since: 1.50

## asFontDesc

attributeAsFontDesc Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Attribute | `attr`: A `PangoAttribute` representing a font description
-> m (Maybe AttrFontDesc) | Returns: The attribute as `PangoAttrFontDesc`, or `Nothing` if it's not a font description attribute

Returns the attribute cast to `PangoAttrFontDesc`.

This is mainly useful for language bindings.

Since: 1.50

## asFontFeatures

attributeAsFontFeatures Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Attribute | `attr`: A `PangoAttribute` representing font features
-> m (Maybe AttrFontFeatures) | Returns: The attribute as `PangoAttrFontFeatures`, or `Nothing` if it's not a font features attribute

Returns the attribute cast to `PangoAttrFontFeatures`.

This is mainly useful for language bindings.

Since: 1.50

## asInt

attributeAsInt Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Attribute | `attr`: A `PangoAttribute` such as weight
-> m (Maybe AttrInt) | Returns: The attribute as `PangoAttrInt`, or `Nothing` if it's not an integer attribute

Returns the attribute cast to `PangoAttrInt`.

This is mainly useful for language bindings.

Since: 1.50

## asLanguage

attributeAsLanguage Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Attribute | `attr`: A `PangoAttribute` representing a language
-> m (Maybe AttrLanguage) | Returns: The attribute as `PangoAttrLanguage`, or `Nothing` if it's not a language attribute

Returns the attribute cast to `PangoAttrLanguage`.

This is mainly useful for language bindings.

Since: 1.50

## asShape

attributeAsShape Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Attribute | `attr`: A `PangoAttribute` representing a shape
-> m (Maybe AttrShape) | Returns: The attribute as `PangoAttrShape`, or `Nothing` if it's not a shape attribute

Returns the attribute cast to `PangoAttrShape`.

This is mainly useful for language bindings.

Since: 1.50

## asSize

attributeAsSize Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Attribute | `attr`: A `PangoAttribute` representing a size
-> m (Maybe AttrSize) | Returns: The attribute as `PangoAttrSize`, or NULL if it's not a size attribute

Returns the attribute cast to `PangoAttrSize`.

This is mainly useful for language bindings.

Since: 1.50

## asString

attributeAsString Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Attribute | `attr`: A `PangoAttribute` such as family
-> m (Maybe AttrString) | Returns: The attribute as `PangoAttrString`, or `Nothing` if it's not a string attribute

Returns the attribute cast to `PangoAttrString`.

This is mainly useful for language bindings.

Since: 1.50

## copy

attributeCopy Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Attribute | `attr`: a `PangoAttribute`
-> m Attribute | Returns: the newly allocated `PangoAttribute`, which should be freed with `attributeDestroy`.

Make a copy of an attribute.

## destroy

attributeDestroy Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Attribute | `attr`: a `PangoAttribute`.
-> m () |

Destroy a `PangoAttribute` and free all associated memory.

## equal

attributeEqual Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Attribute | `attr1`: a `PangoAttribute`
-> Attribute | `attr2`: another `PangoAttribute`
-> m Bool | Returns: `True` if the two attributes have the same value

Compare two attributes for equality.

This compares only the actual value of the two attributes and not the ranges that the attributes apply to.

## init

attributeInit Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Attribute | `attr`: a `PangoAttribute`
-> AttrClass | `klass`: a `PangoAttrClass`
-> m () |

Initializes `attr`'s klass to `klass`, it's start_index to `ATTR_INDEX_FROM_TEXT_BEGINNING` and end_index to `ATTR_INDEX_TO_TEXT_END` such that the attribute applies to the entire text by default.

Since: 1.20

# Properties

## endIndex

end index of the range (in bytes). The character at this index is not included in the range.

getAttributeEndIndex :: MonadIO m => Attribute -> m Word32 Source #

Get the value of the “`end_index`” field. When overloading is enabled, this is equivalent to

    get attribute #endIndex

setAttributeEndIndex :: MonadIO m => Attribute -> Word32 -> m () Source #

Set the value of the “`end_index`” field. When overloading is enabled, this is equivalent to

    set attribute [ #endIndex := value ]

## klass

the class structure holding information about the type of the attribute

clearAttributeKlass :: MonadIO m => Attribute -> m () Source #

Set the value of the “`klass`” field to `Nothing`. When overloading is enabled, this is equivalent to

    clear #klass

getAttributeKlass :: MonadIO m => Attribute -> m (Maybe AttrClass) Source #

Get the value of the “`klass`” field. When overloading is enabled, this is equivalent to

    get attribute #klass

setAttributeKlass :: MonadIO m => Attribute -> Ptr AttrClass -> m () Source #

Set the value of the “`klass`” field. When overloading is enabled, this is equivalent to

    set attribute [ #klass := value ]

## startIndex

the start index of the range (in bytes).

getAttributeStartIndex :: MonadIO m => Attribute -> m Word32 Source #

Get the value of the “`start_index`” field. When overloading is enabled, this is equivalent to

    get attribute #startIndex

setAttributeStartIndex :: MonadIO m => Attribute -> Word32 -> m () Source #

Set the value of the “`start_index`” field. When overloading is enabled, this is equivalent to

    set attribute [ #startIndex := value ]