gi-glib-2.0.17: GLib 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.GLib.Structs.Hook

Contents

- Exported types
- Methods
  - compareIds
  - destroy
  - destroyLink
  - free
  - insertBefore
  - prepend
  - unref
- Properties
  - data
  - destroy
  - flags
  - func
  - hookId
  - next
  - prev
  - refCount

Description

The `Hook` struct represents a single hook function in a `HookList`.

Synopsis

- newtype Hook = Hook (ManagedPtr Hook)
- newZeroHook :: MonadIO m => m Hook
- noHook :: Maybe Hook
- hookCompareIds :: (HasCallStack, MonadIO m) => Hook -> Hook -> m Int32
- hookDestroy :: (HasCallStack, MonadIO m) => HookList -> CULong -> m Bool
- hookDestroyLink :: (HasCallStack, MonadIO m) => HookList -> Hook -> m ()
- hookFree :: (HasCallStack, MonadIO m) => HookList -> Hook -> m ()
- hookInsertBefore :: (HasCallStack, MonadIO m) => HookList -> Maybe Hook -> Hook -> m ()
- hookPrepend :: (HasCallStack, MonadIO m) => HookList -> Hook -> m ()
- hookUnref :: (HasCallStack, MonadIO m) => HookList -> Hook -> m ()
- clearHookData :: MonadIO m => Hook -> m ()
- getHookData :: MonadIO m => Hook -> m (Ptr ())
- setHookData :: MonadIO m => Hook -> Ptr () -> m ()
- clearHookDestroy :: MonadIO m => Hook -> m ()
- getHookDestroy :: MonadIO m => Hook -> m (Maybe DestroyNotify)
- setHookDestroy :: MonadIO m => Hook -> FunPtr C_DestroyNotify -> m ()
- getHookFlags :: MonadIO m => Hook -> m Word32
- setHookFlags :: MonadIO m => Hook -> Word32 -> m ()
- clearHookFunc :: MonadIO m => Hook -> m ()
- getHookFunc :: MonadIO m => Hook -> m (Ptr ())
- setHookFunc :: MonadIO m => Hook -> Ptr () -> m ()
- getHookHookId :: MonadIO m => Hook -> m CULong
- setHookHookId :: MonadIO m => Hook -> CULong -> m ()
- clearHookNext :: MonadIO m => Hook -> m ()
- getHookNext :: MonadIO m => Hook -> m (Maybe Hook)
- setHookNext :: MonadIO m => Hook -> Ptr Hook -> m ()
- clearHookPrev :: MonadIO m => Hook -> m ()
- getHookPrev :: MonadIO m => Hook -> m (Maybe Hook)
- setHookPrev :: MonadIO m => Hook -> Ptr Hook -> m ()
- getHookRefCount :: MonadIO m => Hook -> m Word32
- setHookRefCount :: MonadIO m => Hook -> Word32 -> m ()

# Exported types

newtype Hook Source #

Memory-managed wrapper type.

Constructors

Hook (ManagedPtr Hook) |

Instances

WrappedPtr Hook Source # |
Instance details Defined in GI.GLib.Structs.Hook Methods wrappedPtrCalloc :: IO (Ptr Hook) Source # wrappedPtrCopy :: Hook -> IO Hook Source # wrappedPtrFree :: Maybe (FunPtr (Ptr Hook -> IO ())) Source #
tag ~ AttrSet => Constructible Hook tag Source # |
Instance details Defined in GI.GLib.Structs.Hook Methods new :: MonadIO m => (ManagedPtr Hook -> Hook) -> [AttrOp Hook tag] -> m Hook Source #

newZeroHook :: MonadIO m => m Hook Source #

Construct a `Hook` struct initialized to zero.

noHook :: Maybe Hook Source #

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

# Methods

## compareIds

hookCompareIds Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Hook | `newHook`: a `Hook`
-> Hook | `sibling`: a `Hook` to compare with `newHook`
-> m Int32 | Returns: a value <= 0 if the id of `sibling` is >= the id of `newHook`

Compares the ids of two `Hook` elements, returning a negative value if the second id is greater than the first.

## destroy

hookDestroy Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> HookList | `hookList`: a `HookList`
-> CULong | `hookId`: a hook ID
-> m Bool | Returns: `True` if the `Hook` was found in the `HookList` and destroyed

