|
System.Glib.GObject | Portability | portable (depends on GHC) | Stability | provisional | Maintainer | gtk2hs-users@lists.sourceforge.net |
|
|
|
|
|
Description |
The base object type for all glib objects
|
|
Synopsis |
|
|
|
|
Types
|
|
newtype GObject |
Constructors | | Instances | |
|
|
class GObjectClass o |
| Instances | |
|
|
toGObject :: GObjectClass o => o -> GObject |
|
fromGObject :: GObjectClass o => GObject -> o |
|
castToGObject :: GObjectClass obj => obj -> obj |
|
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 :: FinalizerPtr a |
Decrease the reference counter of an object
|
|
objectRefSink :: GObjectClass obj => Ptr obj -> IO () |
Reference and sink an object.
|
|
makeNewGObject |
:: GObjectClass obj | | => (ForeignPtr obj -> obj) | constructor for the Haskell object
| -> IO (Ptr obj) | action which yields a pointer to the C object
| -> IO obj | | This function wraps any object that does not derive from Object.
It should be used whenever a function returns a pointer to an existing
GObject (as opposed to a function that constructs a new object).
- The first argument is the contructor of the specific object.
|
|
|
constructNewGObject :: GObjectClass obj => (ForeignPtr obj -> obj) -> IO (Ptr obj) -> IO obj |
This function wraps any object that does not
derive from Object. The object is NOT reference, hence it should be used
when a new object is created. Newly created GObjects have a reference
count of one, hence don't need ref'ing.
|
|
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
|
|
User-Defined Attributes
|
|
type Quark = CUInt |
|
quarkFromString :: String -> IO Quark |
Create a unique id based on the given string.
|
|
objectCreateAttribute :: GObjectClass o => IO (Attr o (Maybe a)) |
Add an attribute to this object.
- The function returns a new attribute that can be set or retrieved from
any GObject. The attribute is wrapped in a Maybe type to reflect
the circumstance when the attribute is not set or if it should be unset.
|
|
objectSetAttribute :: GObjectClass o => Quark -> o -> Maybe a -> IO () |
Set the value of an association.
|
|
objectGetAttributeUnsafe :: GObjectClass o => Quark -> o -> IO (Maybe a) |
Get the value of an association.
- Note that this function may crash the Haskell run-time since the
returned type can be forced to be anything. See objectCreateAttribute
for a safe wrapper around this funciton.
|
|
Produced by Haddock version 0.8 |