AutoForms-0.5.0: GUI library based upon generic programming (SYB3)ContentsIndex
Graphics.UI.AF.General.AutoForm
Contents
Creating windows
Components
Component constructors
Valueless components
State
Mapping the component type
Value
Actions
Setting/getting value of component
Presentation of component
Misc
Synopsis
class TypePresentation a action comH builder satCxt com where
mkCom :: (AutoForm action comH builder satCxt com, Sat (satCxt a)) => a -> com a
class Monad m => SimpleDialog m where
errorDialog :: String -> String -> m ()
infoDialog :: String -> String -> m ()
confirmDialog :: String -> String -> Bool -> m Bool
infoDialog :: SimpleDialog m => String -> String -> m ()
errorDialog :: SimpleDialog m => String -> String -> m ()
confirmDialog :: SimpleDialog m => String -> String -> Bool -> m Bool
window :: AutoForm action comH builder satCxt com => com a -> action ()
addCom :: AutoForm action comH builder satCxt com => com a -> builder (comH a)
mkCom :: (TypePresentation a action comH builder satCxt com, AutoForm action comH builder satCxt com, Sat (satCxt a)) => a -> com a
defaultCom :: (AutoForm action comH builder satCxt com, Sat (satCxt a)) => a -> com a
builderToCom :: AutoForm action comH builder satCxt com => builder (comH a) -> com a
builderCom :: (Sat (satCxt a), AutoForm action comH builder satCxt com, TypePresentation a action comH builder satCxt com) => a -> builder (comH a)
button :: AutoForm action comH builder satCxt com => String -> action () -> builder (comH ())
addTimer :: AutoForm action comH builder satCxt com => Int -> action () -> builder ()
class (Monad m, Monad action) => Process m action | m -> action where
executeProcess :: String -> ExitCode -> action () -> String -> action () -> String -> action () -> m ()
executeProcess :: Process m action => String -> ExitCode -> action () -> String -> action () -> String -> action () -> m ()
state :: AutoForm action comH builder satCxt com => s -> builder (comH s)
makeChangedState :: (Eq a, AutoForm action comH builder satCxt com) => comH a -> builder (comH (Changed a))
data Changed a
= Changed
| Unchanged a
class Valued valued where
mapValue :: old -> new -> old -> new -> old -> valued old -> valued new
fstValue :: valued (valFst, valSnd) -> valued valFst
sndValue :: valued (valFst, valSnd) -> valued valSnd
noValue :: valued a -> valued ()
mapValue :: Valued valued => old -> new -> old -> new -> old -> valued old -> valued new
fstValue :: Valued valued => valued (valFst, valSnd) -> valued valFst
sndValue :: Valued valued => valued (valFst, valSnd) -> valued valSnd
noValue :: Valued valued => valued a -> valued ()
class Mergeable valued where
merge :: valued left -> valued right -> valued (left, right)
postponeAction :: AutoForm action comH builder satCxt com => action a -> builder ()
class Monad action => Action action comH | action -> comH, comH -> action where
setEnabled :: comH a -> Bool -> action ()
closeWindow :: action ()
giveFocus :: comH a -> action ()
setEnabled :: Action action comH => comH a -> Bool -> action ()
closeWindow :: Action action comH => action ()
giveFocus :: Action action comH => comH a -> action ()
class Monad action => ValuedAction valued action where
getValue :: valued a -> action a
setValue :: valued a -> a -> action ()
nonRecursiveSetValue :: valued a -> a -> action ()
appendValue :: Monoid a => valued a -> a -> action ()
modifyValue :: ValuedAction valued action => valued a -> (a -> a) -> action ()
limit :: (AutoForm action comH builder satCxt com, Show a) => a -> IO Bool -> String -> com a -> com a
label :: AutoForm action comH builder satCxt com => String -> com a -> com a
class (Action action comH, Valued com, Valued comH, ValuedAction comH action, SimpleDialog action, SimpleDialog builder) => AutoForm action comH builder satCxt com | action -> comH, comH -> builder, builder -> satCxt, satCxt -> com, com -> action where
defaultCom :: Sat (satCxt a) => a -> com a
builderToCom :: builder (comH a) -> com a
addCom :: com a -> builder (comH a)
state :: s -> builder (comH s)
postponeAction :: action a -> builder ()
button :: String -> action () -> builder (comH ())
addTimer :: Int -> action () -> builder ()
limit :: Show a => a -> IO Bool -> String -> com a -> com a
label :: String -> com a -> com a
addListener :: action () -> comH a -> builder (comH a)
command :: (Sat (satCxt a), Sat (satCxt [String])) => builder () -> com a -> a -> IO String -> IO ()
window :: com a -> action ()
commandImpl :: (AutoForm action comH builder satCxt com, MonadIO action, Sat (satCxt a), Sat (satCxt [String])) => com a -> a -> IO String -> builder ()
command :: (AutoForm action comH builder satCxt com, Sat (satCxt a), Sat (satCxt [String])) => builder () -> com a -> a -> IO String -> IO ()
addListener :: AutoForm action comH builder satCxt com => action () -> comH a -> builder (comH a)
Documentation
class TypePresentation a action comH builder satCxt com where
Instantiate this class if you want to specialize behavior for some type.
Methods
mkCom :: (AutoForm action comH builder satCxt com, Sat (satCxt a)) => a -> com a
Constructs a component. The default implementation just calls defaultCom. Override this if you want other behaviour.
show/hide Instances
AutoForm action comH builder satCxt com => TypePresentation AFFilePath action comH builder satCxt com
AutoForm action comH builder satCxt com => TypePresentation AFDirectoryPath action comH builder satCxt com
class Monad m => SimpleDialog m where
The methods of this class shows simple dialogs. E.g. dialogs which do not take a component as input.
Methods
errorDialog
:: StringTitle
-> StringMessage
-> m ()
infoDialog
:: StringTitle
-> StringMessage
-> m ()
confirmDialog
:: StringTitle
-> StringMessage
-> BoolShould the dialog defalut to true or to false
-> m Bool
show/hide Instances
Creating windows
infoDialog
:: SimpleDialog m
=> StringTitle
-> StringMessage
-> m ()
errorDialog
:: SimpleDialog m
=> StringTitle
-> StringMessage
-> m ()
confirmDialog
:: SimpleDialog m
=> StringTitle
-> StringMessage
-> BoolShould the dialog defalut to true or to false
-> m Bool
window :: AutoForm action comH builder satCxt com => com a -> action ()
Constructs a new non-modal window.
Components
addCom :: AutoForm action comH builder satCxt com => com a -> builder (comH a)
Encapsulates (or adds) a component in the builder monad.
Component constructors
mkCom :: (TypePresentation a action comH builder satCxt com, AutoForm action comH builder satCxt com, Sat (satCxt a)) => a -> com a
Constructs a component. The default implementation just calls defaultCom. Override this if you want other behaviour.
defaultCom :: (AutoForm action comH builder satCxt com, Sat (satCxt a)) => a -> com a
Makes a default component. That is, it do not call mkCom.
builderToCom :: AutoForm action comH builder satCxt com => builder (comH a) -> com a
Takes all components encapsulated in (added to) a builder monad and packages them in a component.
builderCom :: (Sat (satCxt a), AutoForm action comH builder satCxt com, TypePresentation a action comH builder satCxt com) => a -> builder (comH a)
Adds any value to AutoForm interface. The following equation holds: builderCom x = addCom $ mkCom x
Valueless components
button
:: AutoForm action comH builder satCxt com
=> StringThe name displayed on the button
-> action ()The action to execute when the button is pressed
-> builder (comH ())
Creates a button component.
addTimer
:: AutoForm action comH builder satCxt com
=> IntNumber of miliseconds between execution of the aciton
-> action ()The action to execute repeatedly
-> builder ()
Creates an action which is repeatedly executed
class (Monad m, Monad action) => Process m action | m -> action where
Methods
executeProcess
:: StringThe command to execute, including parameters
-> ExitCode -> action ()Action executed when the process ends
-> String -> action ()Action executed when input is recieved on standard input
-> String -> action ()Action executed when input is recieved on standard error
-> m ()
Executes an external process, using the OS build-in command shell.
show/hide Instances
executeProcess
:: Process m action
=> StringThe command to execute, including parameters
-> ExitCode -> action ()Action executed when the process ends
-> String -> action ()Action executed when input is recieved on standard input
-> String -> action ()Action executed when input is recieved on standard error
-> m ()
Executes an external process, using the OS build-in command shell.
State
state :: AutoForm action comH builder satCxt com => s -> builder (comH s)
Creates a component solely containing some state. It has no visual representation.
makeChangedState :: (Eq a, AutoForm action comH builder satCxt com) => comH a -> builder (comH (Changed a))
Makes a state, which reflects whether a components value has changed.
data Changed a
Constructors
Changed
Unchanged a
show/hide Instances
Eq a => Eq (Changed a)
Show a => Show (Changed a)
Mapping the component type
These functions do not change the GUI-user sees the components - only how the programmer sees them. E.g. they change state and/or value, not presentation.
Value
class Valued valued where
Methods
mapValue
::
=> old -> newold to new conversion
-> old -> new -> oldnew to old conversions. This functions also get the current old value as input.
-> valued oldold component
-> valued newnew component
Maps the value of a compoent
fstValue :: valued (valFst, valSnd) -> valued valFst
Hides the second part of a 2-tuple
sndValue :: valued (valFst, valSnd) -> valued valSnd
Hides the first part of a 2-tuple
noValue :: valued a -> valued ()
Hides the value of a valued object.
show/hide Instances
Valued EC
Valued Com
Valued Com'
(Monad act, InterleaveMonad act) => Valued (ComActions act ref)
mapValue
:: Valued valued
=> old -> newold to new conversion
-> old -> new -> oldnew to old conversions. This functions also get the current old value as input.
-> valued oldold component
-> valued newnew component
Maps the value of a compoent
fstValue :: Valued valued => valued (valFst, valSnd) -> valued valFst
Hides the second part of a 2-tuple
sndValue :: Valued valued => valued (valFst, valSnd) -> valued valSnd
Hides the first part of a 2-tuple
noValue :: Valued valued => valued a -> valued ()
Hides the value of a valued object.
class Mergeable valued where
Methods
merge :: valued left -> valued right -> valued (left, right)
Currently unused. So do not use it.
show/hide Instances
Actions
postponeAction :: AutoForm action comH builder satCxt com => action a -> builder ()
class Monad action => Action action comH | action -> comH, comH -> action where
Methods
setEnabled :: comH a -> Bool -> action ()
Sets whether the component is enabled. That is, if the user can change it's value or in case of buttons if it can be pressed.
closeWindow :: action ()
Closes the window this action is attached to.
giveFocus :: comH a -> action ()
Will give this compoment focus
show/hide Instances
setEnabled :: Action action comH => comH a -> Bool -> action ()
Sets whether the component is enabled. That is, if the user can change it's value or in case of buttons if it can be pressed.
closeWindow :: Action action comH => action ()
Closes the window this action is attached to.
giveFocus :: Action action comH => comH a -> action ()
Will give this compoment focus
Setting/getting value of component
class Monad action => ValuedAction valued action where

