This module is the core of this library; it provides infrastructure for creating new types of widgets and extending their functionality. This module provides various bits of infrastructure, including:
- modeling user interface widgets
- managing changes in focus between widgets
- managing widget state
This module does not provide any concrete widget types. For in-depth discussion on this module's API and widget implementation in particular, see the Vty-ui User's Manual.
- data WidgetImpl a = WidgetImpl {
- state :: a
- render_ :: Widget a -> DisplayRegion -> RenderContext -> IO Image
- growHorizontal_ :: a -> IO Bool
- growVertical_ :: a -> IO Bool
- currentSize :: DisplayRegion
- currentPosition :: DisplayRegion
- normalAttribute :: Attr
- focusAttribute :: Attr
- setCurrentPosition_ :: Widget a -> DisplayRegion -> IO ()
- keyEventHandler :: Widget a -> Key -> [Modifier] -> IO Bool
- gainFocusHandlers :: Handlers (Widget a)
- loseFocusHandlers :: Handlers (Widget a)
- focused :: Bool
- getCursorPosition_ :: Widget a -> IO (Maybe DisplayRegion)
- type Widget a = IORef (WidgetImpl a)
- getNormalAttr :: RenderContext -> Attr
- defaultContext :: RenderContext
- updateWidget :: Widget a -> (WidgetImpl a -> WidgetImpl a) -> IO ()
- updateWidgetState :: Widget a -> (a -> a) -> IO ()
- newWidget :: (WidgetImpl a -> WidgetImpl a) -> IO (Widget a)
- getState :: Widget a -> IO a
- getCurrentSize :: Widget a -> IO DisplayRegion
- setCurrentPosition :: Widget a -> DisplayRegion -> IO ()
- getCurrentPosition :: Widget a -> IO DisplayRegion
- growVertical :: Widget a -> IO Bool
- growHorizontal :: Widget a -> IO Bool
- getCursorPosition :: Widget a -> IO (Maybe DisplayRegion)
- showWidget :: Show a => Widget a -> IO String
- (<~) :: (a -> b) -> IORef a -> IO b
- (<~~) :: (a -> b) -> Widget a -> IO b
- data RenderContext = RenderContext {
- normalAttr :: Attr
- focusAttr :: Attr
- overrideAttr :: Attr
- skin :: Skin
- data RenderError = ImageTooBig String DisplayRegion DisplayRegion
- render :: Show a => Widget a -> DisplayRegion -> RenderContext -> IO Image
- renderAndPosition :: Show a => Widget a -> DisplayRegion -> DisplayRegion -> RenderContext -> IO Image
- class HasNormalAttr w where
- setNormalAttribute :: w -> Attr -> IO ()
- class HasFocusAttr w where
- setFocusAttribute :: w -> Attr -> IO ()
- withNormalAttribute :: HasNormalAttr w => Attr -> w -> IO w
- withFocusAttribute :: HasFocusAttr w => Attr -> w -> IO w
- handleKeyEvent :: Widget a -> Key -> [Modifier] -> IO Bool
- onKeyPressed :: Widget a -> (Widget a -> Key -> [Modifier] -> IO Bool) -> IO ()
- onGainFocus :: Widget a -> (Widget a -> IO ()) -> IO ()
- onLoseFocus :: Widget a -> (Widget a -> IO ()) -> IO ()
- relayKeyEvents :: Widget a -> Widget b -> IO ()
- relayFocusEvents :: Widget a -> Widget b -> IO ()
- data FocusGroup
- data FocusGroupError
- newFocusGroup :: IO (Widget FocusGroup)
- mergeFocusGroups :: Widget FocusGroup -> Widget FocusGroup -> IO (Widget FocusGroup)
- resetFocusGroup :: Widget FocusGroup -> IO ()
- addToFocusGroup :: Show a => Widget FocusGroup -> Widget a -> IO (Widget FocusEntry)
- focusNext :: Widget FocusGroup -> IO ()
- focusPrevious :: Widget FocusGroup -> IO ()
- setFocusGroupNextKey :: Widget FocusGroup -> Key -> [Modifier] -> IO ()
- setFocusGroupPrevKey :: Widget FocusGroup -> Key -> [Modifier] -> IO ()
- focus :: Widget a -> IO ()
- unfocus :: Widget a -> IO ()
Widget Infrastructure
data WidgetImpl a Source
WidgetImpl | |
|
Show a => Show (WidgetImpl a) | |
HasFocusAttr (Widget a) | |
HasNormalAttr (Widget a) | |
HasBorderAttr (Widget (Bordered a)) | |
HasBorderAttr (Widget VBorder) | |
HasBorderAttr (Widget HBorder) | |
HasBorderAttr (Widget Table) | |
Show a => RowLike (Widget a) |
type Widget a = IORef (WidgetImpl a)Source
updateWidget :: Widget a -> (WidgetImpl a -> WidgetImpl a) -> IO ()Source
updateWidgetState :: Widget a -> (a -> a) -> IO ()Source
newWidget :: (WidgetImpl a -> WidgetImpl a) -> IO (Widget a)Source
getCurrentSize :: Widget a -> IO DisplayRegionSource
setCurrentPosition :: Widget a -> DisplayRegion -> IO ()Source
growVertical :: Widget a -> IO BoolSource
growHorizontal :: Widget a -> IO BoolSource
getCursorPosition :: Widget a -> IO (Maybe DisplayRegion)Source
Rendering
data RenderContext Source
RenderContext | |
|
data RenderError Source
render :: Show a => Widget a -> DisplayRegion -> RenderContext -> IO ImageSource
renderAndPosition :: Show a => Widget a -> DisplayRegion -> DisplayRegion -> RenderContext -> IO ImageSource
Miscellaneous
class HasNormalAttr w whereSource
setNormalAttribute :: w -> Attr -> IO ()Source
class HasFocusAttr w whereSource
setFocusAttribute :: w -> Attr -> IO ()Source
withNormalAttribute :: HasNormalAttr w => Attr -> w -> IO wSource
withFocusAttribute :: HasFocusAttr w => Attr -> w -> IO wSource
Events
Focus management
data FocusGroup Source
data FocusGroupError Source
mergeFocusGroups :: Widget FocusGroup -> Widget FocusGroup -> IO (Widget FocusGroup)Source
addToFocusGroup :: Show a => Widget FocusGroup -> Widget a -> IO (Widget FocusEntry)Source
focusPrevious :: Widget FocusGroup -> IO ()Source
setFocusGroupNextKey :: Widget FocusGroup -> Key -> [Modifier] -> IO ()Source
setFocusGroupPrevKey :: Widget FocusGroup -> Key -> [Modifier] -> IO ()Source