haskell-gi-base-0.26.9: Foundation for libraries generated by haskell-gi

Safe Haskell | None
Language | Haskell2010

Data.GI.Base.Attributes

Description

## Basic attributes interface

Attributes of an object can be get, set and constructed. For types descending from `GObject`, properties are encoded in attributes, although attributes are slightly more general (every property of a `GObject` is an attribute, but we can also have attributes for types not descending from `GObject`).

If you're wondering what the possible attributes of a GObject are, look at the list of properties in the documentation, e.g. the Properties heading of the docs for `Button` lists properties such as `image` and `relief`. Parent classes may also introduce properties, so since a Button is an instance of `IsActionable`, it inherits properties like `actionName` from `Actionable` too.

As an example consider a `button` widget and a property (of the Button class, or any of its parent classes or implemented interfaces) called "label". The simplest way of getting the value of the button is to do

    value <- getButtonLabel button

And for setting:

    setButtonLabel button label

This mechanism quickly becomes rather cumbersome, for example for setting the "window" property in a DOMDOMWindow in WebKit:

    win <- getDOMDOMWindowWindow dom

and perhaps more importantly, one needs to chase down the type which introduces the property:

    setWidgetSensitive button False

There is no `setButtonSensitive`, since it is the `Widget` type that introduces the "sensitive" property.

## Overloaded attributes

A much more convenient overloaded attribute resolution API is provided by this module. Getting the value of an object's attribute is straightforward:

    value <- get button _label

The definition of `_label` is basically a `Proxy` encoding the name of the attribute to get:

    _label = fromLabelProxy (Proxy :: Proxy "label")

These proxies can be automatically generated by invoking the code generator with the `-l` option. The leading underscore is simply so the autogenerated identifiers do not pollute the namespace, but if this is not a concern the autogenerated names (in the autogenerated `GI/Properties.hs`) can be edited as one wishes.

In addition, for ghc >= 8.0, one can directly use the overloaded labels provided by GHC itself. Using the OverloadedLabels extension, the code above can also be written as

    value <- get button #label

The syntax for setting or updating an attribute is only slightly more complex. At the simplest level it is just:

    set button [ _label := value ]

or for the WebKit example above

    set dom [_window := win]

However as the list notation would indicate, you can set or update multiple attributes of the same object in one go:

    set button [ _label := value, _sensitive := False ]

You are not limited to setting the value of an attribute, you can also apply an update function to an attribute's value. That is the function receives the current value of the attribute and returns the new value.

    set spinButton [ _value :~ (+1) ]

There are other variants of these operators, see `AttrOp` below. `:=>` and `:~>` are like `:=` and `:~` but operate in the `IO` monad rather than being pure.

Attributes can also be set during construction of a `GObject` using `new`

    button <- new Button [_label := "Can't touch this!", _sensitive := False]

In addition for value being set/get having to have the right type, there can be attributes that are read-only, or that can only be set during construction with `new`, but cannot be `set` afterwards. That these invariants hold is also checked during compile time.

## Nullable attributes

Whenever the attribute is represented as a pointer in the C side, it is often the case that the underlying C representation admits or returns `NULL` as a valid value for the property. In these cases the `get` operation may return a `Maybe` value, with `Nothing` representing the `NULL` pointer value (notable exceptions are `GList` and `GSList`, for which `NULL` is represented simply as the empty list). This can be overridden in the introspection data, since sometimes attributes are non-nullable, even if the type would allow for `NULL`.

For convenience, in nullable cases the `set` operation will by default not take a `Maybe` value, but rather assume that the caller wants to set a non-`NULL` value. If setting a `NULL` value is desired, use `clear` as follows

    clear object _propName

Synopsis

