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

Safe Haskell | None
Language | Haskell2010

Data.GI.Base.GParamSpec

Contents

- Memory management
- GParamSpec building
- Get/Set

Description

Management of `GParamSpec`s.

Synopsis

- wrapGParamSpecPtr :: Ptr GParamSpec -> IO GParamSpec
- newGParamSpecFromPtr :: Ptr GParamSpec -> IO GParamSpec
- unrefGParamSpec :: GParamSpec -> IO ()
- disownGParamSpec :: GParamSpec -> IO (Ptr GParamSpec)
- data PropertyInfo o a = PropertyInfo {
  - name :: Text
  - nick :: Text
  - blurb :: Text
  - setter :: o -> a -> IO ()
  - getter :: o -> IO a
  - flags :: Maybe [GParamFlag]
  }
- gParamSpecValue :: GObject o => PropertyInfo o a -> IO GParamSpec
- data CStringPropertyInfo o = CStringPropertyInfo {
  - name :: Text
  - nick :: Text
  - blurb :: Text
  - defaultValue :: Maybe Text
  - flags :: Maybe [GParamFlag]
  - setter :: o -> Maybe Text -> IO ()
  - getter :: o -> IO (Maybe Text)
  }
- gParamSpecCString :: GObject o => CStringPropertyInfo o -> IO GParamSpec
- data CIntPropertyInfo o = CIntPropertyInfo {
  - name :: Text
  - nick :: Text
  - blurb :: Text
  - defaultValue :: CInt
  - setter :: o -> CInt -> IO ()
  - getter :: o -> IO CInt
  - flags :: Maybe [GParamFlag]
  - minValue :: Maybe CInt
  - maxValue :: Maybe CInt
  }
- gParamSpecCInt :: GObject o => CIntPropertyInfo o -> IO GParamSpec
- data GBooleanPropertyInfo o = GBooleanPropertyInfo {
  - name :: Text
  - nick :: Text
  - blurb :: Text
  - defaultValue :: Bool
  - flags :: Maybe [GParamFlag]
  - setter :: o -> Bool -> IO ()
  - getter :: o -> IO Bool
  }
- gParamSpecGBoolean :: GObject o => GBooleanPropertyInfo o -> IO GParamSpec
- data GParamFlag
  - = GParamReadable
  - | GParamWritable
  - | GParamConstruct
  - | GParamConstructOnly
  - | GParamExplicitNotify
  - | AnotherGParamFlag Int
- data PropGetSetter o = PropGetSetter {
  - propGetter :: Ptr o -> Ptr GValue -> IO ()
  - propSetter :: Ptr o -> Ptr GValue -> IO ()
  }
- getGParamSpecGetterSetter :: Ptr GParamSpec -> IO (Maybe (PropGetSetter o))

# Memory management

wrapGParamSpecPtr :: Ptr GParamSpec -> IO GParamSpec Source #

Take ownership of a ParamSpec passed in `Ptr`.

newGParamSpecFromPtr :: Ptr GParamSpec -> IO GParamSpec Source #

Construct a Haskell wrapper for the given `GParamSpec`, without assuming ownership.

unrefGParamSpec :: GParamSpec -> IO () Source #

Remove a reference to the given `GParamSpec`.

disownGParamSpec :: GParamSpec -> IO (Ptr GParamSpec) Source #

Disown a `GParamSpec`, i.e. do not longer unref the associated foreign `GParamSpec` when the Haskell `GParamSpec` gets garbage collected.

# GParamSpec building

data PropertyInfo o a Source #

Information on a property encoding a Haskell value. Note that from the C side this property will appear as an opaque pointer. Use the specialized constructors below for creating properties meaningful from the C side.

A property name consists of segments consisting of ASCII letters and digits, separated by either the '-' or '_' character. The first character of a property name must be a letter. Names which violate these rules lead to undefined behaviour.

When creating and looking up a property, either separator can be used, but they cannot be mixed. Using '-' is considerably more efficient and in fact required when using property names as detail strings for signals.

Beyond the name, properties have two more descriptive strings associated with them, the `nick`, which should be suitable for use as a label for the property in a property editor, and the `blurb`, which should be a somewhat longer description, suitable for e.g. a tooltip. The `nick` and `blurb` should ideally be localized.

Constructors

PropertyInfo |

Fields

- name :: Text

  Identifier for the property.

- nick :: Text

  Identifier for display to the user.

- blurb :: Text

  Description of the property.

- setter :: o -> a -> IO ()

  Handler invoked when the property is being set.

- getter :: o -> IO a

  Handler that returns the current value of the property.

- flags :: Maybe [GParamFlag]

  Set of flags, or `Nothing` for the default set of flags.

gParamSpecValue :: GObject o => PropertyInfo o a -> IO GParamSpec Source #

Create a `GParamSpec` for a Haskell value.

data CStringPropertyInfo o Source #

Information on a property of type `Text` to be registered. A property name consists of segments consisting of ASCII letters and digits, separated by either the '-' or '_' character. The first character of a property name must be a letter. Names which violate these rules lead to undefined behaviour.

When creating and looking up a property, either separator can be used, but they cannot be mixed. Using '-' is considerably more efficient and in fact required when using property names as detail strings for signals.

