Gtk2HsContentsIndex
System.Glib.GObject
Portabilityportable (depends on GHC)
Stabilityprovisional
Maintainergtk2hs-users@lists.sourceforge.net
Contents
Types
Low level binding functions
GType queries
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
isA :: GObjectClass o => o -> GType -> Bool
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 Adapter
GObjectClass Adjustment
GObjectClass Alignment
GObjectClass AppInfo
GObjectClass Arrow
GObjectClass AspectFrame
GObjectClass AsyncResult
GObjectClass AudioClock
GObjectClass BaseSink
GObjectClass BaseSrc
GObjectClass BaseTransform
GObjectClass Bin
GObjectClass Bin
GObjectClass Box
GObjectClass BufferedInputStream
GObjectClass BufferedOutputStream
GObjectClass Bus
GObjectClass Button
GObjectClass ButtonBox
GObjectClass CList
GObjectClass CTree
GObjectClass Calendar
GObjectClass Cancellable
GObjectClass CellLayout
GObjectClass CellRenderer
GObjectClass CellRendererCombo
GObjectClass CellRendererPixbuf
GObjectClass CellRendererProgress
GObjectClass CellRendererText
GObjectClass CellRendererToggle
GObjectClass CellView
GObjectClass CheckButton
GObjectClass CheckMenuItem
GObjectClass ChildProxy
GObjectClass Clipboard
GObjectClass Clock
GObjectClass CollectPads
GObjectClass ColorButton
GObjectClass ColorSelection
GObjectClass ColorSelectionDialog
GObjectClass Colormap
GObjectClass Combo
GObjectClass ComboBox
GObjectClass ComboBoxEntry
GObjectClass Container
GObjectClass Controller
GObjectClass DataInputStream
GObjectClass DataOutputStream
GObjectClass Dialog
GObjectClass Display
GObjectClass DragContext
GObjectClass DrawWindow
GObjectClass Drawable
GObjectClass DrawingArea
GObjectClass Drive
GObjectClass Drive
GObjectClass Editable
GObjectClass Element
GObjectClass ElementFactory
GObjectClass Entry
GObjectClass EntryCompletion
GObjectClass EventBox
GObjectClass Expander
GObjectClass File
GObjectClass FileChooser
GObjectClass FileChooserButton
GObjectClass FileChooserDialog
GObjectClass FileChooserWidget
GObjectClass FileEnumerator
GObjectClass FileFilter
GObjectClass FileIcon
GObjectClass FileInfo
GObjectClass FileInputStream
GObjectClass FileMonitor
GObjectClass FileOutputStream
GObjectClass FileSelection
GObjectClass FilenameCompleter
GObjectClass FilterInputStream
GObjectClass FilterOutputStream
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 GLConfig
GObjectClass GLContext
GObjectClass GLDrawable
GObjectClass GLDrawingArea
GObjectClass GLPixmap
GObjectClass GLWindow
GObjectClass GObject
GObjectClass GhostPad
GObjectClass GladeXML
GObjectClass HBox
GObjectClass HButtonBox
GObjectClass HPaned
GObjectClass HRuler
GObjectClass HScale
GObjectClass HScrollbar
GObjectClass HSeparator
GObjectClass HandleBox
GObjectClass IMContext
GObjectClass IMMulticontext
GObjectClass Icon
GObjectClass IconFactory
GObjectClass IconView
GObjectClass Image
GObjectClass ImageMenuItem
GObjectClass ImplementsInterface
GObjectClass Index
GObjectClass IndexFactory
GObjectClass InputDialog
GObjectClass InputStream
GObjectClass Invisible
GObjectClass Item
GObjectClass ItemFactory
GObjectClass Label
GObjectClass Layout
GObjectClass List
GObjectClass ListItem
GObjectClass ListStore
GObjectClass LoadableIcon
GObjectClass MemoryInputStream
GObjectClass MemoryOutputStream
GObjectClass Menu
GObjectClass MenuBar
GObjectClass MenuItem
GObjectClass MenuShell
GObjectClass MenuToolButton
GObjectClass MessageDialog
GObjectClass Misc
GObjectClass Mount
GObjectClass MountOperation
GObjectClass NetClientClock
GObjectClass Notebook
GObjectClass Object
GObjectClass Object
GObjectClass OptionMenu
GObjectClass OutputStream
GObjectClass Pad
GObjectClass PadTemplate
GObjectClass Paned
GObjectClass PangoContext
GObjectClass PangoLayoutRaw
GObjectClass Pipeline
GObjectClass Pixbuf
GObjectClass Pixmap
GObjectClass Plug
GObjectClass Plugin
GObjectClass PluginFeature
GObjectClass Preview
GObjectClass ProgressBar
GObjectClass PushSrc
GObjectClass RadioAction
GObjectClass RadioButton
GObjectClass RadioMenuItem
GObjectClass RadioToolButton
GObjectClass Range
GObjectClass RcStyle
GObjectClass Registry
GObjectClass Ruler
GObjectClass SVG
GObjectClass Scale
GObjectClass Screen
GObjectClass Scrollbar
GObjectClass ScrolledWindow
GObjectClass Seekable
GObjectClass Separator
GObjectClass SeparatorMenuItem
GObjectClass SeparatorToolItem
GObjectClass Settings
GObjectClass SimpleAsyncResult
GObjectClass SizeGroup
GObjectClass Socket
GObjectClass SourceBuffer
GObjectClass SourceLanguage
GObjectClass SourceLanguageManager
GObjectClass SourceMark
GObjectClass SourceStyleObject
GObjectClass SourceStyleScheme
GObjectClass SourceStyleSchemeManager
GObjectClass SourceView
GObjectClass SpinButton
GObjectClass StatusIcon
GObjectClass Statusbar
GObjectClass Style
GObjectClass SystemClock
GObjectClass Table
GObjectClass TagSetter
GObjectClass Task
GObjectClass TearoffMenuItem
GObjectClass TextBuffer
GObjectClass TextChildAnchor
GObjectClass TextMark
GObjectClass TextTag
GObjectClass TextTagTable
GObjectClass TextView
GObjectClass ThemedIcon
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 TypeFindFactory
GObjectClass UIManager
GObjectClass URIHandler
GObjectClass VBox
GObjectClass VButtonBox
GObjectClass VPaned
GObjectClass VRuler
GObjectClass VScale
GObjectClass VScrollbar
GObjectClass VSeparator
GObjectClass Vfs
GObjectClass Viewport
GObjectClass Volume
GObjectClass Volume
GObjectClass VolumeMonitor
GObjectClass VolumeMonitor
GObjectClass Widget
GObjectClass Window
GObjectClass WindowGroup
GObjectClass XML
GObjectClass (ListStore a)
GObjectClass (TreeStore a)
GObjectClass (TypedTreeModelSort a)
GObjectClass (CustomStore 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.
GType queries
isA :: GObjectClass o => o -> GType -> Bool
Determine if this is an instance of a particular GTK type
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