{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc)

The GdkPixbufLoader struct contains only private
fields.
-}

#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
       && !defined(__HADDOCK_VERSION__))

module GI.GdkPixbuf.Objects.PixbufLoader
    (

-- * Exported types
    PixbufLoader(..)                        ,
    IsPixbufLoader                          ,
    toPixbufLoader                          ,
    noPixbufLoader                          ,


 -- * Methods
-- ** close #method:close#

#if ENABLE_OVERLOADING
    PixbufLoaderCloseMethodInfo             ,
#endif
    pixbufLoaderClose                       ,


-- ** getAnimation #method:getAnimation#

#if ENABLE_OVERLOADING
    PixbufLoaderGetAnimationMethodInfo      ,
#endif
    pixbufLoaderGetAnimation                ,


-- ** getFormat #method:getFormat#

#if ENABLE_OVERLOADING
    PixbufLoaderGetFormatMethodInfo         ,
#endif
    pixbufLoaderGetFormat                   ,


-- ** getPixbuf #method:getPixbuf#

#if ENABLE_OVERLOADING
    PixbufLoaderGetPixbufMethodInfo         ,
#endif
    pixbufLoaderGetPixbuf                   ,


-- ** new #method:new#

    pixbufLoaderNew                         ,


-- ** newWithMimeType #method:newWithMimeType#

    pixbufLoaderNewWithMimeType             ,


-- ** newWithType #method:newWithType#

    pixbufLoaderNewWithType                 ,


-- ** setSize #method:setSize#

#if ENABLE_OVERLOADING
    PixbufLoaderSetSizeMethodInfo           ,
#endif
    pixbufLoaderSetSize                     ,


-- ** write #method:write#

#if ENABLE_OVERLOADING
    PixbufLoaderWriteMethodInfo             ,
#endif
    pixbufLoaderWrite                       ,


-- ** writeBytes #method:writeBytes#

#if ENABLE_OVERLOADING
    PixbufLoaderWriteBytesMethodInfo        ,
#endif
    pixbufLoaderWriteBytes                  ,




 -- * Signals
-- ** areaPrepared #signal:areaPrepared#

    C_PixbufLoaderAreaPreparedCallback      ,
    PixbufLoaderAreaPreparedCallback        ,
#if ENABLE_OVERLOADING
    PixbufLoaderAreaPreparedSignalInfo      ,
#endif
    afterPixbufLoaderAreaPrepared           ,
    genClosure_PixbufLoaderAreaPrepared     ,
    mk_PixbufLoaderAreaPreparedCallback     ,
    noPixbufLoaderAreaPreparedCallback      ,
    onPixbufLoaderAreaPrepared              ,
    wrap_PixbufLoaderAreaPreparedCallback   ,


-- ** areaUpdated #signal:areaUpdated#

    C_PixbufLoaderAreaUpdatedCallback       ,
    PixbufLoaderAreaUpdatedCallback         ,
#if ENABLE_OVERLOADING
    PixbufLoaderAreaUpdatedSignalInfo       ,
#endif
    afterPixbufLoaderAreaUpdated            ,
    genClosure_PixbufLoaderAreaUpdated      ,
    mk_PixbufLoaderAreaUpdatedCallback      ,
    noPixbufLoaderAreaUpdatedCallback       ,
    onPixbufLoaderAreaUpdated               ,
    wrap_PixbufLoaderAreaUpdatedCallback    ,


-- ** closed #signal:closed#

    C_PixbufLoaderClosedCallback            ,
    PixbufLoaderClosedCallback              ,
#if ENABLE_OVERLOADING
    PixbufLoaderClosedSignalInfo            ,
#endif
    afterPixbufLoaderClosed                 ,
    genClosure_PixbufLoaderClosed           ,
    mk_PixbufLoaderClosedCallback           ,
    noPixbufLoaderClosedCallback            ,
    onPixbufLoaderClosed                    ,
    wrap_PixbufLoaderClosedCallback         ,


-- ** sizePrepared #signal:sizePrepared#

    C_PixbufLoaderSizePreparedCallback      ,
    PixbufLoaderSizePreparedCallback        ,
#if ENABLE_OVERLOADING
    PixbufLoaderSizePreparedSignalInfo      ,
#endif
    afterPixbufLoaderSizePrepared           ,
    genClosure_PixbufLoaderSizePrepared     ,
    mk_PixbufLoaderSizePreparedCallback     ,
    noPixbufLoaderSizePreparedCallback      ,
    onPixbufLoaderSizePrepared              ,
    wrap_PixbufLoaderSizePreparedCallback   ,




    ) 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.GLib.Structs.Bytes as GLib.Bytes
