module Graphics.UI.Gtk.SourceView.Enums (
SourceCompletionActivation (..),
SourceSearchFlags (..),
SourceSmartHomeEndType (..),
SourceDrawSpacesFlags (..),
SourceViewGutterPosition (..)
) where
import Control.Monad (liftM)
import System.Glib.FFI
import System.Glib.Flags
data SourceCompletionActivation = SourceCompletionActivationNone
| SourceCompletionActivationInteractive
| SourceCompletionActivationUserRequested
deriving (Eq,Bounded,Show,Read)
instance Enum SourceCompletionActivation where
fromEnum SourceCompletionActivationNone = 0
fromEnum SourceCompletionActivationInteractive = 1
fromEnum SourceCompletionActivationUserRequested = 2
toEnum 0 = SourceCompletionActivationNone
toEnum 1 = SourceCompletionActivationInteractive
toEnum 2 = SourceCompletionActivationUserRequested
toEnum unmatched = error ("SourceCompletionActivation.toEnum: Cannot match " ++ show unmatched)
succ SourceCompletionActivationNone = SourceCompletionActivationInteractive
succ SourceCompletionActivationInteractive = SourceCompletionActivationUserRequested
succ _ = undefined
pred SourceCompletionActivationInteractive = SourceCompletionActivationNone
pred SourceCompletionActivationUserRequested = SourceCompletionActivationInteractive
pred _ = undefined
enumFromTo x y | fromEnum x == fromEnum y = [ y ]
| otherwise = x : enumFromTo (succ x) y
enumFrom x = enumFromTo x SourceCompletionActivationUserRequested
enumFromThen _ _ = error "Enum SourceCompletionActivation: enumFromThen not implemented"
enumFromThenTo _ _ _ = error "Enum SourceCompletionActivation: enumFromThenTo not implemented"
data SourceSearchFlags = SourceSearchVisibleOnly
| SourceSearchTextOnly
| SourceSearchCaseInsensitive
deriving (Eq,Bounded,Show,Read)
instance Enum SourceSearchFlags where
fromEnum SourceSearchVisibleOnly = 1
fromEnum SourceSearchTextOnly = 2
fromEnum SourceSearchCaseInsensitive = 4
toEnum 1 = SourceSearchVisibleOnly
toEnum 2 = SourceSearchTextOnly
toEnum 4 = SourceSearchCaseInsensitive
toEnum unmatched = error ("SourceSearchFlags.toEnum: Cannot match " ++ show unmatched)
succ SourceSearchVisibleOnly = SourceSearchTextOnly
succ SourceSearchTextOnly = SourceSearchCaseInsensitive
succ _ = undefined
pred SourceSearchTextOnly = SourceSearchVisibleOnly
pred SourceSearchCaseInsensitive = SourceSearchTextOnly
pred _ = undefined
enumFromTo x y | fromEnum x == fromEnum y = [ y ]
| otherwise = x : enumFromTo (succ x) y
enumFrom x = enumFromTo x SourceSearchCaseInsensitive
enumFromThen _ _ = error "Enum SourceSearchFlags: enumFromThen not implemented"
enumFromThenTo _ _ _ = error "Enum SourceSearchFlags: enumFromThenTo not implemented"
instance Flags SourceSearchFlags
data SourceSmartHomeEndType = SourceSmartHomeEndDisabled
| SourceSmartHomeEndBefore
| SourceSmartHomeEndAfter
| SourceSmartHomeEndAlways
deriving (Enum,Eq,Bounded,Show,Read)
data SourceDrawSpacesFlags = SourceDrawSpacesSpace
| SourceDrawSpacesTab
| SourceDrawSpacesNewline
| SourceDrawSpacesNbsp
| SourceDrawSpacesLeading
| SourceDrawSpacesText
| SourceDrawSpacesTrailing
| SourceDrawSpacesAll
deriving (Eq,Bounded,Show,Read)
instance Enum SourceDrawSpacesFlags where
fromEnum SourceDrawSpacesSpace = 1
fromEnum SourceDrawSpacesTab = 2
fromEnum SourceDrawSpacesNewline = 4
fromEnum SourceDrawSpacesNbsp = 8
fromEnum SourceDrawSpacesLeading = 16
fromEnum SourceDrawSpacesText = 32
fromEnum SourceDrawSpacesTrailing = 64
fromEnum SourceDrawSpacesAll = 127
toEnum 1 = SourceDrawSpacesSpace
toEnum 2 = SourceDrawSpacesTab
toEnum 4 = SourceDrawSpacesNewline
toEnum 8 = SourceDrawSpacesNbsp
toEnum 16 = SourceDrawSpacesLeading
toEnum 32 = SourceDrawSpacesText
toEnum 64 = SourceDrawSpacesTrailing
toEnum 127 = SourceDrawSpacesAll
toEnum unmatched = error ("SourceDrawSpacesFlags.toEnum: Cannot match " ++ show unmatched)
succ SourceDrawSpacesSpace = SourceDrawSpacesTab
succ SourceDrawSpacesTab = SourceDrawSpacesNewline
succ SourceDrawSpacesNewline = SourceDrawSpacesNbsp
succ SourceDrawSpacesNbsp = SourceDrawSpacesLeading
succ SourceDrawSpacesLeading = SourceDrawSpacesText
succ SourceDrawSpacesText = SourceDrawSpacesTrailing
succ SourceDrawSpacesTrailing = SourceDrawSpacesAll
succ _ = undefined
pred SourceDrawSpacesTab = SourceDrawSpacesSpace
pred SourceDrawSpacesNewline = SourceDrawSpacesTab
pred SourceDrawSpacesNbsp = SourceDrawSpacesNewline
pred SourceDrawSpacesLeading = SourceDrawSpacesNbsp
pred SourceDrawSpacesText = SourceDrawSpacesLeading
pred SourceDrawSpacesTrailing = SourceDrawSpacesText
pred SourceDrawSpacesAll = SourceDrawSpacesTrailing
pred _ = undefined
enumFromTo x y | fromEnum x == fromEnum y = [ y ]
| otherwise = x : enumFromTo (succ x) y
enumFrom x = enumFromTo x SourceDrawSpacesAll
enumFromThen _ _ = error "Enum SourceDrawSpacesFlags: enumFromThen not implemented"
enumFromThenTo _ _ _ = error "Enum SourceDrawSpacesFlags: enumFromThenTo not implemented"
instance Flags SourceDrawSpacesFlags
data SourceViewGutterPosition = SourceViewGutterPositionLines
| SourceViewGutterPositionMarks
deriving (Eq,Bounded,Show,Read)
instance Enum SourceViewGutterPosition where
fromEnum SourceViewGutterPositionLines = (30)
fromEnum SourceViewGutterPositionMarks = (20)
toEnum (30) = SourceViewGutterPositionLines
toEnum (20) = SourceViewGutterPositionMarks
toEnum unmatched = error ("SourceViewGutterPosition.toEnum: Cannot match " ++ show unmatched)
succ SourceViewGutterPositionLines = SourceViewGutterPositionMarks
succ _ = undefined
pred SourceViewGutterPositionMarks = SourceViewGutterPositionLines
pred _ = undefined
enumFromTo x y | fromEnum x == fromEnum y = [ y ]
| otherwise = x : enumFromTo (succ x) y
enumFrom x = enumFromTo x SourceViewGutterPositionMarks
enumFromThen _ _ = error "Enum SourceViewGutterPosition: enumFromThen not implemented"
enumFromThenTo _ _ _ = error "Enum SourceViewGutterPosition: enumFromThenTo not implemented"