| Gtk2Hs | Contents | Index

System.Glib.GObject

Portability | portable (depends on GHC)
Stability | provisional
Maintainer | gtk2hs-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

mkGObject
unGObject
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) |

Instances

GObjectClass GObject

class GObjectClass o where

Methods

toGObject :: GObjectClass o => o -> GObject
Safe upcast.
unsafeCastGObject :: GObjectClass o => GObject -> o
Unchecked downcast.

Instances

GObjectClass GObject
GObjectClass FontSet
GObjectClass FontMap
GObjectClass FontFace
GObjectClass FontFamily
GObjectClass Font
GObjectClass PangoLayoutRaw
GObjectClass PangoContext
GObjectClass GC
GObjectClass FileChooser
GObjectClass Editable
GObjectClass WindowGroup
GObjectClass UIManager
GObjectClass ActionGroup
GObjectClass RadioAction
GObjectClass ToggleAction
GObjectClass Action
GObjectClass EntryCompletion
GObjectClass AccelMap
GObjectClass AccelGroup
GObjectClass Clipboard
GObjectClass SizeGroup
GObjectClass IconFactory
GObjectClass TreeModelFilter
GObjectClass TreeModelSort
GObjectClass ListStore
GObjectClass TreeStore
GObjectClass TreeModel
GObjectClass TreeSelection
GObjectClass StatusIcon
GObjectClass TreeSortable
GObjectClass CellLayout
GObjectClass FileFilter
GObjectClass CellRendererProgress
GObjectClass CellRendererToggle
GObjectClass CellRendererCombo
GObjectClass CellRendererText
GObjectClass CellRendererPixbuf
GObjectClass CellRenderer
GObjectClass TreeViewColumn
GObjectClass Tooltips
GObjectClass ItemFactory
GObjectClass IMMulticontext
GObjectClass IMContext
GObjectClass Adjustment
GObjectClass ProgressBar
GObjectClass Preview
GObjectClass Invisible
GObjectClass VSeparator
GObjectClass HSeparator
GObjectClass Separator
GObjectClass VScrollbar
GObjectClass HScrollbar
GObjectClass Scrollbar
GObjectClass VScale
GObjectClass HScale
GObjectClass Scale
GObjectClass Range
GObjectClass VRuler
GObjectClass HRuler
GObjectClass Ruler
GObjectClass SpinButton
GObjectClass Entry
GObjectClass DrawingArea
GObjectClass CellView
GObjectClass Calendar
GObjectClass TreeView
GObjectClass Toolbar
GObjectClass TextView
GObjectClass Table
GObjectClass Socket
GObjectClass Notebook
GObjectClass MenuBar
GObjectClass Menu
GObjectClass MenuShell
GObjectClass List
GObjectClass Layout
GObjectClass IconView
GObjectClass VPaned
GObjectClass HPaned
GObjectClass Paned
GObjectClass Fixed
GObjectClass CTree
GObjectClass CList
GObjectClass Statusbar
GObjectClass FileChooserButton
GObjectClass Combo
GObjectClass HBox
GObjectClass FileChooserWidget
GObjectClass FontSelection
GObjectClass ColorSelection
GObjectClass VBox
GObjectClass VButtonBox
GObjectClass HButtonBox
GObjectClass ButtonBox
GObjectClass Box
GObjectClass SeparatorToolItem
GObjectClass RadioToolButton
GObjectClass ToggleToolButton
GObjectClass MenuToolButton
GObjectClass ToolButton
GObjectClass ToolItem
GObjectClass ComboBoxEntry
GObjectClass ComboBox
GObjectClass Expander
GObjectClass Viewport
GObjectClass ScrolledWindow
GObjectClass HandleBox
GObjectClass EventBox
GObjectClass Plug
GObjectClass MessageDialog
GObjectClass InputDialog
GObjectClass FontSelectionDialog
GObjectClass FileChooserDialog
GObjectClass FileSelection
GObjectClass ColorSelectionDialog
GObjectClass AboutDialog
GObjectClass Dialog
GObjectClass Window
GObjectClass ListItem
GObjectClass SeparatorMenuItem
GObjectClass ImageMenuItem
GObjectClass TearoffMenuItem
GObjectClass RadioMenuItem
GObjectClass CheckMenuItem
GObjectClass MenuItem
GObjectClass Item
GObjectClass OptionMenu
GObjectClass FontButton
GObjectClass ColorButton
GObjectClass RadioButton
GObjectClass CheckButton
GObjectClass ToggleButton
GObjectClass Button
GObjectClass AspectFrame
GObjectClass Frame
GObjectClass Alignment
GObjectClass Bin
GObjectClass Container
GObjectClass Image
GObjectClass Arrow
GObjectClass TipsQuery
GObjectClass AccelLabel
GObjectClass Label
GObjectClass Misc
GObjectClass Widget
GObjectClass Object
GObjectClass TextMark
GObjectClass TextChildAnchor
GObjectClass Pixbuf
GObjectClass DragContext
GObjectClass RcStyle
GObjectClass Style
GObjectClass TextTagTable
GObjectClass TextTag
GObjectClass TextBuffer
GObjectClass Settings
GObjectClass Display
GObjectClass Screen
GObjectClass Colormap
GObjectClass Pixmap
GObjectClass DrawWindow
GObjectClass Drawable
GObjectClass GladeXML
GObjectClass SourceStyleSchemeManager
GObjectClass SourceStyleScheme
GObjectClass SourceStyleObject
GObjectClass SourceLanguageManager
GObjectClass SourceLanguage
GObjectClass SourceView
GObjectClass SourceMark
GObjectClass SourceBuffer
GObjectClass MozEmbed
GObjectClass GLDrawable
GObjectClass GLConfig
GObjectClass GLContext
GObjectClass GLWindow
GObjectClass GLPixmap
GObjectClass Mount
GObjectClass File
GObjectClass Drive
GObjectClass LoadableIcon
GObjectClass AsyncResult
GObjectClass Volume
GObjectClass AppInfo
GObjectClass Seekable
GObjectClass Icon
GObjectClass FileInfo
GObjectClass SimpleAsyncResult
GObjectClass Cancellable
GObjectClass VolumeMonitor
GObjectClass FileIcon
GObjectClass FilenameCompleter
GObjectClass FileEnumerator
GObjectClass ThemedIcon
GObjectClass MountOperation
GObjectClass Vfs
GObjectClass FileMonitor
GObjectClass FileInputStream
GObjectClass DataInputStream
GObjectClass BufferedInputStream
GObjectClass FilterInputStream
GObjectClass MemoryInputStream
GObjectClass InputStream
GObjectClass MemoryOutputStream
GObjectClass FileOutputStream
GObjectClass BufferedOutputStream
GObjectClass DataOutputStream
GObjectClass FilterOutputStream
GObjectClass OutputStream
GObjectClass GConf
GObjectClass VolumeMonitor
GObjectClass Drive
GObjectClass Volume
GObjectClass SVG
GObjectClass GLDrawingArea
GObjectClass ChildProxy
GObjectClass XML
GObjectClass Task
GObjectClass PadTemplate
GObjectClass Index
GObjectClass SystemClock
GObjectClass Clock
GObjectClass Bus
GObjectClass Registry
GObjectClass Plugin
GObjectClass TagSetter
GObjectClass ImplementsInterface
GObjectClass Pipeline
GObjectClass Bin
GObjectClass Element
GObjectClass IndexFactory
GObjectClass TypeFindFactory
GObjectClass ElementFactory
GObjectClass PluginFeature
GObjectClass GhostPad
GObjectClass Pad
GObjectClass Object
GObjectClass URIHandler
GObjectClass CollectPads
GObjectClass BaseTransform
GObjectClass BaseSink
GObjectClass PushSrc
GObjectClass BaseSrc
GObjectClass Adapter
GObjectClass Controller
GObjectClass NetClientClock
GObjectClass AudioClock
GObjectClass (TypedTreeModelSort a)
GObjectClass (ListStore a)
GObjectClass (TreeStore a)
GObjectClass (CustomStore private row)

mkGObject
unGObject
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 `GObject`s 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 2.4.2