monomer-1.5.0.0: A GUI library for writing native Haskell applications.
Copyright(c) 2018 Francisco Vallarino
LicenseBSD-3-Clause (see the LICENSE file)
Maintainerfjvallarino@gmail.com
Stabilityexperimental
Portabilitynon-portable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Monomer.Widgets.Util.Style

Description

Helper functions for style related operations.

Synopsis

Documentation

collectStyleField Source #

Arguments

:: 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.

collectStyleField_ Source #

Arguments

:: 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.

initNodeStyle Source #

Arguments

:: 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.

handleStyleChange Source #

Arguments

:: 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.

childOfFocusedStyle Source #

Arguments

:: 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 # 
Instance details

Methods

def :: CurrentStyleCfg s e #