Safe Haskell | None |
---|---|
Language | Haskell98 |
This module constains helpers for dealing with GObject
-derived
types.
Synopsis
- constructGObject :: forall o m. (GObject o, MonadIO m) => (ManagedPtr o -> o) -> [AttrOp o AttrConstruct] -> m o
- gobjectGetUserData :: (HasCallStack, GObject o) => o -> GQuark a -> IO (Maybe a)
- gobjectSetUserData :: (HasCallStack, GObject o) => o -> GQuark a -> a -> IO ()
- class GObject a => DerivedGObject a where
- type GObjectParentType a
- type GObjectPrivateData a
- objectTypeName :: Text
- objectClassInit :: GObjectClass -> IO ()
- objectInstanceInit :: GObjectClass -> IO (GObjectPrivateData a)
- registerGType :: forall o. (HasCallStack, DerivedGObject o, GObject (GObjectParentType o)) => (ManagedPtr o -> o) -> IO GType
- gobjectGetPrivateData :: forall o. (HasCallStack, DerivedGObject o) => o -> IO (GObjectPrivateData o)
- gobjectSetPrivateData :: forall o. (HasCallStack, DerivedGObject o) => o -> GObjectPrivateData o -> IO ()
- data GObjectClass
- gtypeFromClass :: GObjectClass -> IO GType
- gtypeFromInstance :: GObject o => o -> IO GType
- gobjectInstallProperty :: DerivedGObject o => GObjectClass -> PropertyInfo o a -> IO ()
- gobjectInstallCIntProperty :: DerivedGObject o => GObjectClass -> CIntPropertyInfo o -> IO ()
- gobjectInstallCStringProperty :: DerivedGObject o => GObjectClass -> CStringPropertyInfo o -> IO ()
Constructing new GObject
s
constructGObject :: forall o m. (GObject o, MonadIO m) => (ManagedPtr o -> o) -> [AttrOp o AttrConstruct] -> m o Source #
Construct a GObject given the constructor and a list of settable
attributes. See new
for a more general
version.
User data
gobjectGetUserData :: (HasCallStack, GObject o) => o -> GQuark a -> IO (Maybe a) Source #
Get the value of a given key for the object.
gobjectSetUserData :: (HasCallStack, GObject o) => o -> GQuark a -> a -> IO () Source #
Deriving new object types
class GObject a => DerivedGObject a where Source #
This typeclass contains the data necessary for defining a new
GObject
type from Haskell.
type GObjectParentType a Source #
The parent type
type GObjectPrivateData a Source #
Type of the private data for each instance.
objectTypeName :: Text Source #
Name of the type, it should be unique.
objectClassInit :: GObjectClass -> IO () Source #
Code to run when the class is inited. This is a good place to register signals and properties for the type.
objectInstanceInit :: GObjectClass -> IO (GObjectPrivateData a) Source #
Code to run when each instance of the type is
constructed. Returns the private data to be associated with the
new instance (use gobjectGetPrivateData
and
gobjectSetPrivateData
to manipulate this further).
registerGType :: forall o. (HasCallStack, DerivedGObject o, GObject (GObjectParentType o)) => (ManagedPtr o -> o) -> IO GType Source #
Register the given type into the GObject
type system and return
the resulting GType
, if it has not been registered already. If
the type has been registered already the existing GType
will be
returned instead.
Note that for this function to work the type must be an instance of
DerivedGObject
.
gobjectGetPrivateData :: forall o. (HasCallStack, DerivedGObject o) => o -> IO (GObjectPrivateData o) Source #
Get the private data associated with the given object.
gobjectSetPrivateData :: forall o. (HasCallStack, DerivedGObject o) => o -> GObjectPrivateData o -> IO () Source #
Set the private data associated with the given object.
data GObjectClass Source #
Opaque wrapper around GObjectClass
on the C-side.
gtypeFromClass :: GObjectClass -> IO GType Source #
Find the GType
associated to a given GObjectClass
.
Installing properties for derived objects
gobjectInstallProperty :: DerivedGObject o => GObjectClass -> PropertyInfo o a -> IO () Source #
Add a Haskell object-valued property to the given object class.
gobjectInstallCIntProperty :: DerivedGObject o => GObjectClass -> CIntPropertyInfo o -> IO () Source #
Add a CInt
-valued property to the given object class.
gobjectInstallCStringProperty :: DerivedGObject o => GObjectClass -> CStringPropertyInfo o -> IO () Source #
Add a CString
-valued property to the given object class.