Copyright | (c) 2018 Francisco Vallarino |
---|---|
License | BSD-3-Clause (see the LICENSE file) |
Maintainer | fjvallarino@gmail.com |
Stability | experimental |
Portability | non-portable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Base single line text editing field. Extensible for handling specific textual representations of other types, such as numbers and dates. It is not meant for direct use, but to create custom widgets using it.
See Monomer.Widgets.Singles.NumericField, Monomer.Widgets.Singles.DateField, Monomer.Widgets.Singles.TimeField and Monomer.Widgets.Singles.TextField.
Synopsis
- type InputFieldValue a = (Eq a, Show a, Typeable a)
- type InputWheelHandler a = InputFieldState a -> Point -> Point -> WheelDirection -> (Text, Int, Maybe Int)
- type InputDragHandler a = InputFieldState a -> Point -> Point -> (Text, Int, Maybe Int)
- data InputFieldCfg s e a = InputFieldCfg {
- _ifcPlaceholder :: Maybe Text
- _ifcInitialValue :: a
- _ifcValue :: WidgetData s a
- _ifcValid :: Maybe (WidgetData s Bool)
- _ifcValidV :: [Bool -> e]
- _ifcDefCursorEnd :: Bool
- _ifcDefWidth :: Double
- _ifcCaretWidth :: Maybe Double
- _ifcCaretMs :: Maybe Millisecond
- _ifcDisplayChar :: Maybe Char
- _ifcResizeOnChange :: Bool
- _ifcSelectOnFocus :: Bool
- _ifcReadOnly :: Bool
- _ifcFromText :: Text -> Maybe a
- _ifcToText :: a -> Text
- _ifcAcceptInput :: Text -> Bool
- _ifcIsValidInput :: Text -> Bool
- _ifcStyle :: Maybe (ALens' ThemeState StyleState)
- _ifcWheelHandler :: Maybe (InputWheelHandler a)
- _ifcDragHandler :: Maybe (InputDragHandler a)
- _ifcDragCursor :: Maybe CursorIcon
- _ifcOnFocusReq :: [Path -> WidgetRequest s e]
- _ifcOnBlurReq :: [Path -> WidgetRequest s e]
- _ifcOnChangeReq :: [a -> WidgetRequest s e]
- data InputFieldState a = InputFieldState {
- _ifsPlaceholder :: Seq TextLine
- _ifsCurrValue :: a
- _ifsCurrText :: !Text
- _ifsCursorPos :: !Int
- _ifsSelStart :: Maybe Int
- _ifsDragSelValue :: a
- _ifsGlyphs :: Seq GlyphPos
- _ifsOffset :: !Double
- _ifsTextRect :: Rect
- _ifsTextMetrics :: TextMetrics
- _ifsHistory :: Seq (HistoryStep a)
- _ifsHistIdx :: Int
- _ifsFocusStart :: Millisecond
- data HistoryStep a
- inputField_ :: (InputFieldValue a, WidgetEvent e) => WidgetType -> InputFieldCfg s e a -> WidgetNode s e
Configuration
type InputFieldValue a = (Eq a, Show a, Typeable a) Source #
Constraints for a value handled by input field.
type InputWheelHandler a Source #
= InputFieldState a | The state of the input field |
-> Point | The mouse position. |
-> Point | The wheel movement along x/y. |
-> WheelDirection | Whether movement is normal or inverted. |
-> (Text, Int, Maybe Int) | New text, cursor position and selection start. |
Handler for wheel events. Useful for values on which increase/decrease makes sense.
type InputDragHandler a Source #
= InputFieldState a | The state of the input field |
-> Point | The mouse position. |
-> Point | The wheel movement along x/y. |
-> (Text, Int, Maybe Int) | New text, cursor position and selection start. |
Handler for drag events. Useful for values on which increase/decrease makes sense.
data InputFieldCfg s e a Source #
Configuration options for an input field. These options are not directly exposed to users; each derived widget should expose its own options.
InputFieldCfg | |
|
data InputFieldState a Source #
Current state of the input field. Provided to some event handlers.
InputFieldState | |
|
Instances
data HistoryStep a Source #
Snapshot of a point in history of the input.
Instances
Constructors
:: (InputFieldValue a, WidgetEvent e) | |
=> WidgetType | The |
-> InputFieldCfg s e a | The config options. |
-> WidgetNode s e | The created instance of an input field. |
Creates an instance of an input field, with customizations in config.