-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria

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

module GI.Rsvg.Enums
    ( 

 -- * Enumerations


-- ** Error #enum:Error#

    Error(..)                               ,
    catchError                              ,
    handleError                             ,


-- ** Unit #enum:Unit#

    Unit(..)                                ,




    ) 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.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


-- Enum Unit
-- | Units for the @RsvgLength@ struct.  These have the same meaning as <https://www.w3.org/TR/CSS21/syndata.html#length-units CSS length
-- units>.
data Unit = 
      UnitPercent
    -- ^ percentage values; where \<literal>1.0\<\/literal> means 100%.
    | UnitPx
    -- ^ pixels
    | UnitEm
    -- ^ em, or the current font size
    | UnitEx
    -- ^ x-height of the current font
    | UnitIn
    -- ^ inches
    | UnitCm
    -- ^ centimeters
    | UnitMm
    -- ^ millimeters
    | UnitPt
    -- ^ points, or 1\/72 inch
    | UnitPc
    -- ^ picas, or 1\/6 inch (12 points)
    | AnotherUnit Int
    -- ^ Catch-all for unknown values
    deriving (Int -> Unit -> ShowS
[Unit] -> ShowS
Unit -> String
(Int -> Unit -> ShowS)
-> (Unit -> String) -> ([Unit] -> ShowS) -> Show Unit
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Unit -> ShowS
showsPrec :: Int -> Unit -> ShowS
$cshow :: Unit -> String
show :: Unit -> String
$cshowList :: [Unit] -> ShowS
showList :: [Unit] -> ShowS
Show, Unit -> Unit -> Bool
(Unit -> Unit -> Bool) -> (Unit -> Unit -> Bool) -> Eq Unit
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Unit -> Unit -> Bool
== :: Unit -> Unit -> Bool
$c/= :: Unit -> Unit -> Bool
/= :: Unit -> Unit -> Bool
Eq)

instance P.Enum Unit where
    fromEnum :: Unit -> Int
fromEnum Unit
UnitPercent = Int
0
    fromEnum Unit
UnitPx = Int
1
    fromEnum Unit
UnitEm = Int
2
    fromEnum Unit
UnitEx = Int
3
    fromEnum Unit
UnitIn = Int
4
    fromEnum Unit
UnitCm = Int
5
    fromEnum Unit
UnitMm = Int
6
    fromEnum Unit
UnitPt = Int
7
    fromEnum Unit
UnitPc = Int
8
    fromEnum (AnotherUnit Int
k) = Int
k

    toEnum :: Int -> Unit
toEnum Int
0 = Unit
UnitPercent
    toEnum Int
1 = Unit
UnitPx
    toEnum Int
2 = Unit
UnitEm
    toEnum Int
3 = Unit
UnitEx
    toEnum Int
4 = Unit
UnitIn
    toEnum Int
5 = Unit
UnitCm
    toEnum Int
6 = Unit
UnitMm
    toEnum Int
7 = Unit
UnitPt
    toEnum Int
8 = Unit
UnitPc
    toEnum Int
k = Int -> Unit
AnotherUnit Int
k

instance P.Ord Unit where
    compare :: Unit -> Unit -> Ordering
compare Unit
a Unit
b = Int -> Int -> Ordering
forall a. Ord a => a -> a -> Ordering
P.compare (Unit -> Int
forall a. Enum a => a -> Int
P.fromEnum Unit
a) (Unit -> Int
forall a. Enum a => a -> Int
P.fromEnum Unit
b)

-- Enum Error
-- | An enumeration representing possible errors
data Error = 
      ErrorFailed
    -- ^ the request failed
    | AnotherError Int
    -- ^ Catch-all for unknown values
    deriving (Int -> Error -> ShowS
[Error] -> ShowS
Error -> String
(Int -> Error -> ShowS)
-> (Error -> String) -> ([Error] -> ShowS) -> Show Error
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Error -> ShowS
showsPrec :: Int -> Error -> ShowS
$cshow :: Error -> String
show :: Error -> String
$cshowList :: [Error] -> ShowS
showList :: [Error] -> ShowS
Show, Error -> Error -> Bool
(Error -> Error -> Bool) -> (Error -> Error -> Bool) -> Eq Error
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Error -> Error -> Bool
== :: Error -> Error -> Bool
$c/= :: Error -> Error -> Bool
/= :: Error -> Error -> Bool
Eq)

instance P.Enum Error where
    fromEnum :: Error -> Int
fromEnum Error
ErrorFailed = Int
0
    fromEnum (AnotherError Int
k) = Int
k

    toEnum :: Int -> Error
toEnum Int
0 = Error
ErrorFailed
    toEnum Int
k = Int -> Error
AnotherError Int
k

instance P.Ord Error where
    compare :: Error -> Error -> Ordering
compare Error
a Error
b = Int -> Int -> Ordering
forall a. Ord a => a -> a -> Ordering
P.compare (Error -> Int
forall a. Enum a => a -> Int
P.fromEnum Error
a) (Error -> Int
forall a. Enum a => a -> Int
P.fromEnum Error
b)

instance GErrorClass Error where
    gerrorClassDomain :: Error -> Text
gerrorClassDomain Error
_ = Text
"rsvg-error-quark"

-- | Catch exceptions of type `Error`. This is a specialized version of `Data.GI.Base.GError.catchGErrorJustDomain`.
catchError ::
    IO a ->
    (Error -> GErrorMessage -> IO a) ->
    IO a
catchError :: forall a. IO a -> (Error -> Text -> IO a) -> IO a
catchError = IO a -> (Error -> Text -> IO a) -> IO a
forall err a.
GErrorClass err =>
IO a -> (err -> Text -> IO a) -> IO a
catchGErrorJustDomain

-- | Handle exceptions of type `Error`. This is a specialized version of `Data.GI.Base.GError.handleGErrorJustDomain`.
handleError ::
    (Error -> GErrorMessage -> IO a) ->
    IO a ->
    IO a
handleError :: forall a. (Error -> Text -> IO a) -> IO a -> IO a
handleError = (Error -> Text -> IO a) -> IO a -> IO a
forall err a.
GErrorClass err =>
(err -> Text -> IO a) -> IO a -> IO a
handleGErrorJustDomain

type instance O.ParentTypes Error = '[]
instance O.HasParentTypes Error

foreign import ccall "rsvg_error_get_type" c_rsvg_error_get_type :: 
    IO GType

instance B.Types.TypedObject Error where
    glibType :: IO GType
glibType = IO GType
c_rsvg_error_get_type

instance B.Types.BoxedEnum Error