{-# LINE 2 "./Graphics/UI/Gtk/Windows/WindowGroup.chs" #-}
module Graphics.UI.Gtk.Windows.WindowGroup (
WindowGroup,
WindowGroupClass,
castToWindowGroup, gTypeWindowGroup,
toWindowGroup,
windowGroupNew,
windowGroupAddWindow,
windowGroupRemoveWindow,
windowGroupListWindows,
) where
import System.Glib.FFI
import System.Glib.GList (fromGList)
import Graphics.UI.Gtk.Types
{-# LINE 57 "./Graphics/UI/Gtk/Windows/WindowGroup.chs" #-}
{-# LINE 59 "./Graphics/UI/Gtk/Windows/WindowGroup.chs" #-}
windowGroupNew :: IO WindowGroup
windowGroupNew :: IO WindowGroup
windowGroupNew =
(ForeignPtr WindowGroup -> WindowGroup, FinalizerPtr WindowGroup)
-> IO (Ptr WindowGroup) -> IO WindowGroup
forall obj.
GObjectClass obj =>
(ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
wrapNewGObject (ForeignPtr WindowGroup -> WindowGroup, FinalizerPtr WindowGroup)
forall {a}. (ForeignPtr WindowGroup -> WindowGroup, FinalizerPtr a)
mkWindowGroup (IO (Ptr WindowGroup) -> IO WindowGroup)
-> IO (Ptr WindowGroup) -> IO WindowGroup
forall a b. (a -> b) -> a -> b
$
IO (Ptr WindowGroup)
gtk_window_group_new
{-# LINE 71 "./Graphics/UI/Gtk/Windows/WindowGroup.chs" #-}
windowGroupAddWindow :: (WindowGroupClass self, WindowClass window) => self
-> window
-> IO ()
windowGroupAddWindow :: forall self window.
(WindowGroupClass self, WindowClass window) =>
self -> window -> IO ()
windowGroupAddWindow self
self window
window =
(\(WindowGroup ForeignPtr WindowGroup
arg1) (Window ForeignPtr Window
arg2) -> ForeignPtr WindowGroup -> (Ptr WindowGroup -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr WindowGroup
arg1 ((Ptr WindowGroup -> IO ()) -> IO ())
-> (Ptr WindowGroup -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr WindowGroup
argPtr1 ->ForeignPtr Window -> (Ptr Window -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Window
arg2 ((Ptr Window -> IO ()) -> IO ()) -> (Ptr Window -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Window
argPtr2 ->Ptr WindowGroup -> Ptr Window -> IO ()
gtk_window_group_add_window Ptr WindowGroup
argPtr1 Ptr Window
argPtr2)
{-# LINE 82 "./Graphics/UI/Gtk/Windows/WindowGroup.chs" #-}
(toWindowGroup self)
(window -> Window
forall o. WindowClass o => o -> Window
toWindow window
window)
windowGroupRemoveWindow :: (WindowGroupClass self, WindowClass window) => self
-> window
-> IO ()
windowGroupRemoveWindow :: forall self window.
(WindowGroupClass self, WindowClass window) =>
self -> window -> IO ()
windowGroupRemoveWindow self
self window
window =
(\(WindowGroup ForeignPtr WindowGroup
arg1) (Window ForeignPtr Window
arg2) -> ForeignPtr WindowGroup -> (Ptr WindowGroup -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr WindowGroup
arg1 ((Ptr WindowGroup -> IO ()) -> IO ())
-> (Ptr WindowGroup -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr WindowGroup
argPtr1 ->ForeignPtr Window -> (Ptr Window -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Window
arg2 ((Ptr Window -> IO ()) -> IO ()) -> (Ptr Window -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Window
argPtr2 ->Ptr WindowGroup -> Ptr Window -> IO ()
gtk_window_group_remove_window Ptr WindowGroup
argPtr1 Ptr Window
argPtr2)
{-# LINE 92 "./Graphics/UI/Gtk/Windows/WindowGroup.chs" #-}
(toWindowGroup self)
(window -> Window
forall o. WindowClass o => o -> Window
toWindow window
window)
windowGroupListWindows :: WindowGroupClass self
=> self
-> IO [Window]
windowGroupListWindows :: forall self. WindowGroupClass self => self -> IO [Window]
windowGroupListWindows self
self = do
Ptr ()
glist <- (\(WindowGroup ForeignPtr WindowGroup
arg1) -> ForeignPtr WindowGroup
-> (Ptr WindowGroup -> IO (Ptr ())) -> IO (Ptr ())
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr WindowGroup
arg1 ((Ptr WindowGroup -> IO (Ptr ())) -> IO (Ptr ()))
-> (Ptr WindowGroup -> IO (Ptr ())) -> IO (Ptr ())
forall a b. (a -> b) -> a -> b
$ \Ptr WindowGroup
argPtr1 ->Ptr WindowGroup -> IO (Ptr ())
gtk_window_group_list_windows Ptr WindowGroup
argPtr1) (self -> WindowGroup
forall o. WindowGroupClass o => o -> WindowGroup
toWindowGroup self
self)
[Ptr Window]
ptrList <- Ptr () -> IO [Ptr Window]
forall a. Ptr () -> IO [Ptr a]
fromGList Ptr ()
glist
(Ptr Window -> IO Window) -> [Ptr Window] -> IO [Window]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
forall (m :: * -> *) a b. Monad m => (a -> m b) -> [a] -> m [b]
mapM ((ForeignPtr Window -> Window, FinalizerPtr Window)
-> IO (Ptr Window) -> IO Window
forall obj.
GObjectClass obj =>
(ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
makeNewGObject (ForeignPtr Window -> Window, FinalizerPtr Window)
forall {a}. (ForeignPtr Window -> Window, FinalizerPtr a)
mkWindow (IO (Ptr Window) -> IO Window)
-> (Ptr Window -> IO (Ptr Window)) -> Ptr Window -> IO Window
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Ptr Window -> IO (Ptr Window)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return) [Ptr Window]
ptrList
foreign import ccall safe "gtk_window_group_new"
gtk_window_group_new :: (IO (Ptr WindowGroup))
foreign import ccall safe "gtk_window_group_add_window"
gtk_window_group_add_window :: ((Ptr WindowGroup) -> ((Ptr Window) -> (IO ())))
foreign import ccall safe "gtk_window_group_remove_window"
gtk_window_group_remove_window :: ((Ptr WindowGroup) -> ((Ptr Window) -> (IO ())))
foreign import ccall safe "gtk_window_group_list_windows"
gtk_window_group_list_windows :: ((Ptr WindowGroup) -> (IO (Ptr ())))