Gtk2HsSource codeContentsIndex
Graphics.UI.Gtk.Multiline.TextIter
Portabilityportable (depends on GHC)
Stabilityprovisional
Maintainergtk2hs-users@lists.sourceforge.net
Contents
Types
Methods
Attributes
Description
An iterator is an abstract datatype representing a pointer into a TextBuffer.
Synopsis
newtype TextIter = TextIter (ForeignPtr TextIter)
data TextSearchFlags
= TextSearchVisibleOnly
| TextSearchTextOnly
mkTextIterCopy :: Ptr TextIter -> IO TextIter
makeEmptyTextIter :: IO TextIter
textIterGetBuffer :: TextIter -> IO TextBuffer
textIterCopy :: TextIter -> IO TextIter
textIterGetOffset :: TextIter -> IO Int
textIterGetLine :: TextIter -> IO Int
textIterGetLineOffset :: TextIter -> IO Int
textIterGetVisibleLineOffset :: TextIter -> IO Int
textIterGetChar :: TextIter -> IO (Maybe Char)
textIterGetSlice :: TextIter -> TextIter -> IO String
textIterGetText :: TextIter -> TextIter -> IO String
textIterGetVisibleSlice :: TextIter -> TextIter -> IO String
textIterGetVisibleText :: TextIter -> TextIter -> IO String
textIterGetPixbuf :: TextIter -> IO (Maybe Pixbuf)
textIterBeginsTag :: TextIter -> TextTag -> IO Bool
textIterEndsTag :: TextIter -> TextTag -> IO Bool
textIterTogglesTag :: TextIter -> TextTag -> IO Bool
textIterHasTag :: TextIter -> TextTag -> IO Bool
textIterEditable :: TextIter -> Bool -> IO Bool
textIterCanInsert :: TextIter -> Bool -> IO Bool
textIterStartsWord :: TextIter -> IO Bool
textIterEndsWord :: TextIter -> IO Bool
textIterInsideWord :: TextIter -> IO Bool
textIterStartsLine :: TextIter -> IO Bool
textIterEndsLine :: TextIter -> IO Bool
textIterStartsSentence :: TextIter -> IO Bool
textIterEndsSentence :: TextIter -> IO Bool
textIterInsideSentence :: TextIter -> IO Bool
textIterIsCursorPosition :: TextIter -> IO Bool
textIterGetCharsInLine :: TextIter -> IO Int
textIterIsEnd :: TextIter -> IO Bool
textIterIsStart :: TextIter -> IO Bool
textIterForwardChar :: TextIter -> IO Bool
textIterBackwardChar :: TextIter -> IO Bool
textIterForwardChars :: TextIter -> Int -> IO Bool
textIterBackwardChars :: TextIter -> Int -> IO Bool
textIterForwardLine :: TextIter -> IO Bool
textIterBackwardLine :: TextIter -> IO Bool
textIterForwardLines :: TextIter -> Int -> IO Bool
textIterBackwardLines :: TextIter -> Int -> IO Bool
textIterForwardWordEnds :: TextIter -> Int -> IO Bool
textIterBackwardWordStarts :: TextIter -> Int -> IO Bool
textIterForwardWordEnd :: TextIter -> IO Bool
textIterBackwardWordStart :: TextIter -> IO Bool
textIterForwardCursorPosition :: TextIter -> IO Bool
textIterBackwardCursorPosition :: TextIter -> IO Bool
textIterForwardCursorPositions :: TextIter -> Int -> IO Bool
textIterBackwardCursorPositions :: TextIter -> Int -> IO Bool
textIterForwardSentenceEnds :: TextIter -> Int -> IO Bool
textIterBackwardSentenceStarts :: TextIter -> Int -> IO Bool
textIterForwardSentenceEnd :: TextIter -> IO Bool
textIterBackwardSentenceStart :: TextIter -> IO Bool
textIterSetOffset :: TextIter -> Int -> IO ()
textIterSetLine :: TextIter -> Int -> IO ()
textIterSetLineOffset :: TextIter -> Int -> IO ()
textIterSetVisibleLineOffset :: TextIter -> Int -> IO ()
textIterForwardToEnd :: TextIter -> IO ()
textIterForwardToLineEnd :: TextIter -> IO Bool
textIterForwardToTagToggle :: TextIter -> Maybe TextTag -> IO Bool
textIterBackwardToTagToggle :: TextIter -> Maybe TextTag -> IO Bool
textIterForwardFindChar :: TextIter -> (Char -> Bool) -> Maybe TextIter -> IO Bool
textIterBackwardFindChar :: TextIter -> (Char -> Bool) -> Maybe TextIter -> IO Bool
textIterForwardSearch :: TextIter -> String -> [TextSearchFlags] -> Maybe TextIter -> IO (Maybe (TextIter, TextIter))
textIterBackwardSearch :: TextIter -> String -> [TextSearchFlags] -> Maybe TextIter -> IO (Maybe (TextIter, TextIter))
textIterEqual :: TextIter -> TextIter -> IO Bool
textIterCompare :: TextIter -> TextIter -> IO Ordering
textIterForwardVisibleLine :: TextIter -> IO Bool
textIterBackwardVisibleLine :: TextIter -> IO Bool
textIterForwardVisibleLines :: TextIter -> Int -> IO Bool
textIterBackwardVisibleLines :: TextIter -> Int -> IO Bool
textIterVisibleLineOffset :: Attr TextIter Int
textIterOffset :: Attr TextIter Int
textIterLineOffset :: Attr TextIter Int
textIterLine :: Attr TextIter Int
Types
newtype TextIter
Constructors
TextIter (ForeignPtr TextIter)
data TextSearchFlags
Specify the way the search function for TextBuffer works.
Constructors
TextSearchVisibleOnly
TextSearchTextOnly
show/hide Instances
Methods
mkTextIterCopy :: Ptr TextIter -> IO TextIter
makeEmptyTextIter :: IO TextIter
textIterGetBuffer :: TextIter -> IO TextBuffer
Return the TextBuffer this iterator is associated with.
textIterCopy :: TextIter -> IO TextIter
Copy the iterator.
textIterGetOffset :: TextIter -> IO Int
Extract the offset relative to the beginning of the buffer.
textIterGetLine :: TextIter -> IO Int
Extract the line of the buffer.
textIterGetLineOffset :: TextIter -> IO Int
Extract the offset relative to the beginning of the line.
textIterGetVisibleLineOffset :: TextIter -> IO Int
Extract the offset relative to the beginning of the line skipping invisible parts of the line.
textIterGetChar :: TextIter -> IO (Maybe Char)
Return the character at this iterator.
textIterGetSlice :: TextIter -> TextIter -> IO String

