module System.Terminal.Emulator.KeyboardInput
( KeyboardState (..),
initialKeyboardState,
KeyPress (..),
KeyModifiers (..),
SpecialKey (..),
)
where
data KeyboardState = KeyboardState
{ KeyboardState -> Bool
keyboardState_DECCKM :: !Bool,
KeyboardState -> Bool
keyboardState_Locked :: !Bool,
KeyboardState -> Bool
keyboardState_CRLF :: !Bool
}
deriving (Int -> KeyboardState -> ShowS
[KeyboardState] -> ShowS
KeyboardState -> String
(Int -> KeyboardState -> ShowS)
-> (KeyboardState -> String)
-> ([KeyboardState] -> ShowS)
-> Show KeyboardState
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [KeyboardState] -> ShowS
$cshowList :: [KeyboardState] -> ShowS
show :: KeyboardState -> String
$cshow :: KeyboardState -> String
showsPrec :: Int -> KeyboardState -> ShowS
$cshowsPrec :: Int -> KeyboardState -> ShowS
Show, KeyboardState -> KeyboardState -> Bool
(KeyboardState -> KeyboardState -> Bool)
-> (KeyboardState -> KeyboardState -> Bool) -> Eq KeyboardState
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: KeyboardState -> KeyboardState -> Bool
$c/= :: KeyboardState -> KeyboardState -> Bool
== :: KeyboardState -> KeyboardState -> Bool
$c== :: KeyboardState -> KeyboardState -> Bool
Eq, Eq KeyboardState
Eq KeyboardState
-> (KeyboardState -> KeyboardState -> Ordering)
-> (KeyboardState -> KeyboardState -> Bool)
-> (KeyboardState -> KeyboardState -> Bool)
-> (KeyboardState -> KeyboardState -> Bool)
-> (KeyboardState -> KeyboardState -> Bool)
-> (KeyboardState -> KeyboardState -> KeyboardState)
-> (KeyboardState -> KeyboardState -> KeyboardState)
-> Ord KeyboardState
KeyboardState -> KeyboardState -> Bool
KeyboardState -> KeyboardState -> Ordering
KeyboardState -> KeyboardState -> KeyboardState
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: KeyboardState -> KeyboardState -> KeyboardState
$cmin :: KeyboardState -> KeyboardState -> KeyboardState
max :: KeyboardState -> KeyboardState -> KeyboardState
$cmax :: KeyboardState -> KeyboardState -> KeyboardState
>= :: KeyboardState -> KeyboardState -> Bool
$c>= :: KeyboardState -> KeyboardState -> Bool
> :: KeyboardState -> KeyboardState -> Bool
$c> :: KeyboardState -> KeyboardState -> Bool
<= :: KeyboardState -> KeyboardState -> Bool
$c<= :: KeyboardState -> KeyboardState -> Bool
< :: KeyboardState -> KeyboardState -> Bool
$c< :: KeyboardState -> KeyboardState -> Bool
compare :: KeyboardState -> KeyboardState -> Ordering
$ccompare :: KeyboardState -> KeyboardState -> Ordering
$cp1Ord :: Eq KeyboardState
Ord)
initialKeyboardState :: KeyboardState
initialKeyboardState :: KeyboardState
initialKeyboardState =
KeyboardState :: Bool -> Bool -> Bool -> KeyboardState
KeyboardState
{ keyboardState_DECCKM :: Bool
keyboardState_DECCKM = Bool
False,
keyboardState_Locked :: Bool
keyboardState_Locked = Bool
False,
keyboardState_CRLF :: Bool
keyboardState_CRLF = Bool
False
}
data KeyPress
=
KeyPress_Char !Char !KeyModifiers
|
KeyPress_SpecialKey !SpecialKey !KeyModifiers
deriving (KeyPress -> KeyPress -> Bool
(KeyPress -> KeyPress -> Bool)
-> (KeyPress -> KeyPress -> Bool) -> Eq KeyPress
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: KeyPress -> KeyPress -> Bool
$c/= :: KeyPress -> KeyPress -> Bool
== :: KeyPress -> KeyPress -> Bool
$c== :: KeyPress -> KeyPress -> Bool
Eq, Eq KeyPress
Eq KeyPress
-> (KeyPress -> KeyPress -> Ordering)
-> (KeyPress -> KeyPress -> Bool)
-> (KeyPress -> KeyPress -> Bool)
-> (KeyPress -> KeyPress -> Bool)
-> (KeyPress -> KeyPress -> Bool)
-> (KeyPress -> KeyPress -> KeyPress)
-> (KeyPress -> KeyPress -> KeyPress)
-> Ord KeyPress
KeyPress -> KeyPress -> Bool
KeyPress -> KeyPress -> Ordering
KeyPress -> KeyPress -> KeyPress
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: KeyPress -> KeyPress -> KeyPress
$cmin :: KeyPress -> KeyPress -> KeyPress
max :: KeyPress -> KeyPress -> KeyPress
$cmax :: KeyPress -> KeyPress -> KeyPress
>= :: KeyPress -> KeyPress -> Bool
$c>= :: KeyPress -> KeyPress -> Bool
> :: KeyPress -> KeyPress -> Bool
$c> :: KeyPress -> KeyPress -> Bool
<= :: KeyPress -> KeyPress -> Bool
$c<= :: KeyPress -> KeyPress -> Bool
< :: KeyPress -> KeyPress -> Bool
$c< :: KeyPress -> KeyPress -> Bool
compare :: KeyPress -> KeyPress -> Ordering
$ccompare :: KeyPress -> KeyPress -> Ordering
$cp1Ord :: Eq KeyPress
Ord, Int -> KeyPress -> ShowS
[KeyPress] -> ShowS
KeyPress -> String
(Int -> KeyPress -> ShowS)
-> (KeyPress -> String) -> ([KeyPress] -> ShowS) -> Show KeyPress
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [KeyPress] -> ShowS
$cshowList :: [KeyPress] -> ShowS
show :: KeyPress -> String
$cshow :: KeyPress -> String
showsPrec :: Int -> KeyPress -> ShowS
$cshowsPrec :: Int -> KeyPress -> ShowS
Show)
data KeyModifiers = KeyModifiers
{ KeyModifiers -> Bool
shift :: !Bool,
KeyModifiers -> Bool
ctrl :: !Bool,
KeyModifiers -> Bool
alt :: !Bool,
KeyModifiers -> Bool
capsLock :: !Bool
}
deriving (KeyModifiers -> KeyModifiers -> Bool
(KeyModifiers -> KeyModifiers -> Bool)
-> (KeyModifiers -> KeyModifiers -> Bool) -> Eq KeyModifiers
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: KeyModifiers -> KeyModifiers -> Bool
$c/= :: KeyModifiers -> KeyModifiers -> Bool
== :: KeyModifiers -> KeyModifiers -> Bool
$c== :: KeyModifiers -> KeyModifiers -> Bool
Eq, Eq KeyModifiers
Eq KeyModifiers
-> (KeyModifiers -> KeyModifiers -> Ordering)
-> (KeyModifiers -> KeyModifiers -> Bool)
-> (KeyModifiers -> KeyModifiers -> Bool)
-> (KeyModifiers -> KeyModifiers -> Bool)
-> (KeyModifiers -> KeyModifiers -> Bool)
-> (KeyModifiers -> KeyModifiers -> KeyModifiers)
-> (KeyModifiers -> KeyModifiers -> KeyModifiers)
-> Ord KeyModifiers
KeyModifiers -> KeyModifiers -> Bool
KeyModifiers -> KeyModifiers -> Ordering
KeyModifiers -> KeyModifiers -> KeyModifiers
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: KeyModifiers -> KeyModifiers -> KeyModifiers
$cmin :: KeyModifiers -> KeyModifiers -> KeyModifiers
max :: KeyModifiers -> KeyModifiers -> KeyModifiers
$cmax :: KeyModifiers -> KeyModifiers -> KeyModifiers
>= :: KeyModifiers -> KeyModifiers -> Bool
$c>= :: KeyModifiers -> KeyModifiers -> Bool
> :: KeyModifiers -> KeyModifiers -> Bool
$c> :: KeyModifiers -> KeyModifiers -> Bool
<= :: KeyModifiers -> KeyModifiers -> Bool
$c<= :: KeyModifiers -> KeyModifiers -> Bool
< :: KeyModifiers -> KeyModifiers -> Bool
$c< :: KeyModifiers -> KeyModifiers -> Bool
compare :: KeyModifiers -> KeyModifiers -> Ordering
$ccompare :: KeyModifiers -> KeyModifiers -> Ordering
$cp1Ord :: Eq KeyModifiers
Ord, Int -> KeyModifiers -> ShowS
[KeyModifiers] -> ShowS
KeyModifiers -> String
(Int -> KeyModifiers -> ShowS)
-> (KeyModifiers -> String)
-> ([KeyModifiers] -> ShowS)
-> Show KeyModifiers
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [KeyModifiers] -> ShowS
$cshowList :: [KeyModifiers] -> ShowS
show :: KeyModifiers -> String
$cshow :: KeyModifiers -> String
showsPrec :: Int -> KeyModifiers -> ShowS
$cshowsPrec :: Int -> KeyModifiers -> ShowS
Show)
data SpecialKey
= SpecialKey_Escape
| SpecialKey_F1
| SpecialKey_F2
| SpecialKey_F3
| SpecialKey_F4
| SpecialKey_F5
| SpecialKey_F6
| SpecialKey_F7
| SpecialKey_F8
| SpecialKey_F9
| SpecialKey_F10
| SpecialKey_F11
| SpecialKey_F12
| SpecialKey_Insert
| SpecialKey_Delete
| SpecialKey_Home
| SpecialKey_End
| SpecialKey_PageUp
| SpecialKey_PageDown
| SpecialKey_Tab
| SpecialKey_Enter
| SpecialKey_Backspace
| SpecialKey_ArrowLeft
| SpecialKey_ArrowRight
| SpecialKey_ArrowUp
| SpecialKey_ArrowDown
deriving (SpecialKey -> SpecialKey -> Bool
(SpecialKey -> SpecialKey -> Bool)
-> (SpecialKey -> SpecialKey -> Bool) -> Eq SpecialKey
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SpecialKey -> SpecialKey -> Bool
$c/= :: SpecialKey -> SpecialKey -> Bool
== :: SpecialKey -> SpecialKey -> Bool
$c== :: SpecialKey -> SpecialKey -> Bool
Eq, Eq SpecialKey
Eq SpecialKey
-> (SpecialKey -> SpecialKey -> Ordering)
-> (SpecialKey -> SpecialKey -> Bool)
-> (SpecialKey -> SpecialKey -> Bool)
-> (SpecialKey -> SpecialKey -> Bool)
-> (SpecialKey -> SpecialKey -> Bool)
-> (SpecialKey -> SpecialKey -> SpecialKey)
-> (SpecialKey -> SpecialKey -> SpecialKey)
-> Ord SpecialKey
SpecialKey -> SpecialKey -> Bool
SpecialKey -> SpecialKey -> Ordering
SpecialKey -> SpecialKey -> SpecialKey
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: SpecialKey -> SpecialKey -> SpecialKey
$cmin :: SpecialKey -> SpecialKey -> SpecialKey
max :: SpecialKey -> SpecialKey -> SpecialKey
$cmax :: SpecialKey -> SpecialKey -> SpecialKey
>= :: SpecialKey -> SpecialKey -> Bool
$c>= :: SpecialKey -> SpecialKey -> Bool
> :: SpecialKey -> SpecialKey -> Bool
$c> :: SpecialKey -> SpecialKey -> Bool
<= :: SpecialKey -> SpecialKey -> Bool
$c<= :: SpecialKey -> SpecialKey -> Bool
< :: SpecialKey -> SpecialKey -> Bool
$c< :: SpecialKey -> SpecialKey -> Bool
compare :: SpecialKey -> SpecialKey -> Ordering
$ccompare :: SpecialKey -> SpecialKey -> Ordering
$cp1Ord :: Eq SpecialKey
Ord, Int -> SpecialKey -> ShowS
[SpecialKey] -> ShowS
SpecialKey -> String
(Int -> SpecialKey -> ShowS)
-> (SpecialKey -> String)
-> ([SpecialKey] -> ShowS)
-> Show SpecialKey
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SpecialKey] -> ShowS
$cshowList :: [SpecialKey] -> ShowS
show :: SpecialKey -> String
$cshow :: SpecialKey -> String
showsPrec :: Int -> SpecialKey -> ShowS
$cshowsPrec :: Int -> SpecialKey -> ShowS
Show)