{- |
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.Vte.Enums
    ( 
    catchPtyError                           ,
    handlePtyError                          ,

-- * Exported types
    WriteFlags(..)                          ,
    PtyError(..)                            ,
    EraseBinding(..)                        ,
    CursorShape(..)                         ,
    CursorBlinkMode(..)                     ,


    ) where

import Prelude ()
import Data.GI.Base.ShortPrelude

import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map




-- Enum WriteFlags

data WriteFlags = 
      WriteFlagsDefault
    | AnotherWriteFlags Int
    deriving (Show, Eq)

instance Enum WriteFlags where
    fromEnum WriteFlagsDefault = 0
    fromEnum (AnotherWriteFlags k) = k

    toEnum 0 = WriteFlagsDefault
    toEnum k = AnotherWriteFlags k

foreign import ccall "vte_write_flags_get_type" c_vte_write_flags_get_type :: 
    IO GType

instance BoxedEnum WriteFlags where
    boxedEnumType _ = c_vte_write_flags_get_type

-- Enum PtyError

data PtyError = 
      PtyErrorPtyHelperFailed
    | PtyErrorPty98Failed
    | AnotherPtyError Int
    deriving (Show, Eq)

instance Enum PtyError where
    fromEnum PtyErrorPtyHelperFailed = 0
    fromEnum PtyErrorPty98Failed = 1
    fromEnum (AnotherPtyError k) = k

    toEnum 0 = PtyErrorPtyHelperFailed
    toEnum 1 = PtyErrorPty98Failed
    toEnum k = AnotherPtyError k

instance GErrorClass PtyError where
    gerrorClassDomain _ = "vte-pty-error"

catchPtyError ::
    IO a ->
    (PtyError -> GErrorMessage -> IO a) ->
    IO a
catchPtyError = catchGErrorJustDomain

handlePtyError ::
    (PtyError -> GErrorMessage -> IO a) ->
    IO a ->
    IO a
handlePtyError = handleGErrorJustDomain

foreign import ccall "vte_pty_error_get_type" c_vte_pty_error_get_type :: 
    IO GType

instance BoxedEnum PtyError where
    boxedEnumType _ = c_vte_pty_error_get_type

-- Enum EraseBinding

data EraseBinding = 
      EraseBindingAuto
    | EraseBindingAsciiBackspace
    | EraseBindingAsciiDelete
    | EraseBindingDeleteSequence
    | EraseBindingTty
    | AnotherEraseBinding Int
    deriving (Show, Eq)

instance Enum EraseBinding where
    fromEnum EraseBindingAuto = 0
    fromEnum EraseBindingAsciiBackspace = 1
    fromEnum EraseBindingAsciiDelete = 2
    fromEnum EraseBindingDeleteSequence = 3
    fromEnum EraseBindingTty = 4
    fromEnum (AnotherEraseBinding k) = k

    toEnum 0 = EraseBindingAuto
    toEnum 1 = EraseBindingAsciiBackspace
    toEnum 2 = EraseBindingAsciiDelete
    toEnum 3 = EraseBindingDeleteSequence
    toEnum 4 = EraseBindingTty
    toEnum k = AnotherEraseBinding k

foreign import ccall "vte_erase_binding_get_type" c_vte_erase_binding_get_type :: 
    IO GType

instance BoxedEnum EraseBinding where
    boxedEnumType _ = c_vte_erase_binding_get_type

-- Enum CursorShape

data CursorShape = 
      CursorShapeBlock
    | CursorShapeIbeam
    | CursorShapeUnderline
    | AnotherCursorShape Int
    deriving (Show, Eq)

instance Enum CursorShape where
    fromEnum CursorShapeBlock = 0
    fromEnum CursorShapeIbeam = 1
    fromEnum CursorShapeUnderline = 2
    fromEnum (AnotherCursorShape k) = k

    toEnum 0 = CursorShapeBlock
    toEnum 1 = CursorShapeIbeam
    toEnum 2 = CursorShapeUnderline
    toEnum k = AnotherCursorShape k

foreign import ccall "vte_cursor_shape_get_type" c_vte_cursor_shape_get_type :: 
    IO GType

instance BoxedEnum CursorShape where
    boxedEnumType _ = c_vte_cursor_shape_get_type

-- Enum CursorBlinkMode

data CursorBlinkMode = 
      CursorBlinkModeSystem
    | CursorBlinkModeOn
    | CursorBlinkModeOff
    | AnotherCursorBlinkMode Int
    deriving (Show, Eq)

instance Enum CursorBlinkMode where
    fromEnum CursorBlinkModeSystem = 0
    fromEnum CursorBlinkModeOn = 1
    fromEnum CursorBlinkModeOff = 2
    fromEnum (AnotherCursorBlinkMode k) = k

    toEnum 0 = CursorBlinkModeSystem
    toEnum 1 = CursorBlinkModeOn
    toEnum 2 = CursorBlinkModeOff
    toEnum k = AnotherCursorBlinkMode k

foreign import ccall "vte_cursor_blink_mode_get_type" c_vte_cursor_blink_mode_get_type :: 
    IO GType

instance BoxedEnum CursorBlinkMode where
    boxedEnumType _ = c_vte_cursor_blink_mode_get_type