{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)
-}

module GI.GtkSource.Enums
    ( 
    catchFileSaverError                     ,
    handleFileSaverError                    ,
    catchFileLoaderError                    ,
    handleFileLoaderError                   ,
    catchCompletionError                    ,
    handleCompletionError                   ,

-- * Exported types
    ViewGutterPosition(..)                  ,
    SmartHomeEndType(..)                    ,
    NewlineType(..)                         ,
    GutterRendererAlignmentMode(..)         ,
    FileSaverError(..)                      ,
    FileLoaderError(..)                     ,
    CompressionType(..)                     ,
    CompletionError(..)                     ,
    ChangeCaseType(..)                      ,
    BracketMatchType(..)                    ,
    BackgroundPatternType(..)               ,


    ) 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.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
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


-- Enum ViewGutterPosition
{- |
/No description available in the introspection data./
-}
data ViewGutterPosition = 
      ViewGutterPositionLines
    {- ^
    the gutter position of the lines
    renderer
    -}
    | ViewGutterPositionMarks
    {- ^
    the gutter position of the marks
    renderer
    -}
    | AnotherViewGutterPosition Int
    -- ^ Catch-all for unknown values
    deriving (Show, Eq)

instance P.Enum ViewGutterPosition where
    fromEnum ViewGutterPositionLines = -30
    fromEnum ViewGutterPositionMarks = -20
    fromEnum (AnotherViewGutterPosition k) = k

    toEnum -30 = ViewGutterPositionLines
    toEnum -20 = ViewGutterPositionMarks
    toEnum k = AnotherViewGutterPosition k

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

foreign import ccall "gtk_source_view_gutter_position_get_type" c_gtk_source_view_gutter_position_get_type :: 
    IO GType

instance BoxedEnum ViewGutterPosition where
    boxedEnumType _ = c_gtk_source_view_gutter_position_get_type

-- Enum SmartHomeEndType
{- |
/No description available in the introspection data./
-}
data SmartHomeEndType = 
      SmartHomeEndTypeDisabled
    {- ^
    smart-home-end disabled.
    -}
    | SmartHomeEndTypeBefore
    {- ^
    move to the first\/last
    non-whitespace character on the first press of the HOME\/END keys and
    to the beginning\/end of the line on the second press.
    -}
    | SmartHomeEndTypeAfter
    {- ^
    move to the beginning\/end of the
    line on the first press of the HOME\/END keys and to the first\/last
    non-whitespace character on the second press.
    -}
    | SmartHomeEndTypeAlways
    {- ^
    always move to the first\/last
    non-whitespace character when the HOME\/END keys are pressed.
    -}
    | AnotherSmartHomeEndType Int
    -- ^ Catch-all for unknown values
    deriving (Show, Eq)

instance P.Enum SmartHomeEndType where
    fromEnum SmartHomeEndTypeDisabled = 0
    fromEnum SmartHomeEndTypeBefore = 1
    fromEnum SmartHomeEndTypeAfter = 2
    fromEnum SmartHomeEndTypeAlways = 3
    fromEnum (AnotherSmartHomeEndType k) = k

    toEnum 0 = SmartHomeEndTypeDisabled
    toEnum 1 = SmartHomeEndTypeBefore
    toEnum 2 = SmartHomeEndTypeAfter
    toEnum 3 = SmartHomeEndTypeAlways
    toEnum k = AnotherSmartHomeEndType k

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

foreign import ccall "gtk_source_smart_home_end_type_get_type" c_gtk_source_smart_home_end_type_get_type :: 
    IO GType

instance BoxedEnum SmartHomeEndType where
    boxedEnumType _ = c_gtk_source_smart_home_end_type_get_type

-- Enum NewlineType
{- |
/No description available in the introspection data./

@since 3.14
-}
data NewlineType = 
      NewlineTypeLf
    {- ^
    line feed, used on UNIX.
    -}
    | NewlineTypeCr
    {- ^
    carriage return, used on Mac.
    -}
    | NewlineTypeCrLf
    {- ^
    carriage return followed by a line feed, used
      on Windows.
    -}
    | AnotherNewlineType Int
    -- ^ Catch-all for unknown values
    deriving (Show, Eq)

