2017-11-29 16:49:56 +00:00
|
|
|
module Affection.MessageBus.Message.WindowMessage where
|
|
|
|
|
|
|
|
import Affection.MessageBus.Message.Class
|
|
|
|
|
|
|
|
import Data.Word (Word32(..))
|
|
|
|
import Data.Int (Int32(..))
|
|
|
|
|
|
|
|
import qualified SDL
|
|
|
|
|
|
|
|
import Linear (V2(..))
|
|
|
|
|
2017-12-06 05:36:25 +00:00
|
|
|
data WindowMessage
|
2017-12-12 12:12:47 +00:00
|
|
|
-- = MsgEngineReady Word32
|
|
|
|
= MsgWindowShow
|
2017-11-29 16:49:56 +00:00
|
|
|
{ msgWSWhen :: Word32
|
|
|
|
, msgWSWindow :: SDL.Window
|
|
|
|
}
|
2017-12-12 12:12:47 +00:00
|
|
|
| MsgWindowHide
|
2017-11-29 16:49:56 +00:00
|
|
|
{ msgWHWhen :: Word32
|
|
|
|
, msgWHWindow :: SDL.Window
|
|
|
|
}
|
2017-12-12 12:12:47 +00:00
|
|
|
| MsgWindowExpose
|
2017-11-29 16:49:56 +00:00
|
|
|
{ msgWEWhen :: Word32
|
|
|
|
, msgWEWindow :: SDL.Window
|
|
|
|
}
|
2017-12-12 12:12:47 +00:00
|
|
|
| MsgWindowMove
|
2017-11-29 16:49:56 +00:00
|
|
|
{ msgWMWhen :: Word32
|
|
|
|
, msgWMWindow :: SDL.Window
|
|
|
|
, msgWMNewPos :: V2 Int32
|
|
|
|
}
|
2017-12-12 12:12:47 +00:00
|
|
|
| MsgWindowResize
|
2017-11-29 16:49:56 +00:00
|
|
|
{ msgWRWhen :: Word32
|
|
|
|
, msgWRWindow :: SDL.Window
|
|
|
|
, msgWRNewSize :: V2 Int32
|
|
|
|
}
|
2017-12-12 12:12:47 +00:00
|
|
|
| MsgWindowSizeChange
|
2017-11-29 16:49:56 +00:00
|
|
|
{ msgWSCWhen :: Word32
|
|
|
|
, msgWSCWindow :: SDL.Window
|
|
|
|
}
|
2017-12-12 12:12:47 +00:00
|
|
|
| MsgWindowMinimize
|
2017-11-29 16:49:56 +00:00
|
|
|
{ msgWMinWhen :: Word32
|
|
|
|
, msgWMinWindow :: SDL.Window
|
|
|
|
}
|
2017-12-12 12:12:47 +00:00
|
|
|
| MsgWindowMaximize
|
2017-11-29 16:49:56 +00:00
|
|
|
{ msgWMaxWhen :: Word32
|
|
|
|
, msgWMaxWindow :: SDL.Window
|
|
|
|
}
|
2017-12-12 12:12:47 +00:00
|
|
|
| MsgWindowRestore
|
2017-11-29 16:49:56 +00:00
|
|
|
{ msgWRestWhen :: Word32
|
|
|
|
, msgWRestWindow :: SDL.Window
|
|
|
|
}
|
2017-12-12 12:12:47 +00:00
|
|
|
| MsgWindowGainMouseFocus
|
2017-11-29 16:49:56 +00:00
|
|
|
{ msgWGMFWhen :: Word32
|
|
|
|
, msgWGMFWindow :: SDL.Window
|
|
|
|
}
|
2017-12-12 12:12:47 +00:00
|
|
|
| MsgWindowLoseMouseFocus
|
2017-11-29 16:49:56 +00:00
|
|
|
{ msgWLMFWhen :: Word32
|
|
|
|
, msgWLMFWindow :: SDL.Window
|
|
|
|
}
|
2017-12-12 12:12:47 +00:00
|
|
|
| MsgWindowGainKeyboardFocus
|
2017-11-29 16:49:56 +00:00
|
|
|
{ msgWGKFWhen :: Word32
|
|
|
|
, msgWGKFWindow :: SDL.Window
|
|
|
|
}
|
2017-12-12 12:12:47 +00:00
|
|
|
| MsgWindowLoseKeyboardFocus
|
2017-11-29 16:49:56 +00:00
|
|
|
{ msgWLKFWhen :: Word32
|
|
|
|
, msgWLKFWindow :: SDL.Window
|
|
|
|
}
|
2017-12-12 12:12:47 +00:00
|
|
|
| MsgWindowClose
|
2017-11-29 16:49:56 +00:00
|
|
|
{ msgWCWhen :: Word32
|
|
|
|
, msgWCWindow :: SDL.Window
|
|
|
|
}
|
2017-12-13 03:37:16 +00:00
|
|
|
deriving (Show)
|
2017-11-29 16:49:56 +00:00
|
|
|
|
2017-12-06 05:36:25 +00:00
|
|
|
instance Message WindowMessage where
|
2017-12-12 12:12:47 +00:00
|
|
|
-- msgTime (MsgEngineReady t) = t
|
|
|
|
msgTime (MsgWindowShow t _) = t
|
|
|
|
msgTime (MsgWindowHide t _) = t
|
|
|
|
msgTime (MsgWindowExpose t _) = t
|
|
|
|
msgTime (MsgWindowMove t _ _) = t
|
|
|
|
msgTime (MsgWindowResize t _ _) = t
|
|
|
|
msgTime (MsgWindowSizeChange t _) = t
|
|
|
|
msgTime (MsgWindowMinimize t _) = t
|
|
|
|
msgTime (MsgWindowMaximize t _) = t
|
|
|
|
msgTime (MsgWindowRestore t _) = t
|
|
|
|
msgTime (MsgWindowGainMouseFocus t _) = t
|
|
|
|
msgTime (MsgWindowLoseMouseFocus t _) = t
|
|
|
|
msgTime (MsgWindowGainKeyboardFocus t _) = t
|
|
|
|
msgTime (MsgWindowLoseKeyboardFocus t _) = t
|
|
|
|
msgTime (MsgWindowClose t _) = t
|