| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
NanoUI.Widgets.TextArea
Contents
Description
The multi-line text area widget and its state: the document buffer, caret and selection, viewport, and commands run against it.
Synopsis
- data TextAreaState = TextAreaState {
- buffer :: !TextBuffer
- selectionAnchor :: !Cursor
- scrollOffset :: !(Double, Double)
- viewportSize :: !(Double, Double)
- lineHeight :: !Double
- history :: !EditHistory
- initTextAreaState :: Text -> TextAreaState
- setTextAreaViewport :: (Double, Double) -> Double -> TextAreaState -> TextAreaState
- setTextAreaSelection :: Cursor -> Cursor -> TextAreaState -> TextAreaState
- textArea :: forall (es :: [Effect]). Ui :> es => Text -> Eff es Text
- textArea' :: forall (es :: [Effect]). Ui :> es => Text -> Eff es (Response, Text)
- textAreaWith :: forall (es :: [Effect]). Ui :> es => (Layout -> Layout) -> Text -> Eff es Text
- textAreaWith' :: forall (es :: [Effect]). Ui :> es => (Layout -> Layout) -> Text -> Eff es (Response, Text)
- textAreaLayout :: Layout
- loadTextAreaState :: WidgetStore -> Int -> Text -> TextAreaState
- loadTextAreaStateWithBuffer :: WidgetStore -> Int -> TextBuffer -> TextAreaState
- saveTextAreaState :: Int -> Text -> TextAreaState -> WidgetStore -> WidgetStore
- textAreaEditor :: TextAreaState -> Editor
- runTextAreaCommand :: TextCommand -> TextAreaState -> TextAreaState
- applyTextAreaCommand :: Context -> WidgetId -> TextCommand -> IO ()
Pure state
data TextAreaState Source #
Constructors
| TextAreaState | |
Fields
| |
Instances
| Show TextAreaState Source # | |
Defined in NanoUI.Widgets.TextArea Methods showsPrec :: Int -> TextAreaState -> ShowS # show :: TextAreaState -> String # showList :: [TextAreaState] -> ShowS # | |
setTextAreaViewport :: (Double, Double) -> Double -> TextAreaState -> TextAreaState Source #
setTextAreaSelection :: Cursor -> Cursor -> TextAreaState -> TextAreaState Source #
Widget
textArea :: forall (es :: [Effect]). Ui :> es => Text -> Eff es Text Source #
Multi-line text editor. Pass the current text; the result is the text
after this frame's edits. Pair it with a label when a caption is wanted.
textAreaWith :: forall (es :: [Effect]). Ui :> es => (Layout -> Layout) -> Text -> Eff es Text Source #
textArea with a modifier applied to textAreaLayout, for example
grow to fill the parent.
textAreaWith' :: forall (es :: [Effect]). Ui :> es => (Layout -> Layout) -> Text -> Eff es (Response, Text) Source #
loadTextAreaState :: WidgetStore -> Int -> Text -> TextAreaState Source #
loadTextAreaStateWithBuffer :: WidgetStore -> Int -> TextBuffer -> TextAreaState Source #
loadTextAreaState with the buffer already resolved (the paint path
ensures the buffer cache and hands it straight through, avoiding a second
store lookup).
saveTextAreaState :: Int -> Text -> TextAreaState -> WidgetStore -> WidgetStore Source #
Store the editor state with its text. Callers pass the text because they
usually have it already, and toText joins the whole document.
textAreaEditor :: TextAreaState -> Editor Source #
runTextAreaCommand :: TextCommand -> TextAreaState -> TextAreaState Source #
Run a command that needs no clipboard, keeping the caret in view.
applyTextAreaCommand :: Context -> WidgetId -> TextCommand -> IO () Source #
Run a command on a text area outside its frame (a context menu row, an
app's Edit menu). A change to the text pulses respChanged on the area's
next frame.