Karya, built on 2018-05-31T02:46:59 (patch 0a1a35479c514820d77330ae8a978975ba22a47a)

Safe HaskellNone

Ui.Fltk

Description

This has the FLTK event thread, and communication with it.

Synopsis

Documentation

data Fltk a Source #

You should only talk to FLTK from the main thread, which is also the FLTK event thread. So to call a FLTK function, you have to put it on the UI Channel, where the FLTK thread will pick it up. This also serializes them, so I don't have to worry about concurrency at the Fltk layer. Since FLTK operations are wrapped in Fltk, and only this module can unwrap a Fltk, this should enforce that you can't cell them willy-nilly.

Instances
Monad Fltk # 
Instance details

Defined in Ui.Fltk

Methods

(>>=) :: Fltk a -> (a -> Fltk b) -> Fltk b #

(>>) :: Fltk a -> Fltk b -> Fltk b #

return :: a -> Fltk a #

fail :: String -> Fltk a #

Functor Fltk # 
Instance details

Defined in Ui.Fltk

Methods

fmap :: (a -> b) -> Fltk a -> Fltk b #

(<$) :: a -> Fltk b -> Fltk a #

Applicative.Applicative Fltk # 
Instance details

Defined in Ui.Fltk

Methods

pure :: a -> Fltk a #

(<*>) :: Fltk (a -> b) -> Fltk a -> Fltk b #

liftA2 :: (a -> b -> c) -> Fltk a -> Fltk b -> Fltk c #

(*>) :: Fltk a -> Fltk b -> Fltk b #

(<*) :: Fltk a -> Fltk b -> Fltk a #

MonadIO Fltk # 
Instance details

Defined in Ui.Fltk

Methods

liftIO :: IO a -> Fltk a #

fltk :: IO a -> Fltk a Source #

type Channel = MVar.MVar [(Fltk (), Text)] Source #

Channel to communicate with the FLTK event loop. Yes it's not a real channel, but I want to get all actions in one go, and an MVar is suitable for that.

event_loop :: Channel -> QuitRequest -> TChan UiMsg.UiMsg -> IO () Source #

Run the FLTK event loop thread, passing it a channel that produces msgs, and go into the UI polling loop. This is intended to be run from the main thread, since some UIs don't work properly unless run from the main thread. When the app exits, the ui loop will be aborted.

send_action :: Channel -> Text -> Fltk () -> IO () Source #

Send the UI to the ui thread and run it, returning its result.

quit_ui_thread :: QuitRequest -> IO () Source #