Add hotkeys

This commit is contained in:
hasufell 2014-10-01 03:37:27 +02:00
parent bef0c9afe8
commit b5a7b7d507
No known key found for this signature in database
GPG Key ID: 220CD1C5BDEED020
1 changed files with 13 additions and 0 deletions

13
Main.hs
View File

@ -1,3 +1,4 @@
import Control.Monad.IO.Class
import Diagram
import Diagrams.Prelude
import Diagrams.Backend.Cairo
@ -57,6 +58,18 @@ main = do
da
_ <- onClicked saveButton $ onClickedSaveButton fileButton
_ <- onClicked quitButton mainQuit
_ <- window `on` keyPressEvent $ tryEvent $ do
[Control] <- eventModifier
"q" <- eventKeyName
liftIO $ mainQuit
_ <- window `on` keyPressEvent $ tryEvent $ do
[Control] <- eventModifier
"s" <- eventKeyName
liftIO $ onClickedSaveButton fileButton
_ <- window `on` keyPressEvent $ tryEvent $ do
[Control] <- eventModifier
"d" <- eventKeyName
liftIO $ onClickedDrawButton fileButton da
-- draw widgets and start main loop
widgetShowAll window