    {-# LINE 2 "./Graphics/UI/Gtk/Embedding/Types.chs" #-}
    {-# OPTIONS_HADDOCK hide #-}
    {-# OPTIONS_GHC -fno-warn-unused-imports #-}
    -- -*-haskell-*-
    -- -------------------- automatically generated file - do not edit ----------
    -- Object hierarchy for the GIMP Toolkit (GTK) Binding for Haskell
    --
    -- Author : Hamish Mackenzie
    --
    -- 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.
    --
    -- #hide

    -- |
    -- Maintainer : gtk2hs-users@lists.sourceforge.net
    -- Stability : provisional
    -- Portability : portable (depends on GHC)
    --
    module Graphics.UI.Gtk.Embedding.Types (

      Socket(Socket), SocketClass,
      toSocket,
      mkSocket, unSocket,
      castToSocket, gTypeSocket,
      Plug(Plug), PlugClass,
      toPlug,
      mkPlug, unPlug,
      castToPlug, gTypePlug,

      ) where

    import Foreign.ForeignPtr (ForeignPtr, castForeignPtr)
    -- TODO work around cpphs https:

    import Foreign.ForeignPtr.Unsafe (unsafeForeignPtrToPtr)

    import Foreign.C.Types (CULong(..), CUInt(..), CULLong(..))
    import System.Glib.GType (GType, typeInstanceIsA)
    import System.Glib.GObject
    {-# LINE 54 "./Graphics/UI/Gtk/Embedding/Types.chs" #-}
    import Graphics.UI.Gtk.General.Threading
    import Graphics.UI.Gtk.Types
    {-# LINE 56 "./Graphics/UI/Gtk/Embedding/Types.chs" #-}

    {-# LINE 58 "./Graphics/UI/Gtk/Embedding/Types.chs" #-}

    -- The usage of foreignPtrToPtr should be safe as the evaluation will only be
    -- forced if the object is used afterwards
    --
    castTo :: (GObjectClass obj, GObjectClass obj') => GType -> String
                                                    -> (obj -> obj')
    castTo :: forall obj obj'.
    (GObjectClass obj, GObjectClass obj') =>
    GType -> String -> obj -> obj'
    castTo GType
    gtype String
    objTypeName obj
    obj =
      case obj -> GObject
    forall o. GObjectClass o => o -> GObject
    toGObject obj
    obj of
        gobj :: GObject
    gobj@(GObject ForeignPtr GObject
    objFPtr)
          | Ptr () -> GType -> Bool
    typeInstanceIsA ((ForeignPtr () -> Ptr ()
    forall a. ForeignPtr a -> Ptr a
    unsafeForeignPtrToPtr(ForeignPtr () -> Ptr ())
    -> (ForeignPtr GObject -> ForeignPtr ())
    -> ForeignPtr GObject
    -> Ptr ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    .ForeignPtr GObject -> ForeignPtr ()
    forall a b. ForeignPtr a -> ForeignPtr b
    castForeignPtr) ForeignPtr GObject
    objFPtr) GType
    gtype
                      -> GObject -> obj'
    forall o. GObjectClass o => GObject -> o
    unsafeCastGObject GObject
    gobj
          | Bool
    otherwise -> String -> obj'
    forall a. HasCallStack => String -> a
    error (String -> obj') -> String -> obj'
    forall a b. (a -> b) -> a -> b
    $ String
    "Cannot cast object to " String -> String -> String
    forall a. [a] -> [a] -> [a]
    ++ String
    objTypeName

    -- ****************************************************************** Socket

    newtype Socket = Socket (ForeignPtr (Socket)) deriving (Socket -> Socket -> Bool
    (Socket -> Socket -> Bool)
    -> (Socket -> Socket -> Bool) -> Eq Socket
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: Socket -> Socket -> Bool
    == :: Socket -> Socket -> Bool
    $c/= :: Socket -> Socket -> Bool
    /= :: Socket -> Socket -> Bool
    Eq,Eq Socket
    Eq Socket =>
    (Socket -> Socket -> Ordering)
    -> (Socket -> Socket -> Bool)
    -> (Socket -> Socket -> Bool)
    -> (Socket -> Socket -> Bool)
    -> (Socket -> Socket -> Bool)
    -> (Socket -> Socket -> Socket)
    -> (Socket -> Socket -> Socket)
    -> Ord Socket
    Socket -> Socket -> Bool
    Socket -> Socket -> Ordering
    Socket -> Socket -> Socket
    forall a.
    Eq a =>
    (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    $ccompare :: Socket -> Socket -> Ordering
    compare :: Socket -> Socket -> Ordering
    $c< :: Socket -> Socket -> Bool
    < :: Socket -> Socket -> Bool
    $c<= :: Socket -> Socket -> Bool
    <= :: Socket -> Socket -> Bool
    $c> :: Socket -> Socket -> Bool
    > :: Socket -> Socket -> Bool
    $c>= :: Socket -> Socket -> Bool
    >= :: Socket -> Socket -> Bool
    $cmax :: Socket -> Socket -> Socket
    max :: Socket -> Socket -> Socket
    $cmin :: Socket -> Socket -> Socket
    min :: Socket -> Socket -> Socket
    Ord)

    mkSocket :: (ForeignPtr Socket -> Socket, FinalizerPtr a)
    mkSocket = (ForeignPtr Socket -> Socket
    Socket, FinalizerPtr a
    forall a. FinalizerPtr a
    objectUnrefFromMainloop)
    unSocket :: Socket -> ForeignPtr Socket
    unSocket (Socket ForeignPtr Socket
    o) = ForeignPtr Socket
    o

    class ContainerClass o => SocketClass o
    toSocket :: SocketClass o => o -> Socket
    toSocket :: forall o. SocketClass o => o -> Socket
    toSocket = GObject -> Socket
    forall o. GObjectClass o => GObject -> o
    unsafeCastGObject (GObject -> Socket) -> (o -> GObject) -> o -> Socket
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . o -> GObject
    forall o. GObjectClass o => o -> GObject
    toGObject

    instance SocketClass Socket
    instance ContainerClass Socket
    instance WidgetClass Socket

    instance GObjectClass Socket where
      toGObject :: Socket -> GObject
    toGObject = ForeignPtr GObject -> GObject
    GObject (ForeignPtr GObject -> GObject)
    -> (Socket -> ForeignPtr GObject) -> Socket -> GObject
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . ForeignPtr Socket -> ForeignPtr GObject
    forall a b. ForeignPtr a -> ForeignPtr b
    castForeignPtr (ForeignPtr Socket -> ForeignPtr GObject)
    -> (Socket -> ForeignPtr Socket) -> Socket -> ForeignPtr GObject
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket -> ForeignPtr Socket
    unSocket
      unsafeCastGObject :: GObject -> Socket
    unsafeCastGObject = ForeignPtr Socket -> Socket
    Socket (ForeignPtr Socket -> Socket)
    -> (GObject -> ForeignPtr Socket) -> GObject -> Socket
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . ForeignPtr GObject -> ForeignPtr Socket
    forall a b. ForeignPtr a -> ForeignPtr b
    castForeignPtr (ForeignPtr GObject -> ForeignPtr Socket)
    -> (GObject -> ForeignPtr GObject) -> GObject -> ForeignPtr Socket
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . GObject -> ForeignPtr GObject
    unGObject

    castToSocket :: GObjectClass obj => obj -> Socket
    castToSocket :: forall obj. GObjectClass obj => obj -> Socket
    castToSocket = GType -> String -> obj -> Socket
    forall obj obj'.
    (GObjectClass obj, GObjectClass obj') =>
    GType -> String -> obj -> obj'
    castTo GType
    gTypeSocket String
    "Socket"

    gTypeSocket :: GType
    gTypeSocket :: GType
    gTypeSocket =
      GType
    gtk_socket_get_type
    {-# LINE 99 "./Graphics/UI/Gtk/Embedding/Types.chs" #-}

    -- ****************************************************************** Plug

    newtype Plug = Plug (ForeignPtr (Plug)) deriving (Plug -> Plug -> Bool
    (Plug -> Plug -> Bool) -> (Plug -> Plug -> Bool) -> Eq Plug
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: Plug -> Plug -> Bool
    == :: Plug -> Plug -> Bool
    $c/= :: Plug -> Plug -> Bool
    /= :: Plug -> Plug -> Bool
    Eq,Eq Plug
    Eq Plug =>
    (Plug -> Plug -> Ordering)
    -> (Plug -> Plug -> Bool)
    -> (Plug -> Plug -> Bool)
    -> (Plug -> Plug -> Bool)
    -> (Plug -> Plug -> Bool)
    -> (Plug -> Plug -> Plug)
    -> (Plug -> Plug -> Plug)
    -> Ord Plug
    Plug -> Plug -> Bool
    Plug -> Plug -> Ordering
    Plug -> Plug -> Plug
    forall a.
    Eq a =>
    (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    $ccompare :: Plug -> Plug -> Ordering
    compare :: Plug -> Plug -> Ordering
    $c< :: Plug -> Plug -> Bool
    < :: Plug -> Plug -> Bool
    $c<= :: Plug -> Plug -> Bool
    <= :: Plug -> Plug -> Bool
    $c> :: Plug -> Plug -> Bool
    > :: Plug -> Plug -> Bool
    $c>= :: Plug -> Plug -> Bool
    >= :: Plug -> Plug -> Bool
    $cmax :: Plug -> Plug -> Plug
    max :: Plug -> Plug -> Plug
    $cmin :: Plug -> Plug -> Plug
    min :: Plug -> Plug -> Plug
    Ord)

    mkPlug :: (ForeignPtr Plug -> Plug, FinalizerPtr a)
    mkPlug = (ForeignPtr Plug -> Plug
    Plug, FinalizerPtr a
    forall a. FinalizerPtr a
    objectUnrefFromMainloop)
    unPlug :: Plug -> ForeignPtr Plug
    unPlug (Plug ForeignPtr Plug
    o) = ForeignPtr Plug
    o

    class WindowClass o => PlugClass o
    toPlug :: PlugClass o => o -> Plug
    toPlug :: forall o. PlugClass o => o -> Plug
    toPlug = GObject -> Plug
    forall o. GObjectClass o => GObject -> o
    unsafeCastGObject (GObject -> Plug) -> (o -> GObject) -> o -> Plug
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . o -> GObject
    forall o. GObjectClass o => o -> GObject
    toGObject

    instance PlugClass Plug
    instance WindowClass Plug
    instance BinClass Plug
    instance ContainerClass Plug
    instance WidgetClass Plug

    instance GObjectClass Plug where
      toGObject :: Plug -> GObject
    toGObject = ForeignPtr GObject -> GObject
    GObject (ForeignPtr GObject -> GObject)
    -> (Plug -> ForeignPtr GObject) -> Plug -> GObject
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . ForeignPtr Plug -> ForeignPtr GObject
    forall a b. ForeignPtr a -> ForeignPtr b
    castForeignPtr (ForeignPtr Plug -> ForeignPtr GObject)
    -> (Plug -> ForeignPtr Plug) -> Plug -> ForeignPtr GObject
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Plug -> ForeignPtr Plug
    unPlug
      unsafeCastGObject :: GObject -> Plug
    unsafeCastGObject = ForeignPtr Plug -> Plug
    Plug (ForeignPtr Plug -> Plug)
    -> (GObject -> ForeignPtr Plug) -> GObject -> Plug
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . ForeignPtr GObject -> ForeignPtr Plug
    forall a b. ForeignPtr a -> ForeignPtr b
    castForeignPtr (ForeignPtr GObject -> ForeignPtr Plug)
    -> (GObject -> ForeignPtr GObject) -> GObject -> ForeignPtr Plug
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . GObject -> ForeignPtr GObject
    unGObject

    castToPlug :: GObjectClass obj => obj -> Plug
    castToPlug :: forall obj. GObjectClass obj => obj -> Plug
    castToPlug = GType -> String -> obj -> Plug
    forall obj obj'.
    (GObjectClass obj, GObjectClass obj') =>
    GType -> String -> obj -> obj'
    castTo GType
    gTypePlug String
    "Plug"

    gTypePlug :: GType
    gTypePlug :: GType
    gTypePlug =
      GType
    gtk_plug_get_type
    {-# LINE 129 "./Graphics/UI/Gtk/Embedding/Types.chs" #-}

    foreign import ccall unsafe "gtk_socket_get_type"
      gtk_socket_get_type :: CULong

    foreign import ccall unsafe "gtk_plug_get_type"
      gtk_plug_get_type :: CULong