hscurses-1.3.0.2: NCurses bindings for HaskellSource codeContentsIndex
UI.HSCurses.Widgets
Synopsis
type Pos = (Int, Int)
type Offset = (Int, Int)
type Size = (Int, Int)
getHeight :: Size -> Int
getWidth :: Size -> Int
getYOffset :: Offset -> Int
getXOffset :: Offset -> Int
getYPos :: Pos -> Int
getXPos :: Pos -> Int
data Direction
= DirLeft
| DirRight
| DirUp
| DirDown
data HAlignment
= AlignLeft
| AlignCenter
| AlignRight
data Cont a
= Cont a
| Done a
class Widget a where
draw :: Pos -> Size -> DrawingHint -> a -> IO ()
minSize :: a -> Size
class Widget a => ActiveWidget a where
activate :: MonadExcIO m => m () -> Pos -> Size -> a -> m (a, String)
type KeyHandler a = Pos -> Size -> a -> IO (Cont a)
mkKeyHandler :: (Pos -> Size -> a -> a) -> KeyHandler a
data DrawingHint
= DHNormal
| DHFocus
| DHActive
data DrawingStyle = DStyle {
dstyle_normal :: CursesStyle
dstyle_focus :: CursesStyle
dstyle_active :: CursesStyle
}
mkDrawingStyle :: CursesStyle -> DrawingStyle
defaultDrawingStyle :: DrawingStyle
_draw :: DrawingHint -> DrawingStyle -> IO a -> IO a
scrollFactor :: Double
scrollBy :: Int -> Int
scrollForward :: Int -> Int -> Int -> Int
scrollBackward :: t -> Int -> Int -> Int
data EmptyWidget = EmptyWidget Size
data OpaqueWidget = OpaqueWidget Size
data EditWidget = EditWidget {
ew_content :: String
ew_xoffset :: Int
ew_xcursor :: Int
ew_history :: [String]
ew_historyIndex :: Int
ew_historySavedContent :: Maybe String
ew_options :: EditWidgetOptions
}
ew_contentPos :: EditWidget -> Int
data EditWidgetOptions = EWOptions {
ewopt_keyHandlers :: [(Key, KeyHandler EditWidget)]
ewopt_minWidth :: Int
ewopt_style :: DrawingStyle
}
defaultEWOptions :: EditWidgetOptions
newEditWidget :: EditWidgetOptions -> String -> EditWidget
editWidgetGoLeft :: Pos -> Size -> EditWidget -> IO (Cont EditWidget)
editWidgetGoRight :: Pos -> Size -> EditWidget -> IO (Cont EditWidget)
editWidgetDeleteLeft :: Pos -> Size -> EditWidget -> IO (Cont EditWidget)
editWidgetDeleteUnderCursor :: Pos -> Size -> EditWidget -> IO (Cont EditWidget)
editWidgetDeleteToEnd :: Pos -> Size -> EditWidget -> IO (Cont EditWidget)
editWidgetGoHome :: Pos -> Size -> EditWidget -> IO (Cont EditWidget)
editWidgetGoEnd :: Pos -> Size -> EditWidget -> IO (Cont EditWidget)
editWidgetHistoryUp :: Pos -> Size -> EditWidget -> IO (Cont EditWidget)
editWidgetHistoryDown :: Pos -> Size -> EditWidget -> IO (Cont EditWidget)
editWidgetKeyHandlers :: [(Key, Pos -> Size -> EditWidget -> IO (Cont EditWidget))]
editWidgetGetContent :: EditWidget -> String
editWidgetSetContent :: EditWidget -> String -> EditWidget
editWidgetGetOptions :: EditWidget -> EditWidgetOptions
editWidgetSetOptions :: EditWidget -> EditWidgetOptions -> EditWidget
drawEditWidget :: Pos -> Size -> DrawingHint -> EditWidget -> IO ()
activateEditWidget :: MonadExcIO m => m () -> Pos -> Size -> EditWidget -> m (EditWidget, String)
editWidgetGoLeft' :: t -> t1 -> EditWidget -> EditWidget
editWidgetGoRight' :: t -> (t1, Int) -> EditWidget -> EditWidget
editWidgetDeleteLeft' :: Pos -> Size -> EditWidget -> EditWidget
editWidgetDeleteUnderCursor' :: t -> t1 -> EditWidget -> EditWidget
editWidgetDeleteToEnd' :: t -> t1 -> EditWidget -> EditWidget
editWidgetGoHome' :: t -> t1 -> EditWidget -> EditWidget
editWidgetGoEnd' :: Pos -> Size -> EditWidget -> EditWidget
editWidgetFinish :: Monad m => t -> t1 -> EditWidget -> m (Cont EditWidget)
maxHistoryLength :: Int
addToHistory :: EditWidget -> [Char] -> EditWidget
editWidgetHistoryUp' :: t -> t1 -> EditWidget -> EditWidget
editWidgetHistoryDown' :: t -> t1 -> EditWidget -> EditWidget
editWidgetHistory :: Num t => (Int -> t -> Int) -> EditWidget -> EditWidget
data TextWidget = TextWidget {
tw_text :: String
tw_yoffset :: Int
tw_xoffset :: Int
tw_options :: TextWidgetOptions
}
data TextWidgetSize
= TWSizeDefault
| TWSizeFixed Size
data TextWidgetOptions = TWOptions {
twopt_size :: TextWidgetSize
twopt_style :: DrawingStyle
twopt_halign :: HAlignment
}
defaultTWOptions :: TextWidgetOptions
newTextWidget :: TextWidgetOptions -> String -> TextWidget
drawTextWidget :: Pos -> Size -> DrawingHint -> TextWidget -> IO ()
textWidgetGetText :: TextWidget -> String
textWidgetSetText :: TextWidget -> String -> TextWidget
textWidgetScrollDown :: Size -> TextWidget -> TextWidget
textWidgetScrollUp :: Size -> TextWidget -> TextWidget
textWidgetScrollLeft :: Size -> TextWidget -> TextWidget
textWidgetScrollRight :: Size -> TextWidget -> TextWidget
data TableCell
= forall w . Widget w => TableCell w
| forall w . ActiveWidget w => ActiveTableCell w
isActive :: TableCell -> Bool
_activateTableCell :: MonadExcIO m => m () -> Pos -> Size -> TableCell -> m (TableCell, String)
type Row = [TableCell]
singletonRow :: TableCell -> Row
getCellWidget :: TableWidget -> (Int, Int) -> TableCell
setCellWidget :: TableWidget -> (Int, Int) -> TableCell -> TableWidget
data TableWidget = TableWidget {
tbw_rows :: [Row]
tbw_colOffset :: Int
tbw_pos :: Maybe Pos
tbw_options :: TableWidgetOptions
}
data FillRow
= First
| Last
| None
data TableWidgetOptions = TBWOptions {
tbwopt_fillCol :: Maybe Int
tbwopt_fillRow :: FillRow
tbwopt_activeCols :: [Int]
tbwopt_minSize :: Size
}
defaultTBWOptions :: TableWidgetOptions
newTableWidget :: TableWidgetOptions -> [Row] -> TableWidget
data TableWidgetDisplayInfo = TBWDisplayInfo {
tbwdisp_height :: Int
tbwdisp_width :: Int
tbwdisp_firstVis :: Int
tbwdisp_lastVis :: Int
tbwdisp_rows :: [Row]
tbwdisp_nrows :: Int
tbwdisp_heights :: [Int]
tbwdisp_widths :: [Int]
tbwdisp_rightMargin :: Maybe (Int, Size)
}
tableWidgetDisplayInfo :: Size -> TableWidget -> TableWidgetDisplayInfo
getCellInfo :: Pos -> Size -> TableWidget -> (Int, Int) -> (Pos, Size)
drawTableWidget :: Pos -> Size -> DrawingHint -> TableWidget -> IO ()
tableWidgetScrollDown :: Size -> TableWidget -> TableWidget
tableWidgetScrollUp :: Size -> TableWidget -> TableWidget
tableWidgetActivateCurrent :: MonadExcIO m => m () -> Pos -> Size -> DrawingHint -> TableWidget -> m (TableWidget, Maybe String)
tableWidgetGoLeft :: Size -> TableWidget -> TableWidget
tableWidgetGoRight :: Size -> TableWidget -> TableWidget
tableWidgetGoUp :: Size -> TableWidget -> TableWidget
tableWidgetGoDown :: Size -> TableWidget -> TableWidget
tableWidgetMove :: Direction -> (Int, Int) -> TableWidget -> TableWidget
tableWidgetMakeVisible :: TableWidget -> (Int, Int) -> Int -> TableWidget
findFirstActiveCell :: [Row] -> TableWidgetOptions -> Maybe Pos
findNextActiveCell :: TableWidgetOptions -> Int -> Pos -> Direction -> Maybe Pos
tableWidgetDeleteRow :: Int -> TableWidget -> TableWidget
joinLists :: [[a]] -> [a] -> [a]
splitList :: Eq a => [a] -> [a] -> [[a]]
listReplace :: [a] -> a -> Int -> [a]
alignRows :: [[[a]]] -> a -> [a] -> [[a]]
align :: HAlignment -> Int -> a -> [a] -> [a]
deleteAt :: Int -> [a] -> [a]
Documentation
type Pos = (Int, Int)Source
type Offset = (Int, Int)Source
type Size = (Int, Int)Source
getHeight :: Size -> IntSource
getWidth :: Size -> IntSource
getYOffset :: Offset -> IntSource
getXOffset :: Offset -> IntSource
getYPos :: Pos -> IntSource
getXPos :: Pos -> IntSource
data Direction Source
Constructors
DirLeft
DirRight
DirUp
DirDown
data HAlignment Source
Constructors
AlignLeft
AlignCenter
AlignRight
data Cont a Source
Constructors
Cont a
Done a
class Widget a whereSource
Methods
draw :: Pos -> Size -> DrawingHint -> a -> IO ()Source
minSize :: a -> SizeSource
class Widget a => ActiveWidget a whereSource
Methods
activate :: MonadExcIO m => m () -> Pos -> Size -> a -> m (a, String)Source
type KeyHandler a = Pos -> Size -> a -> IO (Cont a)Source
mkKeyHandler :: (Pos -> Size -> a -> a) -> KeyHandler aSource
data DrawingHint Source
Constructors
DHNormal
DHFocus
DHActive
data DrawingStyle Source
Constructors
DStyle
dstyle_normal :: CursesStyle
dstyle_focus :: CursesStyle
dstyle_active :: CursesStyle
mkDrawingStyle :: CursesStyle -> DrawingStyleSource
defaultDrawingStyle :: DrawingStyleSource
_draw :: DrawingHint -> DrawingStyle -> IO a -> IO aSource
scrollFactor :: DoubleSource
scrollBy :: Int -> IntSource
scrollForward :: Int -> Int -> Int -> IntSource
scrollBackward :: t -> Int -> Int -> IntSource
data EmptyWidget Source
Constructors
EmptyWidget Size
data OpaqueWidget Source
Constructors
OpaqueWidget Size
data EditWidget Source
Constructors
EditWidget
ew_content :: String
ew_xoffset :: Int
ew_xcursor :: Int
ew_history :: [String]
ew_historyIndex :: Int
ew_historySavedContent :: Maybe String
ew_options :: EditWidgetOptions
ew_contentPos :: EditWidget -> IntSource
data EditWidgetOptions Source
Constructors
EWOptions
ewopt_keyHandlers :: [(Key, KeyHandler EditWidget)]
ewopt_minWidth :: Int
ewopt_style :: DrawingStyle
defaultEWOptions :: EditWidgetOptionsSource
newEditWidget :: EditWidgetOptions -> String -> EditWidgetSource
editWidgetGoLeft :: Pos -> Size -> EditWidget -> IO (Cont EditWidget)Source
editWidgetGoRight :: Pos -> Size -> EditWidget -> IO (Cont EditWidget)Source
editWidgetDeleteLeft :: Pos -> Size -> EditWidget -> IO (Cont EditWidget)Source
editWidgetDeleteUnderCursor :: Pos -> Size -> EditWidget -> IO (Cont EditWidget)Source
editWidgetDeleteToEnd :: Pos -> Size -> EditWidget -> IO (Cont EditWidget)Source
editWidgetGoHome :: Pos -> Size -> EditWidget -> IO (Cont EditWidget)Source
editWidgetGoEnd :: Pos -> Size -> EditWidget -> IO (Cont EditWidget)Source
editWidgetHistoryUp :: Pos -> Size -> EditWidget -> IO (Cont EditWidget)Source
editWidgetHistoryDown :: Pos -> Size -> EditWidget -> IO (Cont EditWidget)Source
editWidgetKeyHandlers :: [(Key, Pos -> Size -> EditWidget -> IO (Cont EditWidget))]Source
editWidgetGetContent :: EditWidget -> StringSource
editWidgetSetContent :: EditWidget -> String -> EditWidgetSource
editWidgetGetOptions :: EditWidget -> EditWidgetOptionsSource
editWidgetSetOptions :: EditWidget -> EditWidgetOptions -> EditWidgetSource
drawEditWidget :: Pos -> Size -> DrawingHint -> EditWidget -> IO ()Source
activateEditWidget :: MonadExcIO m => m () -> Pos -> Size -> EditWidget -> m (EditWidget, String)Source
editWidgetGoLeft' :: t -> t1 -> EditWidget -> EditWidgetSource
editWidgetGoRight' :: t -> (t1, Int) -> EditWidget -> EditWidgetSource
editWidgetDeleteLeft' :: Pos -> Size -> EditWidget -> EditWidgetSource
editWidgetDeleteUnderCursor' :: t -> t1 -> EditWidget -> EditWidgetSource
editWidgetDeleteToEnd' :: t -> t1 -> EditWidget -> EditWidgetSource
editWidgetGoHome' :: t -> t1 -> EditWidget -> EditWidgetSource
editWidgetGoEnd' :: Pos -> Size -> EditWidget -> EditWidgetSource
editWidgetFinish :: Monad m => t -> t1 -> EditWidget -> m (Cont EditWidget)Source
maxHistoryLength :: IntSource
addToHistory :: EditWidget -> [Char] -> EditWidgetSource
editWidgetHistoryUp' :: t -> t1 -> EditWidget -> EditWidgetSource
editWidgetHistoryDown' :: t -> t1 -> EditWidget -> EditWidgetSource
editWidgetHistory :: Num t => (Int -> t -> Int) -> EditWidget -> EditWidgetSource
data TextWidget Source
Constructors
TextWidget
tw_text :: String
tw_yoffset :: Int
tw_xoffset :: Int
tw_options :: TextWidgetOptions
data TextWidgetSize Source
Constructors
TWSizeDefault
TWSizeFixed Size
data TextWidgetOptions Source
Constructors
TWOptions
twopt_size :: TextWidgetSize
twopt_style :: DrawingStyle
twopt_halign :: HAlignment
defaultTWOptions :: TextWidgetOptionsSource
newTextWidget :: TextWidgetOptions -> String -> TextWidgetSource
drawTextWidget :: Pos -> Size -> DrawingHint -> TextWidget -> IO ()Source
textWidgetGetText :: TextWidget -> StringSource
textWidgetSetText :: TextWidget -> String -> TextWidgetSource
textWidgetScrollDown :: Size -> TextWidget -> TextWidgetSource
textWidgetScrollUp :: Size -> TextWidget -> TextWidgetSource
textWidgetScrollLeft :: Size -> TextWidget -> TextWidgetSource
textWidgetScrollRight :: Size -> TextWidget -> TextWidgetSource
data TableCell Source
Constructors
forall w . Widget w => TableCell w
forall w . ActiveWidget w => ActiveTableCell w
isActive :: TableCell -> BoolSource
_activateTableCell :: MonadExcIO m => m () -> Pos -> Size -> TableCell -> m (TableCell, String)Source
type Row = [TableCell]Source
singletonRow :: TableCell -> RowSource
getCellWidget :: TableWidget -> (Int, Int) -> TableCellSource
setCellWidget :: TableWidget -> (Int, Int) -> TableCell -> TableWidgetSource
data TableWidget Source
Constructors
TableWidget
tbw_rows :: [Row]
tbw_colOffset :: Int
tbw_pos :: Maybe Pos
tbw_options :: TableWidgetOptions
data FillRow Source
Constructors
First
Last
None
data TableWidgetOptions Source
Constructors
TBWOptions
tbwopt_fillCol :: Maybe Int
tbwopt_fillRow :: FillRow
tbwopt_activeCols :: [Int]
tbwopt_minSize :: Size
defaultTBWOptions :: TableWidgetOptionsSource
newTableWidget :: TableWidgetOptions -> [Row] -> TableWidgetSource
data TableWidgetDisplayInfo Source
Constructors
TBWDisplayInfo
tbwdisp_height :: Int
tbwdisp_width :: Int
tbwdisp_firstVis :: Int
tbwdisp_lastVis :: Int
tbwdisp_rows :: [Row]
tbwdisp_nrows :: Int
tbwdisp_heights :: [Int]
tbwdisp_widths :: [Int]
tbwdisp_rightMargin :: Maybe (Int, Size)
tableWidgetDisplayInfo :: Size -> TableWidget -> TableWidgetDisplayInfoSource
getCellInfo :: Pos -> Size -> TableWidget -> (Int, Int) -> (Pos, Size)Source
drawTableWidget :: Pos -> Size -> DrawingHint -> TableWidget -> IO ()Source
tableWidgetScrollDown :: Size -> TableWidget -> TableWidgetSource
tableWidgetScrollUp :: Size -> TableWidget -> TableWidgetSource
tableWidgetActivateCurrent :: MonadExcIO m => m () -> Pos -> Size -> DrawingHint -> TableWidget -> m (TableWidget, Maybe String)Source
tableWidgetGoLeft :: Size -> TableWidget -> TableWidgetSource
tableWidgetGoRight :: Size -> TableWidget -> TableWidgetSource
tableWidgetGoUp :: Size -> TableWidget -> TableWidgetSource
tableWidgetGoDown :: Size -> TableWidget -> TableWidgetSource
tableWidgetMove :: Direction -> (Int, Int) -> TableWidget -> TableWidgetSource
tableWidgetMakeVisible :: TableWidget -> (Int, Int) -> Int -> TableWidgetSource
findFirstActiveCell :: [Row] -> TableWidgetOptions -> Maybe PosSource
findNextActiveCell :: TableWidgetOptions -> Int -> Pos -> Direction -> Maybe PosSource
tableWidgetDeleteRow :: Int -> TableWidget -> TableWidgetSource
joinLists :: [[a]] -> [a] -> [a]Source
Join a list by some delimiter
splitList :: Eq a => [a] -> [a] -> [[a]]Source
Split a list by some delimiter
listReplace :: [a] -> a -> Int -> [a]Source
alignRows :: [[[a]]] -> a -> [a] -> [[a]]Source
align :: HAlignment -> Int -> a -> [a] -> [a]Source
deleteAt :: Int -> [a] -> [a]Source
Produced by Haddock version 2.6.1