Return the text in a given range.

  • Pictures (and other objects) are represented by 0xFFFC.
textIterGetText :: TextIter -> TextIter -> IO String

Return the text in a given range.

  • Pictures (and other objects) are stripped form the output.
textIterGetVisibleSlice :: TextIter -> TextIter -> IO String

Return the visible text in a given range.

  • Pictures (and other objects) are represented by 0xFFFC.
textIterGetVisibleText :: TextIter -> TextIter -> IO String

Return the visible text in a given range.

  • Pictures (and other objects) are stripped form the output.
textIterGetPixbuf :: TextIter -> IO (Maybe Pixbuf)
Get the Pixbuf under the iterator.
textIterBeginsTag :: TextIter -> TextTag -> IO Bool
Query whether a TextIter is at the start of a TextTag.
textIterEndsTag :: TextIter -> TextTag -> IO Bool
Query whether a TextIter is at the end of a TextTag.
textIterTogglesTag :: TextIter -> TextTag -> IO Bool
Query if the TextIter is at the beginning or the end of a TextTag.
textIterHasTag :: TextIter -> TextTag -> IO Bool
Check if TextIter is within a range tagged with tag.
textIterEditable :: TextIter -> Bool -> IO Bool

Check if TextIter is within an editable region.

  • If no tags that affect editability are attached to the current position def will be returned.
  • This function cannot be used to decide whether text can be inserted at TextIter. Use the textIterCanInsert function for this purpose.
textIterCanInsert :: TextIter -> Bool -> IO Bool

Check if new text can be inserted at TextIter.

  • Use textBufferInsertInteractive if you want to insert text depending on the current editable status.
textIterStartsWord :: TextIter -> IO Bool
Determine if TextIter begins a new natural-language word.
textIterEndsWord :: TextIter -> IO Bool
Determine if TextIter ends a new natural-language word.
textIterInsideWord :: TextIter -> IO Bool
Determine if TextIter is inside a word.
textIterStartsLine :: TextIter -> IO Bool
Determine if TextIter begins a new line.
textIterEndsLine :: TextIter -> IO Bool

Determine if TextIter point to the beginning of a line delimiter.

  • Returns False if TextIter points to the n in a rn sequence.
textIterStartsSentence :: TextIter -> IO Bool
Determine if TextIter starts a sentence.
textIterEndsSentence :: TextIter -> IO Bool
Determine if TextIter ends a sentence.
textIterInsideSentence :: TextIter -> IO Bool
Determine if TextIter is inside a sentence.
textIterIsCursorPosition :: TextIter -> IO Bool
Determine if TextIter is at a cursor position.
textIterGetCharsInLine :: TextIter -> IO Int

Return number of characters in this line.

  • The return value includes delimiters.
