Data.GI.Base.GParamSpec

Description

Management of GParamSpecs.

Synopsis

# Memory management

Take ownership of a ParamSpec passed in Ptr.

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

Remove a reference to the given GParamSpec.

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 Fieldsname :: TextIdentifier for the property.nick :: TextIdentifier for display to the user.blurb :: TextDescription of the property.setter :: o -> a -> IO ()Handler invoked when the property is being set.getter :: o -> IO aHandler that returns the current value of the property.flags :: Maybe [GParamFlag]Set of flags, or Nothing for the default set of flags.

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

Create a GParamSpec for a Haskell value.

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 Fieldsname :: Text nick :: Text blurb :: Text defaultValue :: Maybe Text flags :: Maybe [GParamFlag] setter :: o -> Maybe Text -> IO () getter :: o -> IO (Maybe Text)

Create a GParamSpec for a string param.

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 Fieldsname :: TextIdentifier for the property.nick :: TextIdentifier for display to the user.blurb :: TextDescription of the property.defaultValue :: CIntDefault value.setter :: o -> CInt -> IO ()Handler invoked when the property is being set.getter :: o -> IO CIntHandler that returns the current value of the property.flags :: Maybe [GParamFlag]Set of flags, or Nothing for the default set of flags.minValue :: Maybe CIntMinimum value, or Nothing, which would be replaced by MININT.maxValue :: Maybe CIntMaximum value, or Nothing, which would be replaced by MAXINT.

Create a GParamSpec for an integer param.

# Get/Set

data PropGetSetter o Source #

Low-level getter and setter for the property.

Constructors

 PropGetSetter FieldspropGetter :: Ptr o -> Ptr GValue -> IO () propSetter :: Ptr o -> Ptr GValue -> IO ()

getGParamSpecGetterSetter :: forall o. 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.