gi-gobject-2.0.31: GObject bindings

Copyright | Will Thompson and Iñaki García Etxebarria
License | LGPL-2.1
Maintainer | Iñaki García Etxebarria
Safe Haskell | None
Language | Haskell2010

GI.GObject.Structs.ObjectClass

Contents

- Exported types
- Methods
  - findProperty
  - installProperty
  - overrideProperty
- Properties
  - constructed
  - dispatchPropertiesChanged
  - dispose
  - finalize
  - gTypeClass
  - getProperty
  - notify
  - setProperty

Description

The class structure for the GObject type.

### C code

    // Example of implementing a singleton using a constructor.
    static MySingleton *the_singleton = NULL;

    static GObject*
    my_singleton_constructor (GType                  type,
                              guint                  n_construct_params,
                              GObjectConstructParam *construct_params)
    {
      GObject *object;

      if (!the_singleton)
        {
          object = G_OBJECT_CLASS (parent_class)->constructor (type,
                                                               n_construct_params,
                                                               construct_params);
          the_singleton = MY_SINGLETON (object);
        }
      else
        object = g_object_ref (G_OBJECT (the_singleton));

      return object;
    }

Synopsis

- newtype ObjectClass = ObjectClass (ManagedPtr ObjectClass)
- newZeroObjectClass :: MonadIO m => m ObjectClass
- objectClassFindProperty :: (HasCallStack, MonadIO m) => ObjectClass -> Text -> m GParamSpec
- objectClassInstallProperty :: (HasCallStack, MonadIO m) => ObjectClass -> Word32 -> GParamSpec -> m ()
- objectClassOverrideProperty :: (HasCallStack, MonadIO m) => ObjectClass -> Word32 -> Text -> m ()
- clearObjectClassConstructed :: MonadIO m => ObjectClass -> m ()
- getObjectClassConstructed :: MonadIO m => ObjectClass -> m (Maybe ObjectClassConstructedFieldCallback)
- setObjectClassConstructed :: MonadIO m => ObjectClass -> FunPtr C_ObjectClassConstructedFieldCallback -> m ()
- clearObjectClassDispatchPropertiesChanged :: MonadIO m => ObjectClass -> m ()
- getObjectClassDispatchPropertiesChanged :: MonadIO m => ObjectClass -> m (Maybe ObjectClassDispatchPropertiesChangedFieldCallback)
- setObjectClassDispatchPropertiesChanged :: MonadIO m => ObjectClass -> FunPtr C_ObjectClassDispatchPropertiesChangedFieldCallback -> m ()
- clearObjectClassDispose :: MonadIO m => ObjectClass -> m ()
- getObjectClassDispose :: MonadIO m => ObjectClass -> m (Maybe ObjectClassDisposeFieldCallback)
- setObjectClassDispose :: MonadIO m => ObjectClass -> FunPtr C_ObjectClassDisposeFieldCallback -> m ()
- clearObjectClassFinalize :: MonadIO m => ObjectClass -> m ()
- getObjectClassFinalize :: MonadIO m => ObjectClass -> m (Maybe ObjectClassFinalizeFieldCallback)
- setObjectClassFinalize :: MonadIO m => ObjectClass -> FunPtr C_ObjectClassFinalizeFieldCallback -> m ()
- getObjectClassGTypeClass :: MonadIO m => ObjectClass -> m TypeClass
- clearObjectClassGetProperty :: MonadIO m => ObjectClass -> m ()
- getObjectClassGetProperty :: MonadIO m => ObjectClass -> m (Maybe ObjectClassGetPropertyFieldCallback)
- setObjectClassGetProperty :: MonadIO m => ObjectClass -> FunPtr C_ObjectClassGetPropertyFieldCallback -> m ()
- clearObjectClassNotify :: MonadIO m => ObjectClass -> m ()
- getObjectClassNotify :: MonadIO m => ObjectClass -> m (Maybe ObjectClassNotifyFieldCallback)
- setObjectClassNotify :: MonadIO m => ObjectClass -> FunPtr C_ObjectClassNotifyFieldCallback -> m ()
- clearObjectClassSetProperty :: MonadIO m => ObjectClass -> m ()
- getObjectClassSetProperty :: MonadIO m => ObjectClass -> m (Maybe ObjectClassSetPropertyFieldCallback)
- setObjectClassSetProperty :: MonadIO m => ObjectClass -> FunPtr C_ObjectClassSetPropertyFieldCallback -> m ()