textIterIsEnd :: TextIter -> IO Bool
Determine if TextIter is at the end of the buffer.
textIterIsStart :: TextIter -> IO Bool
Determine if TextIter is at the beginning of the buffer.
textIterForwardChar :: TextIter -> IO Bool

Move TextIter forwards.

  • Retuns True if the iterator is pointing to a character.
textIterBackwardChar :: TextIter -> IO Bool

Move TextIter backwards.

  • Retuns True if the movement was possible.
textIterForwardChars :: TextIter -> Int -> IO Bool

Move TextIter forwards by n characters.

  • Retuns True if the iterator is pointing to a new character (and False if the iterator points to a picture or has not moved).
textIterBackwardChars :: TextIter -> Int -> IO Bool

Move TextIter backwards by n characters.

  • Retuns True if the iterator is pointing to a new character (and False if the iterator points to a picture or has not moved).
textIterForwardLine :: TextIter -> IO Bool

Move TextIter forwards.

  • Retuns True if the iterator is pointing to a new line (and False if the iterator points to a picture or has not moved).
  • If TextIter is on the first line, it will be moved to the beginning of the buffer.
textIterBackwardLine :: TextIter -> IO Bool

Move TextIter backwards.

  • Retuns True if the iterator is pointing to a new line (and False if the iterator points to a picture or has not moved).
  • If TextIter is on the first line, it will be moved to the end of the buffer.
textIterForwardLines :: TextIter -> Int -> IO Bool

Move TextIter forwards by n lines.

  • Retuns True if the iterator is pointing to a new line (and False if the iterator points to a picture or has not moved).
  • If TextIter is on the first line, it will be moved to the beginning of the buffer.
  • n can be negative.
textIterBackwardLines :: TextIter -> Int -> IO Bool

Move TextIter backwards by n lines.

  • Retuns True if the iterator is pointing to a new line (and False if the iterator points to a picture or has not moved).
  • If TextIter is on the first line, it will be moved to the end of the buffer.
  • n can be negative.
textIterForwardWordEnds :: TextIter -> Int -> IO Bool

Move TextIter forwards by n word ends.

  • Retuns True if the iterator is pointing to a new word end.
textIterBackwardWordStarts :: TextIter -> Int -> IO Bool

Move TextIter backwards by n word beginnings.

  • Retuns True if the iterator is pointing to a new word start.
textIterForwardWordEnd :: TextIter -> IO Bool

Move TextIter forwards to the next word end.

  • Retuns True if the iterator has moved to a new word end.
textIterBackwardWordStart :: TextIter -> IO Bool

Move TextIter backwards to the next word beginning.

  • Retuns True if the iterator has moved to a new word beginning.
textIterForwardCursorPosition :: TextIter -> IO Bool

Move TextIter forwards to the next cursor position.

  • Some characters are composed of two Unicode codes. This function ensures that TextIter does not point inbetween such double characters.
  • Returns True if TextIter moved and points to a character (not to an object).
textIterBackwardCursorPosition :: TextIter -> IO Bool

Move TextIter backwards to the next cursor position.

  • Some characters are composed of two Unicode codes. This function ensures that TextIter does not point inbetween such double characters.
  • Returns True if TextIter moved and points to a character (not to an object).
textIterForwardCursorPositions :: TextIter -> Int -> IO Bool

Move TextIter forwards by n cursor positions.

  • Returns True if TextIter moved and points to a character (not to an object).
textIterBackwardCursorPositions :: TextIter -> Int -> IO Bool

Move TextIter backwards by n cursor positions.

  • Returns True if TextIter moved and points to a character (not to an object).
textIterForwardSentenceEnds :: TextIter -> Int -> IO Bool

Move TextIter forwards by n sentence ends.

  • Retuns True if the iterator is pointing to a new sentence end.
textIterBackwardSentenceStarts :: TextIter -> Int -> IO Bool

Move TextIter backwards by n sentence beginnings.

  • Retuns True if the iterator is pointing to a new sentence start.
textIterForwardSentenceEnd :: TextIter -> IO Bool

Move TextIter forwards to the next sentence end.

  • Retuns True if the iterator has moved to a new sentence end.
textIterBackwardSentenceStart :: TextIter -> IO Bool

Move TextIter backwards to the next sentence beginning.

  • Retuns True if the iterator has moved to a new sentence beginning.
textIterSetOffset :: TextIter -> Int -> IO ()
Set TextIter to an offset within the buffer.
textIterSetLine :: TextIter -> Int -> IO ()
Set TextIter to a line within the buffer.
textIterSetLineOffset :: TextIter -> Int -> IO ()
Set TextIter to an offset within the line.
textIterSetVisibleLineOffset :: TextIter -> Int -> IO ()
Set TextIter to an visible character within the line.
textIterForwardToEnd :: TextIter -> IO ()
Moves TextIter to the end of the buffer.
textIterForwardToLineEnd :: TextIter -> IO Bool

