{-# LINE 2 "./Graphics/UI/Gtk/Abstract/Object.chs" #-}-- -*-haskell-*--- GIMP Toolkit (GTK) Object---- Author : Axel Simon---- Created: 9 April 2001---- Copyright (C) 2001-2005 Axel Simon---- This library is free software; you can redistribute it and/or-- modify it under the terms of the GNU Lesser General Public-- License as published by the Free Software Foundation; either-- version 2.1 of the License, or (at your option) any later version.---- This library is distributed in the hope that it will be useful,-- but WITHOUT ANY WARRANTY; without even the implied warranty of-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU-- Lesser General Public License for more details.---- |-- Maintainer : gtk2hs-users@lists.sourceforge.net-- Stability : provisional-- Portability : portable (depends on GHC)---- The base class of the Gtk+ type hierarchy.---- * Each widget is a represented as a purely abstract data type. It can only-- be accessed through and the special access functions that are defined-- in each widget file.--moduleGraphics.UI.Gtk.Abstract.Object(-- * Detail---- | 'Object' is the base class for all widgets, and for a few non-widget-- objects such as 'Adjustment'. 'Object' predates 'GObject'; non-widgets that-- derive from 'Object' rather than 'GObject' do so for backward compatibility-- reasons.---- * Class Hierarchy-- |-- @-- | 'GObject'-- | +----Object-- | +----'Widget'-- | +----'Adjustment'-- | +----'CellRenderer'-- | +----'FileFilter'-- | +----'ItemFactory'-- | +----'Tooltips'-- | +----'TreeViewColumn'-- @-- * TypesObject,ObjectClass,castToObject,gTypeObject,toObject,-- * MethodsmakeNewObject,-- * Weak referencesGWeakNotify,objectWeakref,objectWeakunref,-- * SignalsobjectDestroy,notifyProperty)whereimportControl.Monad(when)importSystem.Glib.FFIimportSystem.Glib.Attributes(ReadWriteAttr)importSystem.Glib.GObject(objectUnref)importSystem.Glib.GObject(objectRefSink)importGraphics.UI.Gtk.Types{-# LINE 85 "./Graphics/UI/Gtk/Abstract/Object.chs" #-}importGraphics.UI.Gtk.Signals{-# LINE 86 "./Graphics/UI/Gtk/Abstract/Object.chs" #-}importData.IORef{-# LINE 89 "./Graphics/UI/Gtk/Abstract/Object.chs" #-}---------------------- Methods-- turn the initial floating state to sunk---- * The floating\/sunk concept of a GTK object is not very useful to us.-- The following procedure circumvents the whole subject and ensures-- proper cleanup:-- on creation: objectRef, objectSink-- on finalization: objectUnref---- * This function cannot be bound by c2hs because it is not possible to-- override the pointer hook.-- This is a convenience function to generate a new widget. It adds the-- finalizer with the method described under objectSink.---- * The constr argument is the contructor of the specific object.--makeNewObject::ObjectClassobj=>(ForeignPtrobj->obj,FinalizerPtrobj)->IO(Ptrobj)->IOobjmakeNewObject(constr,objectUnref)generator=doobjPtr<-generatorwhen(objPtr==nullPtr)(fail"makeNewObject: object is NULL")objectRefSinkobjPtrobj<-newForeignPtrobjPtrobjectUnrefreturn$!constrobjtypeGWeakNotify=FunPtr(((Ptr())->((PtrGObject)->(IO())))){-# LINE 128 "./Graphics/UI/Gtk/Abstract/Object.chs" #-}foreignimportccall"wrapper"mkDestructor::IO()->IOGWeakNotify-- | Attach a callback that will be called after the-- destroy hooks have been called--objectWeakref::ObjectClasso=>o->IO()->IOGWeakNotifyobjectWeakrefobjuFun=dofunPtrContainer<-newIORefnullFunPtruFunPtr<-mkDestructor$douFunfunPtr<-readIOReffunPtrContainerfreeHaskellFunPtrfunPtrwriteIOReffunPtrContaineruFunPtr(\(GObjectarg1)arg2arg3->withForeignPtrarg1$\argPtr1->g_object_weak_refargPtr1arg2arg3)(toGObjectobj)uFunPtrnullPtrreturnuFunPtr-- | Detach a weak destroy callback function--objectWeakunref::ObjectClasso=>o->GWeakNotify->IO()objectWeakunrefobjfun=(\(GObjectarg1)arg2arg3->withForeignPtrarg1$\argPtr1->g_object_weak_unrefargPtr1arg2arg3)(toGObjectobj)funnullPtr---------------------- Signals-- | Signals that all holders of a reference to the 'Object' should release-- the reference that they hold. May result in finalization of the object if-- all references are released.--objectDestroy::ObjectClassself=>Signalself(IO())objectDestroy=Signal(connect_NONE__NONE"destroy")-- | Register a notify callback that is triggered when the given property-- has been modified.---- * Note that this callback is triggered even if the actual value of-- the property has not changed.-- * Not all attributes are properties. A warning will be generated at-- runtime if the passed-in attribute is not a property of the class-- with which it was registered.--notifyProperty::ObjectClassself=>ReadWriteAttrselfab->Signalself(IO())notifyPropertyattr=Signal(\onobjcb->connect_PTR__NONE("notify::"++showattr)onobj(constcb))foreignimportccallunsafe"g_object_weak_ref"g_object_weak_ref::((PtrGObject)->((FunPtr((Ptr())->((PtrGObject)->(IO()))))->((Ptr())->(IO()))))foreignimportccallunsafe"g_object_weak_unref"g_object_weak_unref::((PtrGObject)->((FunPtr((Ptr())->((PtrGObject)->(IO()))))->((Ptr())->(IO()))))