-- | Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
-- 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.Pango.Flags
    (

 -- * Flags
-- ** FontMask #flag:FontMask#

    FontMask(..)                            ,


-- ** ShapeFlags #flag:ShapeFlags#

    ShapeFlags(..)                          ,


-- ** ShowFlags #flag:ShowFlags#

    ShowFlags(..)                           ,




    ) 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.GI.Base.Signals as B.Signals
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


-- Flags ShowFlags
-- | These flags affect how Pango treats characters that are normally
-- not visible in the output.
data ShowFlags =
      ShowFlagsNone
    -- ^ No special treatment for invisible characters
    | ShowFlagsSpaces
    -- ^ Render spaces, tabs and newlines visibly
    | ShowFlagsLineBreaks
    -- ^ Render line breaks visibly
    | ShowFlagsIgnorables
    -- ^ Render default-ignorable Unicode
    --      characters visibly
    | AnotherShowFlags Int
    -- ^ Catch-all for unknown values
    deriving (Show, Eq)

instance P.Enum ShowFlags where
    fromEnum ShowFlagsNone = 0
    fromEnum ShowFlagsSpaces = 1
    fromEnum ShowFlagsLineBreaks = 2
    fromEnum ShowFlagsIgnorables = 4
    fromEnum (AnotherShowFlags k) = k

    toEnum 0 = ShowFlagsNone
    toEnum 1 = ShowFlagsSpaces
    toEnum 2 = ShowFlagsLineBreaks
    toEnum 4 = ShowFlagsIgnorables
    toEnum k = AnotherShowFlags k

instance P.Ord ShowFlags where
    compare a b = P.compare (P.fromEnum a) (P.fromEnum b)

foreign import ccall "pango_show_flags_get_type" c_pango_show_flags_get_type ::
    IO GType

instance BoxedFlags ShowFlags where
    boxedFlagsType _ = c_pango_show_flags_get_type

instance IsGFlag ShowFlags

-- Flags ShapeFlags
-- | Flags influencing the shaping process.
-- These can be passed to 'GI.Pango.Functions.shapeWithFlags'.
data ShapeFlags =
      ShapeFlagsNone
    -- ^ Default value.
    | ShapeFlagsRoundPositions
    -- ^ Round glyph positions
    --     and widths to whole device units. This option should
    --     be set if the target renderer can\'t do subpixel
    --     positioning of glyphs.
    | AnotherShapeFlags Int
    -- ^ Catch-all for unknown values
    deriving (Show, Eq)

instance P.Enum ShapeFlags where
    fromEnum ShapeFlagsNone = 0
    fromEnum ShapeFlagsRoundPositions = 1
    fromEnum (AnotherShapeFlags k) = k

    toEnum 0 = ShapeFlagsNone
    toEnum 1 = ShapeFlagsRoundPositions
    toEnum k = AnotherShapeFlags k

instance P.Ord ShapeFlags where
    compare a b = P.compare (P.fromEnum a) (P.fromEnum b)

foreign import ccall "pango_shape_flags_get_type" c_pango_shape_flags_get_type ::
    IO GType

instance BoxedFlags ShapeFlags where
    boxedFlagsType _ = c_pango_shape_flags_get_type

instance IsGFlag ShapeFlags

-- Flags FontMask
-- | The bits in a t'GI.Pango.Flags.FontMask' correspond to fields in a
-- t'GI.Pango.Structs.FontDescription.FontDescription' that have been set.
data FontMask =
      FontMaskFamily
    -- ^ the font family is specified.
    | FontMaskStyle
    -- ^ the font style is specified.
    | FontMaskVariant
    -- ^ the font variant is specified.
    | FontMaskWeight
    -- ^ the font weight is specified.
    | FontMaskStretch
    -- ^ the font stretch is specified.
    | FontMaskSize
    -- ^ the font size is specified.
    | FontMaskGravity
    -- ^ the font gravity is specified (Since: 1.16.)
    | FontMaskVariations
    -- ^ OpenType font variations are specified (Since: 1.42)
    | AnotherFontMask Int
    -- ^ Catch-all for unknown values
    deriving (Show, Eq)

instance P.Enum FontMask where
    fromEnum FontMaskFamily = 1
    fromEnum FontMaskStyle = 2
    fromEnum FontMaskVariant = 4
    fromEnum FontMaskWeight = 8
    fromEnum FontMaskStretch = 16
    fromEnum FontMaskSize = 32
    fromEnum FontMaskGravity = 64
    fromEnum FontMaskVariations = 128
    fromEnum (AnotherFontMask k) = k

    toEnum 1 = FontMaskFamily
    toEnum 2 = FontMaskStyle
    toEnum 4 = FontMaskVariant
    toEnum 8 = FontMaskWeight
    toEnum 16 = FontMaskStretch
    toEnum 32 = FontMaskSize
    toEnum 64 = FontMaskGravity
    toEnum 128 = FontMaskVariations
    toEnum k = AnotherFontMask k

instance P.Ord FontMask where
    compare a b = P.compare (P.fromEnum a) (P.fromEnum b)

foreign import ccall "pango_font_mask_get_type" c_pango_font_mask_get_type ::
    IO GType

instance BoxedFlags FontMask where
    boxedFlagsType _ = c_pango_font_mask_get_type

instance IsGFlag FontMask