- class AttrInfo info where
  - type AttrAllowedOps info :: [AttrOpTag]
  - type AttrBaseTypeConstraint info :: Type -> Constraint
  - type AttrGetType info
  - type AttrSetTypeConstraint info :: Type -> Constraint
  - type AttrTransferTypeConstraint info :: Type -> Constraint
  - type AttrTransferType info
  - type AttrLabel info :: Symbol
  - type AttrOrigin info
  - attrGet :: AttrBaseTypeConstraint info o => o -> IO (AttrGetType info)
  - attrSet :: (AttrBaseTypeConstraint info o, AttrSetTypeConstraint info b) => o -> b -> IO ()
  - attrClear :: AttrBaseTypeConstraint info o => o -> IO ()
  - attrConstruct :: (AttrBaseTypeConstraint info o, AttrSetTypeConstraint info b) => b -> IO (GValueConstruct o)
  - attrTransfer :: (AttrBaseTypeConstraint info o, AttrTransferTypeConstraint info b) => Proxy o -> b -> IO (AttrTransferType info)
  - attrPut :: AttrBaseTypeConstraint info o => o -> AttrGetType info -> IO ()
  - dbgAttrInfo :: Maybe ResolvedSymbolInfo
- data AttrOpTag
  - = AttrGet
  - | AttrSet
  - | AttrConstruct
  - | AttrClear
  - | AttrPut
