Gtk2HsContentsIndex
System.Glib.GObject
Portabilityportable (depends on GHC)
Stabilityprovisional
Maintainergtk2hs-users@lists.sourceforge.net
Contents
Types
Low level binding functions
Callback support
Weak references
Description
The base object type for all glib objects
Synopsis
module System.Glib.Types
objectNew :: GType -> [(String, GValue)] -> IO (Ptr GObject)
objectRef :: GObjectClass obj => Ptr obj -> IO ()
objectUnref :: Ptr a -> FinalizerPtr a
makeNewGObject :: GObjectClass obj => (ForeignPtr obj -> obj) -> IO (Ptr obj) -> IO obj
type DestroyNotify = FunPtr (Ptr () -> IO ())
mkFunPtrDestroyNotify :: FunPtr a -> IO DestroyNotify
type GWeakNotify = FunPtr (Ptr () -> Ptr GObject -> IO ())
objectWeakref :: GObjectClass o => o -> IO () -> IO GWeakNotify
objectWeakunref :: GObjectClass o => o -> GWeakNotify -> IO ()
Types
module System.Glib.Types
Low level binding functions
All these functions are internal and are only interesting to people writing bindings to GObject-style C libraries.
objectNew :: GType -> [(String, GValue)] -> IO (Ptr GObject)
Construct a new object (should rairly be used directly)
objectRef :: GObjectClass obj => Ptr obj -> IO ()
Increase the reference counter of an object
objectUnref :: Ptr a -> FinalizerPtr a
makeNewGObject :: GObjectClass obj => (ForeignPtr obj -> obj) -> IO (Ptr obj) -> IO obj

This is a convenience function to generate an object that does not derive from Object. It adds objectUnref as finalizer.

  • The constr argument is the contructor of the specific object.
Callback support
type DestroyNotify = FunPtr (Ptr () -> IO ())
mkFunPtrDestroyNotify :: FunPtr a -> IO DestroyNotify
Many methods in classes derived from GObject take a callback function and a destructor function which is called to free that callback function when it is no longer required. This function constructs a DestroyNotify function pointer which when called from C land will free the given Haskell function pointer (and itself).
Weak references
type GWeakNotify = FunPtr (Ptr () -> Ptr GObject -> IO ())
objectWeakref :: GObjectClass o => o -> IO () -> IO GWeakNotify
Attach a callback that will be called after the destroy hooks have been called
objectWeakunref :: GObjectClass o => o -> GWeakNotify -> IO ()
Detach a weak destroy callback function
Produced by Haddock version 0.7