Gtk2HsContentsIndex
System.Glib.GObject
Portabilityportable (depends on GHC)
Stabilityprovisional
Maintainergtk2hs-users@lists.sourceforge.net
Contents
Types
Low level binding functions
Callback support
Weak references
User-Defined Attributes
Description
The base object type for all glib objects
Synopsis
newtype GObject = GObject (ForeignPtr GObject)
class GObjectClass o where
toGObject :: GObjectClass o => o -> GObject
unsafeCastGObject :: GObjectClass o => GObject -> o
toGObject :: (GObjectClass o, GObjectClass o) => o -> GObject
unsafeCastGObject :: (GObjectClass o, GObjectClass o) => GObject -> o
castToGObject :: GObjectClass obj => obj -> obj
objectNew :: GType -> [(String, GValue)] -> IO (Ptr GObject)
objectRef :: GObjectClass obj => Ptr obj -> IO ()
objectUnref :: FinalizerPtr a
objectRefSink :: GObjectClass obj => Ptr obj -> IO ()
makeNewGObject :: GObjectClass obj => (ForeignPtr obj -> obj) -> IO (Ptr obj) -> IO obj
constructNewGObject :: 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 ()
type Quark = CUInt
quarkFromString :: String -> IO Quark
objectCreateAttribute :: GObjectClass o => IO (Attr o (Maybe a))
objectSetAttribute :: GObjectClass o => Quark -> o -> Maybe a -> IO ()
objectGetAttributeUnsafe :: GObjectClass o => Quark -> o -> IO (Maybe a)
Types
newtype GObject
Constructors
GObject (ForeignPtr GObject)
show/hide Instances
class GObjectClass o where
Methods
toGObject :: GObjectClass o => o -> GObject
Safe upcast.
unsafeCastGObject :: GObjectClass o => GObject -> o
Unchecked downcast.
show/hide Instances
GObjectClass AboutDialog
GObjectClass AccelGroup
GObjectClass AccelLabel
GObjectClass AccelMap
GObjectClass Action
GObjectClass ActionGroup
GObjectClass Adjustment
GObjectClass Alignment
GObjectClass Arrow
GObjectClass AspectFrame
GObjectClass Bin
GObjectClass Box
GObjectClass Button
GObjectClass ButtonBox
GObjectClass CList
GObjectClass CTree
GObjectClass Calendar
GObjectClass CellLayout
GObjectClass CellRenderer
GObjectClass CellRendererCombo
GObjectClass CellRendererPixbuf
GObjectClass CellRendererProgress
GObjectClass CellRendererText
GObjectClass CellRendererToggle
GObjectClass CellView
GObjectClass CheckButton
GObjectClass CheckMenuItem
GObjectClass Clipboard
GObjectClass ColorButton
GObjectClass ColorSelection
GObjectClass ColorSelectionDialog
GObjectClass Colormap
GObjectClass Combo
GObjectClass ComboBox
GObjectClass ComboBoxEntry
GObjectClass Container
GObjectClass Dialog
GObjectClass Display
GObjectClass DragContext
GObjectClass DrawWindow
GObjectClass Drawable
GObjectClass DrawingArea
GObjectClass Drive
GObjectClass Editable
GObjectClass Entry
GObjectClass EntryCompletion
GObjectClass EventBox
GObjectClass Expander
GObjectClass FileChooser
GObjectClass FileChooserButton
GObjectClass FileChooserDialog
GObjectClass FileChooserWidget
GObjectClass FileFilter
GObjectClass FileSelection
GObjectClass Fixed
GObjectClass Font
GObjectClass FontButton
GObjectClass FontFace
GObjectClass FontFamily
GObjectClass FontMap
GObjectClass FontSelection
GObjectClass FontSelectionDialog
GObjectClass FontSet
GObjectClass Frame
GObjectClass GC
GObjectClass GConf
GObjectClass GObject
GObjectClass GladeXML
GObjectClass HBox
GObjectClass HButtonBox
GObjectClass HPaned
GObjectClass HRuler
GObjectClass HScale
GObjectClass HScrollbar
GObjectClass HSeparator
GObjectClass HandleBox
GObjectClass IMContext
GObjectClass IMMulticontext
GObjectClass IconFactory
GObjectClass IconView
GObjectClass Image
GObjectClass ImageMenuItem
GObjectClass InputDialog
GObjectClass Invisible
GObjectClass Item
GObjectClass ItemFactory
GObjectClass Label
GObjectClass Layout
GObjectClass List
GObjectClass ListItem
GObjectClass ListStore
GObjectClass Menu
GObjectClass MenuBar
GObjectClass MenuItem
GObjectClass MenuShell
GObjectClass MenuToolButton
GObjectClass MessageDialog
GObjectClass Misc
GObjectClass Notebook
GObjectClass Object
GObjectClass OptionMenu
GObjectClass Paned
GObjectClass PangoContext
GObjectClass PangoLayoutRaw
GObjectClass Pixbuf
GObjectClass Pixmap
GObjectClass Plug
GObjectClass Preview
GObjectClass ProgressBar
GObjectClass RadioAction
GObjectClass RadioButton
GObjectClass RadioMenuItem
GObjectClass RadioToolButton
GObjectClass Range
GObjectClass RcStyle
GObjectClass Ruler
GObjectClass SVG
GObjectClass Scale
GObjectClass Screen
GObjectClass Scrollbar
GObjectClass ScrolledWindow
GObjectClass Separator
GObjectClass SeparatorMenuItem
GObjectClass SeparatorToolItem
GObjectClass Settings
GObjectClass SizeGroup
GObjectClass Socket
GObjectClass SourceBuffer
GObjectClass SourceLanguage
GObjectClass SourceLanguagesManager
GObjectClass SourceMarker
GObjectClass SourceStyleScheme
GObjectClass SourceTag
GObjectClass SourceTagTable
GObjectClass SourceView
GObjectClass SpinButton
GObjectClass StatusIcon
GObjectClass Statusbar
GObjectClass Style
GObjectClass Table
GObjectClass TearoffMenuItem
GObjectClass TextBuffer
GObjectClass TextChildAnchor
GObjectClass TextMark
GObjectClass TextTag
GObjectClass TextTagTable
GObjectClass TextView
GObjectClass TipsQuery
GObjectClass ToggleAction
GObjectClass ToggleButton
GObjectClass ToggleToolButton
GObjectClass ToolButton
GObjectClass ToolItem
GObjectClass Toolbar
GObjectClass Tooltips
GObjectClass TreeModel
GObjectClass TreeModelFilter
GObjectClass TreeModelSort
GObjectClass TreeSelection
GObjectClass TreeSortable
GObjectClass TreeStore
GObjectClass TreeView
GObjectClass TreeViewColumn
GObjectClass UIManager
GObjectClass VBox
GObjectClass VButtonBox
GObjectClass VPaned
GObjectClass VRuler
GObjectClass VScale
GObjectClass VScrollbar
GObjectClass VSeparator
GObjectClass Viewport
GObjectClass Volume
GObjectClass VolumeMonitor
GObjectClass Widget
GObjectClass Window
GObjectClass WindowGroup
GObjectClass (ListStore a)
GObjectClass (TreeStore a)
GObjectClass (TypedTreeModelSort a)
GObjectClass (CustomTreeModel private row)
toGObject :: (GObjectClass o, GObjectClass o) => o -> GObject
Safe upcast.
unsafeCastGObject :: (GObjectClass o, GObjectClass o) => GObject -> o
Unchecked downcast.
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