Moves TextIter to the end of the line.

  • Returns True if TextIter moved to a new location which is not the buffer end iterator.
textIterForwardToTagToggle :: TextIter -> Maybe TextTag -> IO Bool

Moves TextIter forward to the next change of a TextTag.

  • If Nothing is supplied, any TextTag will be matched.
  • Returns True if there was a tag toggle after TextIter.
textIterBackwardToTagToggle :: TextIter -> Maybe TextTag -> IO Bool

Moves TextIter backward to the next change of a TextTag.

  • If Nothing is supplied, any TextTag will be matched.
  • Returns True if there was a tag toggle before TextIter.
textIterForwardFindChar :: TextIter -> (Char -> Bool) -> Maybe TextIter -> IO Bool

Move TextIter forward until a predicate function returns True.

  • If pred returns True before limit is reached, the search is stopped and the return value is True.
  • If limit is Nothing, the search stops at the end of the buffer.
textIterBackwardFindChar :: TextIter -> (Char -> Bool) -> Maybe TextIter -> IO Bool

Move TextIter backward until a predicate function returns True.

  • If pred returns True before limit is reached, the search is stopped and the return value is True.
  • If limit is Nothing, the search stops at the end of the buffer.
textIterForwardSearch :: TextIter -> String -> [TextSearchFlags] -> Maybe TextIter -> IO (Maybe (TextIter, TextIter))

Search forward for a specific string.

  • If specified, the last character which is tested against that start of the search pattern will be limit.
  • TextSearchFlags may be empty.
  • Returns the start and end position of the string found.
textIterBackwardSearch :: TextIter -> String -> [TextSearchFlags] -> Maybe TextIter -> IO (Maybe (TextIter, TextIter))

Search backward for a specific string.

  • If specified, the last character which is tested against that start of the search pattern will be limit.
  • TextSearchFlags my be empty.
  • Returns the start and end position of the string found.
textIterEqual :: TextIter -> TextIter -> IO Bool

Compare two TextIter for equality.

  • TextIter could be in class Eq and Ord if there is a guarantee that each iterator is copied before it is modified in place. This is done the next abstraction layer.
textIterCompare :: TextIter -> TextIter -> IO Ordering

Compare two TextIter.

  • TextIter could be in class Eq and Ord if there is a guarantee that each iterator is copied before it is modified in place. This could be done the next abstraction layer.
textIterForwardVisibleLine
:: TextIter
-> IO Boolreturns whether iter can be dereferenced

Moves iter to the start of the next visible line. Returns True if there was a next line to move to, and False if iter was simply moved to the end of the buffer and is now not dereferenceable, or if iter was already at the end of the buffer.

  • Available since Gtk+ version 2.8
textIterBackwardVisibleLine
:: TextIter
-> IO Boolreturns whether iter moved

Moves iter to the start of the previous visible line. Returns True if iter could be moved; i.e. if iter was at character offset 0, this function returns False. Therefore if iter was already on line 0, but not at the start of the line, iter is snapped to the start of the line and the function returns True. (Note that this implies that in a loop calling this function, the line number may not change on every iteration, if your first iteration is on line 0.)

  • Available since Gtk+ version 2.8
textIterForwardVisibleLines
:: TextIter
-> Intcount - number of lines to move forward
-> IO Boolreturns whether iter moved and is dereferenceable

Moves count visible lines forward, if possible (if count would move past the start or end of the buffer, moves to the start or end of the buffer). The return value indicates whether the iterator moved onto a dereferenceable position; if the iterator didn't move, or moved onto the end iterator, then False is returned. If count is 0, the function does nothing and returns False. If count is negative, moves backward by 0 - count lines.

  • Available since Gtk+ version 2.8
textIterBackwardVisibleLines
:: TextIter
-> Intcount - number of lines to move backward
-> IO Boolreturns whether iter moved and is dereferenceable

Moves count visible lines backward, if possible (if count would move past the start or end of the buffer, moves to the start or end of the buffer). The return value indicates whether the iterator moved onto a dereferenceable position; if the iterator didn't move, or moved onto the end iterator, then False is returned. If count is 0, the function does nothing and returns False. If count is negative, moves forward by 0 - count lines.

  • Available since Gtk+ version 2.8
Attributes
textIterVisibleLineOffset :: Attr TextIter Int
'visibleLineOffset' property. See textIterGetVisibleLineOffset and textIterSetVisibleLineOffset
textIterOffset :: Attr TextIter Int
'offset' property. See textIterGetOffset and textIterSetOffset
textIterLineOffset :: Attr TextIter Int
'lineOffset' property. See textIterGetLineOffset and textIterSetLineOffset
textIterLine :: Attr TextIter Int
'line' property. See textIterGetLine and textIterSetLine
Produced by Haddock version 0.7