Go to the first, previous, next, last section, table of contents.

Gauge operators

* getGauge :: Gauge a -> IO a
sample the current value of the Gauge.

* waitGauge :: Gauge a -> IO a
wait until the next time the Gauge changes state.

* waitGaugeChange :: Gauge a -> IO (a,Bool)
wait until the Gauge value `moves', the boolean flag returned with the value indicate whether the change in Gauge value is transitory (False) or the Gauge has completed the transition from previous state and has come to a stop.

* setGauge :: Gauge a -> a -> IO ()
set new current value for a Gauge device.

* changeGauge :: Gauge a -> a -> IO ()
set new value for a Gauge device, but indicate that the Gauge is still in flux, and further changes in value can be expected before the Slider comes to a rest. This operation is useful to indicate dragging actions.

* combineGauges :: [Gauge a] -> IO (Gauge [a])
combineGauges ls merges a set of gauges into one, such that when a change in value is reported on any of the combined Gauges, the combined gauge will report a new value.

* mapGauge atob btoa gauge
* mapIOGauge atobIO btoaIO gauge

mapGauge :: (a->b) -> (b->a) -> Gauge a -> Gauge b
mapIOGauge :: (a-> IO b) -> (b-> IO a) -> Gauge a -> Gauge b

mapGauge f tr creates a new Gauge that transforms values reported on an existing Gauge. For setGauge on the Gauge handle to have effect on the Gauge being `mapped' from, a function for transforming values from the `new' domain back to the `old' is also needed.

* filterGauge pred gauge
* filterIOGauge pred gauge

filterGauge   :: ((a,Bool) ->    Bool) -> Gauge a -> Gauge a
filterIOGauge :: ((a,Bool) -> IO Bool) -> Gauge a -> Gauge a

filterGauge returns a new Gauge handle that will only report values output on gauge that satisfy pred.
* setGaugeName :: String -> Gauge a -> Gauge a
setGaugeName nm tr returns a new Gauge handle with name nm.
* getGaugeName :: Gauge a -> String
returns the Gauge's name.

 nm = getGaugeName (setGaugeName nm tr)

combineGauges merges a list of gauges into one, and sometimes, we want to be able to change the disabled/enabled state of one of these combined gauges via this super-gauge, i.e., if we represent a multiple choice group using a Gauge and combineGauges, it would be really useful if we could selectively changed the enabled/disabled state of the items via the choice group gauge directly.

To achieve exactly this, a Gauge can be given a name using the setGaugeName above, which is used to `guide' the enable/disable operations (see below.) To specify a path through a hierarchy, a list of gauge names, called GaugeNames is used. To illustrate, imagine we have built the following hierarchy using combineGauges and setGaugeName:


  t1-+---t10
     |
     +---t11
     |
     +---t12
     |
     +---t13
     |
     +---t14

The GaugeName ["t11"] refers to the second gauge of the combined gauges, so doing activateGauge tr ["t11"] False will disable this item. Similarly, activateGauge tr ["t1"] False matches Gauge with name t1 and everything underneath it.

* isEnabledGauge :: Gauge a -> GaugeId -> IO Bool
Query the interaction state of a (sub)gauge.
* activateGauge :: Gauge a -> GaugeId -> Bool -> IO ()
Inverse of the above, activateGauge can be used to selectively turn on and off gauges within a hierarchy:

activateGauge tr [] False

disables the whole hierarchy.
* enableGauge, disableGauge :: Gauge a -> IO ()
Convenience functions for activateGauge tr [] True and activateGauge tr [] False, respectively.

Go to the first, previous, next, last section, table of contents.