monomer-1.4.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 HaskellNone
LanguageHaskell2010

Monomer.Widgets.Util.Focus

Description

Helper functions for focus handling.

Synopsis

Documentation

isNodeFocused :: WidgetEnv s e -> WidgetNode s e -> Bool Source #

Checks if the given node is focused.

isNodeInfoFocused :: WidgetEnv s e -> WidgetNodeInfo -> Bool Source #

Checks if the given nodeInfo is focused.

isNodeParentOfFocused :: WidgetEnv s e -> WidgetNode s e -> Bool Source #

Checks if the given node is a parent of the focused node.

parentPath :: WidgetNode s e -> Path Source #

Returns the parent path of a node.

nextTargetStep :: WidgetNode s e -> Path -> Maybe PathStep Source #

Returns the index of the child matching the next step implied by target.

isFocusCandidate :: WidgetNode s e -> Path -> FocusDirection -> Bool Source #

Checks if the node is a candidate for next focus in the given direction. The node must be focusable, enabled and visible, plus having the correct position considering the direction.

isTargetReached :: WidgetNode s e -> Path -> Bool Source #

Checks if the node's path matches the target.

isTargetValid :: WidgetNode s e -> Path -> Bool Source #

Checks if the node has a child matching the next target step.

isNodeParentOfPath :: WidgetNode s e -> Path -> Bool Source #

Checks if the node is parent of the provided path.

isNodeBeforePath :: WidgetNode s e -> Path -> Bool Source #

Checks if the node's path is after the target (higher or to the left).

isNodeAfterPath :: WidgetNode s e -> Path -> Bool Source #

Checks if the node's path is after the target (deeper or to the right).

handleFocusChange Source #

Arguments

:: WidgetNode s e

The node receiving the event.

-> Path

The path of next/prev target, accordingly.

-> [Path -> WidgetRequest s e]

Getter for reqs handler in a config type.

-> Maybe (WidgetResult s e)

The result.

Generates a result with events and requests associated to a focus change.