Actions which manipules or retrieves a value.

When using setValue the value of a component is alwyas set, whereas using nonRecursiveSetValue the value is only set if the component has not previously been visited in the event cycle. To understand this better see the RecursiveUpdates (http://autoforms.svn.sourceforge.net/viewvc/autoforms/trunk/AForms/src/Examples/Misc/RecursiveUpdates.hs?view=log) example and the Control.Monad.RecursiveObserver module.

Methods
getValue :: valued a -> action a
setValue :: valued a -> a -> action ()
nonRecursiveSetValue :: valued a -> a -> action ()
appendValue :: Monoid a => valued a -> a -> action ()
show/hide Instances
ValuedAction ComIO WxAct
ValuedAction ComIO WxAct
ValuedAction InnerEC WxAct
ValuedAction Com' IO
RefMonad act ref => ValuedAction (ComActions act ref) (Listener ref act)
RefMonad act ref => ValuedAction (ComActions act ref) (Listener ref act)
modifyValue :: ValuedAction valued action => valued a -> (a -> a) -> action ()
Updates the value of a component
Presentation of component
limit
:: (AutoForm action comH builder satCxt com, Show a)
=> a -> IO BoolThe limit.
-> StringError message displayed to the GUI-user, if the limit is violated.
-> com a
-> com a
Limits the values a GUI-user can set a component to.
label
:: AutoForm action comH builder satCxt com
=> StringThe label.
-> com a
-> com a
Labels a component. This label will usually be displayed to the GUI-user.
Misc
class (Action action comH, Valued com, Valued comH, ValuedAction comH action, SimpleDialog action, SimpleDialog builder) => AutoForm action comH builder satCxt com | action -> comH, comH -> builder, builder -> satCxt, satCxt -> com, com -> action where
Methods
defaultCom :: Sat (satCxt a) => a -> com a
Makes a default component. That is, it do not call mkCom.
builderToCom :: builder (comH a) -> com a
Takes all components encapsulated in (added to) a builder monad and packages them in a component.
addCom :: com a -> builder (comH a)
Encapsulates (or adds) a component in the builder monad.
state :: s -> builder (comH s)
Creates a component solely containing some state. It has no visual representation.
postponeAction :: action a -> builder ()
button
:: StringThe name displayed on the button
-> action ()The action to execute when the button is pressed
-> builder (comH ())
Creates a button component.
addTimer
:: IntNumber of miliseconds between execution of the aciton
-> action ()The action to execute repeatedly
-> builder ()
Creates an action which is repeatedly executed
limit
:: Show a
=> a -> IO BoolThe limit.
-> StringError message displayed to the GUI-user, if the limit is violated.
-> com a
-> com a
Limits the values a GUI-user can set a component to.
label
::
=> StringThe label.
-> com a
-> com a
Labels a component. This label will usually be displayed to the GUI-user.
addListener :: action () -> comH a -> builder (comH a)
Attaches an action to a component. The action is executed each time the component changes value.
command
:: (Sat (satCxt a), Sat (satCxt [String]))
=> builder ()Not used in WxForm, just a proxy to identify AutoForm instance
-> com aThe component the user edits before executing the command. It's value is the input to the action/command to execute.
-> a -> IO StringCommand to execute
-> IO ()
Creates a window, solely used to execute a command.
window :: com a -> action ()
Constructs a new non-modal window.
show/hide Instances
commandImpl
:: (AutoForm action comH builder satCxt com, MonadIO action, Sat (satCxt a), Sat (satCxt [String]))
=> com a
-> a -> IO StringCommand to execute
-> builder ()
command
:: (AutoForm action comH builder satCxt com, Sat (satCxt a), Sat (satCxt [String]))
=> builder ()Not used in WxForm, just a proxy to identify AutoForm instance
-> com aThe component the user edits before executing the command. It's value is the input to the action/command to execute.
-> a -> IO StringCommand to execute
-> IO ()
Creates a window, solely used to execute a command.
addListener :: AutoForm action comH builder satCxt com => action () -> comH a -> builder (comH a)
Attaches an action to a component. The action is executed each time the component changes value.
Produced by Haddock version 2.0.0.0