| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
NanoUI.Frame.TextEdit
Description
Text-field editing facade: single-line fields (NanoUI.Frame.TextInput), text areas (NanoUI.Frame.TextArea) and their context menu (NanoUI.Frame.TextEdit.Menu), plus the dispatchers that pick between the two field kinds.
Synopsis
- finalizeTextFieldMouse :: Context -> Input -> IO ()
- collapseTextFieldSelection :: Context -> WidgetId -> IO ()
- applyTextFieldMenuAction :: Context -> WidgetId -> Int -> IO ()
- textEditMenuRectAt :: Float -> Float -> Float -> Size -> Rect
- textEditMenuWidth :: Context -> IO Float
- normalizeTextFieldClicks :: Context -> WidgetId -> Int -> Int -> Int -> Bool -> Int -> IO Int
- textWordBounds :: Text -> Int -> (Int, Int)
- data TextAreaHit = TextAreaHit {
- tahNodeIdx :: !NodeIdx
- tahFieldRect :: !Rect
- tahContentX :: !Float
- tahLineH :: !Float
- tahWidgetX :: !Float
- tahWidgetY :: !Float
- tahWidgetW :: !Float
- tahWidgetH :: !Float
- data TextAreaScrollBarLayouts = TextAreaScrollBarLayouts {}
- resolveTextAreaFont :: Context -> NodeIdx -> IO FontMetrics
- textAreaContentMetrics :: Context -> NodeIdx -> IO (Float, Float)
- textAreaBarLane :: Float
- textAreaLineHeight :: FontMetrics -> Float
- textAreaHitForWidget :: Context -> WidgetId -> IO (Maybe TextAreaHit)
- textAreaScrollBarLayout :: FontMetrics -> Rect -> Float -> Float -> Maybe ScrollBarLayout
- textAreaHScrollBarLayout :: FontMetrics -> Rect -> Float -> Float -> Maybe ScrollBarLayout
- textAreaScrollBarLayouts :: FontMetrics -> Rect -> Float -> Float -> Float -> Float -> TextAreaScrollBarLayouts
Dispatch between field kinds
finalizeTextFieldMouse :: Context -> Input -> IO () Source #
Mouse selection in the focused field, whichever kind it is. A release ends any drag.
Context menu
textEditMenuRectAt :: Float -> Float -> Float -> Size -> Rect Source #
Menu rect at the pointer, kept inside the window.
Shared field helpers
normalizeTextFieldClicks :: Context -> WidgetId -> Int -> Int -> Int -> Bool -> Int -> IO Int Source #
Count a press as a multi-click only when it lands on the same cell as the previous press; anything else restarts the count at one.
textWordBounds :: Text -> Int -> (Int, Int) Source #
Find the word bounds around a character position in text.
Text areas
data TextAreaHit Source #
Constructors
| TextAreaHit | |
Fields
| |
data TextAreaScrollBarLayouts Source #
Constructors
| TextAreaScrollBarLayouts | |
Fields
| |
Instances
| Eq TextAreaScrollBarLayouts Source # | |
Defined in NanoUI.Frame.TextArea.Geometry Methods (==) :: TextAreaScrollBarLayouts -> TextAreaScrollBarLayouts -> Bool # (/=) :: TextAreaScrollBarLayouts -> TextAreaScrollBarLayouts -> Bool # | |
| Show TextAreaScrollBarLayouts Source # | |
Defined in NanoUI.Frame.TextArea.Geometry Methods showsPrec :: Int -> TextAreaScrollBarLayouts -> ShowS # show :: TextAreaScrollBarLayouts -> String # showList :: [TextAreaScrollBarLayouts] -> ShowS # | |
resolveTextAreaFont :: Context -> NodeIdx -> IO FontMetrics Source #
Font the text-area content is laid out and painted in. Honors the node's
layoutFontSize (set via fontSize on the editor layout) so a single text
area can zoom without changing the rest of the UI. A size of 0 means the
base UI font.
textAreaContentMetrics :: Context -> NodeIdx -> IO (Float, Float) Source #
Content extent of a text area, (contentWidth, contentHeight). Measuring
the width scans every character of the document, so the result is cached per
widget and only refreshed when the text changes (the editor clears
SlotTextAreaContentFont) or the node font changes.
textAreaBarLane :: Float Source #
Width of the vertical and height of the horizontal scrollbar lane.
textAreaLineHeight :: FontMetrics -> Float Source #
Text area row height, snapped to the device pixel grid.
textAreaHitForWidget :: Context -> WidgetId -> IO (Maybe TextAreaHit) Source #
textAreaScrollBarLayout :: FontMetrics -> Rect -> Float -> Float -> Maybe ScrollBarLayout Source #
textAreaHScrollBarLayout :: FontMetrics -> Rect -> Float -> Float -> Maybe ScrollBarLayout Source #
textAreaScrollBarLayouts :: FontMetrics -> Rect -> Float -> Float -> Float -> Float -> TextAreaScrollBarLayouts Source #