{-# LINE 2 "./Graphics/UI/Gtk/General/StyleContext.chs" #-}
module Graphics.UI.Gtk.General.StyleContext (
StyleContext,
StyleContextClass,
castToStyleContext, gTypeStyleContext,
toStyleContext,
styleContextNew,
styleContextAddProvider,
styleContextAddProviderForScreen,
styleContextAddClass,
styleContextRemoveClass,
styleContextHasClass,
styleContextListClasses,
) where
{-# LINE 77 "./Graphics/UI/Gtk/General/StyleContext.chs" #-}
import Control.Monad (liftM)
import System.Glib.FFI
import System.Glib.UTFString
import Graphics.UI.Gtk.Types
{-# LINE 83 "./Graphics/UI/Gtk/General/StyleContext.chs" #-}
import System.Glib.GList (fromGList)
styleContextNew :: IO StyleContext
styleContextNew :: IO StyleContext
styleContextNew =
(ForeignPtr StyleContext -> StyleContext,
FinalizerPtr StyleContext)
-> IO (Ptr StyleContext) -> IO StyleContext
forall obj.
GObjectClass obj =>
(ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
wrapNewGObject (ForeignPtr StyleContext -> StyleContext,
FinalizerPtr StyleContext)
forall {a}.
(ForeignPtr StyleContext -> StyleContext, FinalizerPtr a)
mkStyleContext IO (Ptr StyleContext)
gtk_style_context_new
{-# LINE 95 "./Graphics/UI/Gtk/General/StyleContext.chs" #-}
styleContextAddProvider :: (StyleContextClass context, StyleProviderClass provider)
=> context
-> provider
-> Int
-> IO ()
styleContextAddProvider :: forall context provider.
(StyleContextClass context, StyleProviderClass provider) =>
context -> provider -> Int -> IO ()
styleContextAddProvider context
context provider
provider Int
priority =
(\(StyleContext ForeignPtr StyleContext
arg1) (StyleProvider ForeignPtr StyleProvider
arg2) CUInt
arg3 -> ForeignPtr StyleContext -> (Ptr StyleContext -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr StyleContext
arg1 ((Ptr StyleContext -> IO ()) -> IO ())
-> (Ptr StyleContext -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr StyleContext
argPtr1 ->ForeignPtr StyleProvider -> (Ptr StyleProvider -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr StyleProvider
arg2 ((Ptr StyleProvider -> IO ()) -> IO ())
-> (Ptr StyleProvider -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr StyleProvider
argPtr2 ->Ptr StyleContext -> Ptr StyleProvider -> CUInt -> IO ()
gtk_style_context_add_provider Ptr StyleContext
argPtr1 Ptr StyleProvider
argPtr2 CUInt
arg3)
{-# LINE 115 "./Graphics/UI/Gtk/General/StyleContext.chs" #-}
(toStyleContext context)
(provider -> StyleProvider
forall o. StyleProviderClass o => o -> StyleProvider
toStyleProvider provider
provider)
(Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
priority)
styleContextAddProviderForScreen :: (ScreenClass screen, StyleProviderClass provider)
=> screen
-> provider
-> Int
-> IO ()
styleContextAddProviderForScreen :: forall screen provider.
(ScreenClass screen, StyleProviderClass provider) =>
screen -> provider -> Int -> IO ()
styleContextAddProviderForScreen screen
screen provider
provider Int
priority =
(\(Screen ForeignPtr Screen
arg1) (StyleProvider ForeignPtr StyleProvider
arg2) CUInt
arg3 -> ForeignPtr Screen -> (Ptr Screen -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Screen
arg1 ((Ptr Screen -> IO ()) -> IO ()) -> (Ptr Screen -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Screen
argPtr1 ->ForeignPtr StyleProvider -> (Ptr StyleProvider -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr StyleProvider
arg2 ((Ptr StyleProvider -> IO ()) -> IO ())
-> (Ptr StyleProvider -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr StyleProvider
argPtr2 ->Ptr Screen -> Ptr StyleProvider -> CUInt -> IO ()
gtk_style_context_add_provider_for_screen Ptr Screen
argPtr1 Ptr StyleProvider
argPtr2 CUInt
arg3)
{-# LINE 138 "./Graphics/UI/Gtk/General/StyleContext.chs" #-}
(toScreen screen)
(provider -> StyleProvider
forall o. StyleProviderClass o => o -> StyleProvider
toStyleProvider provider
provider)
(Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
priority)
styleContextAddClass :: (StyleContextClass context, GlibString string) => context -> string -> IO ()
styleContextAddClass :: forall context string.
(StyleContextClass context, GlibString string) =>
context -> string -> IO ()
styleContextAddClass context
context string
className =
string -> (CString -> IO ()) -> IO ()
forall a. string -> (CString -> IO a) -> IO a
forall s a. GlibString s => s -> (CString -> IO a) -> IO a
withUTFString string
className ((CString -> IO ()) -> IO ()) -> (CString -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \CString
classNamePtr ->
(\(StyleContext ForeignPtr StyleContext
arg1) CString
arg2 -> ForeignPtr StyleContext -> (Ptr StyleContext -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr StyleContext
arg1 ((Ptr StyleContext -> IO ()) -> IO ())
-> (Ptr StyleContext -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr StyleContext
argPtr1 ->Ptr StyleContext -> CString -> IO ()
gtk_style_context_add_class Ptr StyleContext
argPtr1 CString
arg2)
{-# LINE 155 "./Graphics/UI/Gtk/General/StyleContext.chs" #-}
(toStyleContext context)
CString
classNamePtr
styleContextRemoveClass :: (StyleContextClass context, GlibString string) => context -> string -> IO ()
styleContextRemoveClass :: forall context string.
(StyleContextClass context, GlibString string) =>
context -> string -> IO ()
styleContextRemoveClass context
context string
className =
string -> (CString -> IO ()) -> IO ()
forall a. string -> (CString -> IO a) -> IO a
forall s a. GlibString s => s -> (CString -> IO a) -> IO a
withUTFString string
className ((CString -> IO ()) -> IO ()) -> (CString -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \CString
classNamePtr ->
(\(StyleContext ForeignPtr StyleContext
arg1) CString
arg2 -> ForeignPtr StyleContext -> (Ptr StyleContext -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr StyleContext
arg1 ((Ptr StyleContext -> IO ()) -> IO ())
-> (Ptr StyleContext -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr StyleContext
argPtr1 ->Ptr StyleContext -> CString -> IO ()
gtk_style_context_remove_class Ptr StyleContext
argPtr1 CString
arg2)
{-# LINE 163 "./Graphics/UI/Gtk/General/StyleContext.chs" #-}
(toStyleContext context)
CString
classNamePtr
styleContextHasClass :: (StyleContextClass context, GlibString string) => context -> string -> IO Bool
styleContextHasClass :: forall context string.
(StyleContextClass context, GlibString string) =>
context -> string -> IO Bool
styleContextHasClass context
context string
className =
(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
$
string -> (CString -> IO CInt) -> IO CInt
forall a. string -> (CString -> IO a) -> IO a
forall s a. GlibString s => s -> (CString -> IO a) -> IO a
withUTFString string
className ((CString -> IO CInt) -> IO CInt)
-> (CString -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \CString
classNamePtr ->
(\(StyleContext ForeignPtr StyleContext
arg1) CString
arg2 -> ForeignPtr StyleContext -> (Ptr StyleContext -> IO CInt) -> IO CInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr StyleContext
arg1 ((Ptr StyleContext -> IO CInt) -> IO CInt)
-> (Ptr StyleContext -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr StyleContext
argPtr1 ->Ptr StyleContext -> CString -> IO CInt
gtk_style_context_has_class Ptr StyleContext
argPtr1 CString
arg2)
{-# LINE 172 "./Graphics/UI/Gtk/General/StyleContext.chs" #-}
(toStyleContext context)
CString
classNamePtr
styleContextListClasses :: (StyleContextClass context, GlibString string) => context -> IO [string]
styleContextListClasses :: forall context string.
(StyleContextClass context, GlibString string) =>
context -> IO [string]
styleContextListClasses context
context =
(\(StyleContext ForeignPtr StyleContext
arg1) -> ForeignPtr StyleContext
-> (Ptr StyleContext -> IO (Ptr ())) -> IO (Ptr ())
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr StyleContext
arg1 ((Ptr StyleContext -> IO (Ptr ())) -> IO (Ptr ()))
-> (Ptr StyleContext -> IO (Ptr ())) -> IO (Ptr ())
forall a b. (a -> b) -> a -> b
$ \Ptr StyleContext
argPtr1 ->Ptr StyleContext -> IO (Ptr ())
gtk_style_context_list_classes Ptr StyleContext
argPtr1)
{-# LINE 179 "./Graphics/UI/Gtk/General/StyleContext.chs" #-}
(toStyleContext context)
IO (Ptr ()) -> (Ptr () -> IO [CString]) -> IO [CString]
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Ptr () -> IO [CString]
forall a. Ptr () -> IO [Ptr a]
fromGList
IO [CString] -> ([CString] -> IO [string]) -> IO [string]
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (CString -> IO string) -> [CString] -> IO [string]
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 CString -> IO string
forall s. GlibString s => CString -> IO s
peekUTFString
foreign import ccall safe "gtk_style_context_new"
gtk_style_context_new :: (IO (Ptr StyleContext))
foreign import ccall safe "gtk_style_context_add_provider"
gtk_style_context_add_provider :: ((Ptr StyleContext) -> ((Ptr StyleProvider) -> (CUInt -> (IO ()))))
foreign import ccall safe "gtk_style_context_add_provider_for_screen"
gtk_style_context_add_provider_for_screen :: ((Ptr Screen) -> ((Ptr StyleProvider) -> (CUInt -> (IO ()))))
foreign import ccall safe "gtk_style_context_add_class"
gtk_style_context_add_class :: ((Ptr StyleContext) -> ((Ptr CChar) -> (IO ())))
foreign import ccall safe "gtk_style_context_remove_class"
gtk_style_context_remove_class :: ((Ptr StyleContext) -> ((Ptr CChar) -> (IO ())))
foreign import ccall safe "gtk_style_context_has_class"
gtk_style_context_has_class :: ((Ptr StyleContext) -> ((Ptr CChar) -> (IO CInt)))
foreign import ccall safe "gtk_style_context_list_classes"
gtk_style_context_list_classes :: ((Ptr StyleContext) -> (IO (Ptr ())))