-- Copyright 2016 Evan Laforge
-- This program is distributed under the terms of the GNU General Public
-- License 3.0, see COPYING or http://www.gnu.org/licenses/gpl-3.0.txt

{-# OPTIONS_GHC -fno-warn-unused-matches #-}
-- | Like "Ui.BlockCStub" for "Ui.Ui".
module Ui.FltkStub (
    Fltk, fltk, Channel, event_loop, send_action, quit_ui_thread
) where
import qualified Control.Concurrent.MVar as MVar
import qualified Control.Concurrent.STM as STM

import qualified Ui.UiMsg as UiMsg

import           Global


newtype Fltk a = Fltk (IO a)
    deriving (Functor Fltk
forall a. a -> Fltk a
forall a b. Fltk a -> Fltk b -> Fltk a
forall a b. Fltk a -> Fltk b -> Fltk b
forall a b. Fltk (a -> b) -> Fltk a -> Fltk b
forall a b c. (a -> b -> c) -> Fltk a -> Fltk b -> Fltk c
forall (f :: * -> *).
Functor f
-> (forall a. a -> f a)
-> (forall a b. f (a -> b) -> f a -> f b)
-> (forall a b c. (a -> b -> c) -> f a -> f b -> f c)
-> (forall a b. f a -> f b -> f b)
-> (forall a b. f a -> f b -> f a)
-> Applicative f
<* :: forall a b. Fltk a -> Fltk b -> Fltk a
$c<* :: forall a b. Fltk a -> Fltk b -> Fltk a
*> :: forall a b. Fltk a -> Fltk b -> Fltk b
$c*> :: forall a b. Fltk a -> Fltk b -> Fltk b
liftA2 :: forall a b c. (a -> b -> c) -> Fltk a -> Fltk b -> Fltk c
$cliftA2 :: forall a b c. (a -> b -> c) -> Fltk a -> Fltk b -> Fltk c
<*> :: forall a b. Fltk (a -> b) -> Fltk a -> Fltk b
$c<*> :: forall a b. Fltk (a -> b) -> Fltk a -> Fltk b
pure :: forall a. a -> Fltk a
$cpure :: forall a. a -> Fltk a
Applicative, forall a b. a -> Fltk b -> Fltk a
forall a b. (a -> b) -> Fltk a -> Fltk b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: forall a b. a -> Fltk b -> Fltk a
$c<$ :: forall a b. a -> Fltk b -> Fltk a
fmap :: forall a b. (a -> b) -> Fltk a -> Fltk b
$cfmap :: forall a b. (a -> b) -> Fltk a -> Fltk b
Functor, Applicative Fltk
forall a. a -> Fltk a
forall a b. Fltk a -> Fltk b -> Fltk b
forall a b. Fltk a -> (a -> Fltk b) -> Fltk b
forall (m :: * -> *).
Applicative m
-> (forall a b. m a -> (a -> m b) -> m b)
-> (forall a b. m a -> m b -> m b)
-> (forall a. a -> m a)
-> Monad m
return :: forall a. a -> Fltk a
$creturn :: forall a. a -> Fltk a
>> :: forall a b. Fltk a -> Fltk b -> Fltk b
$c>> :: forall a b. Fltk a -> Fltk b -> Fltk b
>>= :: forall a b. Fltk a -> (a -> Fltk b) -> Fltk b
$c>>= :: forall a b. Fltk a -> (a -> Fltk b) -> Fltk b
Monad, Monad Fltk
forall a. IO a -> Fltk a
forall (m :: * -> *).
Monad m -> (forall a. IO a -> m a) -> MonadIO m
liftIO :: forall a. IO a -> Fltk a
$cliftIO :: forall a. IO a -> Fltk a
MonadIO)

fltk :: IO a -> Fltk a
fltk :: forall a. IO a -> Fltk a
fltk = forall a. IO a -> Fltk a
Fltk

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

type QuitRequest = MVar.MVar ()

event_loop :: Channel -> QuitRequest -> STM.TChan UiMsg.UiMsg -> IO ()
event_loop :: Channel -> QuitRequest -> TChan UiMsg -> IO ()
event_loop Channel
ui_chan QuitRequest
quit_request TChan UiMsg
msg_chan = forall (m :: * -> *) a. Monad m => a -> m a
return ()

send_action :: Channel -> Text -> Fltk () -> IO ()
send_action :: Channel -> Text -> Fltk () -> IO ()
send_action Channel
ui_chan Text
description Fltk ()
act = forall (m :: * -> *) a. Monad m => a -> m a
return ()

quit_ui_thread :: QuitRequest -> IO ()
quit_ui_thread :: QuitRequest -> IO ()
quit_ui_thread QuitRequest
quit_request = forall (m :: * -> *) a. Monad m => a -> m a
return ()