instance P.Enum NewlineType where
    fromEnum NewlineTypeLf = 0
    fromEnum NewlineTypeCr = 1
    fromEnum NewlineTypeCrLf = 2
    fromEnum (AnotherNewlineType k) = k

    toEnum 0 = NewlineTypeLf
    toEnum 1 = NewlineTypeCr
    toEnum 2 = NewlineTypeCrLf
    toEnum k = AnotherNewlineType k

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

foreign import ccall "gtk_source_newline_type_get_type" c_gtk_source_newline_type_get_type :: 
    IO GType

instance BoxedEnum NewlineType where
    boxedEnumType _ = c_gtk_source_newline_type_get_type

-- Enum GutterRendererAlignmentMode
{- |
The alignment mode of the renderer, when a cell spans multiple lines (due to
text wrapping).
-}
data GutterRendererAlignmentMode = 
      GutterRendererAlignmentModeCell
    {- ^
    The full cell.
    -}
    | GutterRendererAlignmentModeFirst
    {- ^
    The first line.
    -}
    | GutterRendererAlignmentModeLast
    {- ^
    The last line.
    -}
    | AnotherGutterRendererAlignmentMode Int
    -- ^ Catch-all for unknown values
    deriving (Show, Eq)

instance P.Enum GutterRendererAlignmentMode where
    fromEnum GutterRendererAlignmentModeCell = 0
    fromEnum GutterRendererAlignmentModeFirst = 1
    fromEnum GutterRendererAlignmentModeLast = 2
    fromEnum (AnotherGutterRendererAlignmentMode k) = k

    toEnum 0 = GutterRendererAlignmentModeCell
    toEnum 1 = GutterRendererAlignmentModeFirst
    toEnum 2 = GutterRendererAlignmentModeLast
    toEnum k = AnotherGutterRendererAlignmentMode k

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

foreign import ccall "gtk_source_gutter_renderer_alignment_mode_get_type" c_gtk_source_gutter_renderer_alignment_mode_get_type :: 
    IO GType

instance BoxedEnum GutterRendererAlignmentMode where
    boxedEnumType _ = c_gtk_source_gutter_renderer_alignment_mode_get_type

-- Enum FileSaverError
{- |
An error code used with the @/GTK_SOURCE_FILE_SAVER_ERROR/@ domain.

@since 3.14
-}
data FileSaverError = 
      FileSaverErrorInvalidChars
    {- ^
    The buffer contains invalid
      characters.
    -}
    | FileSaverErrorExternallyModified
    {- ^
    The file is externally
      modified.
    -}
    | AnotherFileSaverError Int
    -- ^ Catch-all for unknown values
    deriving (Show, Eq)

instance P.Enum FileSaverError where
    fromEnum FileSaverErrorInvalidChars = 0
    fromEnum FileSaverErrorExternallyModified = 1
    fromEnum (AnotherFileSaverError k) = k

    toEnum 0 = FileSaverErrorInvalidChars
    toEnum 1 = FileSaverErrorExternallyModified
    toEnum k = AnotherFileSaverError k

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

instance GErrorClass FileSaverError where
    gerrorClassDomain _ = "gtk-source-file-saver-error"

catchFileSaverError ::
    IO a ->
    (FileSaverError -> GErrorMessage -> IO a) ->
    IO a
catchFileSaverError = catchGErrorJustDomain

handleFileSaverError ::
    (FileSaverError -> GErrorMessage -> IO a) ->
    IO a ->
    IO a
handleFileSaverError = handleGErrorJustDomain

foreign import ccall "gtk_source_file_saver_error_get_type" c_gtk_source_file_saver_error_get_type :: 
    IO GType

instance BoxedEnum FileSaverError where
    boxedEnumType _ = c_gtk_source_file_saver_error_get_type

-- Enum FileLoaderError
{- |
An error code used with the @/GTK_SOURCE_FILE_LOADER_ERROR/@ domain.
-}
data FileLoaderError = 
      FileLoaderErrorTooBig
    {- ^
    The file is too big.
    -}
    | FileLoaderErrorEncodingAutoDetectionFailed
    {- ^
    It is not
    possible to detect the encoding automatically.
    -}
    | FileLoaderErrorConversionFallback
    {- ^
    There was an encoding
    conversion error and it was needed to use a fallback character.
    -}
    | AnotherFileLoaderError Int
    -- ^ Catch-all for unknown values
    deriving (Show, Eq)

