Safe Haskell | None |
---|---|
Language | Haskell2010 |
A split-view widget that displays two widgets side-by-side.
- hSplitWidget :: Widget s -> Widget t -> HSplitWidget s t
- type HSplitWidget s t = Widget (HSplit s t)
- data HSplit s t
- data Focus
- leftOnly :: Monad m => VgrepT (HSplit s t) m Redraw
- rightOnly :: Monad m => VgrepT (HSplit s t) m Redraw
- splitView :: Monad m => Focus -> Rational -> VgrepT (HSplit s t) m Redraw
- switchFocus :: Monad m => VgrepT (HSplit s t) m Redraw
- leftWidget :: forall s t s. Lens (HSplit s t) (HSplit s t) s s
- rightWidget :: forall s t t. Lens (HSplit s t) (HSplit s t) t t
- currentWidget :: Lens' (HSplit s t) (Either s t)
- leftWidgetFocused :: Traversal' (HSplit s t) s
- rightWidgetFocused :: Traversal' (HSplit s t) t
Horizontal split view widget
hSplitWidget :: Widget s -> Widget t -> HSplitWidget s t Source #
type HSplitWidget s t = Widget (HSplit s t) Source #
Widget state
The internal state of the split-view widget. Tracks the state of both child widgets and the current layout.
Widget actions
:: Monad m | |
=> Focus | Focus left or right area |
-> Rational | Left area width as fraction of overall width |
-> VgrepT (HSplit s t) m Redraw |
Display both widgets in a split view.
Lenses
currentWidget :: Lens' (HSplit s t) (Either s t) Source #
The currently focused child widget
>>>
view currentWidget $ HSplit { _leftWidget = "foo", _layout = LeftOnly }
Left "foo"
leftWidgetFocused :: Traversal' (HSplit s t) s Source #
Traverses the left widget if focused
>>>
has leftWidgetFocused $ HSplit { _layout = LeftOnly }
True
>>>
has leftWidgetFocused $ HSplit { _layout = RightOnly }
False
>>>
has leftWidgetFocused $ HSplit { _layout = Split FocusLeft (1 % 2) }
True
rightWidgetFocused :: Traversal' (HSplit s t) t Source #
Traverses the right widget if focused
>>>
has rightWidgetFocused $ HSplit { _layout = RightOnly }
True
>>>
has rightWidgetFocused $ HSplit { _layout = LeftOnly }
False
>>>
has rightWidgetFocused $ HSplit { _layout = Split FocusRight (1 % 2) }
True