# Exported types

newtype ObjectClass Source #

Memory-managed wrapper type.

Constructors

ObjectClass (ManagedPtr ObjectClass) |

#### Instances

Instances details

Eq ObjectClass Source # |
Instance details Defined in GI.GObject.Structs.ObjectClass Methods (==) :: ObjectClass -> ObjectClass -> Bool Source # (/=) :: ObjectClass -> ObjectClass -> Bool Source #
BoxedPtr ObjectClass Source # |
Instance details Defined in GI.GObject.Structs.ObjectClass Methods boxedPtrCopy :: ObjectClass -> IO ObjectClass Source # boxedPtrFree :: ObjectClass -> IO () Source #
CallocPtr ObjectClass Source # |
Instance details Defined in GI.GObject.Structs.ObjectClass Methods boxedPtrCalloc :: IO (Ptr ObjectClass) Source #
ManagedPtrNewtype ObjectClass Source # |
Instance details Defined in GI.GObject.Structs.ObjectClass Methods toManagedPtr :: ObjectClass -> ManagedPtr ObjectClass Source #
tag ~ 'AttrSet => Constructible ObjectClass tag Source # |
Instance details Defined in GI.GObject.Structs.ObjectClass Methods new :: MonadIO m => (ManagedPtr ObjectClass -> ObjectClass) -> [AttrOp ObjectClass tag] -> m ObjectClass Source #

newZeroObjectClass :: MonadIO m => m ObjectClass Source #

Construct a `ObjectClass` struct initialized to zero.

# Methods

### Click to display all available methods, including inherited ones

Expand

#### Methods

findProperty, installProperty, overrideProperty.

#### Getters

None.

#### Setters

None.

## findProperty

objectClassFindProperty Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> ObjectClass | `oclass`: a `ObjectClass`
-> Text | `propertyName`: the name of the property to look up
-> m GParamSpec | Returns: the `ParamSpec` for the property, or `Nothing` if the class doesn't have a property of that name

Looks up the `ParamSpec` for a property of a class.

## installProperty

objectClassInstallProperty Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> ObjectClass | `oclass`: a `ObjectClass`
-> Word32 | `propertyId`: the id for the new property
-> GParamSpec | `pspec`: the `ParamSpec` for the new property
-> m () |

Installs a new property.

All properties should be installed during the class initializer. It is possible to install properties after that, but doing so is not recommend, and specifically, is not guaranteed to be thread-safe vs. use of properties on the same type on other threads.

Note that it is possible to redefine a property in a derived class, by installing a property with the same name. This can be useful at times, e.g. to change the range of allowed values or the default value.

## overrideProperty

objectClassOverrideProperty Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> ObjectClass | `oclass`: a `ObjectClass`
-> Word32 | `propertyId`: the new property ID
-> Text | `name`: the name of a property registered in a parent class or in an interface of this class.
-> m () |

Registers `propertyId` as referring to a property with the name `name` in a parent class or in an interface implemented by `oclass`. This allows this class to "override" a property implementation in a parent class or to provide the implementation of a property from an interface.

Internally, overriding is implemented by creating a property of type `ParamSpecOverride`; generally operations that query the properties of the object class, such as `objectClassFindProperty` or `objectClassListProperties` will return the overridden property. However, in one case, the `constructProperties` argument of the `constructor` virtual function, the `ParamSpecOverride` is passed instead, so that the `paramId` field of the `ParamSpec` will be correct. For virtually all uses, this makes no difference. If you need to get the overridden property, you can call `paramSpecGetRedirectTarget`.

Since: 2.4

# Properties

## constructed

the `constructed` function is called by `g_object_new()` as the final step of the object creation process. At the point of the call, all construction properties have been set on the object. The purpose of this call is to allow for object initialisation steps that can only be performed after construction properties have been set. `constructed` implementors should chain up to the `constructed` call of their parent class to allow it to complete its initialisation.

clearObjectClassConstructed :: MonadIO m => ObjectClass -> m () Source #

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

    clear #constructed

getObjectClassConstructed :: MonadIO m => ObjectClass -> m (Maybe ObjectClassConstructedFieldCallback) Source #

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

    get objectClass #constructed