Destroys a `Hook`, given its ID.

## destroyLink

hookDestroyLink Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> HookList | `hookList`: a `HookList`
-> Hook | `hook`: the `Hook` to remove
-> m () |

Removes one `Hook` from a `HookList`, marking it inactive and calling `hookUnref` on it.

## free

hookFree Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> HookList | `hookList`: a `HookList`
-> Hook | `hook`: the `Hook` to free
-> m () |

Calls the `HookList` `finalizeHook` function if it exists, and frees the memory allocated for the `Hook`.

## insertBefore

hookInsertBefore Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> HookList | `hookList`: a `HookList`
-> Maybe Hook | `sibling`: the `Hook` to insert the new `Hook` before
-> Hook | `hook`: the `Hook` to insert
-> m () |

Inserts a `Hook` into a `HookList`, before a given `Hook`.

## prepend

hookPrepend Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> HookList | `hookList`: a `HookList`
-> Hook | `hook`: the `Hook` to add to the start of `hookList`
-> m () |

Prepends a `Hook` on the start of a `HookList`.

## unref

hookUnref Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> HookList | `hookList`: a `HookList`
-> Hook | `hook`: the `Hook` to unref
-> m () |

Decrements the reference count of a `Hook`. If the reference count falls to 0, the `Hook` is removed from the `HookList` and `hookFree` is called to free it.

# Properties

## data

data which is passed to func when this hook is invoked

clearHookData :: MonadIO m => Hook -> m () Source #

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

    clear #data

getHookData :: MonadIO m => Hook -> m (Ptr ()) Source #

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

    get hook #data

setHookData :: MonadIO m => Hook -> Ptr () -> m () Source #

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

    set hook [ #data := value ]

## destroy

the default `finalizeHook` function of a `HookList` calls this member of the hook that is being finalized

clearHookDestroy :: MonadIO m => Hook -> m () Source #

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

    clear #destroy

getHookDestroy :: MonadIO m => Hook -> m (Maybe DestroyNotify) Source #

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

    get hook #destroy

setHookDestroy :: MonadIO m => Hook -> FunPtr C_DestroyNotify -> m () Source #

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

    set hook [ #destroy := value ]

## flags

flags which are set for this hook. See `HookFlagMask` for predefined flags

getHookFlags :: MonadIO m => Hook -> m Word32 Source #

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

    get hook #flags

setHookFlags :: MonadIO m => Hook -> Word32 -> m () Source #

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

    set hook [ #flags := value ]

## func

the function to call when this hook is invoked. The possible signatures for this function are `HookFunc` and `HookCheckFunc`

clearHookFunc :: MonadIO m => Hook -> m () Source #

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

    clear #func

getHookFunc :: MonadIO m => Hook -> m (Ptr ()) Source #

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

    get hook #func

setHookFunc :: MonadIO m => Hook -> Ptr () -> m () Source #

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

    set hook [ #func := value ]

## hookId

the id of this hook, which is unique within its list

getHookHookId :: MonadIO m => Hook -> m CULong Source #

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

    get hook #hookId

setHookHookId :: MonadIO m => Hook -> CULong -> m () Source #

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

    set hook [ #hookId := value ]

## next

pointer to the next hook in the list

clearHookNext :: MonadIO m => Hook -> m () Source #

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

    clear #next

getHookNext :: MonadIO m => Hook -> m (Maybe Hook) Source #

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

    get hook #next

setHookNext :: MonadIO m => Hook -> Ptr Hook -> m () Source #

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

    set hook [ #next := value ]

## prev

pointer to the previous hook in the list

clearHookPrev :: MonadIO m => Hook -> m () Source #

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

    clear #prev

getHookPrev :: MonadIO m => Hook -> m (Maybe Hook) Source #

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

    get hook #prev

setHookPrev :: MonadIO m => Hook -> Ptr Hook -> m () Source #

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

    set hook [ #prev := value ]

## refCount

the reference count of this hook

getHookRefCount :: MonadIO m => Hook -> m Word32 Source #

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

    get hook #refCount

setHookRefCount :: MonadIO m => Hook -> Word32 -> m () Source #

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

    set hook [ #refCount := value ]