----------------------------------------------------------------------------
-- |
-- Module      :  Main
-- Copyright   :  (c) Don Stewart 2008
-- License     :  BSD3-style (see LICENSE)
--
-- Maintainer  :  dons@galois.com
-- Stability   :  unstable
--
-- A simple test pattern display program, useful for callibrating
-- projectors before talks.
--
-----------------------------------------------------------------------------

import Graphics.UI.Gtk
import Paths_testpattern
import System.FilePath
import Control.Concurrent

main :: IO ()
main = do
  initGUI
  window <- windowNew
  path   <- getDataDir
  image  <- imageNewFromFile (path </> "test-pattern-1024x768.png")
  set window [ containerBorderWidth := 0
             , containerChild       := image
             , windowTitle          := "Test Pattern"
             ]

  onDestroy window mainQuit
  onKeyPress window (\k -> case k of Key {eventKeyChar = Just 'q'} -> do mainQuit; return True
                                     _ -> return False)

  widgetShowAll window
  mainGUI
