PriLabels are labels with a priority.
PriLabels are usefull when widgets can have their label set multiple times. This happens with genericcally created widgets. For example in:
data Foo = Foo { someName :: Bar } data Bar = Bar Int
widgets created from Bar instances can have labels set due it's constructor name and the fieldName in Foo (someName). A GUI application programmer may also set the widgets label.
When a widget has set it's label multiple times, the priority can be used to decide which label should be chosen.
- data PriLabel = PriLabel {}
- data Priority
- = BadConstr
- | GoodConstr
- | FieldName
- | UserDefined
- badConstrLabel :: String -> PriLabel
- goodConstrLabel :: String -> PriLabel
- fieldNameLabel :: String -> PriLabel
- userDefinedLabel :: String -> PriLabel
- bestLabel :: PriLabel -> PriLabel -> PriLabel
- humanizeLabel :: PriLabel -> PriLabel
- defaultLabel :: String -> PriLabel
- labelless :: PriLabel
Documentation
Prioritized label. If two PriLabel
can be used for some
component, then the one with highest priority is used.
The label priority.
bestLabel :: PriLabel -> PriLabel -> PriLabelSource
Choose label with highest priority. If equal then choose the left |(first parameter) label.
humanizeLabel :: PriLabel -> PriLabelSource
Humanized label strings, by turning labels like someLabelName into Some label name.
defaultLabel :: String -> PriLabelSource
Creates a default (lowest priority) PriLabel