import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.GdkPixbuf.Objects.Pixbuf as GdkPixbuf.Pixbuf
import {-# SOURCE #-} qualified GI.GdkPixbuf.Objects.PixbufAnimation as GdkPixbuf.PixbufAnimation
import {-# SOURCE #-} qualified GI.GdkPixbuf.Structs.PixbufFormat as GdkPixbuf.PixbufFormat

-- | Memory-managed wrapper type.
newtype PixbufLoader = PixbufLoader (ManagedPtr PixbufLoader)
foreign import ccall "gdk_pixbuf_loader_get_type"
    c_gdk_pixbuf_loader_get_type :: IO GType

instance GObject PixbufLoader where
    gobjectType = c_gdk_pixbuf_loader_get_type


-- | Type class for types which can be safely cast to `PixbufLoader`, for instance with `toPixbufLoader`.
class (GObject o, O.IsDescendantOf PixbufLoader o) => IsPixbufLoader o
instance (GObject o, O.IsDescendantOf PixbufLoader o) => IsPixbufLoader o

instance O.HasParentTypes PixbufLoader
type instance O.ParentTypes PixbufLoader = '[GObject.Object.Object]

-- | Cast to `PixbufLoader`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toPixbufLoader :: (MonadIO m, IsPixbufLoader o) => o -> m PixbufLoader
toPixbufLoader = liftIO . unsafeCastTo PixbufLoader

-- | A convenience alias for `Nothing` :: `Maybe` `PixbufLoader`.
noPixbufLoader :: Maybe PixbufLoader
noPixbufLoader = Nothing

#if ENABLE_OVERLOADING
type family ResolvePixbufLoaderMethod (t :: Symbol) (o :: *) :: * where
    ResolvePixbufLoaderMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolvePixbufLoaderMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolvePixbufLoaderMethod "close" o = PixbufLoaderCloseMethodInfo
    ResolvePixbufLoaderMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolvePixbufLoaderMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolvePixbufLoaderMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolvePixbufLoaderMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolvePixbufLoaderMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolvePixbufLoaderMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolvePixbufLoaderMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolvePixbufLoaderMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolvePixbufLoaderMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolvePixbufLoaderMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolvePixbufLoaderMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolvePixbufLoaderMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolvePixbufLoaderMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolvePixbufLoaderMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolvePixbufLoaderMethod "write" o = PixbufLoaderWriteMethodInfo
    ResolvePixbufLoaderMethod "writeBytes" o = PixbufLoaderWriteBytesMethodInfo
    ResolvePixbufLoaderMethod "getAnimation" o = PixbufLoaderGetAnimationMethodInfo
    ResolvePixbufLoaderMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolvePixbufLoaderMethod "getFormat" o = PixbufLoaderGetFormatMethodInfo
    ResolvePixbufLoaderMethod "getPixbuf" o = PixbufLoaderGetPixbufMethodInfo
    ResolvePixbufLoaderMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolvePixbufLoaderMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolvePixbufLoaderMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolvePixbufLoaderMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolvePixbufLoaderMethod "setSize" o = PixbufLoaderSetSizeMethodInfo
    ResolvePixbufLoaderMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolvePixbufLoaderMethod t PixbufLoader, O.MethodInfo info PixbufLoader p) => OL.IsLabel t (PixbufLoader -> 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

-- signal PixbufLoader::area-prepared
{- |
This signal is emitted when the pixbuf loader has allocated the
pixbuf in the desired size.  After this signal is emitted,
applications can call 'GI.GdkPixbuf.Objects.PixbufLoader.pixbufLoaderGetPixbuf' to fetch
the partially-loaded pixbuf.
-}
type PixbufLoaderAreaPreparedCallback =
    IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `PixbufLoaderAreaPreparedCallback`@.
noPixbufLoaderAreaPreparedCallback :: Maybe PixbufLoaderAreaPreparedCallback
noPixbufLoaderAreaPreparedCallback = Nothing

-- | Type for the callback on the (unwrapped) C side.
type C_PixbufLoaderAreaPreparedCallback =
    Ptr () ->                               -- object
    Ptr () ->                               -- user_data
    IO ()

-- | Generate a function pointer callable from C code, from a `C_PixbufLoaderAreaPreparedCallback`.
foreign import ccall "wrapper"
    mk_PixbufLoaderAreaPreparedCallback :: C_PixbufLoaderAreaPreparedCallback -> IO (FunPtr C_PixbufLoaderAreaPreparedCallback)

-- | Wrap the callback into a `GClosure`.
genClosure_PixbufLoaderAreaPrepared :: MonadIO m => PixbufLoaderAreaPreparedCallback -> m (GClosure C_PixbufLoaderAreaPreparedCallback)
genClosure_PixbufLoaderAreaPrepared cb = liftIO $ do
    let cb' = wrap_PixbufLoaderAreaPreparedCallback cb
    mk_PixbufLoaderAreaPreparedCallback cb' >>= B.GClosure.newGClosure


-- | Wrap a `PixbufLoaderAreaPreparedCallback` into a `C_PixbufLoaderAreaPreparedCallback`.
wrap_PixbufLoaderAreaPreparedCallback ::
    PixbufLoaderAreaPreparedCallback ->
    C_PixbufLoaderAreaPreparedCallback
wrap_PixbufLoaderAreaPreparedCallback _cb _ _ = do
    _cb


{- |
Connect a signal handler for the “@area-prepared@” signal, to be run before the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.on' pixbufLoader #areaPrepared callback
@
-}
onPixbufLoaderAreaPrepared :: (IsPixbufLoader a, MonadIO m) => a -> PixbufLoaderAreaPreparedCallback -> m SignalHandlerId
onPixbufLoaderAreaPrepared obj cb = liftIO $ do
    let cb' = wrap_PixbufLoaderAreaPreparedCallback cb
    cb'' <- mk_PixbufLoaderAreaPreparedCallback cb'
    connectSignalFunPtr obj "area-prepared" cb'' SignalConnectBefore

{- |
Connect a signal handler for the “@area-prepared@” signal, to be run after the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.after' pixbufLoader #areaPrepared callback
@
-}
afterPixbufLoaderAreaPrepared :: (IsPixbufLoader a, MonadIO m) => a -> PixbufLoaderAreaPreparedCallback -> m SignalHandlerId
afterPixbufLoaderAreaPrepared obj cb = liftIO $ do
    let cb' = wrap_PixbufLoaderAreaPreparedCallback cb
    cb'' <- mk_PixbufLoaderAreaPreparedCallback cb'
    connectSignalFunPtr obj "area-prepared" cb'' SignalConnectAfter


-- signal PixbufLoader::area-updated
{- |
This signal is emitted when a significant area of the image being
loaded has been updated.  Normally it means that a complete
scanline has been read in, but it could be a different area as
well.  Applications can use this signal to know when to repaint
areas of an image that is being loaded.
-}
type PixbufLoaderAreaUpdatedCallback =
    Int32
    {- ^ /@x@/: X offset of upper-left corner of the updated area. -}
    -> Int32
    {- ^ /@y@/: Y offset of upper-left corner of the updated area. -}
    -> Int32
    {- ^ /@width@/: Width of updated area. -}
    -> Int32
    {- ^ /@height@/: Height of updated area. -}
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `PixbufLoaderAreaUpdatedCallback`@.
noPixbufLoaderAreaUpdatedCallback :: Maybe PixbufLoaderAreaUpdatedCallback
noPixbufLoaderAreaUpdatedCallback = Nothing

-- | Type for the callback on the (unwrapped) C side.
type C_PixbufLoaderAreaUpdatedCallback =
    Ptr () ->                               -- object
    Int32 ->
    Int32 ->
    Int32 ->
    Int32 ->
    Ptr () ->                               -- user_data
    IO ()

-- | Generate a function pointer callable from C code, from a `C_PixbufLoaderAreaUpdatedCallback`.
foreign import ccall "wrapper"
    mk_PixbufLoaderAreaUpdatedCallback :: C_PixbufLoaderAreaUpdatedCallback -> IO (FunPtr C_PixbufLoaderAreaUpdatedCallback)

-- | Wrap the callback into a `GClosure`.
genClosure_PixbufLoaderAreaUpdated :: MonadIO m => PixbufLoaderAreaUpdatedCallback -> m (GClosure C_PixbufLoaderAreaUpdatedCallback)
genClosure_PixbufLoaderAreaUpdated cb = liftIO $ do
    let cb' = wrap_PixbufLoaderAreaUpdatedCallback cb
    mk_PixbufLoaderAreaUpdatedCallback cb' >>= B.GClosure.newGClosure


-- | Wrap a `PixbufLoaderAreaUpdatedCallback` into a `C_PixbufLoaderAreaUpdatedCallback`.
wrap_PixbufLoaderAreaUpdatedCallback ::
    PixbufLoaderAreaUpdatedCallback ->
    C_PixbufLoaderAreaUpdatedCallback
wrap_PixbufLoaderAreaUpdatedCallback _cb _ x y width height _ = do
    _cb  x y width height


{- |
Connect a signal handler for the “@area-updated@” signal, to be run before the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.on' pixbufLoader #areaUpdated callback
@
-}
onPixbufLoaderAreaUpdated :: (IsPixbufLoader a, MonadIO m) => a -> PixbufLoaderAreaUpdatedCallback -> m SignalHandlerId
onPixbufLoaderAreaUpdated obj cb = liftIO $ do
    let cb' = wrap_PixbufLoaderAreaUpdatedCallback cb
    cb'' <- mk_PixbufLoaderAreaUpdatedCallback cb'
    connectSignalFunPtr obj "area-updated" cb'' SignalConnectBefore

{- |
Connect a signal handler for the “@area-updated@” signal, to be run after the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.after' pixbufLoader #areaUpdated callback
@
-}
afterPixbufLoaderAreaUpdated :: (IsPixbufLoader a, MonadIO m) => a -> PixbufLoaderAreaUpdatedCallback -> m SignalHandlerId
afterPixbufLoaderAreaUpdated obj cb = liftIO $ do
    let cb' = wrap_PixbufLoaderAreaUpdatedCallback cb
    cb'' <- mk_PixbufLoaderAreaUpdatedCallback cb'
    connectSignalFunPtr obj "area-updated" cb'' SignalConnectAfter


-- signal PixbufLoader::closed
{- |
This signal is emitted when 'GI.GdkPixbuf.Objects.PixbufLoader.pixbufLoaderClose' is called.
It can be used by different parts of an application to receive
notification when an image loader is closed by the code that
drives it.
-}
type PixbufLoaderClosedCallback =
    IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `PixbufLoaderClosedCallback`@.
noPixbufLoaderClosedCallback :: Maybe PixbufLoaderClosedCallback
noPixbufLoaderClosedCallback = Nothing

-- | Type for the callback on the (unwrapped) C side.
type C_PixbufLoaderClosedCallback =
    Ptr () ->                               -- object
    Ptr () ->                               -- user_data
    IO ()

-- | Generate a function pointer callable from C code, from a `C_PixbufLoaderClosedCallback`.
foreign import ccall "wrapper"
    mk_PixbufLoaderClosedCallback :: C_PixbufLoaderClosedCallback -> IO (FunPtr C_PixbufLoaderClosedCallback)

-- | Wrap the callback into a `GClosure`.
genClosure_PixbufLoaderClosed :: MonadIO m => PixbufLoaderClosedCallback -> m (GClosure C_PixbufLoaderClosedCallback)
genClosure_PixbufLoaderClosed cb = liftIO $ do
    let cb' = wrap_PixbufLoaderClosedCallback cb
    mk_PixbufLoaderClosedCallback cb' >>= B.GClosure.newGClosure


-- | Wrap a `PixbufLoaderClosedCallback` into a `C_PixbufLoaderClosedCallback`.
wrap_PixbufLoaderClosedCallback ::
    PixbufLoaderClosedCallback ->
    C_PixbufLoaderClosedCallback
wrap_PixbufLoaderClosedCallback _cb _ _ = do
    _cb


{- |
Connect a signal handler for the “@closed@” signal, to be run before the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.on' pixbufLoader #closed callback
@
-}
onPixbufLoaderClosed :: (IsPixbufLoader a, MonadIO m) => a -> PixbufLoaderClosedCallback -> m SignalHandlerId
onPixbufLoaderClosed obj cb = liftIO $ do
    let cb' = wrap_PixbufLoaderClosedCallback cb
    cb'' <- mk_PixbufLoaderClosedCallback cb'
    connectSignalFunPtr obj "closed" cb'' SignalConnectBefore

{- |
Connect a signal handler for the “@closed@” signal, to be run after the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.after' pixbufLoader #closed callback
@
-}
afterPixbufLoaderClosed :: (IsPixbufLoader a, MonadIO m) => a -> PixbufLoaderClosedCallback -> m SignalHandlerId
afterPixbufLoaderClosed obj cb = liftIO $ do
    let cb' = wrap_PixbufLoaderClosedCallback cb
    cb'' <- mk_PixbufLoaderClosedCallback cb'
    connectSignalFunPtr obj "closed" cb'' SignalConnectAfter


-- signal PixbufLoader::size-prepared
{- |
This signal is emitted when the pixbuf loader has been fed the
initial amount of data that is required to figure out the size
of the image that it will create.  Applications can call
'GI.GdkPixbuf.Objects.PixbufLoader.pixbufLoaderSetSize' in response to this signal to set
the desired size to which the image should be scaled.
-}
type PixbufLoaderSizePreparedCallback =
    Int32
    {- ^ /@width@/: the original width of the image -}
    -> Int32
    {- ^ /@height@/: the original height of the image -}
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `PixbufLoaderSizePreparedCallback`@.
noPixbufLoaderSizePreparedCallback :: Maybe PixbufLoaderSizePreparedCallback
noPixbufLoaderSizePreparedCallback = Nothing

-- | Type for the callback on the (unwrapped) C side.
type C_PixbufLoaderSizePreparedCallback =
    Ptr () ->                               -- object
    Int32 ->
    Int32 ->
    Ptr () ->                               -- user_data
    IO ()

-- | Generate a function pointer callable from C code, from a `C_PixbufLoaderSizePreparedCallback`.
foreign import ccall "wrapper"
    mk_PixbufLoaderSizePreparedCallback :: C_PixbufLoaderSizePreparedCallback -> IO (FunPtr C_PixbufLoaderSizePreparedCallback)

-- | Wrap the callback into a `GClosure`.
genClosure_PixbufLoaderSizePrepared :: MonadIO m => PixbufLoaderSizePreparedCallback -> m (GClosure C_PixbufLoaderSizePreparedCallback)
genClosure_PixbufLoaderSizePrepared cb = liftIO $ do
    let cb' = wrap_PixbufLoaderSizePreparedCallback cb
    mk_PixbufLoaderSizePreparedCallback cb' >>= B.GClosure.newGClosure


-- | Wrap a `PixbufLoaderSizePreparedCallback` into a `C_PixbufLoaderSizePreparedCallback`.
wrap_PixbufLoaderSizePreparedCallback ::
    PixbufLoaderSizePreparedCallback ->
    C_PixbufLoaderSizePreparedCallback
wrap_PixbufLoaderSizePreparedCallback _cb _ width height _ = do
    _cb  width height


{- |
Connect a signal handler for the “@size-prepared@” signal, to be run before the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.on' pixbufLoader #sizePrepared callback
@
-}
onPixbufLoaderSizePrepared :: (IsPixbufLoader a, MonadIO m) => a -> PixbufLoaderSizePreparedCallback -> m SignalHandlerId
onPixbufLoaderSizePrepared obj cb = liftIO $ do
    let cb' = wrap_PixbufLoaderSizePreparedCallback cb
    cb'' <- mk_PixbufLoaderSizePreparedCallback cb'
    connectSignalFunPtr obj "size-prepared" cb'' SignalConnectBefore

{- |
Connect a signal handler for the “@size-prepared@” signal, to be run after the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.after' pixbufLoader #sizePrepared callback
@
-}
afterPixbufLoaderSizePrepared :: (IsPixbufLoader a, MonadIO m) => a -> PixbufLoaderSizePreparedCallback -> m SignalHandlerId
afterPixbufLoaderSizePrepared obj cb = liftIO $ do
    let cb' = wrap_PixbufLoaderSizePreparedCallback cb
    cb'' <- mk_PixbufLoaderSizePreparedCallback cb'
    connectSignalFunPtr obj "size-prepared" cb'' SignalConnectAfter


#if ENABLE_OVERLOADING
instance O.HasAttributeList PixbufLoader
type instance O.AttributeList PixbufLoader = PixbufLoaderAttributeList
type PixbufLoaderAttributeList = ('[ ] :: [(Symbol, *)])
#endif

#if ENABLE_OVERLOADING
#endif

#if ENABLE_OVERLOADING
data PixbufLoaderAreaPreparedSignalInfo
instance SignalInfo PixbufLoaderAreaPreparedSignalInfo where
    type HaskellCallbackType PixbufLoaderAreaPreparedSignalInfo = PixbufLoaderAreaPreparedCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_PixbufLoaderAreaPreparedCallback cb
        cb'' <- mk_PixbufLoaderAreaPreparedCallback cb'
        connectSignalFunPtr obj "area-prepared" cb'' connectMode

data PixbufLoaderAreaUpdatedSignalInfo
instance SignalInfo PixbufLoaderAreaUpdatedSignalInfo where
    type HaskellCallbackType PixbufLoaderAreaUpdatedSignalInfo = PixbufLoaderAreaUpdatedCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_PixbufLoaderAreaUpdatedCallback cb
        cb'' <- mk_PixbufLoaderAreaUpdatedCallback cb'
        connectSignalFunPtr obj "area-updated" cb'' connectMode

data PixbufLoaderClosedSignalInfo
instance SignalInfo PixbufLoaderClosedSignalInfo where
    type HaskellCallbackType PixbufLoaderClosedSignalInfo = PixbufLoaderClosedCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_PixbufLoaderClosedCallback cb
        cb'' <- mk_PixbufLoaderClosedCallback cb'
        connectSignalFunPtr obj "closed" cb'' connectMode

data PixbufLoaderSizePreparedSignalInfo
instance SignalInfo PixbufLoaderSizePreparedSignalInfo where
    type HaskellCallbackType PixbufLoaderSizePreparedSignalInfo = PixbufLoaderSizePreparedCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_PixbufLoaderSizePreparedCallback cb
        cb'' <- mk_PixbufLoaderSizePreparedCallback cb'
        connectSignalFunPtr obj "size-prepared" cb'' connectMode

type instance O.SignalList PixbufLoader = PixbufLoaderSignalList
type PixbufLoaderSignalList = ('[ '("areaPrepared", PixbufLoaderAreaPreparedSignalInfo), '("areaUpdated", PixbufLoaderAreaUpdatedSignalInfo), '("closed", PixbufLoaderClosedSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo), '("sizePrepared", PixbufLoaderSizePreparedSignalInfo)] :: [(Symbol, *)])

#endif

-- method PixbufLoader::new
-- method type : Constructor
-- Args : []
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GdkPixbuf", name = "PixbufLoader"}))
-- throws : False
-- Skip return : False

foreign import ccall "gdk_pixbuf_loader_new" gdk_pixbuf_loader_new ::
    IO (Ptr PixbufLoader)

{- |
Creates a new pixbuf loader object.
-}
pixbufLoaderNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m PixbufLoader
    {- ^ __Returns:__ A newly-created pixbuf loader. -}
pixbufLoaderNew  = liftIO $ do
    result <- gdk_pixbuf_loader_new
    checkUnexpectedReturnNULL "pixbufLoaderNew" result
    result' <- (wrapObject PixbufLoader) result
    return result'

#if ENABLE_OVERLOADING
#endif

-- method PixbufLoader::new_with_mime_type
-- method type : Constructor
-- Args : [Arg {argCName = "mime_type", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the mime type to be loaded", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GdkPixbuf", name = "PixbufLoader"}))
-- throws : True
-- Skip return : False

foreign import ccall "gdk_pixbuf_loader_new_with_mime_type" gdk_pixbuf_loader_new_with_mime_type ::
    CString ->                              -- mime_type : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr PixbufLoader)

{- |
Creates a new pixbuf loader object that always attempts to parse
image data as if it were an image of mime type /@mimeType@/, instead of
identifying the type automatically. Useful if you want an error if
the image isn\'t the expected mime type, for loading image formats
that can\'t be reliably identified by looking at the data, or if
the user manually forces a specific mime type.

The list of supported mime types depends on what image loaders
are installed, but typically \"image\/png\", \"image\/jpeg\", \"image\/gif\",
\"image\/tiff\" and \"image\/x-xpixmap\" are among the supported mime types.
To obtain the full list of supported mime types, call
'GI.GdkPixbuf.Structs.PixbufFormat.pixbufFormatGetMimeTypes' on each of the 'GI.GdkPixbuf.Structs.PixbufFormat.PixbufFormat'
structs returned by 'GI.GdkPixbuf.Objects.Pixbuf.pixbufGetFormats'.

/Since: 2.4/
-}
pixbufLoaderNewWithMimeType ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@mimeType@/: the mime type to be loaded -}
    -> m PixbufLoader
    {- ^ __Returns:__ A newly-created pixbuf loader. /(Can throw 'Data.GI.Base.GError.GError')/ -}
pixbufLoaderNewWithMimeType mimeType = liftIO $ do
    mimeType' <- textToCString mimeType
    onException (do
        result <- propagateGError $ gdk_pixbuf_loader_new_with_mime_type mimeType'
        checkUnexpectedReturnNULL "pixbufLoaderNewWithMimeType" result
        result' <- (wrapObject PixbufLoader) result
        freeMem mimeType'
        return result'
     ) (do
        freeMem mimeType'
     )

#if ENABLE_OVERLOADING
#endif

-- method PixbufLoader::new_with_type
-- method type : Constructor
-- Args : [Arg {argCName = "image_type", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "name of the image format to be loaded with the image", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GdkPixbuf", name = "PixbufLoader"}))
-- throws : True
-- Skip return : False

foreign import ccall "gdk_pixbuf_loader_new_with_type" gdk_pixbuf_loader_new_with_type ::
    CString ->                              -- image_type : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr PixbufLoader)

{- |
Creates a new pixbuf loader object that always attempts to parse
image data as if it were an image of type /@imageType@/, instead of
identifying the type automatically. Useful if you want an error if
the image isn\'t the expected type, for loading image formats
that can\'t be reliably identified by looking at the data, or if
the user manually forces a specific type.

The list of supported image formats depends on what image loaders
are installed, but typically \"png\", \"jpeg\", \"gif\", \"tiff\" and
\"xpm\" are among the supported formats. To obtain the full list of
supported image formats, call 'GI.GdkPixbuf.Structs.PixbufFormat.pixbufFormatGetName' on each
of the 'GI.GdkPixbuf.Structs.PixbufFormat.PixbufFormat' structs returned by 'GI.GdkPixbuf.Objects.Pixbuf.pixbufGetFormats'.
-}
pixbufLoaderNewWithType ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@imageType@/: name of the image format to be loaded with the image -}
    -> m PixbufLoader
    {- ^ __Returns:__ A newly-created pixbuf loader. /(Can throw 'Data.GI.Base.GError.GError')/ -}
pixbufLoaderNewWithType imageType = liftIO $ do
    imageType' <- textToCString imageType
    onException (do
        result <- propagateGError $ gdk_pixbuf_loader_new_with_type imageType'
        checkUnexpectedReturnNULL "pixbufLoaderNewWithType" result
        result' <- (wrapObject PixbufLoader) result
        freeMem imageType'
        return result'
     ) (do
        freeMem imageType'
     )

#if ENABLE_OVERLOADING
#endif

-- method PixbufLoader::close
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "loader", argType = TInterface (Name {namespace = "GdkPixbuf", name = "PixbufLoader"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A pixbuf loader.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "gdk_pixbuf_loader_close" gdk_pixbuf_loader_close ::
    Ptr PixbufLoader ->                     -- loader : TInterface (Name {namespace = "GdkPixbuf", name = "PixbufLoader"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
Informs a pixbuf loader that no further writes with
'GI.GdkPixbuf.Objects.PixbufLoader.pixbufLoaderWrite' will occur, so that it can free its
internal loading structures. Also, tries to parse any data that
hasn\'t yet been parsed; if the remaining data is partial or
corrupt, an error will be returned.  If 'False' is returned, /@error@/
will be set to an error from the @/GDK_PIXBUF_ERROR/@ or @/G_FILE_ERROR/@
domains. If you\'re just cancelling a load rather than expecting it
to be finished, passing 'Nothing' for /@error@/ to ignore it is
reasonable.

Remember that this does not unref the loader, so if you plan not to
use it anymore, please 'GI.GObject.Objects.Object.objectUnref' it.
-}
pixbufLoaderClose ::
    (B.CallStack.HasCallStack, MonadIO m, IsPixbufLoader a) =>
    a
    {- ^ /@loader@/: A pixbuf loader. -}
    -> m ()
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
pixbufLoaderClose loader = liftIO $ do
    loader' <- unsafeManagedPtrCastPtr loader
    onException (do
        _ <- propagateGError $ gdk_pixbuf_loader_close loader'
        touchManagedPtr loader
        return ()
     ) (do
        return ()
     )

#if ENABLE_OVERLOADING
data PixbufLoaderCloseMethodInfo
instance (signature ~ (m ()), MonadIO m, IsPixbufLoader a) => O.MethodInfo PixbufLoaderCloseMethodInfo a signature where
    overloadedMethod _ = pixbufLoaderClose

#endif

-- method PixbufLoader::get_animation
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "loader", argType = TInterface (Name {namespace = "GdkPixbuf", name = "PixbufLoader"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A pixbuf loader", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GdkPixbuf", name = "PixbufAnimation"}))
-- throws : False
-- Skip return : False

foreign import ccall "gdk_pixbuf_loader_get_animation" gdk_pixbuf_loader_get_animation ::
    Ptr PixbufLoader ->                     -- loader : TInterface (Name {namespace = "GdkPixbuf", name = "PixbufLoader"})
    IO (Ptr GdkPixbuf.PixbufAnimation.PixbufAnimation)

{- |
Queries the 'GI.GdkPixbuf.Objects.PixbufAnimation.PixbufAnimation' that a pixbuf loader is currently creating.
In general it only makes sense to call this function after the \"area-prepared\"
signal has been emitted by the loader. If the loader doesn\'t have enough
bytes yet (hasn\'t emitted the \"area-prepared\" signal) this function will
return 'Nothing'.
-}
pixbufLoaderGetAnimation ::
    (B.CallStack.HasCallStack, MonadIO m, IsPixbufLoader a) =>
    a
    {- ^ /@loader@/: A pixbuf loader -}
    -> m GdkPixbuf.PixbufAnimation.PixbufAnimation
    {- ^ __Returns:__ The 'GI.GdkPixbuf.Objects.PixbufAnimation.PixbufAnimation' that the loader is loading, or 'Nothing' if
not enough data has been read to determine the information. -}
pixbufLoaderGetAnimation loader = liftIO $ do
    loader' <- unsafeManagedPtrCastPtr loader
    result <- gdk_pixbuf_loader_get_animation loader'
    checkUnexpectedReturnNULL "pixbufLoaderGetAnimation" result
    result' <- (newObject GdkPixbuf.PixbufAnimation.PixbufAnimation) result
    touchManagedPtr loader
    return result'

#if ENABLE_OVERLOADING
data PixbufLoaderGetAnimationMethodInfo
instance (signature ~ (m GdkPixbuf.PixbufAnimation.PixbufAnimation), MonadIO m, IsPixbufLoader a) => O.MethodInfo PixbufLoaderGetAnimationMethodInfo a signature where
    overloadedMethod _ = pixbufLoaderGetAnimation

#endif

-- method PixbufLoader::get_format
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "loader", argType = TInterface (Name {namespace = "GdkPixbuf", name = "PixbufLoader"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A pixbuf loader.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GdkPixbuf", name = "PixbufFormat"}))
-- throws : False
-- Skip return : False

foreign import ccall "gdk_pixbuf_loader_get_format" gdk_pixbuf_loader_get_format ::
    Ptr PixbufLoader ->                     -- loader : TInterface (Name {namespace = "GdkPixbuf", name = "PixbufLoader"})
    IO (Ptr GdkPixbuf.PixbufFormat.PixbufFormat)

{- |
Obtains the available information about the format of the
currently loading image file.

/Since: 2.2/
-}
pixbufLoaderGetFormat ::
    (B.CallStack.HasCallStack, MonadIO m, IsPixbufLoader a) =>
    a
    {- ^ /@loader@/: A pixbuf loader. -}
    -> m (Maybe GdkPixbuf.PixbufFormat.PixbufFormat)
    {- ^ __Returns:__ A 'GI.GdkPixbuf.Structs.PixbufFormat.PixbufFormat' or
'Nothing'. The return value is owned by GdkPixbuf and should not be
freed. -}
pixbufLoaderGetFormat loader = liftIO $ do
    loader' <- unsafeManagedPtrCastPtr loader
    result <- gdk_pixbuf_loader_get_format loader'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (newBoxed GdkPixbuf.PixbufFormat.PixbufFormat) result'
        return result''
    touchManagedPtr loader
    return maybeResult

#if ENABLE_OVERLOADING
data PixbufLoaderGetFormatMethodInfo
instance (signature ~ (m (Maybe GdkPixbuf.PixbufFormat.PixbufFormat)), MonadIO m, IsPixbufLoader a) => O.MethodInfo PixbufLoaderGetFormatMethodInfo a signature where
    overloadedMethod _ = pixbufLoaderGetFormat

#endif

-- method PixbufLoader::get_pixbuf
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "loader", argType = TInterface (Name {namespace = "GdkPixbuf", name = "PixbufLoader"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A pixbuf loader.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GdkPixbuf", name = "Pixbuf"}))
-- throws : False
-- Skip return : False

foreign import ccall "gdk_pixbuf_loader_get_pixbuf" gdk_pixbuf_loader_get_pixbuf ::
    Ptr PixbufLoader ->                     -- loader : TInterface (Name {namespace = "GdkPixbuf", name = "PixbufLoader"})
    IO (Ptr GdkPixbuf.Pixbuf.Pixbuf)

{- |
Queries the 'GI.GdkPixbuf.Objects.Pixbuf.Pixbuf' that a pixbuf loader is currently creating.
In general it only makes sense to call this function after the
\"area-prepared\" signal has been emitted by the loader; this means
that enough data has been read to know the size of the image that
will be allocated.  If the loader has not received enough data via
'GI.GdkPixbuf.Objects.PixbufLoader.pixbufLoaderWrite', then this function returns 'Nothing'.  The
returned pixbuf will be the same in all future calls to the loader,
so simply calling 'GI.GObject.Objects.Object.objectRef' should be sufficient to continue
using it.  Additionally, if the loader is an animation, it will
return the \"static image\" of the animation
(see 'GI.GdkPixbuf.Objects.PixbufAnimation.pixbufAnimationGetStaticImage').
-}
pixbufLoaderGetPixbuf ::
    (B.CallStack.HasCallStack, MonadIO m, IsPixbufLoader a) =>
    a
    {- ^ /@loader@/: A pixbuf loader. -}
    -> m (Maybe GdkPixbuf.Pixbuf.Pixbuf)
    {- ^ __Returns:__ The 'GI.GdkPixbuf.Objects.Pixbuf.Pixbuf' that the loader is creating, or 'Nothing' if not
enough data has been read to determine how to create the image buffer. -}
pixbufLoaderGetPixbuf loader = liftIO $ do
    loader' <- unsafeManagedPtrCastPtr loader
    result <- gdk_pixbuf_loader_get_pixbuf loader'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (newObject GdkPixbuf.Pixbuf.Pixbuf) result'
        return result''
    touchManagedPtr loader
    return maybeResult

#if ENABLE_OVERLOADING
data PixbufLoaderGetPixbufMethodInfo
instance (signature ~ (m (Maybe GdkPixbuf.Pixbuf.Pixbuf)), MonadIO m, IsPixbufLoader a) => O.MethodInfo PixbufLoaderGetPixbufMethodInfo a signature where
    overloadedMethod _ = pixbufLoaderGetPixbuf

#endif

-- method PixbufLoader::set_size
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "loader", argType = TInterface (Name {namespace = "GdkPixbuf", name = "PixbufLoader"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A pixbuf loader.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "width", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The desired width of the image being loaded.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "height", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The desired height of the image being loaded.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gdk_pixbuf_loader_set_size" gdk_pixbuf_loader_set_size ::
    Ptr PixbufLoader ->                     -- loader : TInterface (Name {namespace = "GdkPixbuf", name = "PixbufLoader"})
    Int32 ->                                -- width : TBasicType TInt
    Int32 ->                                -- height : TBasicType TInt
    IO ()

{- |
Causes the image to be scaled while it is loaded. The desired
image size can be determined relative to the original size of
the image by calling 'GI.GdkPixbuf.Objects.PixbufLoader.pixbufLoaderSetSize' from a
signal handler for the ::size-prepared signal.

Attempts to set the desired image size  are ignored after the
emission of the ::size-prepared signal.

/Since: 2.2/
-}
pixbufLoaderSetSize ::
    (B.CallStack.HasCallStack, MonadIO m, IsPixbufLoader a) =>
    a
    {- ^ /@loader@/: A pixbuf loader. -}
    -> Int32
    {- ^ /@width@/: The desired width of the image being loaded. -}
    -> Int32
    {- ^ /@height@/: The desired height of the image being loaded. -}
    -> m ()
pixbufLoaderSetSize loader width height = liftIO $ do
    loader' <- unsafeManagedPtrCastPtr loader
    gdk_pixbuf_loader_set_size loader' width height
    touchManagedPtr loader
    return ()

#if ENABLE_OVERLOADING
data PixbufLoaderSetSizeMethodInfo
instance (signature ~ (Int32 -> Int32 -> m ()), MonadIO m, IsPixbufLoader a) => O.MethodInfo PixbufLoaderSetSizeMethodInfo a signature where
    overloadedMethod _ = pixbufLoaderSetSize

#endif

-- method PixbufLoader::write
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "loader", argType = TInterface (Name {namespace = "GdkPixbuf", name = "PixbufLoader"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A pixbuf loader.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "buf", argType = TCArray False (-1) 2 (TBasicType TUInt8), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Pointer to image data.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "count", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Length of the @buf buffer in bytes.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : [Arg {argCName = "count", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Length of the @buf buffer in bytes.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- returnType : Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "gdk_pixbuf_loader_write" gdk_pixbuf_loader_write ::
    Ptr PixbufLoader ->                     -- loader : TInterface (Name {namespace = "GdkPixbuf", name = "PixbufLoader"})
    Ptr Word8 ->                            -- buf : TCArray False (-1) 2 (TBasicType TUInt8)
    Word64 ->                               -- count : TBasicType TUInt64
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
This will cause a pixbuf loader to parse the next /@count@/ bytes of
an image.  It will return 'True' if the data was loaded successfully,
and 'False' if an error occurred.  In the latter case, the loader
will be closed, and will not accept further writes. If 'False' is
returned, /@error@/ will be set to an error from the @/GDK_PIXBUF_ERROR/@
or @/G_FILE_ERROR/@ domains.
-}
pixbufLoaderWrite ::
    (B.CallStack.HasCallStack, MonadIO m, IsPixbufLoader a) =>
    a
    {- ^ /@loader@/: A pixbuf loader. -}
    -> ByteString
    {- ^ /@buf@/: Pointer to image data. -}
    -> m ()
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
pixbufLoaderWrite loader buf = liftIO $ do
    let count = fromIntegral $ B.length buf
    loader' <- unsafeManagedPtrCastPtr loader
    buf' <- packByteString buf
    onException (do
        _ <- propagateGError $ gdk_pixbuf_loader_write loader' buf' count
        touchManagedPtr loader
        freeMem buf'
        return ()
     ) (do
        freeMem buf'
     )

#if ENABLE_OVERLOADING
data PixbufLoaderWriteMethodInfo
instance (signature ~ (ByteString -> m ()), MonadIO m, IsPixbufLoader a) => O.MethodInfo PixbufLoaderWriteMethodInfo a signature where
    overloadedMethod _ = pixbufLoaderWrite

#endif

-- method PixbufLoader::write_bytes
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "loader", argType = TInterface (Name {namespace = "GdkPixbuf", name = "PixbufLoader"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A pixbuf loader.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "buffer", argType = TInterface (Name {namespace = "GLib", name = "Bytes"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The image data as a #GBytes", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "gdk_pixbuf_loader_write_bytes" gdk_pixbuf_loader_write_bytes ::
    Ptr PixbufLoader ->                     -- loader : TInterface (Name {namespace = "GdkPixbuf", name = "PixbufLoader"})
    Ptr GLib.Bytes.Bytes ->                 -- buffer : TInterface (Name {namespace = "GLib", name = "Bytes"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
This will cause a pixbuf loader to parse a buffer inside a 'GI.GLib.Structs.Bytes.Bytes'
for an image.  It will return 'True' if the data was loaded successfully,
and 'False' if an error occurred.  In the latter case, the loader
will be closed, and will not accept further writes. If 'False' is
returned, /@error@/ will be set to an error from the @/GDK_PIXBUF_ERROR/@
or @/G_FILE_ERROR/@ domains.

See also: 'GI.GdkPixbuf.Objects.PixbufLoader.pixbufLoaderWrite'

/Since: 2.30/
-}
pixbufLoaderWriteBytes ::
    (B.CallStack.HasCallStack, MonadIO m, IsPixbufLoader a) =>
    a
    {- ^ /@loader@/: A pixbuf loader. -}
    -> GLib.Bytes.Bytes
    {- ^ /@buffer@/: The image data as a 'GI.GLib.Structs.Bytes.Bytes' -}
    -> m ()
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
pixbufLoaderWriteBytes loader buffer = liftIO $ do
    loader' <- unsafeManagedPtrCastPtr loader
    buffer' <- unsafeManagedPtrGetPtr buffer
    onException (do
        _ <- propagateGError $ gdk_pixbuf_loader_write_bytes loader' buffer'
        touchManagedPtr loader
        touchManagedPtr buffer
        return ()
     ) (do
        return ()
     )

#if ENABLE_OVERLOADING
data PixbufLoaderWriteBytesMethodInfo
instance (signature ~ (GLib.Bytes.Bytes -> m ()), MonadIO m, IsPixbufLoader a) => O.MethodInfo PixbufLoaderWriteBytesMethodInfo a signature where
    overloadedMethod _ = pixbufLoaderWriteBytes

#endif