setObjectClassConstructed :: MonadIO m => ObjectClass -> FunPtr C_ObjectClassConstructedFieldCallback -> m () Source #

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

    set objectClass [ #constructed := value ]

## dispatchPropertiesChanged

emits property change notification for a bunch of properties. Overriding `dispatchPropertiesChanged` should be rarely needed.

clearObjectClassDispatchPropertiesChanged :: MonadIO m => ObjectClass -> m () Source #

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

    clear #dispatchPropertiesChanged

getObjectClassDispatchPropertiesChanged :: MonadIO m => ObjectClass -> m (Maybe ObjectClassDispatchPropertiesChangedFieldCallback) Source #

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

    get objectClass #dispatchPropertiesChanged

setObjectClassDispatchPropertiesChanged :: MonadIO m => ObjectClass -> FunPtr C_ObjectClassDispatchPropertiesChangedFieldCallback -> m () Source #

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

    set objectClass [ #dispatchPropertiesChanged := value ]

## dispose

the `dispose` function is supposed to drop all references to other objects, but keep the instance otherwise intact, so that client method invocations still work. It may be run multiple times (due to reference loops). Before returning, `dispose` should chain up to the `dispose` method of the parent class.

clearObjectClassDispose :: MonadIO m => ObjectClass -> m () Source #

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

    clear #dispose

getObjectClassDispose :: MonadIO m => ObjectClass -> m (Maybe ObjectClassDisposeFieldCallback) Source #

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

    get objectClass #dispose

setObjectClassDispose :: MonadIO m => ObjectClass -> FunPtr C_ObjectClassDisposeFieldCallback -> m () Source #

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

    set objectClass [ #dispose := value ]

## finalize

instance finalization function, should finish the finalization of the instance begun in `dispose` and chain up to the `finalize` method of the parent class.

clearObjectClassFinalize :: MonadIO m => ObjectClass -> m () Source #

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

    clear #finalize

getObjectClassFinalize :: MonadIO m => ObjectClass -> m (Maybe ObjectClassFinalizeFieldCallback) Source #

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

    get objectClass #finalize

setObjectClassFinalize :: MonadIO m => ObjectClass -> FunPtr C_ObjectClassFinalizeFieldCallback -> m () Source #

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

    set objectClass [ #finalize := value ]

## gTypeClass

the parent class

getObjectClassGTypeClass :: MonadIO m => ObjectClass -> m TypeClass Source #

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

    get objectClass #gTypeClass

## getProperty

the generic getter for all properties of this type. Should be overridden for every type with properties.

clearObjectClassGetProperty :: MonadIO m => ObjectClass -> m () Source #

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

    clear #getProperty

getObjectClassGetProperty :: MonadIO m => ObjectClass -> m (Maybe ObjectClassGetPropertyFieldCallback) Source #

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

    get objectClass #getProperty

setObjectClassGetProperty :: MonadIO m => ObjectClass -> FunPtr C_ObjectClassGetPropertyFieldCallback -> m () Source #

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

    set objectClass [ #getProperty := value ]

## notify

the class closure for the notify signal

clearObjectClassNotify :: MonadIO m => ObjectClass -> m () Source #

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

    clear #notify

getObjectClassNotify :: MonadIO m => ObjectClass -> m (Maybe ObjectClassNotifyFieldCallback) Source #

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

    get objectClass #notify

setObjectClassNotify :: MonadIO m => ObjectClass -> FunPtr C_ObjectClassNotifyFieldCallback -> m () Source #

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

    set objectClass [ #notify := value ]

## setProperty

the generic setter for all properties of this type. Should be overridden for every type with properties. If implementations of `setProperty` don't emit property change notification explicitly, this will be done implicitly by the type system. However, if the notify signal is emitted explicitly, the type system will not emit it a second time.

clearObjectClassSetProperty :: MonadIO m => ObjectClass -> m () Source #

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

    clear #setProperty

getObjectClassSetProperty :: MonadIO m => ObjectClass -> m (Maybe ObjectClassSetPropertyFieldCallback) Source #

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

    get objectClass #setProperty

setObjectClassSetProperty :: MonadIO m => ObjectClass -> FunPtr C_ObjectClassSetPropertyFieldCallback -> m () Source #

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

    set objectClass [ #setProperty := value ]