#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.Gtk.Objects.CssProvider
(
CssProvider(..) ,
IsCssProvider ,
toCssProvider ,
noCssProvider ,
cssProviderGetDefault ,
cssProviderGetNamed ,
#if ENABLE_OVERLOADING
CssProviderLoadFromDataMethodInfo ,
#endif
cssProviderLoadFromData ,
#if ENABLE_OVERLOADING
CssProviderLoadFromFileMethodInfo ,
#endif
cssProviderLoadFromFile ,
#if ENABLE_OVERLOADING
CssProviderLoadFromPathMethodInfo ,
#endif
cssProviderLoadFromPath ,
#if ENABLE_OVERLOADING
CssProviderLoadFromResourceMethodInfo ,
#endif
cssProviderLoadFromResource ,
cssProviderNew ,
#if ENABLE_OVERLOADING
CssProviderToStringMethodInfo ,
#endif
cssProviderToString ,
C_CssProviderParsingErrorCallback ,
CssProviderParsingErrorCallback ,
#if ENABLE_OVERLOADING
CssProviderParsingErrorSignalInfo ,
#endif
afterCssProviderParsingError ,
genClosure_CssProviderParsingError ,
mk_CssProviderParsingErrorCallback ,
noCssProviderParsingErrorCallback ,
onCssProviderParsingError ,
wrap_CssProviderParsingErrorCallback ,
) where
import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P
import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gio.Interfaces.File as Gio.File
import {-# SOURCE #-} qualified GI.Gtk.Interfaces.StyleProvider as Gtk.StyleProvider
import {-# SOURCE #-} qualified GI.Gtk.Structs.CssSection as Gtk.CssSection
newtype CssProvider = CssProvider (ManagedPtr CssProvider)
foreign import ccall "gtk_css_provider_get_type"
c_gtk_css_provider_get_type :: IO GType
instance GObject CssProvider where
gobjectType = c_gtk_css_provider_get_type
class (GObject o, O.IsDescendantOf CssProvider o) => IsCssProvider o
instance (GObject o, O.IsDescendantOf CssProvider o) => IsCssProvider o
instance O.HasParentTypes CssProvider
type instance O.ParentTypes CssProvider = '[GObject.Object.Object, Gtk.StyleProvider.StyleProvider]
toCssProvider :: (MonadIO m, IsCssProvider o) => o -> m CssProvider
toCssProvider = liftIO . unsafeCastTo CssProvider
noCssProvider :: Maybe CssProvider
noCssProvider = Nothing
#if ENABLE_OVERLOADING
type family ResolveCssProviderMethod (t :: Symbol) (o :: *) :: * where
ResolveCssProviderMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveCssProviderMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveCssProviderMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveCssProviderMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveCssProviderMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveCssProviderMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveCssProviderMethod "loadFromData" o = CssProviderLoadFromDataMethodInfo
ResolveCssProviderMethod "loadFromFile" o = CssProviderLoadFromFileMethodInfo
ResolveCssProviderMethod "loadFromPath" o = CssProviderLoadFromPathMethodInfo
ResolveCssProviderMethod "loadFromResource" o = CssProviderLoadFromResourceMethodInfo
ResolveCssProviderMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveCssProviderMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveCssProviderMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveCssProviderMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveCssProviderMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveCssProviderMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveCssProviderMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveCssProviderMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveCssProviderMethod "toString" o = CssProviderToStringMethodInfo
ResolveCssProviderMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveCssProviderMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveCssProviderMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveCssProviderMethod "getIconFactory" o = Gtk.StyleProvider.StyleProviderGetIconFactoryMethodInfo
ResolveCssProviderMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveCssProviderMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveCssProviderMethod "getStyle" o = Gtk.StyleProvider.StyleProviderGetStyleMethodInfo
ResolveCssProviderMethod "getStyleProperty" o = Gtk.StyleProvider.StyleProviderGetStylePropertyMethodInfo
ResolveCssProviderMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveCssProviderMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveCssProviderMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveCssProviderMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveCssProviderMethod t CssProvider, O.MethodInfo info CssProvider p) => OL.IsLabel t (CssProvider -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif
#endif
type CssProviderParsingErrorCallback =
Gtk.CssSection.CssSection
-> GError
-> IO ()
noCssProviderParsingErrorCallback :: Maybe CssProviderParsingErrorCallback
noCssProviderParsingErrorCallback = Nothing
type C_CssProviderParsingErrorCallback =
Ptr () ->
Ptr Gtk.CssSection.CssSection ->
Ptr GError ->
Ptr () ->
IO ()
foreign import ccall "wrapper"
mk_CssProviderParsingErrorCallback :: C_CssProviderParsingErrorCallback -> IO (FunPtr C_CssProviderParsingErrorCallback)
genClosure_CssProviderParsingError :: MonadIO m => CssProviderParsingErrorCallback -> m (GClosure C_CssProviderParsingErrorCallback)
genClosure_CssProviderParsingError cb = liftIO $ do
let cb' = wrap_CssProviderParsingErrorCallback cb
mk_CssProviderParsingErrorCallback cb' >>= B.GClosure.newGClosure
wrap_CssProviderParsingErrorCallback ::
CssProviderParsingErrorCallback ->
C_CssProviderParsingErrorCallback
wrap_CssProviderParsingErrorCallback _cb _ section error_ _ = do
B.ManagedPtr.withTransient Gtk.CssSection.CssSection section $ \section' -> do
error_' <- (newBoxed GError) error_
_cb section' error_'
onCssProviderParsingError :: (IsCssProvider a, MonadIO m) => a -> CssProviderParsingErrorCallback -> m SignalHandlerId
onCssProviderParsingError obj cb = liftIO $ do
let cb' = wrap_CssProviderParsingErrorCallback cb
cb'' <- mk_CssProviderParsingErrorCallback cb'
connectSignalFunPtr obj "parsing-error" cb'' SignalConnectBefore
afterCssProviderParsingError :: (IsCssProvider a, MonadIO m) => a -> CssProviderParsingErrorCallback -> m SignalHandlerId
afterCssProviderParsingError obj cb = liftIO $ do
let cb' = wrap_CssProviderParsingErrorCallback cb
cb'' <- mk_CssProviderParsingErrorCallback cb'
connectSignalFunPtr obj "parsing-error" cb'' SignalConnectAfter
#if ENABLE_OVERLOADING
instance O.HasAttributeList CssProvider
type instance O.AttributeList CssProvider = CssProviderAttributeList
type CssProviderAttributeList = ('[ ] :: [(Symbol, *)])
#endif
#if ENABLE_OVERLOADING
#endif
#if ENABLE_OVERLOADING
data CssProviderParsingErrorSignalInfo
instance SignalInfo CssProviderParsingErrorSignalInfo where
type HaskellCallbackType CssProviderParsingErrorSignalInfo = CssProviderParsingErrorCallback
connectSignal _ obj cb connectMode = do
let cb' = wrap_CssProviderParsingErrorCallback cb
cb'' <- mk_CssProviderParsingErrorCallback cb'
connectSignalFunPtr obj "parsing-error" cb'' connectMode
type instance O.SignalList CssProvider = CssProviderSignalList
type CssProviderSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo), '("parsingError", CssProviderParsingErrorSignalInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "gtk_css_provider_new" gtk_css_provider_new ::
IO (Ptr CssProvider)
cssProviderNew ::
(B.CallStack.HasCallStack, MonadIO m) =>
m CssProvider
cssProviderNew = liftIO $ do
result <- gtk_css_provider_new
checkUnexpectedReturnNULL "cssProviderNew" result
result' <- (wrapObject CssProvider) result
return result'
#if ENABLE_OVERLOADING
#endif
foreign import ccall "gtk_css_provider_load_from_data" gtk_css_provider_load_from_data ::
Ptr CssProvider ->
Ptr Word8 ->
Int64 ->
Ptr (Ptr GError) ->
IO CInt
cssProviderLoadFromData ::
(B.CallStack.HasCallStack, MonadIO m, IsCssProvider a) =>
a
-> ByteString
-> m ()
cssProviderLoadFromData cssProvider data_ = liftIO $ do
let length_ = fromIntegral $ B.length data_
cssProvider' <- unsafeManagedPtrCastPtr cssProvider
data_' <- packByteString data_
onException (do
_ <- propagateGError $ gtk_css_provider_load_from_data cssProvider' data_' length_
touchManagedPtr cssProvider
freeMem data_'
return ()
) (do
freeMem data_'
)
#if ENABLE_OVERLOADING
data CssProviderLoadFromDataMethodInfo
instance (signature ~ (ByteString -> m ()), MonadIO m, IsCssProvider a) => O.MethodInfo CssProviderLoadFromDataMethodInfo a signature where
overloadedMethod _ = cssProviderLoadFromData
#endif
foreign import ccall "gtk_css_provider_load_from_file" gtk_css_provider_load_from_file ::
Ptr CssProvider ->
Ptr Gio.File.File ->
Ptr (Ptr GError) ->
IO CInt
cssProviderLoadFromFile ::
(B.CallStack.HasCallStack, MonadIO m, IsCssProvider a, Gio.File.IsFile b) =>
a
-> b
-> m ()
cssProviderLoadFromFile cssProvider file = liftIO $ do
cssProvider' <- unsafeManagedPtrCastPtr cssProvider
file' <- unsafeManagedPtrCastPtr file
onException (do
_ <- propagateGError $ gtk_css_provider_load_from_file cssProvider' file'
touchManagedPtr cssProvider
touchManagedPtr file
return ()
) (do
return ()
)
#if ENABLE_OVERLOADING
data CssProviderLoadFromFileMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsCssProvider a, Gio.File.IsFile b) => O.MethodInfo CssProviderLoadFromFileMethodInfo a signature where
overloadedMethod _ = cssProviderLoadFromFile
#endif
foreign import ccall "gtk_css_provider_load_from_path" gtk_css_provider_load_from_path ::
Ptr CssProvider ->
CString ->
Ptr (Ptr GError) ->
IO CInt
cssProviderLoadFromPath ::
(B.CallStack.HasCallStack, MonadIO m, IsCssProvider a) =>
a
-> T.Text
-> m ()
cssProviderLoadFromPath cssProvider path = liftIO $ do
cssProvider' <- unsafeManagedPtrCastPtr cssProvider
path' <- textToCString path
onException (do
_ <- propagateGError $ gtk_css_provider_load_from_path cssProvider' path'
touchManagedPtr cssProvider
freeMem path'
return ()
) (do
freeMem path'
)
#if ENABLE_OVERLOADING
data CssProviderLoadFromPathMethodInfo
instance (signature ~ (T.Text -> m ()), MonadIO m, IsCssProvider a) => O.MethodInfo CssProviderLoadFromPathMethodInfo a signature where
overloadedMethod _ = cssProviderLoadFromPath
#endif
foreign import ccall "gtk_css_provider_load_from_resource" gtk_css_provider_load_from_resource ::
Ptr CssProvider ->
CString ->
IO ()
cssProviderLoadFromResource ::
(B.CallStack.HasCallStack, MonadIO m, IsCssProvider a) =>
a
-> T.Text
-> m ()
cssProviderLoadFromResource cssProvider resourcePath = liftIO $ do
cssProvider' <- unsafeManagedPtrCastPtr cssProvider
resourcePath' <- textToCString resourcePath
gtk_css_provider_load_from_resource cssProvider' resourcePath'
touchManagedPtr cssProvider
freeMem resourcePath'
return ()
#if ENABLE_OVERLOADING
data CssProviderLoadFromResourceMethodInfo
instance (signature ~ (T.Text -> m ()), MonadIO m, IsCssProvider a) => O.MethodInfo CssProviderLoadFromResourceMethodInfo a signature where
overloadedMethod _ = cssProviderLoadFromResource
#endif
foreign import ccall "gtk_css_provider_to_string" gtk_css_provider_to_string ::
Ptr CssProvider ->
IO CString
cssProviderToString ::
(B.CallStack.HasCallStack, MonadIO m, IsCssProvider a) =>
a
-> m T.Text
cssProviderToString provider = liftIO $ do
provider' <- unsafeManagedPtrCastPtr provider
result <- gtk_css_provider_to_string provider'
checkUnexpectedReturnNULL "cssProviderToString" result
result' <- cstringToText result
freeMem result
touchManagedPtr provider
return result'
#if ENABLE_OVERLOADING
data CssProviderToStringMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsCssProvider a) => O.MethodInfo CssProviderToStringMethodInfo a signature where
overloadedMethod _ = cssProviderToString
#endif
foreign import ccall "gtk_css_provider_get_default" gtk_css_provider_get_default ::
IO (Ptr CssProvider)
{-# DEPRECATED cssProviderGetDefault ["(Since version 3.24)","Use 'GI.Gtk.Objects.CssProvider.cssProviderNew' instead."] #-}
cssProviderGetDefault ::
(B.CallStack.HasCallStack, MonadIO m) =>
m CssProvider
cssProviderGetDefault = liftIO $ do
result <- gtk_css_provider_get_default
checkUnexpectedReturnNULL "cssProviderGetDefault" result
result' <- (newObject CssProvider) result
return result'
#if ENABLE_OVERLOADING
#endif
foreign import ccall "gtk_css_provider_get_named" gtk_css_provider_get_named ::
CString ->
CString ->
IO (Ptr CssProvider)
cssProviderGetNamed ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-> Maybe (T.Text)
-> m CssProvider
cssProviderGetNamed name variant = liftIO $ do
name' <- textToCString name
maybeVariant <- case variant of
Nothing -> return nullPtr
Just jVariant -> do
jVariant' <- textToCString jVariant
return jVariant'
result <- gtk_css_provider_get_named name' maybeVariant
checkUnexpectedReturnNULL "cssProviderGetNamed" result
result' <- (newObject CssProvider) result
freeMem name'
freeMem maybeVariant
return result'
#if ENABLE_OVERLOADING
#endif