{-# LINE 2 "./Graphics/UI/Gtk/SourceView/Enums.chs" #-}
-- -*-haskell-*-
-- GIMP Toolkit (GTK) Widget Enums
--
-- Author : Andy Stewart
--
-- Created: 08 Aug 2010
--
-- Copyright (C) 2010 Andy Stewart
--
-- This library is free software; you can redistribute it and/or
-- modify it under the terms of the GNU Lesser General Public
-- License as published by the Free Software Foundation; either
-- version 2.1 of the License, or (at your option) any later version.
--
-- This library is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- Lesser General Public License for more details.
--
-- |
-- Maintainer : gtk2hs-users@lists.sourceforge.net
-- Stability : provisional
-- Portability : portable (depends on GHC)
--
module Graphics.UI.Gtk.SourceView.Enums (
-- * Enums
   SourceCompletionActivation (..),
   SourceSearchFlags (..),
   SourceSmartHomeEndType (..),
   SourceDrawSpacesFlags (..),
   SourceViewGutterPosition (..)
) where

import Control.Monad (liftM)

import System.Glib.FFI
import System.Glib.Flags


{-# LINE 41 "./Graphics/UI/Gtk/SourceView/Enums.chs" #-}

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"

{-# LINE 43 "./Graphics/UI/Gtk/SourceView/Enums.chs" #-}

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"

{-# LINE 45 "./Graphics/UI/Gtk/SourceView/Enums.chs" #-}

instance Flags SourceSearchFlags

data SourceSmartHomeEndType = SourceSmartHomeEndDisabled
                            | SourceSmartHomeEndBefore
                            | SourceSmartHomeEndAfter
                            | SourceSmartHomeEndAlways
                            deriving (Enum,Eq,Bounded,Show,Read)

{-# LINE 49 "./Graphics/UI/Gtk/SourceView/Enums.chs" #-}

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"

{-# LINE 51 "./Graphics/UI/Gtk/SourceView/Enums.chs" #-}

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"

{-# LINE 55 "./Graphics/UI/Gtk/SourceView/Enums.chs" #-}