{-# LINE 2 "./Graphics/UI/Gtk/Embedding/Plug.chs" #-}
module Graphics.UI.Gtk.Embedding.Plug (
Plug,
PlugClass,
castToPlug, gTypePlug,
toPlug,
NativeWindowId,
plugNew,
plugNewForDisplay,
plugGetId,
plugGetEmbedded,
plugGetSocketWindow,
plugAttrEmbedded,
plugAttrSocketWindow,
plugEmbedded,
) where
import Control.Monad (liftM)
import Data.Maybe (fromMaybe)
import System.Glib.FFI
import System.Glib.Attributes
import System.Glib.Properties
import Graphics.UI.Gtk.Abstract.Object (makeNewObject)
import Graphics.UI.Gtk.Types
{-# LINE 91 "./Graphics/UI/Gtk/Embedding/Plug.chs" #-}
import Graphics.UI.Gtk.Embedding.Types
{-# LINE 92 "./Graphics/UI/Gtk/Embedding/Plug.chs" #-}
import Graphics.UI.Gtk.Signals
{-# LINE 93 "./Graphics/UI/Gtk/Embedding/Plug.chs" #-}
import Graphics.UI.Gtk.General.Structs
{-# LINE 99 "./Graphics/UI/Gtk/Embedding/Plug.chs" #-}
plugNew ::
Maybe NativeWindowId
-> IO Plug
plugNew :: Maybe NativeWindowId -> IO Plug
plugNew Maybe NativeWindowId
socketId =
(ForeignPtr Plug -> Plug, FinalizerPtr Plug)
-> IO (Ptr Plug) -> IO Plug
forall obj.
GObjectClass obj =>
(ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
makeNewObject (ForeignPtr Plug -> Plug, FinalizerPtr Plug)
forall {a}. (ForeignPtr Plug -> Plug, FinalizerPtr a)
mkPlug (IO (Ptr Plug) -> IO Plug) -> IO (Ptr Plug) -> IO Plug
forall a b. (a -> b) -> a -> b
$
(Ptr Widget -> Ptr Plug) -> IO (Ptr Widget) -> IO (Ptr Plug)
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM (Ptr Widget -> Ptr Plug
forall a b. Ptr a -> Ptr b
castPtr :: Ptr Widget -> Ptr Plug) (IO (Ptr Widget) -> IO (Ptr Plug))
-> IO (Ptr Widget) -> IO (Ptr Plug)
forall a b. (a -> b) -> a -> b
$
CULong -> IO (Ptr Widget)
gtk_plug_new
{-# LINE 120 "./Graphics/UI/Gtk/Embedding/Plug.chs" #-}
(fromNativeWindowId (fromMaybe nativeWindowIdNone socketId))
plugNewForDisplay ::
Display
-> Maybe NativeWindowId
-> IO Plug
plugNewForDisplay :: Display -> Maybe NativeWindowId -> IO Plug
plugNewForDisplay Display
display Maybe NativeWindowId
socketId =
(ForeignPtr Plug -> Plug, FinalizerPtr Plug)
-> IO (Ptr Plug) -> IO Plug
forall obj.
GObjectClass obj =>
(ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
makeNewObject (ForeignPtr Plug -> Plug, FinalizerPtr Plug)
forall {a}. (ForeignPtr Plug -> Plug, FinalizerPtr a)
mkPlug (IO (Ptr Plug) -> IO Plug) -> IO (Ptr Plug) -> IO Plug
forall a b. (a -> b) -> a -> b
$
(Ptr Widget -> Ptr Plug) -> IO (Ptr Widget) -> IO (Ptr Plug)
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM (Ptr Widget -> Ptr Plug
forall a b. Ptr a -> Ptr b
castPtr :: Ptr Widget -> Ptr Plug) (IO (Ptr Widget) -> IO (Ptr Plug))
-> IO (Ptr Widget) -> IO (Ptr Plug)
forall a b. (a -> b) -> a -> b
$
(\(Display ForeignPtr Display
arg1) CULong
arg2 -> ForeignPtr Display
-> (Ptr Display -> IO (Ptr Widget)) -> IO (Ptr Widget)
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Display
arg1 ((Ptr Display -> IO (Ptr Widget)) -> IO (Ptr Widget))
-> (Ptr Display -> IO (Ptr Widget)) -> IO (Ptr Widget)
forall a b. (a -> b) -> a -> b
$ \Ptr Display
argPtr1 ->Ptr Display -> CULong -> IO (Ptr Widget)
gtk_plug_new_for_display Ptr Display
argPtr1 CULong
arg2)
{-# LINE 136 "./Graphics/UI/Gtk/Embedding/Plug.chs" #-}
display
(NativeWindowId -> CULong
forall a. Integral a => NativeWindowId -> a
fromNativeWindowId (NativeWindowId -> Maybe NativeWindowId -> NativeWindowId
forall a. a -> Maybe a -> a
fromMaybe NativeWindowId
nativeWindowIdNone Maybe NativeWindowId
socketId))
plugGetId :: PlugClass self => self
-> IO NativeWindowId
plugGetId :: forall self. PlugClass self => self -> IO NativeWindowId
plugGetId self
self =
(CULong -> NativeWindowId) -> IO CULong -> IO NativeWindowId
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM CULong -> NativeWindowId
forall a. Integral a => a -> NativeWindowId
toNativeWindowId (IO CULong -> IO NativeWindowId) -> IO CULong -> IO NativeWindowId
forall a b. (a -> b) -> a -> b
$
(\(Plug ForeignPtr Plug
arg1) -> ForeignPtr Plug -> (Ptr Plug -> IO CULong) -> IO CULong
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Plug
arg1 ((Ptr Plug -> IO CULong) -> IO CULong)
-> (Ptr Plug -> IO CULong) -> IO CULong
forall a b. (a -> b) -> a -> b
$ \Ptr Plug
argPtr1 ->Ptr Plug -> IO CULong
gtk_plug_get_id Ptr Plug
argPtr1)
{-# LINE 152 "./Graphics/UI/Gtk/Embedding/Plug.chs" #-}
(toPlug self)
plugGetEmbedded :: PlugClass self => self
-> IO Bool
plugGetEmbedded :: forall self. PlugClass self => self -> IO Bool
plugGetEmbedded self
self =
(CInt -> Bool) -> IO CInt -> IO Bool
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM CInt -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (IO CInt -> IO Bool) -> IO CInt -> IO Bool
forall a b. (a -> b) -> a -> b
$
(\(Plug ForeignPtr Plug
arg1) -> ForeignPtr Plug -> (Ptr Plug -> IO CInt) -> IO CInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Plug
arg1 ((Ptr Plug -> IO CInt) -> IO CInt)
-> (Ptr Plug -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr Plug
argPtr1 ->Ptr Plug -> IO CInt
gtk_plug_get_embedded Ptr Plug
argPtr1)
{-# LINE 164 "./Graphics/UI/Gtk/Embedding/Plug.chs" #-}
(toPlug self)
plugGetSocketWindow :: PlugClass self => self
-> IO (Maybe DrawWindow)
plugGetSocketWindow :: forall self. PlugClass self => self -> IO (Maybe DrawWindow)
plugGetSocketWindow self
self =
(IO (Ptr DrawWindow) -> IO DrawWindow)
-> IO (Ptr DrawWindow) -> IO (Maybe DrawWindow)
forall a. (IO (Ptr a) -> IO a) -> IO (Ptr a) -> IO (Maybe a)
maybeNull ((ForeignPtr DrawWindow -> DrawWindow, FinalizerPtr DrawWindow)
-> IO (Ptr DrawWindow) -> IO DrawWindow
forall obj.
GObjectClass obj =>
(ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
makeNewGObject (ForeignPtr DrawWindow -> DrawWindow, FinalizerPtr DrawWindow)
forall {a}. (ForeignPtr DrawWindow -> DrawWindow, FinalizerPtr a)
mkDrawWindow) (IO (Ptr DrawWindow) -> IO (Maybe DrawWindow))
-> IO (Ptr DrawWindow) -> IO (Maybe DrawWindow)
forall a b. (a -> b) -> a -> b
$
(\(Plug ForeignPtr Plug
arg1) -> ForeignPtr Plug
-> (Ptr Plug -> IO (Ptr DrawWindow)) -> IO (Ptr DrawWindow)
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Plug
arg1 ((Ptr Plug -> IO (Ptr DrawWindow)) -> IO (Ptr DrawWindow))
-> (Ptr Plug -> IO (Ptr DrawWindow)) -> IO (Ptr DrawWindow)
forall a b. (a -> b) -> a -> b
$ \Ptr Plug
argPtr1 ->Ptr Plug -> IO (Ptr DrawWindow)
gtk_plug_get_socket_window Ptr Plug
argPtr1)
{-# LINE 175 "./Graphics/UI/Gtk/Embedding/Plug.chs" #-}
(toPlug self)
plugAttrEmbedded :: PlugClass self => ReadAttr self Bool
plugAttrEmbedded :: forall self. PlugClass self => ReadAttr self Bool
plugAttrEmbedded = String -> ReadAttr self Bool
forall gobj. GObjectClass gobj => String -> ReadAttr gobj Bool
readAttrFromBoolProperty String
"embedded"
plugAttrSocketWindow :: PlugClass self => ReadAttr self (Maybe DrawWindow)
plugAttrSocketWindow :: forall self. PlugClass self => ReadAttr self (Maybe DrawWindow)
plugAttrSocketWindow = String -> CULong -> ReadAttr self (Maybe DrawWindow)
forall gobj gobj'.
(GObjectClass gobj, GObjectClass gobj') =>
String -> CULong -> ReadAttr gobj (Maybe gobj')
readAttrFromMaybeObjectProperty String
"socket-window"
CULong
gdk_window_get_type
{-# LINE 200 "./Graphics/UI/Gtk/Embedding/Plug.chs" #-}
plugEmbedded :: PlugClass self => Signal self (IO ())
plugEmbedded :: forall self. PlugClass self => Signal self (IO ())
plugEmbedded = (Bool -> self -> IO () -> IO (ConnectId self))
-> Signal self (IO ())
forall object handler.
(Bool -> object -> handler -> IO (ConnectId object))
-> Signal object handler
Signal (String -> Bool -> self -> IO () -> IO (ConnectId self)
forall obj.
GObjectClass obj =>
String -> Bool -> obj -> IO () -> IO (ConnectId obj)
connect_NONE__NONE String
"embedded")
foreign import ccall unsafe "gtk_plug_new"
gtk_plug_new :: (CULong -> (IO (Ptr Widget)))
foreign import ccall safe "gtk_plug_new_for_display"
gtk_plug_new_for_display :: ((Ptr Display) -> (CULong -> (IO (Ptr Widget))))
foreign import ccall unsafe "gtk_plug_get_id"
gtk_plug_get_id :: ((Ptr Plug) -> (IO CULong))
foreign import ccall safe "gtk_plug_get_embedded"
gtk_plug_get_embedded :: ((Ptr Plug) -> (IO CInt))
foreign import ccall safe "gtk_plug_get_socket_window"
gtk_plug_get_socket_window :: ((Ptr Plug) -> (IO (Ptr DrawWindow)))
foreign import ccall unsafe "gdk_window_get_type"
gdk_window_get_type :: CULong