    -- GENERATED by C->Haskell Compiler, version 0.13.13 (gtk2hs branch) "Bin IO", 27 May 2012 (Haskell)
    -- Edit the ORIGINAL .chs file instead!

    {-# LINE 1 "./System/Glib/Types.chs" #-}
    {-# OPTIONS_HADDOCK hide #-}
    -- -*-haskell-*-
    --  GIMP Toolkit (GTK) Widget GObject
    --
    --  Author : Axel Simon
    --
    --  Created: 9 April 2001
    --
    --  Copyright (c) 2001 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.
    --
    -- #hide

    -- |
    -- Maintainer  : gtk2hs-users@lists.sourceforge.net
    -- Stability   : provisional
    -- Portability : portable (depends on GHC)
    --
    -- Implements the base GObject class.
    --
    module System.Glib.Types (
      GObject(..),
      GObjectClass,
      mkGObject,
      unGObject,
      toGObject,
      unsafeCastGObject,
      castToGObject,
      objectUnref
      ) where

    import System.Glib.FFI

    {-# LINE 43 "./System/Glib/Types.chs" #-}

    newtype GObject = GObject (ForeignPtr (GObject)) deriving (Eq)

    mkGObject :: (ForeignPtr GObject -> GObject, FinalizerPtr a)
    mkGObject = (ForeignPtr GObject -> GObject
    GObject, FinalizerPtr a
    forall a. FinalizerPtr a
    objectUnref)
    unGObject :: GObject -> ForeignPtr GObject
    unGObject (GObject ForeignPtr GObject
    o) = ForeignPtr GObject
    o

    class GObjectClass o where
      -- | Safe upcast.
      toGObject         :: o -> GObject
      -- | Unchecked downcast.
      unsafeCastGObject :: GObject -> o

    instance GObjectClass GObject where
      toGObject :: GObject -> GObject
    toGObject = GObject -> GObject
    forall a. a -> a
    id
      unsafeCastGObject :: GObject -> GObject
    unsafeCastGObject = GObject -> GObject
    forall a. a -> a
    id

    castToGObject :: GObjectClass obj => obj -> obj
    castToGObject :: forall obj. GObjectClass obj => obj -> obj
    castToGObject = obj -> obj
    forall a. a -> a
    id

    -- | Decrease the reference counter of an object
    --
    foreign import ccall unsafe "&g_object_unref"
      objectUnref :: FinalizerPtr a