Copyright | (c) 2018 Francisco Vallarino |
---|---|
License | BSD-3-Clause (see the LICENSE file) |
Maintainer | fjvallarino@gmail.com |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
Helper functions for style related operations.
Synopsis
- collectStyleField :: Lens' StyleState (Maybe t) -> Style -> Style
- collectStyleField_ :: Lens' StyleState (Maybe t) -> Style -> Style -> Style
- currentTheme :: WidgetEnv s e -> WidgetNode s e -> ThemeState
- currentTheme_ :: IsHovered s e -> WidgetEnv s e -> WidgetNode s e -> ThemeState
- currentStyle :: WidgetEnv s e -> WidgetNode s e -> StyleState
- currentStyle_ :: CurrentStyleCfg s e -> WidgetEnv s e -> WidgetNode s e -> StyleState
- focusedStyle :: WidgetEnv s e -> WidgetNode s e -> StyleState
- styleStateChanged :: WidgetEnv s e -> WidgetNode s e -> SystemEvent -> Bool
- initNodeStyle :: GetBaseStyle s e -> WidgetEnv s e -> WidgetNode s e -> WidgetNode s e
- mergeBasicStyle :: Style -> Style
- handleStyleChange :: WidgetEnv s e -> Path -> StyleState -> Bool -> WidgetNode s e -> SystemEvent -> Maybe (WidgetResult s e) -> Maybe (WidgetResult s e)
- childOfFocusedStyle :: WidgetEnv s e -> WidgetNode s e -> StyleState
Documentation
:: Lens' StyleState (Maybe t) | The field into the state. |
-> Style | The source style. |
-> Style | The new style. |
Extracts/copies the field of a style into an empty style.
:: Lens' StyleState (Maybe t) | The field into the state. |
-> Style | The source style. |
-> Style | The target style. |
-> Style | The updated style. |
Extracts/copies the field of a style into a provided style.
currentTheme :: WidgetEnv s e -> WidgetNode s e -> ThemeState Source #
Returns the current theme for the node.
currentTheme_ :: IsHovered s e -> WidgetEnv s e -> WidgetNode s e -> ThemeState Source #
Returns the current theme for the node.
currentStyle :: WidgetEnv s e -> WidgetNode s e -> StyleState Source #
Returns the current style state for the given node.
currentStyle_ :: CurrentStyleCfg s e -> WidgetEnv s e -> WidgetNode s e -> StyleState Source #
Returns the current style state for the given node, using the provided functions to determine hover, focus and active status.
focusedStyle :: WidgetEnv s e -> WidgetNode s e -> StyleState Source #
Returns the correct focused style, depending if it's hovered or not.
styleStateChanged :: WidgetEnv s e -> WidgetNode s e -> SystemEvent -> Bool Source #
Checks if hover or focus states changed between versions of the node.
:: GetBaseStyle s e | The function to get the base style. |
-> WidgetEnv s e | The widget environment. |
-> WidgetNode s e | The widget node. |
-> WidgetNode s e | The updated widget node. |
Initializes the node style states. Mainly, it uses basic as the base of all the other styles.
mergeBasicStyle :: Style -> Style Source #
Uses the basic style state as the base for all the other style states.
:: WidgetEnv s e | The widget environment. |
-> Path | The target of the event. |
-> StyleState | The active style. |
-> Bool | Whether to check/update the cursor. |
-> WidgetNode s e | The old node. |
-> SystemEvent | The event. |
-> Maybe (WidgetResult s e) | The result containing the new node. |
-> Maybe (WidgetResult s e) | The updated result. |
Checks for style changes between the old node and the provided result, in the context of an event. Generates requests for resize, render and cursor change as necessary.
:: WidgetEnv s e | The widget environment. |
-> WidgetNode s e | The embedded child node. |
-> StyleState | The currently active state. |
Replacement of currentStyle for child widgets embedded in a focusable parent. It selects the correct style state according to the situation.
Used, for example, in Monomer.Widgets.Singles.Button and Monomer.Widgets.Singles.ExternalLink, which are focusable but have an embedded label. Since label is not focusable, that style would not be handled correctly.
Orphan instances
Default (CurrentStyleCfg s e) Source # | |
def :: CurrentStyleCfg s e # |