instance P.Enum FileLoaderError where
    fromEnum FileLoaderErrorTooBig = 0
    fromEnum FileLoaderErrorEncodingAutoDetectionFailed = 1
    fromEnum FileLoaderErrorConversionFallback = 2
    fromEnum (AnotherFileLoaderError k) = k

    toEnum 0 = FileLoaderErrorTooBig
    toEnum 1 = FileLoaderErrorEncodingAutoDetectionFailed
    toEnum 2 = FileLoaderErrorConversionFallback
    toEnum k = AnotherFileLoaderError k

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

instance GErrorClass FileLoaderError where
    gerrorClassDomain _ = "gtk-source-file-loader-error"

catchFileLoaderError ::
    IO a ->
    (FileLoaderError -> GErrorMessage -> IO a) ->
    IO a
catchFileLoaderError = catchGErrorJustDomain

handleFileLoaderError ::
    (FileLoaderError -> GErrorMessage -> IO a) ->
    IO a ->
    IO a
handleFileLoaderError = handleGErrorJustDomain

foreign import ccall "gtk_source_file_loader_error_get_type" c_gtk_source_file_loader_error_get_type :: 
    IO GType

instance BoxedEnum FileLoaderError where
    boxedEnumType _ = c_gtk_source_file_loader_error_get_type

-- Enum CompressionType
{- |
/No description available in the introspection data./

@since 3.14
-}
data CompressionType = 
      CompressionTypeNone
    {- ^
    plain text.
    -}
    | CompressionTypeGzip
    {- ^
    gzip compression.
    -}
    | AnotherCompressionType Int
    -- ^ Catch-all for unknown values
    deriving (Show, Eq)

instance P.Enum CompressionType where
    fromEnum CompressionTypeNone = 0
    fromEnum CompressionTypeGzip = 1
    fromEnum (AnotherCompressionType k) = k

    toEnum 0 = CompressionTypeNone
    toEnum 1 = CompressionTypeGzip
    toEnum k = AnotherCompressionType k

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

foreign import ccall "gtk_source_compression_type_get_type" c_gtk_source_compression_type_get_type :: 
    IO GType

instance BoxedEnum CompressionType where
    boxedEnumType _ = c_gtk_source_compression_type_get_type

-- Enum CompletionError
{- |
An error code used with @/GTK_SOURCE_COMPLETION_ERROR/@ in a 'GError' returned
from a completion-related function.
-}
data CompletionError = 
      CompletionErrorAlreadyBound
    {- ^
    The 'GI.GtkSource.Interfaces.CompletionProvider.CompletionProvider'
    is already bound to the 'GI.GtkSource.Objects.Completion.Completion' object.
    -}
    | CompletionErrorNotBound
    {- ^
    The 'GI.GtkSource.Interfaces.CompletionProvider.CompletionProvider' is
    not bound to the 'GI.GtkSource.Objects.Completion.Completion' object.
    -}
    | AnotherCompletionError Int
    -- ^ Catch-all for unknown values
    deriving (Show, Eq)

instance P.Enum CompletionError where
    fromEnum CompletionErrorAlreadyBound = 0
    fromEnum CompletionErrorNotBound = 1
    fromEnum (AnotherCompletionError k) = k

    toEnum 0 = CompletionErrorAlreadyBound
    toEnum 1 = CompletionErrorNotBound
    toEnum k = AnotherCompletionError k

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

instance GErrorClass CompletionError where
    gerrorClassDomain _ = "gtk-source-completion-error-quark"

catchCompletionError ::
    IO a ->
    (CompletionError -> GErrorMessage -> IO a) ->
    IO a
catchCompletionError = catchGErrorJustDomain

handleCompletionError ::
    (CompletionError -> GErrorMessage -> IO a) ->
    IO a ->
    IO a
handleCompletionError = handleGErrorJustDomain

foreign import ccall "gtk_source_completion_error_get_type" c_gtk_source_completion_error_get_type :: 
    IO GType

