Go to the first, previous, next, last section, table of contents.
waitTrigger :: Trigger a -> IO a
-
get next trigger value for this Trigger.
combineTriggers :: [Trigger a] -> IO (Trigger a)
-
combineTriggers ls merges the triggers in ls into one, such
that a value that is signalled on one of the triggers in ls, is
signalled on the merged trigger. Useful to implement exclusive choice
with.
mapTrigger :: (a->b) -> Trigger a -> Trigger b
-
mapIOTrigger :: (a-> IO b) -> Trigger a -> Trigger b
-
mapTrigger f tr creates a new trigger that will signal
the transformed value of anything triggered by tr.
filterTrigger :: (a->Bool) -> Trigger a -> Trigger a
-
filterTrigger pred tr returns a new trigger that will filter the
output from tr, letting only through values that satisfy pred.
mapAccumlTrigger ::(a -> b -> (c,b))->b->Trigger a ->IO (Trigger c)
-
mapAccumlTrigger f v tr returns a new trigger that transforms the
output from tr using f and an accumulating parameter
(its initial state is v.)
onTriggerDo :: Trigger a -> (a -> IO b) -> Trigger b
-
onTriggerDo tr action returns a new trigger which returns the
value returned by action applied to the output of Trigger
tr.
cloneTrigger :: Trigger a -> IO a -> Trigger a
-
replace the get method for the Trigger with new one, but keep the
activate and enable actions of old Trigger intact.
setTriggerName :: String -> Trigger a -> Trigger a
-
setTriggerName nm tr returns a new trigger that with name nm.
getTriggerName :: Trigger a -> String
-
returns the trigger name, i.e.,
nm = getTriggerName (setTriggerName nm tr)
combineTriggers merges a list of triggers into one, and sometimes,
we want to be able to change the disabled/enabled state of just a
sub-trigger of this super-trigger, i.e., if we represent a menu using
a Trigger that has been formed by merging together the items in
the menu, it would be really useful if we could selectively changed
the interaction state of items via the menu trigger directly.
A trigger can be given a name using setTriggerName, which is used to
`guide' the enable/disable operations (see below.) To specify a path
through a hierarchy, a list of trigger names, called TriggerNames
is used. To illustrate, imagine we have built the following hierarchy
using combineTriggers and setTriggerName:
t1-+---t10
|
+---t11
|
+---t12
|
+---t13
|
+---t14
The TriggerName ["t11"] refers to the second trigger of
the combined triggers, so doing activateTrigger tr ["t11"] False
will disable this item. Similarly, activateTrigger tr ["t1"] False
matches Trigger with name t1 and everything underneath it.
isEnabledTrigger :: Trigger a -> TriggerId -> IO Bool
-
Query the interaction state of a (sub)trigger.
activateTrigger :: Trigger a -> TriggerId -> Bool -> IO ()
-
Inverse of the above, activateTrigger can be used to selectively
turn on and off triggers within a hierarchy:
activateTrigger tr [] False
disables the whole hierarchy.
enableTrigger, disableTrigger :: Trigger a -> IO ()
-
Convenience functions for activateTrigger tr [] True and
activateTrigger tr [] False, respectively.
Go to the first, previous, next, last section, table of contents.