Source codeContentsIndex
Editor
Description
HTk's editor widget. A text container for editing purposes. An editor widget can contain text tags, to which you can bind events, and also embedded windows.
Synopsis
module Selection
module ICursor
module Index
data ScrollBar
data ScrollUnit
class (Widget w) => HasScroller w where
isWfOrientation :: w -> Orientation -> Bool
scrollbar :: Orientation -> ScrollBar -> Config w
moveto :: Orientation -> w -> Fraction -> IO ()
scroll :: Orientation -> w -> Int -> ScrollUnit -> IO ()
view :: Orientation -> w -> IO (Fraction, Fraction)
data Editor
newEditor :: (Container par) => par -> [Config Editor] -> IO Editor
deleteText :: (HasIndex Editor i BaseIndex) => Editor -> i -> IO ()
deleteTextRange :: (HasIndex Editor i1 BaseIndex, HasIndex Editor i2 BaseIndex) => Editor -> i1 -> i2 -> IO ()
getTextRange :: (HasIndex Editor i1 BaseIndex, HasIndex Editor i2 BaseIndex) => Editor -> i1 -> i2 -> IO String
insertText :: (HasIndex Editor i BaseIndex, GUIValue a) => Editor -> i -> a -> IO ()
insertNewline :: Editor -> IO ()
getTextLine :: (HasIndex Editor i BaseIndex) => Editor -> i -> IO String
appendText :: Editor -> String -> IO ()
getIndexPosition :: (HasIndex Editor i BaseIndex) => Editor -> i -> IO Position
compareIndices :: (HasIndex Editor i1 BaseIndex, HasIndex Editor i2 BaseIndex) => Editor -> String -> i1 -> i2 -> IO Bool
writeTextToFile :: Editor -> FilePath -> IO ()
readTextFromFile :: Editor -> FilePath -> IO ()
class (GUIObject w) => HasTabulators w where
tabs :: String -> Config w
getTabs :: w -> IO String
class (GUIObject w) => HasLineSpacing w where
spaceAbove :: Distance -> Config w
getSpaceAbove :: w -> IO Distance
spaceWrap :: Distance -> Config w
getSpaceWrap :: w -> IO Distance
spaceBelow :: Distance -> Config w
getSpaceBelow :: w -> IO Distance
adjustViewTo :: (HasIndex Editor i BaseIndex) => Editor -> i -> IO ()
scanMark :: (HasIndex Editor i BaseIndex) => Editor -> i -> IO ()
scanDragTo :: (HasIndex Editor i BaseIndex) => Editor -> i -> IO ()
data SearchDirection
= Forward
| Backward
data SearchMode
= Exact
| Nocase
data SearchSwitch = SearchSwitch {
searchdirection :: SearchDirection
searchmode :: SearchMode
rexexp :: Bool
}
search :: (HasIndex Editor i BaseIndex) => Editor -> SearchSwitch -> String -> i -> IO (Maybe BaseIndex)
newtype IndexModifiers = IndexModifiers [IndexModifier]
data IndexModifier
= ForwardChars Int
| BackwardChars Int
| ForwardLines Int
| BackwardLines Int
| LineStart
| LineEnd
| WordStart
| WordEnd
data WrapMode
= NoWrap
| CharWrap
| WordWrap
wrap :: WrapMode -> Config Editor
getWrapMode :: Editor -> IO WrapMode
Documentation
module Selection
module ICursor
module Index
data ScrollBar
The ScrollBar datatype.
data ScrollUnit
class (Widget w) => HasScroller w where
Methods
isWfOrientation :: w -> Orientation -> Bool
True for widgets that are scrollable in the given orientation.
scrollbar :: Orientation -> ScrollBar -> Config w
Associates a scrollbar with a scrollable widget.
moveto :: Orientation -> w -> Fraction -> IO ()
Positions the scrolled widget so the give Fraction is off-screen to the left.
scroll :: Orientation -> w -> Int -> ScrollUnit -> IO ()
Scrolls the associated widget by n pages or units (depending on the given ScrollUnit).
view :: Orientation -> w -> IO (Fraction, Fraction)
Returns two fractions between 0 and 1 that describe the amount of the widget off-screen to the left and the amount of the widget visible.
Instances
HasScroller Canvas
HasScroller Editor
HasScroller (Entry a)
HasScroller (ListBox a)
(HasScroller a) => HasScroller (ScrollBox a)
data Editor
The Editor datatpe.
newEditor
:: (Container par)
=> par the parent widget, which has to be a container widget (an instance of class Container).
-> [Config Editor] the list of configuration options for this editor.
-> IO Editor An editor widget.
Constructs a new editor widget and returns it as a value.
deleteText
:: (HasIndex Editor i BaseIndex)
=> Editor the concerned editor widget.
-> i the concerned index.
-> IO () None.
Deletes the character at the specified index.
deleteTextRange
:: (HasIndex Editor i1 BaseIndex, HasIndex Editor i2 BaseIndex)
=> Editor the start index.
-> i1 the end index.
-> i2
-> IO () None.
Deletes the text in the specified range.
getTextRange
:: (HasIndex Editor i1 BaseIndex, HasIndex Editor i2 BaseIndex)
=> Editor the concerned editor widget.
-> i1 the start index.
-> i2 the end index.
-> IO String The editor's text in the specified range.
Gets the text in the specified range.
insertText
:: (HasIndex Editor i BaseIndex, GUIValue a)
=> Editor the concerned editor widget.
-> i the index to insert the text.
-> a the text to insert.
-> IO () None.
Inserts the given text at the specified index.
insertNewline
:: Editor the concerned editor widget.
-> IO () None.
Inserts a newline character at the end of the editor widget.
getTextLine
:: (HasIndex Editor i BaseIndex)
=> Editor the concerned editor widget.
-> i an index in the requested text line.
-> IO String The requested line of text.
Gets a text line from an editor widget.
appendText
:: Editor the concerned editor widget.
-> String the text to append.
-> IO () None.
Appends text at the end of the editor widget.
getIndexPosition :: (HasIndex Editor i BaseIndex) => Editor -> i -> IO Position
compareIndices
:: (HasIndex Editor i1 BaseIndex, HasIndex Editor i2 BaseIndex)
=> Editor the concerned editor widget.
-> String an operation given as a string
-> i1 the first index.
-> i2 the second index.
-> IO Bool True or False, depending on the given operation.
Compares two indizes.
writeTextToFile
:: Editor the concerned editor widget.
-> FilePath the name of the file.
-> IO () None.
Writes the contained text to a file.
readTextFromFile
:: Editor the concerned editor widget.
-> FilePath the name of the file.
-> IO () None.
Reads a text from a file and inserts it into the editor pane.
class (GUIObject w) => HasTabulators w where
Methods
tabs :: String -> Config w
Sets the tab stops.
getTabs :: w -> IO String
Gets the tab stops.
Instances
HasTabulators Editor
HasTabulators TextTag
class (GUIObject w) => HasLineSpacing w where
Widgets with an adjustable line spacing instantiate the class HasLineSpacing.
Methods
spaceAbove :: Distance -> Config w
Sets the space above an unwrapped line.
getSpaceAbove :: w -> IO Distance
Gets the space above an unwrapped line.
spaceWrap :: Distance -> Config w
Sets the space above a wrapped line.
getSpaceWrap :: w -> IO Distance
Gets the space above a wrapped line.
spaceBelow :: Distance -> Config w
Sets the space below an unwrapped line.
getSpaceBelow :: w -> IO Distance
Sets the space below an unwrapped line.
Instances
HasLineSpacing Editor
HasLineSpacing TextTag
adjustViewTo :: (HasIndex Editor i BaseIndex) => Editor -> i -> IO ()
scanMark
:: (HasIndex Editor i BaseIndex)
=> Editor the concerned editor widget.
-> i the concerned index.
-> IO () None.
Anchor a scrolling operation.
scanDragTo
:: (HasIndex Editor i BaseIndex)
=> Editor the concerned editor widget.
-> i the concerned index.
-> IO () None.
Scroll based on a new position.
data SearchDirection
The SearchDirection datatype.
Constructors
Forward
Backward
Instances
Show SearchDirection
data SearchMode
Constructors
Exact
Nocase
Instances
Show SearchMode
data SearchSwitch
Constructors
SearchSwitch
searchdirection :: SearchDirection
searchmode :: SearchMode
rexexp :: Bool
Instances
Show SearchSwitch
search
:: (HasIndex Editor i BaseIndex)
=> Editor the concerned editor widget.
-> SearchSwitch the search switch.
-> String the searched text or regular expression.
-> i the start index.
-> IO (Maybe BaseIndex) The index of the first match (if successful).
Searches for text inside an editor widget.
newtype IndexModifiers
Constructors
IndexModifiers [IndexModifier]
Instances
Show IndexModifiers
data IndexModifier
The IndexModifier datatype.
Constructors
ForwardChars Int
BackwardChars Int
ForwardLines Int
BackwardLines Int
LineStart
LineEnd
WordStart
WordEnd
Instances
(HasIndex Editor i BaseIndex) => HasIndex Editor (i, [IndexModifier]) BaseIndex
(HasIndex Editor i BaseIndex) => HasIndex Editor (i, IndexModifier) BaseIndex
Show IndexModifier
data WrapMode
The WrapMode datatype.
Constructors
NoWrap
CharWrap
WordWrap
Instances
GUIValue WrapMode
Read WrapMode
Show WrapMode
wrap :: WrapMode -> Config Editor
Sets the editor's wrap mode.
getWrapMode :: Editor -> IO WrapMode
Gets the editor's wrap mode.
Produced by Haddock version 0.3