AutoForms-0.5.0: GUI library based upon generic programming (SYB3)ContentsIndex
Graphics.UI.AF.WxForm.ComIO
Contents
ComIO
Component construction
Handle limits
Listener monad and signaling of change
ComAction manipulation
ComAction-creator functions
Listener transformer
Invocating the network
Observable class
Functions used to help construct Observable instances
Debug
Debug
Description
The ComIO type
Synopsis
io :: MonadIO m => IO a -> m a
type ComIO = ComActions IO IORef
guiComM :: (RefMonad builder ref, Show a, MonadIO builder) => AddGui builder com a -> IO EventID -> Maybe (a -> a -> Bool) -> a -> (a -> IO ()) -> Window w -> GUI -> builder (com a, GuiComHelper a)
data GuiComHelper a = GuiComHelper {
testInputParm' :: SetOn -> a -> IO ()
readGuiOnGetValParm' :: Eq a => IO a -> IO ()
}
type AddGui builder com a = forall w. Window w -> GUI -> ComIO a -> builder (com a)
tellUserOfIllegalValue :: String -> IO ()
type LimitIO a = Limit IO a
type OnChangeVarsIO = OnChangeVars IO IORef
type ListenerIO = Listener IORef IO
data Monad act => ComActions act ref a
setAppendValue :: RefMonad act ref => (a -> act x) -> ComActions act ref a -> ComActions act ref a
comActionsAddListener :: (RefMonad m ref, Monad act) => ComActions act ref a -> Listener ref act () -> m ()
setParentListener :: (RefMonad m ref, Monad act) => ComActions act ref a -> Listener ref act () -> m ()
mkComActions :: MkComActions act ref a
type MkComActions act ref a = RefMonad act ref => act a -> (a -> Listener ref act ()) -> OnChangeVars act ref -> act Bool -> (Bool -> act ()) -> (Limit act a -> act ()) -> ComActions act ref a
staticComActions :: (RefMonad act ref, RefMonad m ref, InterleaveMonad act) => a -> m (ComActions act ref a)
getterSetterComActions :: (RefMonad builder ref, RefMonad act ref, InterleaveMonad act, Monad act) => act a -> (a -> Listener ref act ()) -> builder (ComActions act ref a)
makeComProxy :: (RefMonad builder ref, RefMonad act ref) => ComActions act ref a -> builder (ComActions act ref a -> Listener ref act (), ComActions act ref a)
type Limit m a = a -> m LimitResult
type LimitRef m ref a = ref [Limit m a]
data LimitResult
= Rejected String
| Accepted
makeLimitVar :: (RefMonad m ref, RefMonad act ref) => m (LimitRef act ref a)
addToLimitVar :: RefMonad m ref => LimitRef m ref a -> Limit m a -> m ()
checkLimits :: (RefMonad m ref, Show a) => LimitRef m ref a -> a -> m LimitResult
data SetOn
= SetOnAccept
| SetOnReject
testInput :: (RefMonad act ref, Show a, Observable oc (Listener ref act)) => (String -> act ()) -> act EventID -> oc -> (a -> act ()) -> ref a -> LimitRef act ref a -> Maybe (a -> a -> Bool) -> SetOn -> a -> act ()
newtype RefMonad act ref => Listener ref act a = Listener {
listener' :: ListenerT EventID act a
}
data EventID
runListener :: RefMonad act ref => act EventID -> Listener ref act a -> act a
signalGuiChange :: (Observable o (Listener ref act), RefMonad act ref) => act EventID -> o -> act ()
runNoSignalingListener :: RefMonad act ref => Listener ref act a -> act a
data OnChangeVars act ref = OnChangeVars {
pickEventID :: ref EventID
pickListeners :: ref [Listener ref act ()]
pickParent :: ref (Listener ref act ())
}
makeOnChangeVar :: (Monad act, RefMonad m ref) => m (OnChangeVars act ref)
data ListenerT eid m a
class Monad m => MonadListener m where
postponeEvent :: m () -> m ()
eventIDFactory :: (Num n, RefMonad m r, RefMonad m2 r) => m2 (m n)
runListenerTWithFactory :: Monad m => m eid -> ListenerT eid m a -> m a
class MonadListener m => Observable o m where
whenNotVisited :: o -> m () -> m ()
visit :: o -> m ()
signalChange :: o -> m ()
whenNotVisitedHelper :: (Eq eid, Monad m) => (o -> ListenerT eid m eid) -> o -> ListenerT eid m () -> ListenerT eid m ()
visitHelper :: Monad m => (t -> eid -> m a) -> t -> ListenerT eid m a
signalChangeHelper :: Observable o t => (o -> t ()) -> o -> t ()
debugPrintEID :: Show eid => ListenerT eid IO ()
debugListenerPrintEID :: RefMonad IO ref => Listener ref IO ()
spliterToComActions :: forall act ref builder a. (InterleaveMonad act, RefMonad act ref, RefMonad builder ref) => Spliter act ref a a -> builder (ComActions act ref a)
data Spliter act ref a master
= Constructor a
| forall b . Part ComActions act ref b Getter master b Setter master b Spliter act ref (b -> a) master
Documentation
io :: MonadIO m => IO a -> m a
ComIO
type ComIO = ComActions IO IORef
Component construction
guiComM :: (RefMonad builder ref, Show a, MonadIO builder) => AddGui builder com a -> IO EventID -> Maybe (a -> a -> Bool) -> a -> (a -> IO ()) -> Window w -> GUI -> builder (com a, GuiComHelper a)
data GuiComHelper a
IO-commands helped in the construction of components. Is used by function that construct components via guiComM.
Constructors
GuiComHelper
testInputParm' :: SetOn -> a -> IO ()
readGuiOnGetValParm' :: Eq a => IO a -> IO ()
type AddGui builder com a = forall w. Window w -> GUI -> ComIO a -> builder (com a)
Handle limits
tellUserOfIllegalValue :: String -> IO ()
Use this function to tell the GUI-user that he violated some limit.
type LimitIO a = Limit IO a
Listener monad and signaling of change
type OnChangeVarsIO = OnChangeVars IO IORef
type ListenerIO = Listener IORef IO
ComAction manipulation
data Monad act => ComActions act ref a
Component actions
show/hide Instances
Valued ComIO
ValuedAction ComIO WxAct
TypeLift ComIO InnerEC
Able (ComIO a)
Observable (ComIO b) WxAct
(Monad act, InterleaveMonad act) => Valued (ComActions act ref)
RefMonad act ref => ValuedAction (ComActions act ref) (Listener ref act)
(Monad act, RefMonad act ref) => Observable (ComActions act ref a) (ListenerT EventID act)
RefMonad act ref => Observable (ComActions act ref b) (Listener ref act)
setAppendValue :: RefMonad act ref => (a -> act x) -> ComActions act ref a -> ComActions act ref a
comActionsAddListener :: (RefMonad m ref, Monad act) => ComActions act ref a -> Listener ref act () -> m ()
setParentListener :: (RefMonad m ref, Monad act) => ComActions act ref a -> Listener ref act () -> m ()
ComAction-creator functions
mkComActions :: MkComActions act ref a
Creates a ComActions object.
type MkComActions act ref a = RefMonad act ref => act a -> (a -> Listener ref act ()) -> OnChangeVars act ref -> act Bool -> (Bool -> act ()) -> (Limit act a -> act ()) -> ComActions act ref a
staticComActions :: (RefMonad act ref, RefMonad m ref, InterleaveMonad act) => a -> m (ComActions act ref a)
Returns a ComActions type, which just stores values when setVal is called and retrieves values when getVal is called. It should be used when no GUI can be created for a type.
getterSetterComActions :: (RefMonad builder ref, RefMonad act ref, InterleaveMonad act, Monad act) => act a -> (a -> Listener ref act ()) -> builder (ComActions act ref a)
Creates a ComActions object with custom getter/setter -functions.
makeComProxy :: (RefMonad builder ref, RefMonad act ref) => ComActions act ref a -> builder (ComActions act ref a -> Listener ref act (), ComActions act ref a)
Creates a ComAction proxy. That is, a ComAction which contains another ComAction. The contained ComAction can be updated by using the returned Listener action.
type Limit m a = a -> m LimitResult
type LimitRef m ref a = ref [Limit m a]
data LimitResult
Constructors
Rejected String
Accepted
makeLimitVar :: (RefMonad m ref, RefMonad act ref) => m (LimitRef act ref a)
Constructs a LimitRef with no limits in it.
addToLimitVar :: RefMonad m ref => LimitRef m ref a -> Limit m a -> m ()
Adds a limit to a LimitRef
checkLimits
:: (RefMonad m ref, Show a)
=> LimitRef m ref a
-> aThe new value
-> m LimitResultThe result of the limit check
Checks if a value violates any limit.
data SetOn
Constructors
SetOnAccept
SetOnReject
testInput :: (RefMonad act ref, Show a, Observable oc (Listener ref act)) => (String -> act ()) -> act EventID -> oc -> (a -> act ()) -> ref a -> LimitRef act ref a -> Maybe (a -> a -> Bool) -> SetOn -> a -> act ()
Tests input to see if it respects the limits attached to some object (the oc parameter below).
newtype RefMonad act ref => Listener ref act a
Listeners listens for signals send from Observable objects OnChangeVars and ComActions).
Constructors
Listener
listener' :: ListenerT EventID act a
show/hide Instances
MonadTrans (Listener ref)
Monad act => Monad (Listener ref act)
MonadIO act => MonadIO (Listener ref act)
Monad act => MonadListener (Listener ref act)
RefMonad act ref => Observable (OnChangeVars act ref) (Listener ref act)
RefMonad act ref => ValuedAction (ComActions act ref) (Listener ref act)
RefMonad act ref => Observable (ComActions act ref b) (Listener ref act)
data EventID
The event identification type used by ComActions and Listener.
show/hide Instances
runListener
:: RefMonad act ref
=> act EventIDThe event-id factory to use.
-> Listener ref act a
-> act a
Runs a listener using a specific event-id factory.
signalGuiChange :: (Observable o (Listener ref act), RefMonad act ref) => act EventID -> o -> act ()
Signals a change which occured in the GUI, such as the user changed some components value, a timer was triggered, a menu item were choosen by the user, ...
runNoSignalingListener :: RefMonad act ref => Listener ref act a -> act a
Used to bring action upto listener level (see WxHaskell.Valued instance) The listener is runned with noSignalEID. That means the event will not propagate though the network of listeners and observers.
data OnChangeVars act ref
Constructors
OnChangeVars
pickEventID :: ref EventID
pickListeners :: ref [Listener ref act ()]
pickParent :: ref (Listener ref act ())
show/hide Instances
Observable OnChangeVarsIO WxAct
RefMonad act ref => Observable (OnChangeVars act ref) (Listener ref act)
(Monad act, RefMonad act ref) => Observable (OnChangeVars act ref) (ListenerT EventID act)
makeOnChangeVar :: (Monad act, RefMonad m ref) => m (OnChangeVars act ref)
Constructs an OnChangeVar with no listeners.
Listener transformer
data ListenerT eid m a
show/hide Instances
MonadTrans (ListenerT eid)
Monad m => Monad (ListenerT eid m)
MonadIO m => MonadIO (ListenerT eid m)
Monad m => MonadListener (ListenerT eid m)
(Monad act, RefMonad act ref) => Observable (OnChangeVars act ref) (ListenerT EventID act)
(Monad act, RefMonad act ref) => Observable (ComActions act ref a) (ListenerT EventID act)
class Monad m => MonadListener m where
Methods
postponeEvent :: m () -> m ()
show/hide Instances
MonadListener WxAct
Monad m => MonadListener (ListenerT eid m)
Monad act => MonadListener (Listener ref act)
Invocating the network
eventIDFactory :: (Num n, RefMonad m r, RefMonad m2 r) => m2 (m n)
runListenerTWithFactory :: Monad m => m eid -> ListenerT eid m a -> m a
Observable class
class MonadListener m => Observable o m where
Methods
whenNotVisited
:: oObject to ask
-> m ()Monad to execute if the object has not been visited
-> m ()
visit :: o -> m ()
signalChange :: o -> m ()
show/hide Instances
Observable OnChangeVarsIO WxAct
Observable OnChangeVarsIO WxAct
Observable (ComIO b) WxAct
Observable (ComIO b) WxAct
RefMonad act ref => Observable (OnChangeVars act ref) (Listener ref act)
RefMonad act ref => Observable (OnChangeVars act ref) (Listener ref act)
(Monad act, RefMonad act ref) => Observable (OnChangeVars act ref) (ListenerT EventID act)
(Monad act, RefMonad act ref) => Observable (OnChangeVars act ref) (ListenerT EventID act)
(Monad act, RefMonad act ref) => Observable (ComActions act ref a) (ListenerT EventID act)
(Monad act, RefMonad act ref) => Observable (ComActions act ref a) (ListenerT EventID act)
RefMonad act ref => Observable (ComActions act ref b) (Listener ref act)
RefMonad act ref => Observable (ComActions act ref b) (Listener ref act)
Functions used to help construct Observable instances
whenNotVisitedHelper :: (Eq eid, Monad m) => (o -> ListenerT eid m eid) -> o -> ListenerT eid m () -> ListenerT eid m ()
visitHelper :: Monad m => (t -> eid -> m a) -> t -> ListenerT eid m a
signalChangeHelper :: Observable o t => (o -> t ()) -> o -> t ()
Debug
debugPrintEID :: Show eid => ListenerT eid IO ()
Debug
debugListenerPrintEID :: RefMonad IO ref => Listener ref IO ()
spliterToComActions :: forall act ref builder a. (InterleaveMonad act, RefMonad act ref, RefMonad builder ref) => Spliter act ref a a -> builder (ComActions act ref a)
Constructs a ComAction from a Spliter type.
data Spliter act ref a master
Contains ComActions, getters, and setters for each element in a product type.
Constructors
Constructor a
forall b . Part ComActions act ref b Getter master b Setter master b Spliter act ref (b -> a) master
Produced by Haddock version 2.0.0.0