Beyond the name, properties have two more descriptive strings associated with them, the `nick`, which should be suitable for use as a label for the property in a property editor, and the `blurb`, which should be a somewhat longer description, suitable for e.g. a tooltip. The `nick` and `blurb` should ideally be localized.

Constructors

CStringPropertyInfo |

Fields

- name :: Text
- nick :: Text
- blurb :: Text
- defaultValue :: Maybe Text
- flags :: Maybe [GParamFlag]
- setter :: o -> Maybe Text -> IO ()
- getter :: o -> IO (Maybe Text)

gParamSpecCString :: GObject o => CStringPropertyInfo o -> IO GParamSpec Source #

Create a `GParamSpec` for a string param.

data CIntPropertyInfo o Source #

Information on a property of type `CInt` to be registered. A property name consists of segments consisting of ASCII letters and digits, separated by either the '-' or '_' character. The first character of a property name must be a letter. Names which violate these rules lead to undefined behaviour.

When creating and looking up a property, either separator can be used, but they cannot be mixed. Using '-' is considerably more efficient and in fact required when using property names as detail strings for signals.

Beyond the name, properties have two more descriptive strings associated with them, the `nick`, which should be suitable for use as a label for the property in a property editor, and the `blurb`, which should be a somewhat longer description, suitable for e.g. a tooltip. The `nick` and `blurb` should ideally be localized.

Constructors

CIntPropertyInfo |

Fields

- name :: Text

  Identifier for the property.

- nick :: Text

  Identifier for display to the user.

- blurb :: Text

  Description of the property.

- defaultValue :: CInt

  Default value.

- setter :: o -> CInt -> IO ()

  Handler invoked when the property is being set.

- getter :: o -> IO CInt

  Handler that returns the current value of the property.

- flags :: Maybe [GParamFlag]

  Set of flags, or `Nothing` for the default set of flags.

- minValue :: Maybe CInt

  Minimum value, or `Nothing`, which would be replaced by `MININT`.

- maxValue :: Maybe CInt

  Maximum value, or `Nothing`, which would be replaced by `MAXINT`.

gParamSpecCInt :: GObject o => CIntPropertyInfo o -> IO GParamSpec Source #

Create a `GParamSpec` for an integer param.

data GBooleanPropertyInfo o Source #

Information on a property of type `type gboolean` to be registered. A property name consists of segments consisting of ASCII letters and digits, separated by either the '-' or '_' character. The first character of a property name must be a letter. Names which violate these rules lead to undefined behaviour.

When creating and looking up a property, either separator can be used, but they cannot be mixed. Using '-' is considerably more efficient and in fact required when using property names as detail strings for signals.

Beyond the name, properties have two more descriptive strings associated with them, the `nick`, which should be suitable for use as a label for the property in a property editor, and the `blurb`, which should be a somewhat longer description, suitable for e.g. a tooltip. The `nick` and `blurb` should ideally be localized.

Constructors

GBooleanPropertyInfo |

Fields

- name :: Text
- nick :: Text
- blurb :: Text
- defaultValue :: Bool
- flags :: Maybe [GParamFlag]
- setter :: o -> Bool -> IO ()
- getter :: o -> IO Bool

gParamSpecGBoolean :: GObject o => GBooleanPropertyInfo o -> IO GParamSpec Source #

Create a `GParamSpec` for a bool param.

data GParamFlag Source #

Flags controlling the behaviour of the the parameters.

Constructors

GParamReadable | the parameter is readable
GParamWritable | the parameter is writable
GParamConstruct | the parameter will be set upon object construction
GParamConstructOnly | the parameter can only be set upon object construction
GParamExplicitNotify | calls to `objectSetProperty` for this property will not automatically result in a "notify" signal being emitted: the implementation must call `objectNotify` themselves in case the property actually changes.
AnotherGParamFlag Int | Catch-all for unknown values

#### Instances

Instances details

Enum GParamFlag Source # |

Instance details

Defined in Data.GI.Base.GParamSpec

Methods

succ :: GParamFlag -> GParamFlag Source #

pred :: GParamFlag -> GParamFlag Source #

toEnum :: Int -> GParamFlag Source #

fromEnum :: GParamFlag -> Int Source #

enumFrom :: GParamFlag -> [GParamFlag] Source #

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

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

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

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

Instance details

Defined in Data.GI.Base.GParamSpec

Methods

compare :: GParamFlag -> GParamFlag -> Ordering Source #

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

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

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

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

max :: GParamFlag -> GParamFlag -> GParamFlag Source #

min :: GParamFlag -> GParamFlag -> GParamFlag Source #

IsGFlag GParamFlag Source # |
Instance details Defined in Data.GI.Base.GParamSpec

# Get/Set

data PropGetSetter o Source #

Low-level getter and setter for the property.

Constructors

PropGetSetter |

Fields

- propGetter :: Ptr o -> Ptr GValue -> IO ()
- propSetter :: Ptr o -> Ptr GValue -> IO ()

getGParamSpecGetterSetter :: Ptr GParamSpec -> IO (Maybe (PropGetSetter o)) Source #

Attempt to get the Haskell setter and getter for the given `GParamSpec`. This will only be possible if the `GParamSpec` was created with one of the functions above, if this is not the case the function will return `Nothing`.