WEditor-0.2.0.0: Generic text-editor logic for use with fixed-width fonts.

Safe HaskellSafe
LanguageHaskell2010

WEditor.Base.Viewer

Description

Generic editor-viewport functionality.

Synopsis

Documentation

class FixedFontViewer a c | a -> c where Source #

Generic editor viewport for fixed-width fonts.

Methods

setViewSize :: a -> (Int, Int) -> a Source #

Set the (width,height) size of the viewport. A width < 0 must disable line wrapping, and a height < 0 must disable vertical bounding.

getViewSize :: a -> (Int, Int) Source #

Get the (width,height) size of the viewport.

getVisible :: a -> [[c]] Source #

Get the visible lines in the viewport. This does not need to completely fill the viewport area, but it must not exceed it.

updateView :: a -> ViewAction -> a Source #

Apply a view change.

data ViewAction Source #

Actions that modify the view without affecting editing.

Constructors

ShiftVertical Int

Shift the vertical offset. Negative values shift up.

FillView

Attempt to fill the entire viewport.

Instances
Eq ViewAction Source # 
Instance details

Defined in WEditor.Base.Viewer

Show ViewAction Source # 
Instance details

Defined in WEditor.Base.Viewer

type ViewerAction c = forall a. FixedFontViewer a c => a -> a Source #

Any action that updates a FixedFontViewer.

viewerResizeAction :: (Int, Int) -> ViewerAction c Source #

Action to resize the viewport.

viewerShiftUpAction :: Int -> ViewerAction c Source #

Action to shift the view upward.

viewerShiftDownAction :: Int -> ViewerAction c Source #

Action to shift the view downward.