{-# LANGUAGE ImplicitParams, RankNTypes, TypeApplications #-}


-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- A paintable implementation that renders SVG, with animations.
-- 
-- @GtkSvg@ objects are created by parsing a subset of SVG,
-- including SVG animations.
-- 
-- @GtkSvg@ fills or strokes paths with symbolic or fixed colors.
-- It can have multiple states, and paths can be included in a subset
-- of the states. States can have animations, and the transition
-- between different states can also be animated.
-- 
-- To show a static SVG image, it is enough to load the
-- the SVG and use it like any other paintable.
-- 
-- To play an SVG animation, use 'GI.Gtk.Objects.Svg.svgSetFrameClock'
-- to connect the paintable to a frame clock, and call
-- 'GI.Gtk.Objects.Svg.svgPlay' after loading the SVG. The animation can
-- be paused using 'GI.Gtk.Objects.Svg.svgPause'.
-- 
-- To set the current state, use 'GI.Gtk.Objects.Svg.svgSetState'.
-- 
-- 
-- == Error handling
-- 
-- Loading an SVG into @GtkSvg@ will always produce a (possibly empty)
-- paintable. GTK will drop things that it can\'t handle and try to make
-- sense of the rest.
-- 
-- To track errors during parsing or rendering, connect to the
-- [Svg::error]("GI.Gtk.Objects.Svg#g:signal:error") signal.
-- 
-- For parsing errors in the @GTK_SVG_ERROR@ domain, the functions
-- t'GI.Gtk.Enums.SvgError'.@/get_start/@(), t'GI.Gtk.Enums.SvgError'.@/get_end/@(),
-- t'GI.Gtk.Enums.SvgError'.@/get_element/@() and t'GI.Gtk.Enums.SvgError'.@/get_attribute/@()
-- can be used to obtain information about where the error occurred.
-- 
-- 
-- == The supported subset of SVG
-- 
-- The paintable supports much of SVG 2, with some exceptions.
-- 
-- Among the graphical elements, @\<textPath>@ and @\<foreignObject>@
-- are not supported.
-- 
-- Among the structural elements, @\<a>@ and @\<view>@ are not supported.
-- 
-- In the @\<filter>@ element, the following primitives are not
-- supported: feConvolveMatrix, feDiffuseLighting,
-- feMorphology, feSpecularLighting and feTurbulence.
-- 
-- Support for the @mask@ attribute is limited to just a url
-- referring to the @\<mask>@ element by ID.
-- 
-- In animation elements, the parsing of @begin@ and @end@ attributes
-- is limited, and the @min@ and @max@ attributes are not supported.
-- 
-- Lastly, there is only minimal CSS support (the style attribute,
-- but not @\<style>@), and no interactivity.
-- 
-- 
-- == SVG Extensions
-- 
-- The paintable supports a number of <https://docs.gtk.org/gtk4/icon-format.html custom attributes>
-- that offer a convenient way to define states, transitions and animations.
-- For example,
-- 
--     \<circle cx=\'5\' cy=\'5\' r=\'5\'
--             gpa:states=\'0 1\'
--             gpa:animation-type=\'automatic\'
--             gpa:animation-direction=\'segment\'
--             gpa:animation-duration=\'600ms\'\/>
-- 
-- defines the circle to be shown in states 0 and 1, and animates a segment
-- of the circle.
-- 
-- \<image src=\"svg-renderer1.svg\">
-- 
-- Note that the generated animations are implemented using standard
-- SVG attributes (@visibility@, @stroke-dasharray, @stroke-dashoffset@,
-- @pathLength@ and @filter@). Setting these attributes in your SVG
-- is therefore going to interfere with generated animations.
-- 
-- To connect general SVG animations to the states of the paintable,
-- use the custom @gpa:states(...)@ condition in the @begin@ and @end@
-- attributes of SVG animation elements. For example,
-- 
--     \<animate href=\'path1\'
--              attributeName=\'fill\'
--              begin=\'gpa:states(0).begin\'
--              dur=\'300ms\'
--              fill=\'freeze\'
--              from=\'black\'
--              to=\'magenta\'\/>
-- 
-- will make the fill color of path1 transition from black to
-- magenta when the renderer enters state 0.
-- 
-- \<image src=\"svg-renderer2.svg\">
-- 
-- The @gpa:states(...)@ condition triggers for upcoming state changes
-- as well, to support fade-out transitions. For example,
-- 
--     \<animate href=\'path1\'
--              attributeName=\'opacity\'
--              begin=\'gpa:states(0).end -300ms\'
--              dur=\'300ms\'
--              fill=\'freeze\'
--              from=\'1\'
--              to=\'0\'\/>
-- 
-- will start a fade-out of path1 300ms before state 0 ends.
-- 
-- A variant of the @gpa:states(...)@ condition allows specifying
-- both before and after states:
-- 
--     \<animate href=\'path1\'
--              attributeName=\'opacity\'
--              begin=\'gpa:states(0, 1 2)\'
--              dur=\'300ms\'
--              fill=\'freeze\'
--              from=\'1\'
--              to=\'0\'\/>
-- 
-- will start the animation when the state changes from 0 to 1 or
-- from 0 to 2, but not when it changes from 0 to 3.
-- 
-- In addition to the @gpa:fill@ and @gpa:stroke@ attributes, symbolic
-- colors can also be specified as a custom paint server reference,
-- like this: @url(@/gpa:warning/@)@. This works in @fill@ and @stroke@
-- attributes, but also when specifying colors in SVG animation
-- attributes like @to@ or @values@.
-- 
-- Note that the SVG syntax allows for a fallback RGB color to be
-- specified after the url, for compatibility with other SVG consumers:
-- 
--     fill=\'url(#gpa:warning) orange\'
-- 
-- In contrast to SVG 1.1 and 2.0, we allow the @transform@ attribute
-- to be animated with @\<animate>\`.
-- 
-- /Since: 4.22/

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

module GI.Gtk.Objects.Svg
    ( 

-- * Exported types
    Svg(..)                                 ,
    IsSvg                                   ,
    toSvg                                   ,


 -- * Methods
-- | 
-- 
--  === __Click to display all available methods, including inherited ones__
-- ==== Methods
-- [bindProperty]("GI.GObject.Objects.Object#g:method:bindProperty"), [bindPropertyFull]("GI.GObject.Objects.Object#g:method:bindPropertyFull"), [computeConcreteSize]("GI.Gdk.Interfaces.Paintable#g:method:computeConcreteSize"), [forceFloating]("GI.GObject.Objects.Object#g:method:forceFloating"), [freezeNotify]("GI.GObject.Objects.Object#g:method:freezeNotify"), [getv]("GI.GObject.Objects.Object#g:method:getv"), [invalidateContents]("GI.Gdk.Interfaces.Paintable#g:method:invalidateContents"), [invalidateSize]("GI.Gdk.Interfaces.Paintable#g:method:invalidateSize"), [isFloating]("GI.GObject.Objects.Object#g:method:isFloating"), [loadFromBytes]("GI.Gtk.Objects.Svg#g:method:loadFromBytes"), [loadFromResource]("GI.Gtk.Objects.Svg#g:method:loadFromResource"), [notify]("GI.GObject.Objects.Object#g:method:notify"), [notifyByPspec]("GI.GObject.Objects.Object#g:method:notifyByPspec"), [pause]("GI.Gtk.Objects.Svg#g:method:pause"), [play]("GI.Gtk.Objects.Svg#g:method:play"), [ref]("GI.GObject.Objects.Object#g:method:ref"), [refSink]("GI.GObject.Objects.Object#g:method:refSink"), [runDispose]("GI.GObject.Objects.Object#g:method:runDispose"), [serialize]("GI.Gtk.Objects.Svg#g:method:serialize"), [snapshot]("GI.Gdk.Interfaces.Paintable#g:method:snapshot"), [snapshotSymbolic]("GI.Gtk.Interfaces.SymbolicPaintable#g:method:snapshotSymbolic"), [snapshotWithWeight]("GI.Gtk.Interfaces.SymbolicPaintable#g:method:snapshotWithWeight"), [stealData]("GI.GObject.Objects.Object#g:method:stealData"), [stealQdata]("GI.GObject.Objects.Object#g:method:stealQdata"), [thawNotify]("GI.GObject.Objects.Object#g:method:thawNotify"), [unref]("GI.GObject.Objects.Object#g:method:unref"), [watchClosure]("GI.GObject.Objects.Object#g:method:watchClosure"), [writeToFile]("GI.Gtk.Objects.Svg#g:method:writeToFile").
-- 
-- ==== Getters
-- [getCurrentImage]("GI.Gdk.Interfaces.Paintable#g:method:getCurrentImage"), [getData]("GI.GObject.Objects.Object#g:method:getData"), [getFeatures]("GI.Gtk.Objects.Svg#g:method:getFeatures"), [getFlags]("GI.Gdk.Interfaces.Paintable#g:method:getFlags"), [getIntrinsicAspectRatio]("GI.Gdk.Interfaces.Paintable#g:method:getIntrinsicAspectRatio"), [getIntrinsicHeight]("GI.Gdk.Interfaces.Paintable#g:method:getIntrinsicHeight"), [getIntrinsicWidth]("GI.Gdk.Interfaces.Paintable#g:method:getIntrinsicWidth"), [getProperty]("GI.GObject.Objects.Object#g:method:getProperty"), [getQdata]("GI.GObject.Objects.Object#g:method:getQdata"), [getState]("GI.Gtk.Objects.Svg#g:method:getState"), [getStateNames]("GI.Gtk.Objects.Svg#g:method:getStateNames"), [getWeight]("GI.Gtk.Objects.Svg#g:method:getWeight").
-- 
-- ==== Setters
-- [setData]("GI.GObject.Objects.Object#g:method:setData"), [setDataFull]("GI.GObject.Objects.Object#g:method:setDataFull"), [setFeatures]("GI.Gtk.Objects.Svg#g:method:setFeatures"), [setFrameClock]("GI.Gtk.Objects.Svg#g:method:setFrameClock"), [setProperty]("GI.GObject.Objects.Object#g:method:setProperty"), [setState]("GI.Gtk.Objects.Svg#g:method:setState"), [setWeight]("GI.Gtk.Objects.Svg#g:method:setWeight").

#if defined(ENABLE_OVERLOADING)
    ResolveSvgMethod                        ,
#endif

-- ** getFeatures #method:getFeatures#

#if defined(ENABLE_OVERLOADING)
    SvgGetFeaturesMethodInfo                ,
#endif
    svgGetFeatures                          ,


-- ** getState #method:getState#

#if defined(ENABLE_OVERLOADING)
    SvgGetStateMethodInfo                   ,
#endif
    svgGetState                             ,


-- ** getStateNames #method:getStateNames#

#if defined(ENABLE_OVERLOADING)
    SvgGetStateNamesMethodInfo              ,
#endif
    svgGetStateNames                        ,


-- ** getWeight #method:getWeight#

#if defined(ENABLE_OVERLOADING)
    SvgGetWeightMethodInfo                  ,
#endif
    svgGetWeight                            ,


-- ** loadFromBytes #method:loadFromBytes#

#if defined(ENABLE_OVERLOADING)
    SvgLoadFromBytesMethodInfo              ,
#endif
    svgLoadFromBytes                        ,


-- ** loadFromResource #method:loadFromResource#

#if defined(ENABLE_OVERLOADING)
    SvgLoadFromResourceMethodInfo           ,
#endif
    svgLoadFromResource                     ,


-- ** new #method:new#

    svgNew                                  ,


-- ** newFromBytes #method:newFromBytes#

    svgNewFromBytes                         ,


-- ** newFromResource #method:newFromResource#

    svgNewFromResource                      ,


-- ** pause #method:pause#

#if defined(ENABLE_OVERLOADING)
    SvgPauseMethodInfo                      ,
#endif
    svgPause                                ,


-- ** play #method:play#

#if defined(ENABLE_OVERLOADING)
    SvgPlayMethodInfo                       ,
#endif
    svgPlay                                 ,


-- ** serialize #method:serialize#

#if defined(ENABLE_OVERLOADING)
    SvgSerializeMethodInfo                  ,
#endif
    svgSerialize                            ,


-- ** setFeatures #method:setFeatures#

#if defined(ENABLE_OVERLOADING)
    SvgSetFeaturesMethodInfo                ,
#endif
    svgSetFeatures                          ,


-- ** setFrameClock #method:setFrameClock#

#if defined(ENABLE_OVERLOADING)
    SvgSetFrameClockMethodInfo              ,
#endif
    svgSetFrameClock                        ,


-- ** setState #method:setState#

#if defined(ENABLE_OVERLOADING)
    SvgSetStateMethodInfo                   ,
#endif
    svgSetState                             ,


-- ** setWeight #method:setWeight#

#if defined(ENABLE_OVERLOADING)
    SvgSetWeightMethodInfo                  ,
#endif
    svgSetWeight                            ,


-- ** writeToFile #method:writeToFile#

#if defined(ENABLE_OVERLOADING)
    SvgWriteToFileMethodInfo                ,
#endif
    svgWriteToFile                          ,




 -- * Properties


-- ** features #attr:features#
-- | Enabled features for this paintable.
-- 
-- Note that features have to be set before
-- loading SVG data to take effect.
-- 
-- /Since: 4.22/

#if defined(ENABLE_OVERLOADING)
    SvgFeaturesPropertyInfo                 ,
#endif
    constructSvgFeatures                    ,
    getSvgFeatures                          ,
    setSvgFeatures                          ,
#if defined(ENABLE_OVERLOADING)
    svgFeatures                             ,
#endif


-- ** playing #attr:playing#
-- | Whether the paintable is currently animating its content.
-- 
-- To set this property, use the 'GI.Gtk.Objects.Svg.svgPlay' and
-- 'GI.Gtk.Objects.Svg.svgPause' functions.
-- 
-- /Since: 4.22/

#if defined(ENABLE_OVERLOADING)
    SvgPlayingPropertyInfo                  ,
#endif
    constructSvgPlaying                     ,
    getSvgPlaying                           ,
    setSvgPlaying                           ,
#if defined(ENABLE_OVERLOADING)
    svgPlaying                              ,
#endif


-- ** resource #attr:resource#
-- | Resource to load SVG data from.
-- 
-- This property is meant to create a paintable
-- from a resource in ui files.
-- 
-- /Since: 4.22/

#if defined(ENABLE_OVERLOADING)
    SvgResourcePropertyInfo                 ,
#endif
    clearSvgResource                        ,
    constructSvgResource                    ,
    getSvgResource                          ,
    setSvgResource                          ,
#if defined(ENABLE_OVERLOADING)
    svgResource                             ,
#endif


-- ** state #attr:state#
-- | The current state of the renderer.
-- 
-- This can be a number between 0 and 63.
-- 
-- /Since: 4.22/

#if defined(ENABLE_OVERLOADING)
    SvgStatePropertyInfo                    ,
#endif
    constructSvgState                       ,
    getSvgState                             ,
    setSvgState                             ,
#if defined(ENABLE_OVERLOADING)
    svgState                                ,
#endif


-- ** weight #attr:weight#
-- | If not set to -1, this value overrides the weight used
-- when rendering the paintable.
-- 
-- /Since: 4.22/

#if defined(ENABLE_OVERLOADING)
    SvgWeightPropertyInfo                   ,
#endif
    constructSvgWeight                      ,
    getSvgWeight                            ,
    setSvgWeight                            ,
#if defined(ENABLE_OVERLOADING)
    svgWeight                               ,
#endif




 -- * Signals


-- ** error #signal:error#

    SvgErrorCallback                        ,
#if defined(ENABLE_OVERLOADING)
    SvgErrorSignalInfo                      ,
#endif
    afterSvgError                           ,
    onSvgError                              ,




    ) 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.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GHashTable as B.GHT
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.GI.Base.Signals as B.Signals
import qualified Control.Monad.IO.Class as MIO
import qualified Data.Coerce as Coerce
import qualified Data.Text as T
import qualified Data.Kind as DK
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 GHC.Records as R
import qualified Data.Word as DW
import qualified Data.Int as DI
import qualified System.Posix.Types as SPT
import qualified Foreign.C.Types as FCT

-- Workaround for https://gitlab.haskell.org/ghc/ghc/-/issues/23392
#if MIN_VERSION_base(4,18,0)
import qualified GI.GLib.Structs.Bytes as GLib.Bytes
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gdk.Interfaces.Paintable as Gdk.Paintable
import qualified GI.Gdk.Objects.FrameClock as Gdk.FrameClock
import qualified GI.Gdk.Objects.Snapshot as Gdk.Snapshot
import qualified GI.Gdk.Structs.RGBA as Gdk.RGBA
import {-# SOURCE #-} qualified GI.Gtk.Flags as Gtk.Flags
import {-# SOURCE #-} qualified GI.Gtk.Interfaces.SymbolicPaintable as Gtk.SymbolicPaintable

#else
import qualified GI.GLib.Structs.Bytes as GLib.Bytes
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gdk.Interfaces.Paintable as Gdk.Paintable
import qualified GI.Gdk.Objects.FrameClock as Gdk.FrameClock
import {-# SOURCE #-} qualified GI.Gtk.Flags as Gtk.Flags
import {-# SOURCE #-} qualified GI.Gtk.Interfaces.SymbolicPaintable as Gtk.SymbolicPaintable

#endif

-- | Memory-managed wrapper type.
newtype Svg = Svg (SP.ManagedPtr Svg)
    deriving (Eq)

instance SP.ManagedPtrNewtype Svg where
    toManagedPtr (Svg p) = p

foreign import ccall "gtk_svg_get_type"
    c_gtk_svg_get_type :: IO B.Types.GType

instance B.Types.TypedObject Svg where
    glibType = c_gtk_svg_get_type

instance B.Types.GObject Svg

-- | Type class for types which can be safely cast to t'Svg', for instance with `toSvg`.
class (SP.GObject o, O.IsDescendantOf Svg o) => IsSvg o
instance (SP.GObject o, O.IsDescendantOf Svg o) => IsSvg o

instance O.HasParentTypes Svg
type instance O.ParentTypes Svg = '[GObject.Object.Object, Gdk.Paintable.Paintable, Gtk.SymbolicPaintable.SymbolicPaintable]

-- | Cast to t'Svg', for types for which this is known to be safe. For general casts, use 'Data.GI.Base.ManagedPtr.castTo'.
toSvg :: (MIO.MonadIO m, IsSvg o) => o -> m Svg
toSvg = MIO.liftIO . B.ManagedPtr.unsafeCastTo Svg

-- | Convert t'Svg' to and from t'Data.GI.Base.GValue.GValue'. See 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
instance B.GValue.IsGValue (Maybe Svg) where
    gvalueGType_ = c_gtk_svg_get_type
    gvalueSet_ gv P.Nothing = B.GValue.set_object gv (FP.nullPtr :: FP.Ptr Svg)
    gvalueSet_ gv (P.Just obj) = B.ManagedPtr.withManagedPtr obj (B.GValue.set_object gv)
    gvalueGet_ gv = do
        ptr <- B.GValue.get_object gv :: IO (FP.Ptr Svg)
        if ptr /= FP.nullPtr
        then P.Just <$> B.ManagedPtr.newObject Svg ptr
        else return P.Nothing
        
    

#if defined(ENABLE_OVERLOADING)
type family ResolveSvgMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
    ResolveSvgMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveSvgMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveSvgMethod "computeConcreteSize" o = Gdk.Paintable.PaintableComputeConcreteSizeMethodInfo
    ResolveSvgMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveSvgMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveSvgMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveSvgMethod "invalidateContents" o = Gdk.Paintable.PaintableInvalidateContentsMethodInfo
    ResolveSvgMethod "invalidateSize" o = Gdk.Paintable.PaintableInvalidateSizeMethodInfo
    ResolveSvgMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveSvgMethod "loadFromBytes" o = SvgLoadFromBytesMethodInfo
    ResolveSvgMethod "loadFromResource" o = SvgLoadFromResourceMethodInfo
    ResolveSvgMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveSvgMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveSvgMethod "pause" o = SvgPauseMethodInfo
    ResolveSvgMethod "play" o = SvgPlayMethodInfo
    ResolveSvgMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveSvgMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveSvgMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveSvgMethod "serialize" o = SvgSerializeMethodInfo
    ResolveSvgMethod "snapshot" o = Gdk.Paintable.PaintableSnapshotMethodInfo
    ResolveSvgMethod "snapshotSymbolic" o = Gtk.SymbolicPaintable.SymbolicPaintableSnapshotSymbolicMethodInfo
    ResolveSvgMethod "snapshotWithWeight" o = Gtk.SymbolicPaintable.SymbolicPaintableSnapshotWithWeightMethodInfo
    ResolveSvgMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveSvgMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveSvgMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveSvgMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveSvgMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveSvgMethod "writeToFile" o = SvgWriteToFileMethodInfo
    ResolveSvgMethod "getCurrentImage" o = Gdk.Paintable.PaintableGetCurrentImageMethodInfo
    ResolveSvgMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveSvgMethod "getFeatures" o = SvgGetFeaturesMethodInfo
    ResolveSvgMethod "getFlags" o = Gdk.Paintable.PaintableGetFlagsMethodInfo
    ResolveSvgMethod "getIntrinsicAspectRatio" o = Gdk.Paintable.PaintableGetIntrinsicAspectRatioMethodInfo
    ResolveSvgMethod "getIntrinsicHeight" o = Gdk.Paintable.PaintableGetIntrinsicHeightMethodInfo
    ResolveSvgMethod "getIntrinsicWidth" o = Gdk.Paintable.PaintableGetIntrinsicWidthMethodInfo
    ResolveSvgMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveSvgMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveSvgMethod "getState" o = SvgGetStateMethodInfo
    ResolveSvgMethod "getStateNames" o = SvgGetStateNamesMethodInfo
    ResolveSvgMethod "getWeight" o = SvgGetWeightMethodInfo
    ResolveSvgMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveSvgMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveSvgMethod "setFeatures" o = SvgSetFeaturesMethodInfo
    ResolveSvgMethod "setFrameClock" o = SvgSetFrameClockMethodInfo
    ResolveSvgMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveSvgMethod "setState" o = SvgSetStateMethodInfo
    ResolveSvgMethod "setWeight" o = SvgSetWeightMethodInfo
    ResolveSvgMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveSvgMethod t Svg, O.OverloadedMethod info Svg p) => OL.IsLabel t (Svg -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod @info
#else
    fromLabel _ = O.overloadedMethod @info
#endif

#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveSvgMethod t Svg, O.OverloadedMethod info Svg p, R.HasField t Svg p) => R.HasField t Svg p where
    getField = O.overloadedMethod @info

#endif

instance (info ~ ResolveSvgMethod t Svg, O.OverloadedMethodInfo info Svg) => OL.IsLabel t (O.MethodProxy info Svg) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.MethodProxy
#else
    fromLabel _ = O.MethodProxy
#endif

#endif

-- signal Svg::error
-- | Signals that an error occurred.
-- 
-- Errors can occur both during parsing and during rendering.
-- 
-- The expected error values are in the [error/@gtk@/.SvgError] enumeration,
-- context information about the location of parsing errors can
-- be obtained with the various @gtk_svg_error@ functions.
-- 
-- Parsing errors are never fatal, so the parsing will resume after
-- the error. Errors may however cause parts of the given data or
-- even all of it to not be parsed at all. So it is a useful idea
-- to check that the parsing succeeds by connecting to this signal.
-- 
-- ::: note
--     This signal is emitted in the middle of parsing or rendering,
--     and if you handle it, you must be careful. Logging the errors
--     you receive is fine, but modifying the widget hierarchy or
--     changing the paintable state definitively isn\'t.
-- 
--     If in doubt, defer to an idle.
-- 
-- /Since: 4.22/
type SvgErrorCallback =
    GError
    -- ^ /@error@/: the error
    -> IO ()

type C_SvgErrorCallback =
    Ptr Svg ->                              -- object
    Ptr GError ->
    Ptr () ->                               -- user_data
    IO ()

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

wrap_SvgErrorCallback :: 
    GObject a => (a -> SvgErrorCallback) ->
    C_SvgErrorCallback
wrap_SvgErrorCallback gi'cb gi'selfPtr error_ _ = do
    error_' <- (newBoxed GError) error_
    B.ManagedPtr.withNewObject gi'selfPtr $ \gi'self -> gi'cb (Coerce.coerce gi'self)  error_'


-- | Connect a signal handler for the [error](#signal:error) 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' svg #error callback
-- @
-- 
-- 
onSvgError :: (IsSvg a, MonadIO m) => a -> ((?self :: a) => SvgErrorCallback) -> m SignalHandlerId
onSvgError obj cb = liftIO $ do
    let wrapped self = let ?self = self in cb
    let wrapped' = wrap_SvgErrorCallback wrapped
    wrapped'' <- mk_SvgErrorCallback wrapped'
    connectSignalFunPtr obj "error" wrapped'' SignalConnectBefore Nothing

-- | Connect a signal handler for the [error](#signal:error) 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' svg #error callback
-- @
-- 
-- 
-- 
-- By default the object invoking the signal is not passed to the callback.
-- If you need to access it, you can use the implit @?self@ parameter.
-- Note that this requires activating the @ImplicitParams@ GHC extension.
-- 
afterSvgError :: (IsSvg a, MonadIO m) => a -> ((?self :: a) => SvgErrorCallback) -> m SignalHandlerId
afterSvgError obj cb = liftIO $ do
    let wrapped self = let ?self = self in cb
    let wrapped' = wrap_SvgErrorCallback wrapped
    wrapped'' <- mk_SvgErrorCallback wrapped'
    connectSignalFunPtr obj "error" wrapped'' SignalConnectAfter Nothing


#if defined(ENABLE_OVERLOADING)
data SvgErrorSignalInfo
instance SignalInfo SvgErrorSignalInfo where
    type HaskellCallbackType SvgErrorSignalInfo = SvgErrorCallback
    connectSignal obj cb connectMode detail = do
        let cb' = wrap_SvgErrorCallback cb
        cb'' <- mk_SvgErrorCallback cb'
        connectSignalFunPtr obj "error" cb'' connectMode detail
    dbgSignalInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Objects.Svg::error"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-4.0.11/docs/GI-Gtk-Objects-Svg.html#g:signal:error"})

#endif

-- VVV Prop "features"
   -- Type: TInterface (Name {namespace = "Gtk", name = "SvgFeatures"})
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Just False,Just False)

-- | Get the value of the “@features@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' svg #features
-- @
getSvgFeatures :: (MonadIO m, IsSvg o) => o -> m [Gtk.Flags.SvgFeatures]
getSvgFeatures obj = MIO.liftIO $ B.Properties.getObjectPropertyFlags obj "features"

-- | Set the value of the “@features@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.set' svg [ #features 'Data.GI.Base.Attributes.:=' value ]
-- @
setSvgFeatures :: (MonadIO m, IsSvg o) => o -> [Gtk.Flags.SvgFeatures] -> m ()
setSvgFeatures obj val = MIO.liftIO $ do
    B.Properties.setObjectPropertyFlags obj "features" val

-- | Construct a t'GValueConstruct' with valid value for the “@features@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
constructSvgFeatures :: (IsSvg o, MIO.MonadIO m) => [Gtk.Flags.SvgFeatures] -> m (GValueConstruct o)
constructSvgFeatures val = MIO.liftIO $ do
    MIO.liftIO $ B.Properties.constructObjectPropertyFlags "features" val

#if defined(ENABLE_OVERLOADING)
data SvgFeaturesPropertyInfo
instance AttrInfo SvgFeaturesPropertyInfo where
    type AttrAllowedOps SvgFeaturesPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet, 'AttrPut]
    type AttrBaseTypeConstraint SvgFeaturesPropertyInfo = IsSvg
    type AttrSetTypeConstraint SvgFeaturesPropertyInfo = (~) [Gtk.Flags.SvgFeatures]
    type AttrTransferTypeConstraint SvgFeaturesPropertyInfo = (~) [Gtk.Flags.SvgFeatures]
    type AttrTransferType SvgFeaturesPropertyInfo = [Gtk.Flags.SvgFeatures]
    type AttrGetType SvgFeaturesPropertyInfo = [Gtk.Flags.SvgFeatures]
    type AttrLabel SvgFeaturesPropertyInfo = "features"
    type AttrOrigin SvgFeaturesPropertyInfo = Svg
    attrGet = getSvgFeatures
    attrSet = setSvgFeatures
    attrPut = setSvgFeatures
    attrTransfer _ v = do
        return v
    attrConstruct = constructSvgFeatures
    attrClear = undefined
    dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Objects.Svg.features"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-4.0.11/docs/GI-Gtk-Objects-Svg.html#g:attr:features"
        })
#endif

-- VVV Prop "playing"
   -- Type: TBasicType TBoolean
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Nothing,Nothing)

-- | Get the value of the “@playing@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' svg #playing
-- @
getSvgPlaying :: (MonadIO m, IsSvg o) => o -> m Bool
getSvgPlaying obj = MIO.liftIO $ B.Properties.getObjectPropertyBool obj "playing"

-- | Set the value of the “@playing@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.set' svg [ #playing 'Data.GI.Base.Attributes.:=' value ]
-- @
setSvgPlaying :: (MonadIO m, IsSvg o) => o -> Bool -> m ()
setSvgPlaying obj val = MIO.liftIO $ do
    B.Properties.setObjectPropertyBool obj "playing" val

-- | Construct a t'GValueConstruct' with valid value for the “@playing@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
constructSvgPlaying :: (IsSvg o, MIO.MonadIO m) => Bool -> m (GValueConstruct o)
constructSvgPlaying val = MIO.liftIO $ do
    MIO.liftIO $ B.Properties.constructObjectPropertyBool "playing" val

#if defined(ENABLE_OVERLOADING)
data SvgPlayingPropertyInfo
instance AttrInfo SvgPlayingPropertyInfo where
    type AttrAllowedOps SvgPlayingPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet, 'AttrPut]
    type AttrBaseTypeConstraint SvgPlayingPropertyInfo = IsSvg
    type AttrSetTypeConstraint SvgPlayingPropertyInfo = (~) Bool
    type AttrTransferTypeConstraint SvgPlayingPropertyInfo = (~) Bool
    type AttrTransferType SvgPlayingPropertyInfo = Bool
    type AttrGetType SvgPlayingPropertyInfo = Bool
    type AttrLabel SvgPlayingPropertyInfo = "playing"
    type AttrOrigin SvgPlayingPropertyInfo = Svg
    attrGet = getSvgPlaying
    attrSet = setSvgPlaying
    attrPut = setSvgPlaying
    attrTransfer _ v = do
        return v
    attrConstruct = constructSvgPlaying
    attrClear = undefined
    dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Objects.Svg.playing"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-4.0.11/docs/GI-Gtk-Objects-Svg.html#g:attr:playing"
        })
#endif

-- VVV Prop "resource"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Nothing,Nothing)

-- | Get the value of the “@resource@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' svg #resource
-- @
getSvgResource :: (MonadIO m, IsSvg o) => o -> m (Maybe T.Text)
getSvgResource obj = MIO.liftIO $ B.Properties.getObjectPropertyString obj "resource"

-- | Set the value of the “@resource@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.set' svg [ #resource 'Data.GI.Base.Attributes.:=' value ]
-- @
setSvgResource :: (MonadIO m, IsSvg o) => o -> T.Text -> m ()
setSvgResource obj val = MIO.liftIO $ do
    B.Properties.setObjectPropertyString obj "resource" (Just val)

-- | Construct a t'GValueConstruct' with valid value for the “@resource@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
constructSvgResource :: (IsSvg o, MIO.MonadIO m) => T.Text -> m (GValueConstruct o)
constructSvgResource val = MIO.liftIO $ do
    MIO.liftIO $ B.Properties.constructObjectPropertyString "resource" (P.Just val)

-- | Set the value of the “@resource@” property to `Nothing`.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.clear' #resource
-- @
clearSvgResource :: (MonadIO m, IsSvg o) => o -> m ()
clearSvgResource obj = liftIO $ B.Properties.setObjectPropertyString obj "resource" (Nothing :: Maybe T.Text)

#if defined(ENABLE_OVERLOADING)
data SvgResourcePropertyInfo
instance AttrInfo SvgResourcePropertyInfo where
    type AttrAllowedOps SvgResourcePropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrBaseTypeConstraint SvgResourcePropertyInfo = IsSvg
    type AttrSetTypeConstraint SvgResourcePropertyInfo = (~) T.Text
    type AttrTransferTypeConstraint SvgResourcePropertyInfo = (~) T.Text
    type AttrTransferType SvgResourcePropertyInfo = T.Text
    type AttrGetType SvgResourcePropertyInfo = (Maybe T.Text)
    type AttrLabel SvgResourcePropertyInfo = "resource"
    type AttrOrigin SvgResourcePropertyInfo = Svg
    attrGet = getSvgResource
    attrSet = setSvgResource
    attrPut = undefined
    attrTransfer _ v = do
        return v
    attrConstruct = constructSvgResource
    attrClear = clearSvgResource
    dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Objects.Svg.resource"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-4.0.11/docs/GI-Gtk-Objects-Svg.html#g:attr:resource"
        })
#endif

-- VVV Prop "state"
   -- Type: TBasicType TUInt
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Just False,Just False)

-- | Get the value of the “@state@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' svg #state
-- @
getSvgState :: (MonadIO m, IsSvg o) => o -> m Word32
getSvgState obj = MIO.liftIO $ B.Properties.getObjectPropertyUInt32 obj "state"

-- | Set the value of the “@state@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.set' svg [ #state 'Data.GI.Base.Attributes.:=' value ]
-- @
setSvgState :: (MonadIO m, IsSvg o) => o -> Word32 -> m ()
setSvgState obj val = MIO.liftIO $ do
    B.Properties.setObjectPropertyUInt32 obj "state" val

-- | Construct a t'GValueConstruct' with valid value for the “@state@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
constructSvgState :: (IsSvg o, MIO.MonadIO m) => Word32 -> m (GValueConstruct o)
constructSvgState val = MIO.liftIO $ do
    MIO.liftIO $ B.Properties.constructObjectPropertyUInt32 "state" val

#if defined(ENABLE_OVERLOADING)
data SvgStatePropertyInfo
instance AttrInfo SvgStatePropertyInfo where
    type AttrAllowedOps SvgStatePropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet, 'AttrPut]
    type AttrBaseTypeConstraint SvgStatePropertyInfo = IsSvg
    type AttrSetTypeConstraint SvgStatePropertyInfo = (~) Word32
    type AttrTransferTypeConstraint SvgStatePropertyInfo = (~) Word32
    type AttrTransferType SvgStatePropertyInfo = Word32
    type AttrGetType SvgStatePropertyInfo = Word32
    type AttrLabel SvgStatePropertyInfo = "state"
    type AttrOrigin SvgStatePropertyInfo = Svg
    attrGet = getSvgState
    attrSet = setSvgState
    attrPut = setSvgState
    attrTransfer _ v = do
        return v
    attrConstruct = constructSvgState
    attrClear = undefined
    dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Objects.Svg.state"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-4.0.11/docs/GI-Gtk-Objects-Svg.html#g:attr:state"
        })
#endif

-- VVV Prop "weight"
   -- Type: TBasicType TDouble
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Just False,Just False)

-- | Get the value of the “@weight@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' svg #weight
-- @
getSvgWeight :: (MonadIO m, IsSvg o) => o -> m Double
getSvgWeight obj = MIO.liftIO $ B.Properties.getObjectPropertyDouble obj "weight"

-- | Set the value of the “@weight@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.set' svg [ #weight 'Data.GI.Base.Attributes.:=' value ]
-- @
setSvgWeight :: (MonadIO m, IsSvg o) => o -> Double -> m ()
setSvgWeight obj val = MIO.liftIO $ do
    B.Properties.setObjectPropertyDouble obj "weight" val

-- | Construct a t'GValueConstruct' with valid value for the “@weight@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
constructSvgWeight :: (IsSvg o, MIO.MonadIO m) => Double -> m (GValueConstruct o)
constructSvgWeight val = MIO.liftIO $ do
    MIO.liftIO $ B.Properties.constructObjectPropertyDouble "weight" val

#if defined(ENABLE_OVERLOADING)
data SvgWeightPropertyInfo
instance AttrInfo SvgWeightPropertyInfo where
    type AttrAllowedOps SvgWeightPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet, 'AttrPut]
    type AttrBaseTypeConstraint SvgWeightPropertyInfo = IsSvg
    type AttrSetTypeConstraint SvgWeightPropertyInfo = (~) Double
    type AttrTransferTypeConstraint SvgWeightPropertyInfo = (~) Double
    type AttrTransferType SvgWeightPropertyInfo = Double
    type AttrGetType SvgWeightPropertyInfo = Double
    type AttrLabel SvgWeightPropertyInfo = "weight"
    type AttrOrigin SvgWeightPropertyInfo = Svg
    attrGet = getSvgWeight
    attrSet = setSvgWeight
    attrPut = setSvgWeight
    attrTransfer _ v = do
        return v
    attrConstruct = constructSvgWeight
    attrClear = undefined
    dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Objects.Svg.weight"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-4.0.11/docs/GI-Gtk-Objects-Svg.html#g:attr:weight"
        })
#endif

#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList Svg
type instance O.AttributeList Svg = SvgAttributeList
type SvgAttributeList = ('[ '("features", SvgFeaturesPropertyInfo), '("playing", SvgPlayingPropertyInfo), '("resource", SvgResourcePropertyInfo), '("state", SvgStatePropertyInfo), '("weight", SvgWeightPropertyInfo)] :: [(Symbol, DK.Type)])
#endif

#if defined(ENABLE_OVERLOADING)
svgFeatures :: AttrLabelProxy "features"
svgFeatures = AttrLabelProxy

svgPlaying :: AttrLabelProxy "playing"
svgPlaying = AttrLabelProxy

svgResource :: AttrLabelProxy "resource"
svgResource = AttrLabelProxy

svgState :: AttrLabelProxy "state"
svgState = AttrLabelProxy

svgWeight :: AttrLabelProxy "weight"
svgWeight = AttrLabelProxy

#endif

#if defined(ENABLE_OVERLOADING)
type instance O.SignalList Svg = SvgSignalList
type SvgSignalList = ('[ '("error", SvgErrorSignalInfo), '("invalidateContents", Gdk.Paintable.PaintableInvalidateContentsSignalInfo), '("invalidateSize", Gdk.Paintable.PaintableInvalidateSizeSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, DK.Type)])

#endif

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

foreign import ccall "gtk_svg_new" gtk_svg_new :: 
    IO (Ptr Svg)

-- | Creates a new, empty SVG paintable.
-- 
-- /Since: 4.22/
svgNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Svg
    -- ^ __Returns:__ the paintable
svgNew  = liftIO $ do
    result <- gtk_svg_new
    checkUnexpectedReturnNULL "svgNew" result
    result' <- (wrapObject Svg) result
    return result'

#if defined(ENABLE_OVERLOADING)
#endif

-- method Svg::new_from_bytes
-- method type : Constructor
-- Args: [ Arg
--           { argCName = "bytes"
--           , argType = TInterface Name { namespace = "GLib" , name = "Bytes" }
--           , argCType = Just "GBytes*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the data" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Gtk" , name = "Svg" })
-- throws : False
-- Skip return : False

foreign import ccall "gtk_svg_new_from_bytes" gtk_svg_new_from_bytes :: 
    Ptr GLib.Bytes.Bytes ->                 -- bytes : TInterface (Name {namespace = "GLib", name = "Bytes"})
    IO (Ptr Svg)

-- | Parses the SVG data in /@bytes@/ and creates a paintable.
-- 
-- /Since: 4.22/
svgNewFromBytes ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GLib.Bytes.Bytes
    -- ^ /@bytes@/: the data
    -> m Svg
    -- ^ __Returns:__ the paintable
svgNewFromBytes bytes = liftIO $ do
    bytes' <- unsafeManagedPtrGetPtr bytes
    result <- gtk_svg_new_from_bytes bytes'
    checkUnexpectedReturnNULL "svgNewFromBytes" result
    result' <- (wrapObject Svg) result
    touchManagedPtr bytes
    return result'

#if defined(ENABLE_OVERLOADING)
#endif

-- method Svg::new_from_resource
-- method type : Constructor
-- Args: [ Arg
--           { argCName = "path"
--           , argType = TBasicType TUTF8
--           , argCType = Just "const char*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the resource path" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Gtk" , name = "Svg" })
-- throws : False
-- Skip return : False

foreign import ccall "gtk_svg_new_from_resource" gtk_svg_new_from_resource :: 
    CString ->                              -- path : TBasicType TUTF8
    IO (Ptr Svg)

-- | Parses the SVG data in the resource and creates a paintable.
-- 
-- /Since: 4.22/
svgNewFromResource ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@path@/: the resource path
    -> m Svg
    -- ^ __Returns:__ the paintable
svgNewFromResource path = liftIO $ do
    path' <- textToCString path
    result <- gtk_svg_new_from_resource path'
    checkUnexpectedReturnNULL "svgNewFromResource" result
    result' <- (wrapObject Svg) result
    freeMem path'
    return result'

#if defined(ENABLE_OVERLOADING)
#endif

-- method Svg::get_features
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType = TInterface Name { namespace = "Gtk" , name = "Svg" }
--           , argCType = Just "GtkSvg*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an SVG paintable" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Gtk" , name = "SvgFeatures" })
-- throws : False
-- Skip return : False

foreign import ccall "gtk_svg_get_features" gtk_svg_get_features :: 
    Ptr Svg ->                              -- self : TInterface (Name {namespace = "Gtk", name = "Svg"})
    IO CUInt

-- | Returns the currently enabled features.
-- 
-- /Since: 4.22/
svgGetFeatures ::
    (B.CallStack.HasCallStack, MonadIO m, IsSvg a) =>
    a
    -- ^ /@self@/: an SVG paintable
    -> m [Gtk.Flags.SvgFeatures]
    -- ^ __Returns:__ the enabled features
svgGetFeatures self = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    result <- gtk_svg_get_features self'
    let result' = wordToGFlags result
    touchManagedPtr self
    return result'

#if defined(ENABLE_OVERLOADING)
data SvgGetFeaturesMethodInfo
instance (signature ~ (m [Gtk.Flags.SvgFeatures]), MonadIO m, IsSvg a) => O.OverloadedMethod SvgGetFeaturesMethodInfo a signature where
    overloadedMethod = svgGetFeatures

instance O.OverloadedMethodInfo SvgGetFeaturesMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Objects.Svg.svgGetFeatures",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-4.0.11/docs/GI-Gtk-Objects-Svg.html#v:svgGetFeatures"
        })


#endif

-- method Svg::get_state
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType = TInterface Name { namespace = "Gtk" , name = "Svg" }
--           , argCType = Just "GtkSvg*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an SVG paintable" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "gtk_svg_get_state" gtk_svg_get_state :: 
    Ptr Svg ->                              -- self : TInterface (Name {namespace = "Gtk", name = "Svg"})
    IO Word32

-- | Gets the current state of the paintable.
-- 
-- /Since: 4.22/
svgGetState ::
    (B.CallStack.HasCallStack, MonadIO m, IsSvg a) =>
    a
    -- ^ /@self@/: an SVG paintable
    -> m Word32
    -- ^ __Returns:__ the state
svgGetState self = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    result <- gtk_svg_get_state self'
    touchManagedPtr self
    return result

#if defined(ENABLE_OVERLOADING)
data SvgGetStateMethodInfo
instance (signature ~ (m Word32), MonadIO m, IsSvg a) => O.OverloadedMethod SvgGetStateMethodInfo a signature where
    overloadedMethod = svgGetState

instance O.OverloadedMethodInfo SvgGetStateMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Objects.Svg.svgGetState",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-4.0.11/docs/GI-Gtk-Objects-Svg.html#v:svgGetState"
        })


#endif

-- method Svg::get_state_names
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType = TInterface Name { namespace = "Gtk" , name = "Svg" }
--           , argCType = Just "GtkSvg*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an SVG paintable" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "length"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "return location for the number\n  of strings that are returned"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TCArray True (-1) (-1) (TBasicType TUTF8))
-- throws : False
-- Skip return : False

foreign import ccall "gtk_svg_get_state_names" gtk_svg_get_state_names :: 
    Ptr Svg ->                              -- self : TInterface (Name {namespace = "Gtk", name = "Svg"})
    Ptr Word32 ->                           -- length : TBasicType TUInt
    IO (Ptr CString)

-- | Returns a @NULL@-terminated array of
-- state names, if available.
-- 
-- Note that the returned array and the strings
-- contained in it will only be valid until the
-- @GtkSvg@ is cleared or reloaded, so if you
-- want to keep it around, you should make a copy.
-- 
-- /Since: 4.22/
svgGetStateNames ::
    (B.CallStack.HasCallStack, MonadIO m, IsSvg a) =>
    a
    -- ^ /@self@/: an SVG paintable
    -> m ((Maybe [T.Text], Word32))
    -- ^ __Returns:__ the state names
svgGetStateNames self = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    length_ <- allocMem :: IO (Ptr Word32)
    result <- gtk_svg_get_state_names self' length_
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- unpackZeroTerminatedUTF8CArray result'
        return result''
    length_' <- peek length_
    touchManagedPtr self
    freeMem length_
    return (maybeResult, length_')

#if defined(ENABLE_OVERLOADING)
data SvgGetStateNamesMethodInfo
instance (signature ~ (m ((Maybe [T.Text], Word32))), MonadIO m, IsSvg a) => O.OverloadedMethod SvgGetStateNamesMethodInfo a signature where
    overloadedMethod = svgGetStateNames

instance O.OverloadedMethodInfo SvgGetStateNamesMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Objects.Svg.svgGetStateNames",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-4.0.11/docs/GI-Gtk-Objects-Svg.html#v:svgGetStateNames"
        })


#endif

-- method Svg::get_weight
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType = TInterface Name { namespace = "Gtk" , name = "Svg" }
--           , argCType = Just "GtkSvg*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an SVG paintable" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TDouble)
-- throws : False
-- Skip return : False

foreign import ccall "gtk_svg_get_weight" gtk_svg_get_weight :: 
    Ptr Svg ->                              -- self : TInterface (Name {namespace = "Gtk", name = "Svg"})
    IO CDouble

-- | Gets the value of the weight property.
-- 
-- /Since: 4.22/
svgGetWeight ::
    (B.CallStack.HasCallStack, MonadIO m, IsSvg a) =>
    a
    -- ^ /@self@/: an SVG paintable
    -> m Double
    -- ^ __Returns:__ the weight
svgGetWeight self = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    result <- gtk_svg_get_weight self'
    let result' = realToFrac result
    touchManagedPtr self
    return result'

#if defined(ENABLE_OVERLOADING)
data SvgGetWeightMethodInfo
instance (signature ~ (m Double), MonadIO m, IsSvg a) => O.OverloadedMethod SvgGetWeightMethodInfo a signature where
    overloadedMethod = svgGetWeight

instance O.OverloadedMethodInfo SvgGetWeightMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Objects.Svg.svgGetWeight",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-4.0.11/docs/GI-Gtk-Objects-Svg.html#v:svgGetWeight"
        })


#endif

-- method Svg::load_from_bytes
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType = TInterface Name { namespace = "Gtk" , name = "Svg" }
--           , argCType = Just "GtkSvg*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an SVG paintable" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "bytes"
--           , argType = TInterface Name { namespace = "GLib" , name = "Bytes" }
--           , argCType = Just "GBytes*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the data to load" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_svg_load_from_bytes" gtk_svg_load_from_bytes :: 
    Ptr Svg ->                              -- self : TInterface (Name {namespace = "Gtk", name = "Svg"})
    Ptr GLib.Bytes.Bytes ->                 -- bytes : TInterface (Name {namespace = "GLib", name = "Bytes"})
    IO ()

-- | Loads SVG content into an existing SVG paintable.
-- 
-- To track errors while loading SVG content,
-- connect to the [Svg::error]("GI.Gtk.Objects.Svg#g:signal:error") signal.
-- 
-- This clears any previously loaded content.
-- 
-- /Since: 4.22/
svgLoadFromBytes ::
    (B.CallStack.HasCallStack, MonadIO m, IsSvg a) =>
    a
    -- ^ /@self@/: an SVG paintable
    -> GLib.Bytes.Bytes
    -- ^ /@bytes@/: the data to load
    -> m ()
svgLoadFromBytes self bytes = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    bytes' <- unsafeManagedPtrGetPtr bytes
    gtk_svg_load_from_bytes self' bytes'
    touchManagedPtr self
    touchManagedPtr bytes
    return ()

#if defined(ENABLE_OVERLOADING)
data SvgLoadFromBytesMethodInfo
instance (signature ~ (GLib.Bytes.Bytes -> m ()), MonadIO m, IsSvg a) => O.OverloadedMethod SvgLoadFromBytesMethodInfo a signature where
    overloadedMethod = svgLoadFromBytes

instance O.OverloadedMethodInfo SvgLoadFromBytesMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Objects.Svg.svgLoadFromBytes",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-4.0.11/docs/GI-Gtk-Objects-Svg.html#v:svgLoadFromBytes"
        })


#endif

-- method Svg::load_from_resource
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType = TInterface Name { namespace = "Gtk" , name = "Svg" }
--           , argCType = Just "GtkSvg*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an SVG paintable" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "path"
--           , argType = TBasicType TUTF8
--           , argCType = Just "const char*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the resource path" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_svg_load_from_resource" gtk_svg_load_from_resource :: 
    Ptr Svg ->                              -- self : TInterface (Name {namespace = "Gtk", name = "Svg"})
    CString ->                              -- path : TBasicType TUTF8
    IO ()

-- | Loads SVG content into an existing SVG paintable.
-- 
-- To track errors while loading SVG content,
-- connect to the [Svg::error]("GI.Gtk.Objects.Svg#g:signal:error") signal.
-- 
-- This clears any previously loaded content.
-- 
-- /Since: 4.22/
svgLoadFromResource ::
    (B.CallStack.HasCallStack, MonadIO m, IsSvg a) =>
    a
    -- ^ /@self@/: an SVG paintable
    -> T.Text
    -- ^ /@path@/: the resource path
    -> m ()
svgLoadFromResource self path = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    path' <- textToCString path
    gtk_svg_load_from_resource self' path'
    touchManagedPtr self
    freeMem path'
    return ()

#if defined(ENABLE_OVERLOADING)
data SvgLoadFromResourceMethodInfo
instance (signature ~ (T.Text -> m ()), MonadIO m, IsSvg a) => O.OverloadedMethod SvgLoadFromResourceMethodInfo a signature where
    overloadedMethod = svgLoadFromResource

instance O.OverloadedMethodInfo SvgLoadFromResourceMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Objects.Svg.svgLoadFromResource",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-4.0.11/docs/GI-Gtk-Objects-Svg.html#v:svgLoadFromResource"
        })


#endif

-- method Svg::pause
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType = TInterface Name { namespace = "Gtk" , name = "Svg" }
--           , argCType = Just "GtkSvg*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an SVG paintable" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_svg_pause" gtk_svg_pause :: 
    Ptr Svg ->                              -- self : TInterface (Name {namespace = "Gtk", name = "Svg"})
    IO ()

-- | Stop any playing animations and state transitions.
-- 
-- Animations can be paused and started repeatedly.
-- 
-- /Since: 4.22/
svgPause ::
    (B.CallStack.HasCallStack, MonadIO m, IsSvg a) =>
    a
    -- ^ /@self@/: an SVG paintable
    -> m ()
svgPause self = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    gtk_svg_pause self'
    touchManagedPtr self
    return ()

#if defined(ENABLE_OVERLOADING)
data SvgPauseMethodInfo
instance (signature ~ (m ()), MonadIO m, IsSvg a) => O.OverloadedMethod SvgPauseMethodInfo a signature where
    overloadedMethod = svgPause

instance O.OverloadedMethodInfo SvgPauseMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Objects.Svg.svgPause",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-4.0.11/docs/GI-Gtk-Objects-Svg.html#v:svgPause"
        })


#endif

-- method Svg::play
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType = TInterface Name { namespace = "Gtk" , name = "Svg" }
--           , argCType = Just "GtkSvg*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an SVG paintable" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_svg_play" gtk_svg_play :: 
    Ptr Svg ->                              -- self : TInterface (Name {namespace = "Gtk", name = "Svg"})
    IO ()

-- | Start playing animations and state transitions.
-- 
-- Animations can be paused and started repeatedly.
-- 
-- /Since: 4.22/
svgPlay ::
    (B.CallStack.HasCallStack, MonadIO m, IsSvg a) =>
    a
    -- ^ /@self@/: an SVG paintable
    -> m ()
svgPlay self = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    gtk_svg_play self'
    touchManagedPtr self
    return ()

#if defined(ENABLE_OVERLOADING)
data SvgPlayMethodInfo
instance (signature ~ (m ()), MonadIO m, IsSvg a) => O.OverloadedMethod SvgPlayMethodInfo a signature where
    overloadedMethod = svgPlay

instance O.OverloadedMethodInfo SvgPlayMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Objects.Svg.svgPlay",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-4.0.11/docs/GI-Gtk-Objects-Svg.html#v:svgPlay"
        })


#endif

-- method Svg::serialize
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType = TInterface Name { namespace = "Gtk" , name = "Svg" }
--           , argCType = Just "GtkSvg*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an SVG paintable" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "GLib" , name = "Bytes" })
-- throws : False
-- Skip return : False

foreign import ccall "gtk_svg_serialize" gtk_svg_serialize :: 
    Ptr Svg ->                              -- self : TInterface (Name {namespace = "Gtk", name = "Svg"})
    IO (Ptr GLib.Bytes.Bytes)

-- | Serializes the content of the renderer as SVG.
-- 
-- The SVG will be similar to the orignally loaded one,
-- but is not guaranteed to be 100% identical.
-- 
-- This function serializes the DOM, i.e. the results
-- of parsing the SVG. It does not reflect the effect
-- of applying animations.
-- 
-- /Since: 4.22/
svgSerialize ::
    (B.CallStack.HasCallStack, MonadIO m, IsSvg a) =>
    a
    -- ^ /@self@/: an SVG paintable
    -> m GLib.Bytes.Bytes
    -- ^ __Returns:__ the serialized contents
svgSerialize self = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    result <- gtk_svg_serialize self'
    checkUnexpectedReturnNULL "svgSerialize" result
    result' <- (wrapBoxed GLib.Bytes.Bytes) result
    touchManagedPtr self
    return result'

#if defined(ENABLE_OVERLOADING)
data SvgSerializeMethodInfo
instance (signature ~ (m GLib.Bytes.Bytes), MonadIO m, IsSvg a) => O.OverloadedMethod SvgSerializeMethodInfo a signature where
    overloadedMethod = svgSerialize

instance O.OverloadedMethodInfo SvgSerializeMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Objects.Svg.svgSerialize",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-4.0.11/docs/GI-Gtk-Objects-Svg.html#v:svgSerialize"
        })


#endif

-- method Svg::set_features
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType = TInterface Name { namespace = "Gtk" , name = "Svg" }
--           , argCType = Just "GtkSvg*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an SVG paintable" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "features"
--           , argType =
--               TInterface Name { namespace = "Gtk" , name = "SvgFeatures" }
--           , argCType = Just "GtkSvgFeatures"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "features to enable" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_svg_set_features" gtk_svg_set_features :: 
    Ptr Svg ->                              -- self : TInterface (Name {namespace = "Gtk", name = "Svg"})
    CUInt ->                                -- features : TInterface (Name {namespace = "Gtk", name = "SvgFeatures"})
    IO ()

-- | Enables or disables features of the SVG paintable.
-- 
-- By default, all features are enabled.
-- 
-- Note that this call only has an effect before the
-- SVG is loaded.
-- 
-- /Since: 4.22/
svgSetFeatures ::
    (B.CallStack.HasCallStack, MonadIO m, IsSvg a) =>
    a
    -- ^ /@self@/: an SVG paintable
    -> [Gtk.Flags.SvgFeatures]
    -- ^ /@features@/: features to enable
    -> m ()
svgSetFeatures self features = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    let features' = gflagsToWord features
    gtk_svg_set_features self' features'
    touchManagedPtr self
    return ()

#if defined(ENABLE_OVERLOADING)
data SvgSetFeaturesMethodInfo
instance (signature ~ ([Gtk.Flags.SvgFeatures] -> m ()), MonadIO m, IsSvg a) => O.OverloadedMethod SvgSetFeaturesMethodInfo a signature where
    overloadedMethod = svgSetFeatures

instance O.OverloadedMethodInfo SvgSetFeaturesMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Objects.Svg.svgSetFeatures",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-4.0.11/docs/GI-Gtk-Objects-Svg.html#v:svgSetFeatures"
        })


#endif

-- method Svg::set_frame_clock
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType = TInterface Name { namespace = "Gtk" , name = "Svg" }
--           , argCType = Just "GtkSvg*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an SVG paintable" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "clock"
--           , argType =
--               TInterface Name { namespace = "Gdk" , name = "FrameClock" }
--           , argCType = Just "GdkFrameClock*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the frame clock" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_svg_set_frame_clock" gtk_svg_set_frame_clock :: 
    Ptr Svg ->                              -- self : TInterface (Name {namespace = "Gtk", name = "Svg"})
    Ptr Gdk.FrameClock.FrameClock ->        -- clock : TInterface (Name {namespace = "Gdk", name = "FrameClock"})
    IO ()

-- | Sets a frame clock.
-- 
-- Without a frame clock, GtkSvg will not advance animations.
-- 
-- /Since: 4.22/
svgSetFrameClock ::
    (B.CallStack.HasCallStack, MonadIO m, IsSvg a, Gdk.FrameClock.IsFrameClock b) =>
    a
    -- ^ /@self@/: an SVG paintable
    -> b
    -- ^ /@clock@/: the frame clock
    -> m ()
svgSetFrameClock self clock = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    clock' <- unsafeManagedPtrCastPtr clock
    gtk_svg_set_frame_clock self' clock'
    touchManagedPtr self
    touchManagedPtr clock
    return ()

#if defined(ENABLE_OVERLOADING)
data SvgSetFrameClockMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsSvg a, Gdk.FrameClock.IsFrameClock b) => O.OverloadedMethod SvgSetFrameClockMethodInfo a signature where
    overloadedMethod = svgSetFrameClock

instance O.OverloadedMethodInfo SvgSetFrameClockMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Objects.Svg.svgSetFrameClock",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-4.0.11/docs/GI-Gtk-Objects-Svg.html#v:svgSetFrameClock"
        })


#endif

-- method Svg::set_state
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType = TInterface Name { namespace = "Gtk" , name = "Svg" }
--           , argCType = Just "GtkSvg*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an SVG paintable" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "state"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the state to set, as a value between 0 and 63"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_svg_set_state" gtk_svg_set_state :: 
    Ptr Svg ->                              -- self : TInterface (Name {namespace = "Gtk", name = "Svg"})
    Word32 ->                               -- state : TBasicType TUInt
    IO ()

-- | Sets the state of the paintable.
-- 
-- If the paintable is currently playing, the state change
-- will apply transitions that are defined in the SVG. If
-- the paintable is not playing, the state change will take
-- effect instantaneously.
-- 
-- /Since: 4.22/
svgSetState ::
    (B.CallStack.HasCallStack, MonadIO m, IsSvg a) =>
    a
    -- ^ /@self@/: an SVG paintable
    -> Word32
    -- ^ /@state@/: the state to set, as a value between 0 and 63
    -> m ()
svgSetState self state = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    gtk_svg_set_state self' state
    touchManagedPtr self
    return ()

#if defined(ENABLE_OVERLOADING)
data SvgSetStateMethodInfo
instance (signature ~ (Word32 -> m ()), MonadIO m, IsSvg a) => O.OverloadedMethod SvgSetStateMethodInfo a signature where
    overloadedMethod = svgSetState

instance O.OverloadedMethodInfo SvgSetStateMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Objects.Svg.svgSetState",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-4.0.11/docs/GI-Gtk-Objects-Svg.html#v:svgSetState"
        })


#endif

-- method Svg::set_weight
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType = TInterface Name { namespace = "Gtk" , name = "Svg" }
--           , argCType = Just "GtkSvg*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an SVG paintable" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "weight"
--           , argType = TBasicType TDouble
--           , argCType = Just "double"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the font weight, as a value between -1 and 1000"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_svg_set_weight" gtk_svg_set_weight :: 
    Ptr Svg ->                              -- self : TInterface (Name {namespace = "Gtk", name = "Svg"})
    CDouble ->                              -- weight : TBasicType TDouble
    IO ()

-- | Sets the weight that is used when rendering.
-- 
-- The weight affects the effective linewidth when stroking
-- paths.
-- 
-- The default value of -1 means to use the font weight
-- from CSS.
-- 
-- /Since: 4.22/
svgSetWeight ::
    (B.CallStack.HasCallStack, MonadIO m, IsSvg a) =>
    a
    -- ^ /@self@/: an SVG paintable
    -> Double
    -- ^ /@weight@/: the font weight, as a value between -1 and 1000
    -> m ()
svgSetWeight self weight = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    let weight' = realToFrac weight
    gtk_svg_set_weight self' weight'
    touchManagedPtr self
    return ()

#if defined(ENABLE_OVERLOADING)
data SvgSetWeightMethodInfo
instance (signature ~ (Double -> m ()), MonadIO m, IsSvg a) => O.OverloadedMethod SvgSetWeightMethodInfo a signature where
    overloadedMethod = svgSetWeight

instance O.OverloadedMethodInfo SvgSetWeightMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Objects.Svg.svgSetWeight",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-4.0.11/docs/GI-Gtk-Objects-Svg.html#v:svgSetWeight"
        })


#endif

-- method Svg::write_to_file
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType = TInterface Name { namespace = "Gtk" , name = "Svg" }
--           , argCType = Just "GtkSvg*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an SVG paintable" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "filename"
--           , argType = TBasicType TUTF8
--           , argCType = Just "const char*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the file to save to"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "gtk_svg_write_to_file" gtk_svg_write_to_file :: 
    Ptr Svg ->                              -- self : TInterface (Name {namespace = "Gtk", name = "Svg"})
    CString ->                              -- filename : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Serializes the paintable, and saves the result to a file.
-- 
-- /Since: 4.22/
svgWriteToFile ::
    (B.CallStack.HasCallStack, MonadIO m, IsSvg a) =>
    a
    -- ^ /@self@/: an SVG paintable
    -> T.Text
    -- ^ /@filename@/: the file to save to
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
svgWriteToFile self filename = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    filename' <- textToCString filename
    onException (do
        _ <- propagateGError $ gtk_svg_write_to_file self' filename'
        touchManagedPtr self
        freeMem filename'
        return ()
     ) (do
        freeMem filename'
     )

#if defined(ENABLE_OVERLOADING)
data SvgWriteToFileMethodInfo
instance (signature ~ (T.Text -> m ()), MonadIO m, IsSvg a) => O.OverloadedMethod SvgWriteToFileMethodInfo a signature where
    overloadedMethod = svgWriteToFile

instance O.OverloadedMethodInfo SvgWriteToFileMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Objects.Svg.svgWriteToFile",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-4.0.11/docs/GI-Gtk-Objects-Svg.html#v:svgWriteToFile"
        })


#endif