instance BoxedEnum CompletionError where
    boxedEnumType _ = c_gtk_source_completion_error_get_type

-- Enum ChangeCaseType
{- |
/No description available in the introspection data./

@since 3.12
-}
data ChangeCaseType = 
      ChangeCaseTypeLower
    {- ^
    change case to lowercase.
    -}
    | ChangeCaseTypeUpper
    {- ^
    change case to uppercase.
    -}
    | ChangeCaseTypeToggle
    {- ^
    toggle case of each character.
    -}
    | ChangeCaseTypeTitle
    {- ^
    capitalize each word.
    -}
    | AnotherChangeCaseType Int
    -- ^ Catch-all for unknown values
    deriving (Show, Eq)

instance P.Enum ChangeCaseType where
    fromEnum ChangeCaseTypeLower = 0
    fromEnum ChangeCaseTypeUpper = 1
    fromEnum ChangeCaseTypeToggle = 2
    fromEnum ChangeCaseTypeTitle = 3
    fromEnum (AnotherChangeCaseType k) = k

    toEnum 0 = ChangeCaseTypeLower
    toEnum 1 = ChangeCaseTypeUpper
    toEnum 2 = ChangeCaseTypeToggle
    toEnum 3 = ChangeCaseTypeTitle
    toEnum k = AnotherChangeCaseType k

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

foreign import ccall "gtk_source_change_case_type_get_type" c_gtk_source_change_case_type_get_type :: 
    IO GType

instance BoxedEnum ChangeCaseType where
    boxedEnumType _ = c_gtk_source_change_case_type_get_type

-- Enum BracketMatchType
{- |
/No description available in the introspection data./
-}
data BracketMatchType = 
      BracketMatchTypeNone
    {- ^
    there is no bracket to match.
    -}
    | BracketMatchTypeOutOfRange
    {- ^
    matching a bracket
     failed because the maximum range was reached.
    -}
    | BracketMatchTypeNotFound
    {- ^
    a matching bracket was not found.
    -}
    | BracketMatchTypeFound
    {- ^
    a matching bracket was found.
    -}
    | AnotherBracketMatchType Int
    -- ^ Catch-all for unknown values
    deriving (Show, Eq)

instance P.Enum BracketMatchType where
    fromEnum BracketMatchTypeNone = 0
    fromEnum BracketMatchTypeOutOfRange = 1
    fromEnum BracketMatchTypeNotFound = 2
    fromEnum BracketMatchTypeFound = 3
    fromEnum (AnotherBracketMatchType k) = k

    toEnum 0 = BracketMatchTypeNone
    toEnum 1 = BracketMatchTypeOutOfRange
    toEnum 2 = BracketMatchTypeNotFound
    toEnum 3 = BracketMatchTypeFound
    toEnum k = AnotherBracketMatchType k

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

foreign import ccall "gtk_source_bracket_match_type_get_type" c_gtk_source_bracket_match_type_get_type :: 
    IO GType

instance BoxedEnum BracketMatchType where
    boxedEnumType _ = c_gtk_source_bracket_match_type_get_type

-- Enum BackgroundPatternType
{- |
/No description available in the introspection data./

@since 3.16
-}
data BackgroundPatternType = 
      BackgroundPatternTypeNone
    {- ^
    no pattern
    -}
    | BackgroundPatternTypeGrid
    {- ^
    grid pattern
    -}
    | AnotherBackgroundPatternType Int
    -- ^ Catch-all for unknown values
    deriving (Show, Eq)

instance P.Enum BackgroundPatternType where
    fromEnum BackgroundPatternTypeNone = 0
    fromEnum BackgroundPatternTypeGrid = 1
    fromEnum (AnotherBackgroundPatternType k) = k

    toEnum 0 = BackgroundPatternTypeNone
    toEnum 1 = BackgroundPatternTypeGrid
    toEnum k = AnotherBackgroundPatternType k

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

foreign import ccall "gtk_source_background_pattern_type_get_type" c_gtk_source_background_pattern_type_get_type :: 
    IO GType

instance BoxedEnum BackgroundPatternType where
    boxedEnumType _ = c_gtk_source_background_pattern_type_get_type