gi-pango-1.0.19: Pango bindings

Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte
License | LGPL-2.1
Maintainer | Iñaki García Etxebarria (garetxe@gmail.com)
Safe Haskell | None
Language | Haskell2010

GI.Pango.Structs.Item

Contents

- Exported types
- Methods
  - copy
  - free
  - new
  - split
- Properties
  - analysis
  - length
  - numChars
  - offset

Description

The `Item` structure stores information about a segment of text.

Synopsis

- newtype Item = Item (ManagedPtr Item)
- newZeroItem :: MonadIO m => m Item
- noItem :: Maybe Item
- itemCopy :: (HasCallStack, MonadIO m) => Item -> m (Maybe Item)
- itemFree :: (HasCallStack, MonadIO m) => Item -> m ()
- itemNew :: (HasCallStack, MonadIO m) => m Item
- itemSplit :: (HasCallStack, MonadIO m) => Item -> Int32 -> Int32 -> m Item
- getItemAnalysis :: MonadIO m => Item -> m Analysis
- getItemLength :: MonadIO m => Item -> m Int32
- setItemLength :: MonadIO m => Item -> Int32 -> m ()
- getItemNumChars :: MonadIO m => Item -> m Int32
- setItemNumChars :: MonadIO m => Item -> Int32 -> m ()
- getItemOffset :: MonadIO m => Item -> m Int32
- setItemOffset :: MonadIO m => Item -> Int32 -> m ()

# Exported types

newtype Item Source #

Memory-managed wrapper type.

Constructors

Item (ManagedPtr Item) |

Instances

BoxedObject Item Source # |
Instance details Defined in GI.Pango.Structs.Item Methods boxedType :: Item -> IO GType Source #
tag ~ AttrSet => Constructible Item tag Source # |
Instance details Defined in GI.Pango.Structs.Item Methods new :: MonadIO m => (ManagedPtr Item -> Item) -> [AttrOp Item tag] -> m Item Source #

newZeroItem :: MonadIO m => m Item Source #

Construct a `Item` struct initialized to zero.

noItem :: Maybe Item Source #

A convenience alias for `Nothing` :: `Maybe` `Item`.

# Methods

## copy

itemCopy Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Item | `item`: a `Item`, may be `Nothing`
-> m (Maybe Item) | Returns: the newly allocated `Item`, which should be freed with `itemFree`, or `Nothing` if `item` was `Nothing`.

Copy an existing `Item` structure.

## free

itemFree Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Item | `item`: a `Item`, may be `Nothing`
-> m () |

Free a `Item` and all associated memory.

## new

itemNew Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> m Item | Returns: the newly allocated `Item`, which should be freed with `itemFree`.

Creates a new `Item` structure initialized to default values.

## split

itemSplit Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Item | `orig`: a `Item`
-> Int32 | `splitIndex`: byte index of position to split item, relative to the start of the item
-> Int32 | `splitOffset`: number of chars between start of `orig` and `splitIndex`
-> m Item | Returns: new item representing text before `splitIndex`, which should be freed with `itemFree`.

Modifies `orig` to cover only the text after `splitIndex`, and returns a new item that covers the text before `splitIndex` that used to be in `orig`. You can think of `splitIndex` as the length of the returned item. `splitIndex` may not be 0, and it may not be greater than or equal to the length of `orig` (that is, there must be at least one byte assigned to each item, you can't create a zero-length item). `splitOffset` is the length of the first item in chars, and must be provided because the text used to generate the item isn't available, so `itemSplit` can't count the char length of the split items itself.

# Properties

## analysis

analysis results for the item.

getItemAnalysis :: MonadIO m => Item -> m Analysis Source #

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

    get item #analysis

## length

length of this item in bytes.

getItemLength :: MonadIO m => Item -> m Int32 Source #

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

    get item #length

setItemLength :: MonadIO m => Item -> Int32 -> m () Source #

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

    set item [ #length := value ]

## numChars

number of Unicode characters in the item.

getItemNumChars :: MonadIO m => Item -> m Int32 Source #

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

    get item #numChars

setItemNumChars :: MonadIO m => Item -> Int32 -> m () Source #

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

    set item [ #numChars := value ]

## offset

byte offset of the start of this item in text.

getItemOffset :: MonadIO m => Item -> m Int32 Source #

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

    get item #offset

setItemOffset :: MonadIO m => Item -> Int32 -> m () Source #

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

    set item [ #offset := value ]