never executed always true always false
    1 {-|
    2 Module: Flaw.Window
    3 Description: General Window framework.
    4 License: MIT
    5 -}
    6 
    7 {-# LANGUAGE GADTs, TypeFamilies #-}
    8 
    9 module Flaw.Window
   10   ( Window(..)
   11   , WindowEvent(..)
   12   , MouseCursor(..)
   13   ) where
   14 
   15 import Control.Concurrent.STM
   16 import qualified Data.Text as T
   17 
   18 -- | Class of window.
   19 class Window w where
   20   -- | Set title of the window.
   21   setWindowTitle :: w -> T.Text -> IO ()
   22   -- | Get window client size.
   23   getWindowClientSize :: w -> IO (Int, Int)
   24   -- | Get chan of window messages.
   25   chanWindowEvents :: w -> STM (TChan WindowEvent)
   26 
   27   -- Clipboard functions.
   28   -- | Get clipboard contents as a text.
   29   getWindowClipboardText :: w -> IO T.Text
   30   -- | Set text as a content of clipboard.
   31   setWindowClipboardText :: w -> T.Text -> IO ()
   32 
   33   -- | Set mouse cursor.
   34   setWindowMouseCursor :: w -> MouseCursor -> IO ()
   35   -- | Set mouse lock mode.
   36   setWindowMouseLock :: w -> Bool -> IO ()
   37 
   38 data WindowEvent
   39   -- | User is trying to close window.
   40   = CloseWindowEvent
   41   -- | Window is destroyed.
   42   | DestroyWindowEvent
   43   -- | Window is resized.
   44   | ResizeWindowEvent !Int !Int
   45   -- | Window is activated or deactivated.
   46   | ActivateWindowEvent !Bool
   47 
   48 data MouseCursor
   49   = MouseCursorArrow
   50   | MouseCursorWait
   51   | MouseCursorWaitArrow
   52   | MouseCursorIBeam
   53   | MouseCursorSizeNWSE
   54   | MouseCursorSizeNESW
   55   | MouseCursorSizeWE
   56   | MouseCursorSizeNS
   57   | MouseCursorSizeAll
   58   | MouseCursorHand
   59   deriving (Eq, Bounded, Enum)