hscurses-1.2: NCurses bindings for HaskellSource codeContentsIndex
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
_draw :: DrawingHint -> DrawingStyle -> IO a -> IO a
scrollBy :: 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
}
data EditWidgetOptions = EWOptions {
ewopt_keyHandlers :: [(Key, KeyHandler EditWidget)]
ewopt_minWidth :: Int
ewopt_style :: DrawingStyle
}
newEditWidget :: EditWidgetOptions -> String -> EditWidget
drawEditWidget :: Pos -> Size -> DrawingHint -> EditWidget -> IO ()
activateEditWidget :: MonadExcIO m => m () -> Pos -> Size -> EditWidget -> m (EditWidget, String)
editWidgetDeleteLeft' :: Pos -> Size -> EditWidget -> EditWidget
editWidgetGoEnd' :: Pos -> Size -> 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
}
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
}
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
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
show/hide Instances
data HAlignment Source
Constructors
AlignLeft
AlignCenter
AlignRight
show/hide Instances
data Cont a Source
Constructors
Cont a
Done a
class Widget a whereSource
Methods
draw :: Pos -> Size -> DrawingHint -> a -> IO ()Source
minSize :: a -> SizeSource
show/hide Instances
class Widget a => ActiveWidget a whereSource
Methods
activate :: MonadExcIO m => m () -> Pos -> Size -> a -> m (a, String)Source
show/hide Instances
type KeyHandler a = Pos -> Size -> a -> IO (Cont a)Source
mkKeyHandler :: (Pos -> Size -> a -> a) -> KeyHandler aSource
data DrawingHint Source
Constructors
DHNormal
DHFocus
DHActive
show/hide Instances
data DrawingStyle Source
Constructors
DStyle
dstyle_normal :: CursesStyle
dstyle_focus :: CursesStyle
dstyle_active :: CursesStyle
show/hide Instances
mkDrawingStyle :: CursesStyle -> DrawingStyleSource
_draw :: DrawingHint -> DrawingStyle -> IO a -> IO aSource
scrollBy :: Int -> IntSource
data EmptyWidget Source
Constructors
EmptyWidget Size
show/hide Instances
data OpaqueWidget Source
Constructors
OpaqueWidget Size
show/hide Instances
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
show/hide Instances
data EditWidgetOptions Source
Constructors
EWOptions
ewopt_keyHandlers :: [(Key, KeyHandler EditWidget)]
ewopt_minWidth :: Int
ewopt_style :: DrawingStyle
newEditWidget :: EditWidgetOptions -> String -> EditWidgetSource
drawEditWidget :: Pos -> Size -> DrawingHint -> EditWidget -> IO ()Source
activateEditWidget :: MonadExcIO m => m () -> Pos -> Size -> EditWidget -> m (EditWidget, String)Source
editWidgetDeleteLeft' :: Pos -> Size -> EditWidget -> EditWidgetSource
editWidgetGoEnd' :: Pos -> Size -> EditWidget -> EditWidgetSource
data TextWidget Source
Constructors
TextWidget
tw_text :: String
tw_yoffset :: Int
tw_xoffset :: Int
tw_options :: TextWidgetOptions
show/hide Instances
data TextWidgetSize Source
Constructors
TWSizeDefault
TWSizeFixed Size
show/hide Instances
data TextWidgetOptions Source
Constructors
TWOptions
twopt_size :: TextWidgetSize
twopt_style :: DrawingStyle
twopt_halign :: HAlignment
show/hide Instances
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
show/hide Instances
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
show/hide Instances
data FillRow Source
Constructors
First
Last
None
show/hide Instances
data TableWidgetOptions Source
Constructors
TBWOptions
tbwopt_fillCol :: Maybe Int
tbwopt_fillRow :: FillRow
tbwopt_activeCols :: [Int]
tbwopt_minSize :: Size
show/hide Instances
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
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.1.0