- data AttrOp obj (tag :: AttrOpTag) where
  - (:=) :: forall obj info (attr :: Symbol) (tag :: AttrOpTag) b. (HasAttributeList obj, info ~ ResolveAttribute attr obj, AttrInfo info, AttrBaseTypeConstraint info obj, AttrOpAllowed tag info obj, AttrSetTypeConstraint info b) => AttrLabelProxy attr -> b -> AttrOp obj tag
  - (:=>) :: forall obj info (attr :: Symbol) (tag :: AttrOpTag) b. (HasAttributeList obj, info ~ ResolveAttribute attr obj, AttrInfo info, AttrBaseTypeConstraint info obj, AttrOpAllowed tag info obj, AttrSetTypeConstraint info b) => AttrLabelProxy attr -> IO b -> AttrOp obj tag
  - (:~) :: forall obj info (attr :: Symbol) (tag :: AttrOpTag) b a. (HasAttributeList obj, info ~ ResolveAttribute attr obj, AttrInfo info, AttrBaseTypeConstraint info obj, tag ~ 'AttrSet, AttrOpAllowed 'AttrSet info obj, AttrOpAllowed 'AttrGet info obj, AttrSetTypeConstraint info b, a ~ AttrGetType info) => AttrLabelProxy attr -> (a -> b) -> AttrOp obj tag
  - (:~>) :: forall obj info (attr :: Symbol) (tag :: AttrOpTag) b a. (HasAttributeList obj, info ~ ResolveAttribute attr obj, AttrInfo info, AttrBaseTypeConstraint info obj, tag ~ 'AttrSet, AttrOpAllowed 'AttrSet info obj, AttrOpAllowed 'AttrGet info obj, AttrSetTypeConstraint info b, a ~ AttrGetType info) => AttrLabelProxy attr -> (a -> IO b) -> AttrOp obj tag
  - (:&=) :: forall obj info (attr :: Symbol) (tag :: AttrOpTag) b. (HasAttributeList obj, info ~ ResolveAttribute attr obj, AttrInfo info, AttrBaseTypeConstraint info obj, AttrOpAllowed tag info obj, AttrTransferTypeConstraint info b, AttrSetTypeConstraint info (AttrTransferType info)) => AttrLabelProxy attr -> b -> AttrOp obj tag
  - (:!<~) :: forall obj info (attr :: Symbol) (tag1 :: AttrOpTag) b model (tag :: AttrOpTag). (HasAttributeList obj, info ~ ResolveAttribute attr obj, AttrInfo info, AttrBaseTypeConstraint info obj, AttrOpAllowed tag1 info obj, AttrSetTypeConstraint info b, ?_haskell_gi_modelProxy :: ModelProxy model) => AttrLabelProxy attr -> DynVal model b -> AttrOp obj tag
  - (:<~) :: forall obj info (attr :: Symbol) (tag :: AttrOpTag) b model. (HasAttributeList obj, info ~ ResolveAttribute attr obj, AttrInfo info, AttrBaseTypeConstraint info obj, AttrOpAllowed tag info obj, AttrSetTypeConstraint info b, AttrOpAllowed 'AttrGet info obj, EqMaybe b (AttrGetType info), ?_haskell_gi_modelProxy :: ModelProxy model) => AttrLabelProxy attr -> DynVal model b -> AttrOp obj tag
  - Bind :: forall obj info (propName :: Symbol) (tag :: AttrOpTag) model outType (components :: [Symbol]) (fieldName :: Symbol). (HasAttributeList obj, GObject obj, info ~ ResolveAttribute propName obj, AttrInfo info, KnownSymbol (AttrLabel info), AttrBaseTypeConstraint info obj, AttrOpAllowed tag info obj, AttrOpAllowed 'AttrPut info obj, ?_haskell_gi_modelProxy :: ModelProxy model, outType ~ AttrGetType info, AttrSetTypeConstraint info outType, components ~ Components fieldName, PathFieldAccess components model outType, KnownSymbol fieldName, Eq outType) => AttrLabelProxy propName -> AttrLabelProxy fieldName -> AttrOp obj tag
  - On :: forall obj info (tag :: AttrOpTag). (GObject obj, SignalInfo info) => SignalProxy obj info -> ((?self :: obj) => HaskellCallbackType info) -> AttrOp obj tag
  - After :: forall obj info (tag :: AttrOpTag). (GObject obj, SignalInfo info) => SignalProxy obj info -> ((?self :: obj) => HaskellCallbackType info) -> AttrOp obj tag
- type family AttrOpAllowed (tag :: AttrOpTag) info useType where ...
- type AttrGetC info obj (attr :: Symbol) result = (HasAttributeList obj, info ~ ResolveAttribute attr obj, AttrInfo info, AttrBaseTypeConstraint info obj, AttrOpAllowed 'AttrGet info obj, result ~ AttrGetType info)
- type AttrSetC info obj (attr :: Symbol) value = (HasAttributeList obj, info ~ ResolveAttribute attr obj, AttrInfo info, AttrBaseTypeConstraint info obj, AttrOpAllowed 'AttrSet info obj, AttrSetTypeConstraint info value)
- type AttrConstructC info obj (attr :: Symbol) value = (HasAttributeList obj, info ~ ResolveAttribute attr obj, AttrInfo info, AttrBaseTypeConstraint info obj, AttrOpAllowed 'AttrConstruct info obj, AttrSetTypeConstraint info value)
- type AttrClearC info obj (attr :: Symbol) = (HasAttributeList obj, info ~ ResolveAttribute attr obj, AttrInfo info, AttrBaseTypeConstraint info obj, AttrOpAllowed 'AttrClear info obj)
- get :: forall info (attr :: Symbol) obj result m. (AttrGetC info obj attr result, MonadIO m) => obj -> AttrLabelProxy attr -> m result
- set :: forall o m. MonadIO m => o -> [AttrOp o 'AttrSet] -> m ()
- clear :: forall info (attr :: Symbol) obj m. (AttrClearC info obj attr, MonadIO m) => obj -> AttrLabelProxy attr -> m ()
- data AttrLabelProxy (a :: Symbol) = AttrLabelProxy
- resolveAttr :: forall info (attr :: Symbol) obj. (HasAttributeList obj, info ~ ResolveAttribute attr obj, AttrInfo info) => obj -> AttrLabelProxy attr -> Maybe ResolvedSymbolInfo
- bindPropToField :: forall o info (prop :: Symbol) (field :: Symbol) model outType (tag :: AttrOpTag) (components :: [Symbol]). (HasAttributeList o, GObject o, info ~ ResolveAttribute prop o, AttrInfo info, KnownSymbol (AttrLabel info), AttrBaseTypeConstraint info o, AttrOpAllowed tag info o, AttrOpAllowed 'AttrPut info o, ?_haskell_gi_modelProxy :: ModelProxy model, outType ~ AttrGetType info, AttrSetTypeConstraint info outType, components ~ Components field, PathFieldAccess components model outType, KnownSymbol field, Eq outType) => Proxy tag -> o -> AttrLabelProxy prop -> AttrLabelProxy field -> IO ()
- class EqMaybe a b where
  - eqMaybe :: a -> b -> Bool

# Documentation

class AttrInfo info where Source #

Info describing an attribute.

Minimal complete definition

Nothing

Associated Types

type AttrAllowedOps info :: [AttrOpTag] Source #

The operations that are allowed on the attribute.

type AttrBaseTypeConstraint info :: Type -> Constraint Source #

Constraint on the type for which we are allowed to create/set/get the attribute.

type AttrGetType info Source #

Type returned by `attrGet`.

type AttrSetTypeConstraint info :: Type -> Constraint Source #

Constraint on the value being set.

type AttrSetTypeConstraint info = Type ~ AttrGetType info

type AttrTransferTypeConstraint info :: Type -> Constraint Source #

Constraint on the value being set, with allocation allowed (see `:&=` below).

type AttrTransferTypeConstraint info = Type ~ AttrTransferType info

type AttrTransferType info Source #

Type resulting from the allocation.

type AttrTransferType info = AttrGetType info

type AttrLabel info :: Symbol Source #

Name of the attribute.

type AttrOrigin info Source #

Type which introduces the attribute.

Methods

attrGet :: AttrBaseTypeConstraint info o => o -> IO (AttrGetType info) Source #

Get the value of the given attribute.

default attrGet :: CheckNotElem 'AttrGet (AttrAllowedOps info) (GetNotProvidedError info) => o -> IO (AttrGetType info) Source #

attrSet :: (AttrBaseTypeConstraint info o, AttrSetTypeConstraint info b) => o -> b -> IO () Source #

Set the value of the given attribute, after the object having the attribute has already been created.

default attrSet :: CheckNotElem 'AttrSet (AttrAllowedOps info) (SetNotProvidedError info) => o -> b -> IO () Source #

attrClear :: AttrBaseTypeConstraint info o => o -> IO () Source #

Set the value of the given attribute to `NULL` (for nullable attributes).

default attrClear :: CheckNotElem 'AttrClear (AttrAllowedOps info) (ClearNotProvidedError info) => o -> IO () Source #

attrConstruct :: (AttrBaseTypeConstraint info o, AttrSetTypeConstraint info b) => b -> IO (GValueConstruct o) Source #

Build a `GValue` representing the attribute.

default attrConstruct :: CheckNotElem 'AttrConstruct (AttrAllowedOps info) (ConstructNotProvidedError info) => b -> IO (GValueConstruct o) Source #

attrTransfer :: (AttrBaseTypeConstraint info o, AttrTransferTypeConstraint info b) => Proxy o -> b -> IO (AttrTransferType info) Source #

Allocate memory as necessary to generate a settable type from the transfer type. This is useful for types which needs allocations for marshalling from Haskell to C, this makes the allocation explicit.

default attrTransfer :: (AttrBaseTypeConstraint info o, AttrTransferTypeConstraint info b, b ~ AttrGetType info, b ~ AttrTransferType info) => Proxy o -> b -> IO (AttrTransferType info) Source #

attrPut :: AttrBaseTypeConstraint info o => o -> AttrGetType info -> IO () Source #

Like `attrSet`, but it uses the same type as the getter. This is useful for some nullable types, for which the getter returns `Maybe a`, while the setter takes an `a`. `attrPut` will instead accept an `Maybe a`.

default attrPut :: CheckNotElem 'AttrPut (AttrAllowedOps info) (PutNotProvidedError info) => o -> AttrGetType info -> IO () Source #

dbgAttrInfo :: Maybe ResolvedSymbolInfo Source #

Return some information about the overloaded attribute, useful for debugging. See `resolveAttr` for how to access this conveniently.

data AttrOpTag Source #

Possible operations on an attribute.

Constructors

AttrGet | It is possible to read the value of the attribute with `get`.
AttrSet | It is possible to write the value of the attribute with `set`.
AttrConstruct | It is possible to set the value of the attribute in `new`.
AttrClear | It is possible to clear the value of the (nullable) attribute with `clear`.
AttrPut | It is possible to set a value of the same type as the one returned by `get`.

#### Instances

Instances details

Bounded AttrOpTag Source # |
Instance details Defined in Data.GI.Base.Attributes Methods minBound :: AttrOpTag Source # maxBound :: AttrOpTag Source #
Enum AttrOpTag Source # |

Instance details

Defined in Data.GI.Base.Attributes

Methods

succ :: AttrOpTag -> AttrOpTag Source #

pred :: AttrOpTag -> AttrOpTag Source #

toEnum :: Int -> AttrOpTag Source #

fromEnum :: AttrOpTag -> Int Source #

enumFrom :: AttrOpTag -> [AttrOpTag] Source #

enumFromThen :: AttrOpTag -> AttrOpTag -> [AttrOpTag] Source #

enumFromTo :: AttrOpTag -> AttrOpTag -> [AttrOpTag] Source #

enumFromThenTo :: AttrOpTag -> AttrOpTag -> AttrOpTag -> [AttrOpTag] Source #

Show AttrOpTag Source # |
Instance details Defined in Data.GI.Base.Attributes Methods showsPrec :: Int -> AttrOpTag -> ShowS Source # show :: AttrOpTag -> String Source # showList :: [AttrOpTag] -> ShowS Source #
Eq AttrOpTag Source # |
Instance details Defined in Data.GI.Base.Attributes Methods (==) :: AttrOpTag -> AttrOpTag -> Bool Source # (/=) :: AttrOpTag -> AttrOpTag -> Bool Source #
Ord AttrOpTag Source # |

Instance details

Defined in Data.GI.Base.Attributes

Methods

compare :: AttrOpTag -> AttrOpTag -> Ordering Source #

(<) :: AttrOpTag -> AttrOpTag -> Bool Source #

(<=) :: AttrOpTag -> AttrOpTag -> Bool Source #

(>) :: AttrOpTag -> AttrOpTag -> Bool Source #

(>=) :: AttrOpTag -> AttrOpTag -> Bool Source #

max :: AttrOpTag -> AttrOpTag -> AttrOpTag Source #

min :: AttrOpTag -> AttrOpTag -> AttrOpTag Source #

data AttrOp obj (tag :: AttrOpTag) where Source #

Constructors for the different operations allowed on an attribute.

Constructors

(:=) :: forall obj info (attr :: Symbol) (tag :: AttrOpTag) b. (HasAttributeList obj, info ~ ResolveAttribute attr obj, AttrInfo info, AttrBaseTypeConstraint info obj, AttrOpAllowed tag info obj, AttrSetTypeConstraint info b) => AttrLabelProxy attr -> b -> AttrOp obj tag infixr 0 | Assign a value to an attribute
(:=>) :: forall obj info (attr :: Symbol) (tag :: AttrOpTag) b. (HasAttributeList obj, info ~ ResolveAttribute attr obj, AttrInfo info, AttrBaseTypeConstraint info obj, AttrOpAllowed tag info obj, AttrSetTypeConstraint info b) => AttrLabelProxy attr -> IO b -> AttrOp obj tag infixr 0 | Assign the result of an IO action to an attribute

(:~) :: forall obj info (attr :: Symbol) (tag :: AttrOpTag) b a. (HasAttributeList obj, info ~ ResolveAttribute attr obj, AttrInfo info, AttrBaseTypeConstraint info obj, tag ~ 'AttrSet, AttrOpAllowed 'AttrSet info obj, AttrOpAllowed 'AttrGet info obj, AttrSetTypeConstraint info b, a ~ AttrGetType info) => AttrLabelProxy attr -> (a -> b) -> AttrOp obj tag infixr 0

Apply an update function to an attribute

(:~>) :: forall obj info (attr :: Symbol) (tag :: AttrOpTag) b a. (HasAttributeList obj, info ~ ResolveAttribute attr obj, AttrInfo info, AttrBaseTypeConstraint info obj, tag ~ 'AttrSet, AttrOpAllowed 'AttrSet info obj, AttrOpAllowed 'AttrGet info obj, AttrSetTypeConstraint info b, a ~ AttrGetType info) => AttrLabelProxy attr -> (a -> IO b) -> AttrOp obj tag infixr 0

Apply an IO update function to an attribute

(:&=) :: forall obj info (attr :: Symbol) (tag :: AttrOpTag) b. (HasAttributeList obj, info ~ ResolveAttribute attr obj, AttrInfo info, AttrBaseTypeConstraint info obj, AttrOpAllowed tag info obj, AttrTransferTypeConstraint info b, AttrSetTypeConstraint info (AttrTransferType info)) => AttrLabelProxy attr -> b -> AttrOp obj tag

Assign a value to an attribute, allocating any necessary memory for representing the Haskell value as a C value. Note that it is the responsibility of the caller to make sure that the memory is freed when no longer used, otherwise there will be a memory leak. In the majority of cases you probably want to use `:=` instead, which has no potential memory leaks (at the cost of sometimes requiring some explicit Haskell -> C marshalling).

(:!<~) :: forall obj info (attr :: Symbol) (tag1 :: AttrOpTag) b model (tag :: AttrOpTag). (HasAttributeList obj, info ~ ResolveAttribute attr obj, AttrInfo info, AttrBaseTypeConstraint info obj, AttrOpAllowed tag1 info obj, AttrSetTypeConstraint info b, ?_haskell_gi_modelProxy :: ModelProxy model) => AttrLabelProxy attr -> DynVal model b -> AttrOp obj tag infixr 0

Bind a property to the given `DynVal`, so that the property is changed whenever the `DynVal` is. This requires the implicit param `?_haskell_gi_modelProxy`, of type ``ModelProxy` model` to be set.

(:<~) :: forall obj info (attr :: Symbol) (tag :: AttrOpTag) b model. (HasAttributeList obj, info ~ ResolveAttribute attr obj, AttrInfo info, AttrBaseTypeConstraint info obj, AttrOpAllowed tag info obj, AttrSetTypeConstraint info b, AttrOpAllowed 'AttrGet info obj, EqMaybe b (AttrGetType info), ?_haskell_gi_modelProxy :: ModelProxy model) => AttrLabelProxy attr -> DynVal model b -> AttrOp obj tag infixr 0

Bind a property to the given `DynVal`, so that the property is changed whenever the `DynVal` is. This requires the implicit param `?_haskell_gi_modelProxy`, of type ``ModelProxy` model` to be set. This will only actually set the property whenever the `DynVal` changes if the new value of the `DynVal` is different from the actual value of the property. If you want to set the property without checking equality you can use `:!<~` instead.

Bind :: forall obj info (propName :: Symbol) (tag :: AttrOpTag) model outType (components :: [Symbol]) (fieldName :: Symbol). (HasAttributeList obj, GObject obj, info ~ ResolveAttribute propName obj, AttrInfo info, KnownSymbol (AttrLabel info), AttrBaseTypeConstraint info obj, AttrOpAllowed tag info obj, AttrOpAllowed 'AttrPut info obj, ?_haskell_gi_modelProxy :: ModelProxy model, outType ~ AttrGetType info, AttrSetTypeConstraint info outType, components ~ Components fieldName, PathFieldAccess components model outType, KnownSymbol fieldName, Eq outType) => AttrLabelProxy propName -> AttrLabelProxy fieldName -> AttrOp obj tag

Given an AttrLabelProxy, bind the given attribute to the corresponding field in the model proxy (if there's one), so that changes in the attribute are reflected back into changes of the model.

On :: forall obj info (tag :: AttrOpTag). (GObject obj, SignalInfo info) => SignalProxy obj info -> ((?self :: obj) => HaskellCallbackType info) -> AttrOp obj tag | Connect the given signal to a signal handler.
After :: forall obj info (tag :: AttrOpTag). (GObject obj, SignalInfo info) => SignalProxy obj info -> ((?self :: obj) => HaskellCallbackType info) -> AttrOp obj tag | Like `On`, but connect after the default signal.

type family AttrOpAllowed (tag :: AttrOpTag) info useType where ... Source #

Whether a given `AttrOpTag` is allowed on an attribute, given the info type.

Equations

AttrOpAllowed tag info useType = AttrOpIsAllowed tag (AttrAllowedOps info) (AttrLabel info) (AttrOrigin info) useType |

type AttrGetC info obj (attr :: Symbol) result = (HasAttributeList obj, info ~ ResolveAttribute attr obj, AttrInfo info, AttrBaseTypeConstraint info obj, AttrOpAllowed 'AttrGet info obj, result ~ AttrGetType info) Source #

Constraints on a `obj`/`attr` pair so `get` is possible, producing a value of type `result`.

type AttrSetC info obj (attr :: Symbol) value = (HasAttributeList obj, info ~ ResolveAttribute attr obj, AttrInfo info, AttrBaseTypeConstraint info obj, AttrOpAllowed 'AttrSet info obj, AttrSetTypeConstraint info value) Source #

Constraint on a `obj`/`attr` pair so that `set` works on values of type `value`.

type AttrConstructC info obj (attr :: Symbol) value = (HasAttributeList obj, info ~ ResolveAttribute attr obj, AttrInfo info, AttrBaseTypeConstraint info obj, AttrOpAllowed 'AttrConstruct info obj, AttrSetTypeConstraint info value) Source #

Constraint on a `obj`/`value` pair so that `new` works on values of type `value`.

type AttrClearC info obj (attr :: Symbol) = (HasAttributeList obj, info ~ ResolveAttribute attr obj, AttrInfo info, AttrBaseTypeConstraint info obj, AttrOpAllowed 'AttrClear info obj) Source #

Constraint on a `obj`/`attr` pair so that `clear` is allowed.

get :: forall info (attr :: Symbol) obj result m. (AttrGetC info obj attr result, MonadIO m) => obj -> AttrLabelProxy attr -> m result Source #

Get the value of an attribute for an object.

set :: forall o m. MonadIO m => o -> [AttrOp o 'AttrSet] -> m () Source #

Set a number of properties for some object.

clear :: forall info (attr :: Symbol) obj m. (AttrClearC info obj attr, MonadIO m) => obj -> AttrLabelProxy attr -> m () Source #

Set a nullable attribute to `NULL`.

data AttrLabelProxy (a :: Symbol) Source #

A proxy for attribute labels.

Constructors

AttrLabelProxy |

#### Instances

Instances details

a ~ x => IsLabel x (AttrLabelProxy a) Source # |
Instance details Defined in Data.GI.Base.Attributes Methods fromLabel :: AttrLabelProxy a Source #

resolveAttr :: forall info (attr :: Symbol) obj. (HasAttributeList obj, info ~ ResolveAttribute attr obj, AttrInfo info) => obj -> AttrLabelProxy attr -> Maybe ResolvedSymbolInfo Source #

Return the fully qualified attribute name that a given overloaded attribute resolves to (mostly useful for debugging).

    resolveAttr #sensitive button

bindPropToField :: forall o info (prop :: Symbol) (field :: Symbol) model outType (tag :: AttrOpTag) (components :: [Symbol]). (HasAttributeList o, GObject o, info ~ ResolveAttribute prop o, AttrInfo info, KnownSymbol (AttrLabel info), AttrBaseTypeConstraint info o, AttrOpAllowed tag info o, AttrOpAllowed 'AttrPut info o, ?_haskell_gi_modelProxy :: ModelProxy model, outType ~ AttrGetType info, AttrSetTypeConstraint info outType, components ~ Components field, PathFieldAccess components model outType, KnownSymbol field, Eq outType) => Proxy tag -> o -> AttrLabelProxy prop -> AttrLabelProxy field -> IO () Source #

Create a binding between the given property of an object and a field in the model.

class EqMaybe a b where Source #

Methods

eqMaybe :: a -> b -> Bool Source #

#### Instances

Instances details

Eq a => EqMaybe a a Source # |
Instance details Defined in Data.GI.Base.Attributes Methods eqMaybe :: a -> a -> Bool Source #
Eq a => EqMaybe a (Maybe a) Source # |
Instance details Defined in Data.GI.Base.Attributes Methods eqMaybe :: a -> Maybe a -> Bool Source #