org.gnu.gtk

Class TextIter


public class TextIter
extends Boxed

The Text Editor objects are discussed in detail in the TextView widget overview.

Field Summary

Fields inherited from class org.gnu.glib.Boxed

handle

Constructor Summary

TextIter(Handle handle)

Method Summary

boolean
beginsTag(TextTag tag)
Returns TRUE if tag is toggled on at exactly this point.
int
cmp(TextIter other)
A qsort()-style function that returns negative if lhs is less than rhs, positive if lhs is greater than rhs, and 0 if they're equal.
boolean
endsTag(TextTag tag)
Returns TRUE if tag is toggled off at exactly this point.
boolean
equals(TextIter other)
Tests whether two iterators are equal, using the fastest possible mechanism.
boolean
getAttributes(TextAttributes values)
Computes the effect of any tags applied to this spot in the text.
TextBuffer
getBuffer()
Returns the associated buffer
boolean
getCanInsert(boolean defaultSetting)
Considering the default editability of the buffer, and tags that affect editability, determines whether text inserted at iter would be editable.
char
getChar()
Returns the Unicode character at this iterator.
int
getCharsInLine()
Returns the number of characters in the line containing iter, including the paragraph delimiters.
TextChildAnchor
getChildAnchor()
If the location pointed to by iter contains a child anchor, the anchor is returned (with no new reference count added).
boolean
getEditable(boolean defaultSetting)
Returns whether the character at iter is within an editable region of text.
boolean
getEndsLine()
Returns TRUE if iter points to the start of the paragraph delimiter characters for a line (delimiters will be either a newline, a carriage return, a carriage return followed by a newline, or a Unicode paragraph separator character).
boolean
getEndsSentence()
Determines whether iter ends a sentence.
boolean
getEndsWord()
Determines whether iter ends a natural-language word.
boolean
getInsideSentence()
Determines whether iter is inside a sentence (as opposed to in between two sentences, eg after a period and before the first letter of the next sentence).
boolean
getInsideWord()
Determines whether iter is inside a natural-language word (as opposed to say inside some whitespace).
boolean
getIsCursorPosition()
boolean
getIsEndIter()
Returns TRUE if iter is the end iterator, ie one past the last dereferenceable iterator in the buffer.
boolean
getIsStartIter()
Returns TRUE if iter is the first iterator in the buffer, that is if iter has a character offset of 0.
Language
getLanguage()
A convenience wrapper which returns the language in effect at iter.
int
getLineNumber()
Returns the line number containing the iterator.
int
getLineOffset()
Returns the character offset of the iterator, counting from the start of a newline-terminated line.
int
getOffset()
Returns the character offset of an iterator.
Pixbuf
getPixbuf()
If the location pointed to by iter contains a pixbuf, the pixbuf is returned (with no new reference count added).
boolean
getStartsLine()
Returns TRUE if iter begins a paragraph, ie if getLineOffset() would return 0.
boolean
getStartsSentence()
Determines whether iter begins a sentence.
boolean
getStartsWord()
Determines whether iter begins a natural-language word.
int
getVisibleLineOffset()
Returns the offset in characters from the start of the line to the given iter, not counting characters that are invisible due to tags with the "invisible" flag toggled on.
protected static boolean
gtk_text_iter_backward_char(Handle iter)
protected static boolean
gtk_text_iter_backward_chars(Handle iter, int count)
protected static boolean
gtk_text_iter_backward_cursor_position(Handle iter)
protected static boolean
gtk_text_iter_backward_cursor_positions(Handle iter, int count)
protected static boolean
gtk_text_iter_backward_line(Handle iter)
protected static boolean
gtk_text_iter_backward_lines(Handle iter, int count)
protected static boolean
gtk_text_iter_backward_search(Handle iter, String str, int flags, Handle matchStart, Handle matchEnd, Handle limit)
protected static boolean
gtk_text_iter_backward_sentence_start(Handle iter)
protected static boolean
gtk_text_iter_backward_sentence_starts(Handle iter, int count)
protected static boolean
gtk_text_iter_backward_to_tag_toggle(Handle iter, Handle tag)
protected static boolean
gtk_text_iter_backward_word_start(Handle iter)
protected static boolean
gtk_text_iter_backward_word_starts(Handle iter, int count)
protected static boolean
gtk_text_iter_begins_tag(Handle iter, Handle tag)
protected static boolean
gtk_text_iter_can_insert(Handle iter, boolean defaultEditablity)
protected static int
gtk_text_iter_compare(Handle lhs, Handle rhs)
protected static Handle
gtk_text_iter_copy(Handle iter)
protected static boolean
gtk_text_iter_editable(Handle iter, boolean defaultSetting)
protected static boolean
gtk_text_iter_ends_line(Handle iter)
protected static boolean
gtk_text_iter_ends_sentence(Handle iter)
protected static boolean
gtk_text_iter_ends_tag(Handle iter, Handle tag)
protected static boolean
gtk_text_iter_ends_word(Handle iter)
protected static boolean
gtk_text_iter_equal(Handle lhs, Handle rhs)
protected static boolean
gtk_text_iter_forward_char(Handle iter)
protected static boolean
gtk_text_iter_forward_chars(Handle iter, int count)
protected static boolean
gtk_text_iter_forward_cursor_position(Handle iter)
protected static boolean
gtk_text_iter_forward_cursor_positions(Handle iter, int count)
protected static boolean
gtk_text_iter_forward_line(Handle iter)
protected static boolean
gtk_text_iter_forward_lines(Handle iter, int count)
protected static boolean
gtk_text_iter_forward_search(Handle iter, String str, int flags, Handle matchStart, Handle matchEnd, Handle limit)
protected static boolean
gtk_text_iter_forward_sentence_end(Handle iter)
protected static boolean
gtk_text_iter_forward_sentence_ends(Handle iter, int count)
protected static void
gtk_text_iter_forward_to_end(Handle iter)
protected static boolean
gtk_text_iter_forward_to_line_end(Handle iter)
protected static boolean
gtk_text_iter_forward_to_tag_toggle(Handle iter, Handle tag)
protected static boolean
gtk_text_iter_forward_word_end(Handle iter)
protected static boolean
gtk_text_iter_forward_word_ends(Handle iter, int count)
protected static void
gtk_text_iter_free(Handle iter)
protected static boolean
gtk_text_iter_get_attributes(Handle iter, Handle values)
protected static Handle
gtk_text_iter_get_buffer(Handle iter)
protected static int
gtk_text_iter_get_bytes_in_line(Handle iter)
protected static char
gtk_text_iter_get_char(Handle iter)
protected static int
gtk_text_iter_get_chars_in_line(Handle iter)
protected static Handle
gtk_text_iter_get_child_anchor(Handle iter)
protected static Handle
gtk_text_iter_get_language(Handle iter)
protected static int
gtk_text_iter_get_line(Handle iter)
protected static int
gtk_text_iter_get_line_index(Handle iter)
protected static int
gtk_text_iter_get_line_offset(Handle iter)
protected static int
gtk_text_iter_get_offset(Handle iter)
protected static Handle
gtk_text_iter_get_pixbuf(Handle iter)
protected static String
gtk_text_iter_get_slice(Handle start, Handle end)
protected static String
gtk_text_iter_get_text(Handle start, Handle end)
protected static int
gtk_text_iter_get_visible_line_index(Handle iter)
protected static int
gtk_text_iter_get_visible_line_offset(Handle iter)
protected static String
gtk_text_iter_get_visible_slice(Handle start, Handle end)
protected static String
gtk_text_iter_get_visible_text(Handle start, Handle end)
protected static boolean
gtk_text_iter_has_tag(Handle iter, Handle tag)
protected static boolean
gtk_text_iter_in_range(Handle iter, Handle start, Handle end)
protected static boolean
gtk_text_iter_inside_sentence(Handle iter)
protected static boolean
gtk_text_iter_inside_word(Handle iter)
protected static boolean
gtk_text_iter_isChildAnchor(Handle handle)
protected static boolean
gtk_text_iter_isPixbuf(Handle handle)
protected static boolean
gtk_text_iter_is_cursor_position(Handle iter)
protected static boolean
gtk_text_iter_is_end(Handle iter)
protected static boolean
gtk_text_iter_is_start(Handle iter)
protected static void
gtk_text_iter_order(Handle first, Handle second)
protected static void
gtk_text_iter_set_line(Handle iter, int lineNumber)
protected static void
gtk_text_iter_set_line_index(Handle iter, int byteOnLine)
protected static void
gtk_text_iter_set_line_offset(Handle iter, int charOnLine)
protected static void
gtk_text_iter_set_offset(Handle iter, int charOffset)
protected static void
gtk_text_iter_set_visible_line_index(Handle iter, int byteOnLine)
protected static void
gtk_text_iter_set_visible_line_offset(Handle iter, int charOnLine)
protected static boolean
gtk_text_iter_starts_line(Handle iter)
protected static boolean
gtk_text_iter_starts_sentence(Handle iter)
protected static boolean
gtk_text_iter_starts_word(Handle iter)
protected static boolean
gtk_text_iter_toggles_tag(Handle iter, Handle tag)
boolean
hasTag(TextTag tag)
Returns TRUE if iter is within a range tagged with tag.
boolean
inRange(TextIter start, TextIter end)
Checks whether iter falls in the range [start, end).
boolean
isChildAnchor()
Returns true is this location is a child anchor.
boolean
isPixbuf()
Returns true if iter points to a pixbuf.
boolean
moveBackwardChar()
Moves backward by one character offset.
boolean
moveBackwardChar(int count)
Moves count characters backward, if possible (if count would move past the start or end of the buffer, moves to the start or end of the buffer).
boolean
moveBackwardCursorPosition()
Like moveForwardCursorPosition(), but moves backward.
boolean
moveBackwardCursorPosition(int count)
Moves up to count cursor positions.
boolean
moveBackwardLine()
Moves iter to the start of the previous line.
boolean
moveBackwardLine(int count)
Moves count 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).
boolean
moveBackwardSentenceStart()
Moves backward to the previous sentence start; if iter is already at the start of a sentence, moves backward to the next one.
boolean
moveBackwardSentenceStart(int count)
Calls moveBackwardSentenceStart() up to count times, or until it returns FALSE.
boolean
moveBackwardToggle(TextTag tag)
Moves backward to the next toggle (on or off) of the TextTag tag.
boolean
moveBackwardWordStart()
Moves backward to the previous word start.
boolean
moveBackwardWordStart(int count)
Calls moveBackwardWordStart() up to count times.
boolean
moveForwardChar()
Moves iter forward by one character offset.
boolean
moveForwardChar(int count)
Moves count characters if possible (if count would move past the start or end of the buffer, moves to the start or end of the buffer).
boolean
moveForwardCursorPosition()
Moves iter forward by a single cursor position.
boolean
moveForwardCursorPosition(int count)
Moves up to count cursor positions.
boolean
moveForwardLine()
Moves iter to the start of the next line.
boolean
moveForwardLine(int count)
Moves count 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).
boolean
moveForwardSentenceEnd()
Moves forward to the next sentence end.
boolean
moveForwardSentenceEnd(int count)
Calls moveForwardSentenceEnd() count times (or until it returns FALSE).
boolean
moveForwardToggle(TextTag tag)
Moves forward to the next toggle (on or off) of the TextTag tag.
boolean
moveForwardWordEnd()
Moves forward to the next word end.
boolean
moveForwardWordEnd(int count)
Calls moveForwardWordEnd() up to count times.
void
moveToEnd()
Moves iter forward to the "end iterator," which points one past the last valid character in the buffer.
boolean
moveToLineEnd()
Moves the iterator to point to the paragraph delimiter characters, which will be either a newline, a carriage return, a carriage return/newline in sequence, or the Unicode paragraph separator character.
boolean
searchBackward(String str, TextSearchFlags flags, TextIter matchStart, TextIter matchEnd, TextIter limit)
Same as searchForward(String,TextSearchFlags,TextIter,TextIter,TextIter), but moves backward.
boolean
searchForward(String str, TextSearchFlags flags, TextIter matchStart, TextIter matchEnd, TextIter limit)
Searches forward for str.
void
setCharOffset(int charOffset)
Sets iter to point to charOffset.
void
setLine(int lineNumber)
Moves iterator iter to the start of the line lineNumber.
void
setLineOffset(int charOnLine)
Moves iter within a line, to a new character (not byte) offset.
void
setVisibleLineOffset(int charOnLine)
Like setLineOffset(int), but the offset is in visible characters, ie text with a tag making it invisible is not counted in the offset.

Methods inherited from class org.gnu.glib.Boxed

equals, getHandle, hashCode, setHandle

Constructor Details

TextIter

protected TextIter(Handle handle)

Method Details

beginsTag

public boolean beginsTag(TextTag tag)
Returns TRUE if tag is toggled on at exactly this point. Note that this returns TRUE if iter is the start of the tagged range; hasTag(TextTag) tells you whether an iterator is within a tagged range.

Parameters:
tag - A TextTag

Returns:
Whether iter is the start of a range tagged with tag


cmp

public int cmp(TextIter other)
A qsort()-style function that returns negative if lhs is less than rhs, positive if lhs is greater than rhs, and 0 if they're equal. Ordering is in character offset order, i.e. the first character in the buffer is less than the second character in the buffer.

Parameters:
other - Iterator to test

Returns:
-1 if lhs is less than rhs, 1 if lhs is greater, 0 if they are equal


endsTag

public boolean endsTag(TextTag tag)
Returns TRUE if tag is toggled off at exactly this point. Note that this returns TRUE if iter is the end of the tagged range; hasTag(TextTag) tells you whether an iterator is within a tagged range.

Parameters:
tag - A TextTag

Returns:
Whether iter is the end of a range tagged with tag


equals

public boolean equals(TextIter other)
Tests whether two iterators are equal, using the fastest possible mechanism. This function is very fast; you can expect it to perform better than e.g. getting the character offset for each iterator and comparing the offsets yourself.

Parameters:
other - Iterator to test

Returns:
TRUE if the iterators point to the same place in the buffer


getAttributes

public boolean getAttributes(TextAttributes values)
Computes the effect of any tags applied to this spot in the text. The values parameter should be initialized to the default settings you wish to use if no tags are in effect. You'd typically obtain the defaults from TextView.getDefaultAttributes().

This will modify values, applying the effects of any tags present at iter. If any tags affected values, the function returns TRUE.

Parameters:
values - A TextAttributes to be filled in

Returns:
TRUE if values was modified


getBuffer

public TextBuffer getBuffer()
Returns the associated buffer

Returns:
associated buffer


getCanInsert

public boolean getCanInsert(boolean defaultSetting)
Considering the default editability of the buffer, and tags that affect editability, determines whether text inserted at iter would be editable. If text inserted at iter would be editable then the user should be allowed to insert text at iter.

Parameters:
defaultSetting - TRUE if text is editable by default

Returns:
Whether text inserted at iter would be editable


getChar

public char getChar()
Returns the Unicode character at this iterator. (Equivalent to operator* on a C++ iterator.) If the iterator points at a non-character element, such as an image embedded in the buffer, the Unicode "unknown" character 0xFFFC is returned. If invoked on the end iterator, zero is returned; zero is not a valid Unicode character.

Returns:
a Unicode character, or 0 if iter is not dereferenceable


getCharsInLine

public int getCharsInLine()
Returns the number of characters in the line containing iter, including the paragraph delimiters.


getChildAnchor

public TextChildAnchor getChildAnchor()
If the location pointed to by iter contains a child anchor, the anchor is returned (with no new reference count added). Otherwise, null is returned.


getEditable

public boolean getEditable(boolean defaultSetting)

Parameters:
defaultSetting - TRUE if text is editable by default

Returns:
Whether iter is inside an editable range


getEndsLine

public boolean getEndsLine()
Returns TRUE if iter points to the start of the paragraph delimiter characters for a line (delimiters will be either a newline, a carriage return, a carriage return followed by a newline, or a Unicode paragraph separator character). Note that an iterator pointing to the \n of a \r\n pair will not be counted as the end of a line, the line ends before the \r. The end iterator is considered to be at the end of a line, even though there are no paragraph delimiter chars there.


getEndsSentence

public boolean getEndsSentence()
Determines whether iter ends a sentence. Sentence boundaries are determined by Pango and should be correct for nearly any language (if not, the correct fix would be to the Pango text boundary algorithms).


getEndsWord

public boolean getEndsWord()
Determines whether iter ends a natural-language word. Word breaks are determined by Pango and should be correct for nearly any language (if not, the correct fix would be to the Pango word break algorithms).


getInsideSentence

public boolean getInsideSentence()
Determines whether iter is inside a sentence (as opposed to in between two sentences, eg after a period and before the first letter of the next sentence). Sentence boundaries are determined by Pango and should be correct for nearly any language (if not, the correct fix would be to the Pango text boundary algorithms).


getInsideWord

public boolean getInsideWord()
Determines whether iter is inside a natural-language word (as opposed to say inside some whitespace). Word breaks are determined by Pango and should be correct for nearly any language (if not, the correct fix would be to the Pango word break algorithms).


getIsCursorPosition

public boolean getIsCursorPosition()

Returns:
TRUE if the cursor can be placed at iter


getIsEndIter

public boolean getIsEndIter()
Returns TRUE if iter is the end iterator, ie one past the last dereferenceable iterator in the buffer. This is the most efficient way to check whether an iterator is the end iterator.


getIsStartIter

public boolean getIsStartIter()
Returns TRUE if iter is the first iterator in the buffer, that is if iter has a character offset of 0.


getLanguage

public Language getLanguage()
A convenience wrapper which returns the language in effect at iter. If no tags affecting language apply to iter, the return value is identical to that of gtk_get_default_language().


getLineNumber

public int getLineNumber()
Returns the line number containing the iterator. Lines in a GtkTextBuffer are numbered beginning with 0 for the first line in the buffer.

Returns:
the line number.


getLineOffset

public int getLineOffset()
Returns the character offset of the iterator, counting from the start of a newline-terminated line. The first character on the line has offset 0.

Returns:
Character offset from start of line.


getOffset

public int getOffset()
Returns the character offset of an iterator. Each character in a GtkTextBuffer has an offset, starting with 0 for the first character in the buffer.


getPixbuf

public Pixbuf getPixbuf()
If the location pointed to by iter contains a pixbuf, the pixbuf is returned (with no new reference count added). Otherwise, null is returned.


getStartsLine

public boolean getStartsLine()
Returns TRUE if iter begins a paragraph, ie if getLineOffset() would return 0. However this function is potentially more efficient than getLineOffset() because it doesn't have to compute the offset, it just has to see whether it's 0.


getStartsSentence

public boolean getStartsSentence()
Determines whether iter begins a sentence. Sentence boundaries are determined by Pango and should be correct for nearly any language (if not, the correct fix would be to the Pango text boundary algorithms).


getStartsWord

public boolean getStartsWord()
Determines whether iter begins a natural-language word. Word breaks are determined by Pango and should be correct for nearly any language (if not, the correct fix would be to the Pango word break algorithms).


getVisibleLineOffset

public int getVisibleLineOffset()
Returns the offset in characters from the start of the line to the given iter, not counting characters that are invisible due to tags with the "invisible" flag toggled on.


gtk_text_iter_backward_char

protected static final boolean gtk_text_iter_backward_char(Handle iter)


gtk_text_iter_backward_chars

protected static final boolean gtk_text_iter_backward_chars(Handle iter,
                                                            int count)


gtk_text_iter_backward_cursor_position

protected static final boolean gtk_text_iter_backward_cursor_position(Handle iter)


gtk_text_iter_backward_cursor_positions

protected static final boolean gtk_text_iter_backward_cursor_positions(Handle iter,
                                                                       int count)


gtk_text_iter_backward_line

protected static final boolean gtk_text_iter_backward_line(Handle iter)


gtk_text_iter_backward_lines

protected static final boolean gtk_text_iter_backward_lines(Handle iter,
                                                            int count)


gtk_text_iter_backward_search

protected static final boolean gtk_text_iter_backward_search(Handle iter,
                                                             String str,
                                                             int flags,
                                                             Handle matchStart,
                                                             Handle matchEnd,
                                                             Handle limit)


gtk_text_iter_backward_sentence_start

protected static final boolean gtk_text_iter_backward_sentence_start(Handle iter)


gtk_text_iter_backward_sentence_starts

protected static final boolean gtk_text_iter_backward_sentence_starts(Handle iter,
                                                                      int count)


gtk_text_iter_backward_to_tag_toggle

protected static final boolean gtk_text_iter_backward_to_tag_toggle(Handle iter,
                                                                    Handle tag)


gtk_text_iter_backward_word_start

protected static final boolean gtk_text_iter_backward_word_start(Handle iter)


gtk_text_iter_backward_word_starts

protected static final boolean gtk_text_iter_backward_word_starts(Handle iter,
                                                                  int count)


gtk_text_iter_begins_tag

protected static final boolean gtk_text_iter_begins_tag(Handle iter,
                                                        Handle tag)


gtk_text_iter_can_insert

protected static final boolean gtk_text_iter_can_insert(Handle iter,
                                                        boolean defaultEditablity)


gtk_text_iter_compare

protected static final int gtk_text_iter_compare(Handle lhs,
                                                 Handle rhs)


gtk_text_iter_copy

protected static final Handle gtk_text_iter_copy(Handle iter)


gtk_text_iter_editable

protected static final boolean gtk_text_iter_editable(Handle iter,
                                                      boolean defaultSetting)


gtk_text_iter_ends_line

protected static final boolean gtk_text_iter_ends_line(Handle iter)


gtk_text_iter_ends_sentence

protected static final boolean gtk_text_iter_ends_sentence(Handle iter)


gtk_text_iter_ends_tag

protected static final boolean gtk_text_iter_ends_tag(Handle iter,
                                                      Handle tag)


gtk_text_iter_ends_word

protected static final boolean gtk_text_iter_ends_word(Handle iter)


gtk_text_iter_equal

protected static final boolean gtk_text_iter_equal(Handle lhs,
                                                   Handle rhs)


gtk_text_iter_forward_char

protected static final boolean gtk_text_iter_forward_char(Handle iter)


gtk_text_iter_forward_chars

protected static final boolean gtk_text_iter_forward_chars(Handle iter,
                                                           int count)


gtk_text_iter_forward_cursor_position

protected static final boolean gtk_text_iter_forward_cursor_position(Handle iter)


gtk_text_iter_forward_cursor_positions

protected static final boolean gtk_text_iter_forward_cursor_positions(Handle iter,
                                                                      int count)


gtk_text_iter_forward_line

protected static final boolean gtk_text_iter_forward_line(Handle iter)


gtk_text_iter_forward_lines

protected static final boolean gtk_text_iter_forward_lines(Handle iter,
                                                           int count)


gtk_text_iter_forward_search

protected static final boolean gtk_text_iter_forward_search(Handle iter,
                                                            String str,
                                                            int flags,
                                                            Handle matchStart,
                                                            Handle matchEnd,
                                                            Handle limit)


gtk_text_iter_forward_sentence_end

protected static final boolean gtk_text_iter_forward_sentence_end(Handle iter)


gtk_text_iter_forward_sentence_ends

protected static final boolean gtk_text_iter_forward_sentence_ends(Handle iter,
                                                                   int count)


gtk_text_iter_forward_to_end

protected static final void gtk_text_iter_forward_to_end(Handle iter)


gtk_text_iter_forward_to_line_end

protected static final boolean gtk_text_iter_forward_to_line_end(Handle iter)


gtk_text_iter_forward_to_tag_toggle

protected static final boolean gtk_text_iter_forward_to_tag_toggle(Handle iter,
                                                                   Handle tag)


gtk_text_iter_forward_word_end

protected static final boolean gtk_text_iter_forward_word_end(Handle iter)


gtk_text_iter_forward_word_ends

protected static final boolean gtk_text_iter_forward_word_ends(Handle iter,
                                                               int count)


gtk_text_iter_free

protected static final void gtk_text_iter_free(Handle iter)


gtk_text_iter_get_attributes

protected static final boolean gtk_text_iter_get_attributes(Handle iter,
                                                            Handle values)


gtk_text_iter_get_buffer

protected static final Handle gtk_text_iter_get_buffer(Handle iter)


gtk_text_iter_get_bytes_in_line

protected static final int gtk_text_iter_get_bytes_in_line(Handle iter)


gtk_text_iter_get_char

protected static final char gtk_text_iter_get_char(Handle iter)


gtk_text_iter_get_chars_in_line

protected static final int gtk_text_iter_get_chars_in_line(Handle iter)


gtk_text_iter_get_child_anchor

protected static final Handle gtk_text_iter_get_child_anchor(Handle iter)


gtk_text_iter_get_language

protected static final Handle gtk_text_iter_get_language(Handle iter)


gtk_text_iter_get_line

protected static final int gtk_text_iter_get_line(Handle iter)


gtk_text_iter_get_line_index

protected static final int gtk_text_iter_get_line_index(Handle iter)


gtk_text_iter_get_line_offset

protected static final int gtk_text_iter_get_line_offset(Handle iter)


gtk_text_iter_get_offset

protected static final int gtk_text_iter_get_offset(Handle iter)


gtk_text_iter_get_pixbuf

protected static final Handle gtk_text_iter_get_pixbuf(Handle iter)


gtk_text_iter_get_slice

protected static final String gtk_text_iter_get_slice(Handle start,
                                                      Handle end)


gtk_text_iter_get_text

protected static final String gtk_text_iter_get_text(Handle start,
                                                     Handle end)


gtk_text_iter_get_visible_line_index

protected static final int gtk_text_iter_get_visible_line_index(Handle iter)


gtk_text_iter_get_visible_line_offset

protected static final int gtk_text_iter_get_visible_line_offset(Handle iter)


gtk_text_iter_get_visible_slice

protected static final String gtk_text_iter_get_visible_slice(Handle start,
                                                              Handle end)


gtk_text_iter_get_visible_text

protected static final String gtk_text_iter_get_visible_text(Handle start,
                                                             Handle end)


gtk_text_iter_has_tag

protected static final boolean gtk_text_iter_has_tag(Handle iter,
                                                     Handle tag)


gtk_text_iter_in_range

protected static final boolean gtk_text_iter_in_range(Handle iter,
                                                      Handle start,
                                                      Handle end)


gtk_text_iter_inside_sentence

protected static final boolean gtk_text_iter_inside_sentence(Handle iter)


gtk_text_iter_inside_word

protected static final boolean gtk_text_iter_inside_word(Handle iter)


gtk_text_iter_isChildAnchor

protected static final boolean gtk_text_iter_isChildAnchor(Handle handle)


gtk_text_iter_isPixbuf

protected static final boolean gtk_text_iter_isPixbuf(Handle handle)


gtk_text_iter_is_cursor_position

protected static final boolean gtk_text_iter_is_cursor_position(Handle iter)


gtk_text_iter_is_end

protected static final boolean gtk_text_iter_is_end(Handle iter)


gtk_text_iter_is_start

protected static final boolean gtk_text_iter_is_start(Handle iter)


gtk_text_iter_order

protected static final void gtk_text_iter_order(Handle first,
                                                Handle second)


gtk_text_iter_set_line

protected static final void gtk_text_iter_set_line(Handle iter,
                                                   int lineNumber)


gtk_text_iter_set_line_index

protected static final void gtk_text_iter_set_line_index(Handle iter,
                                                         int byteOnLine)


gtk_text_iter_set_line_offset

protected static final void gtk_text_iter_set_line_offset(Handle iter,
                                                          int charOnLine)


gtk_text_iter_set_offset

protected static final void gtk_text_iter_set_offset(Handle iter,
                                                     int charOffset)


gtk_text_iter_set_visible_line_index

protected static final void gtk_text_iter_set_visible_line_index(Handle iter,
                                                                 int byteOnLine)


gtk_text_iter_set_visible_line_offset

protected static final void gtk_text_iter_set_visible_line_offset(Handle iter,
                                                                  int charOnLine)


gtk_text_iter_starts_line

protected static final boolean gtk_text_iter_starts_line(Handle iter)


gtk_text_iter_starts_sentence

protected static final boolean gtk_text_iter_starts_sentence(Handle iter)


gtk_text_iter_starts_word

protected static final boolean gtk_text_iter_starts_word(Handle iter)


gtk_text_iter_toggles_tag

protected static final boolean gtk_text_iter_toggles_tag(Handle iter,
                                                         Handle tag)


hasTag

public boolean hasTag(TextTag tag)
Returns TRUE if iter is within a range tagged with tag.

Returns:
whether iter is tagged with tag


inRange

public boolean inRange(TextIter start,
                       TextIter end)
Checks whether iter falls in the range [start, end). The start and end must be in ascending order.

Parameters:
start - Start of range
end - End of range

Returns:
TRUE if iter is in the range


isChildAnchor

public boolean isChildAnchor()
Returns true is this location is a child anchor.


isPixbuf

public boolean isPixbuf()
Returns true if iter points to a pixbuf.


moveBackwardChar

public boolean moveBackwardChar()
Moves backward by one character offset. Returns TRUE if movement was possible; if iter was the first in the buffer (character offset 0), gtk_text_iter_backward_char() returns FALSE for convenience when writing loops.


moveBackwardChar

public boolean moveBackwardChar(int count)
Moves count characters 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.

Parameters:
count - Number of characters to move

Returns:
Whether iter moved and is dereferenceable


moveBackwardCursorPosition

public boolean moveBackwardCursorPosition()
Like moveForwardCursorPosition(), but moves backward.


moveBackwardCursorPosition

public boolean moveBackwardCursorPosition(int count)


moveBackwardLine

public boolean moveBackwardLine()
Moves iter to the start of the previous 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.)


moveBackwardLine

public boolean moveBackwardLine(int count)
Moves count 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.


moveBackwardSentenceStart

public boolean moveBackwardSentenceStart()
Moves backward to the previous sentence start; if iter is already at the start of a sentence, moves backward to the next one. Sentence boundaries are determined by Pango and should be correct for nearly any language (if not, the correct fix would be to the Pango text boundary algorithms).


moveBackwardSentenceStart

public boolean moveBackwardSentenceStart(int count)
Calls moveBackwardSentenceStart() up to count times, or until it returns FALSE. If count is negative, moves forward instead of backward.


moveBackwardToggle

public boolean moveBackwardToggle(TextTag tag)
Moves backward to the next toggle (on or off) of the TextTag tag. If no matching tag toggles are found, returns FALSE, otherwise TRUE. Does not return toggles located at iter, only toggles before iter. Sets iter to the location of the toggle, or the start of the buffer if no toggle is found.


moveBackwardWordStart

public boolean moveBackwardWordStart()
Moves backward to the previous word start. (If iter is currently on a word start, moves backward to the next one after that.) Word breaks are determined by Pango and should be correct for nearly any language (if not, the correct fix would be to the Pango word break algorithms).


moveBackwardWordStart

public boolean moveBackwardWordStart(int count)
Calls moveBackwardWordStart() up to count times.


moveForwardChar

public boolean moveForwardChar()
Moves iter forward by one character offset. Note that images embedded in the buffer occupy 1 character slot, so gtk_text_iter_forward_char() may actually move onto an image instead of a character, if you have images in your buffer. If iter is the end iterator or one character before it, iter will now point at the end iterator, and gtk_text_iter_forward_char() returns FALSE for convenience when writing loops.


moveForwardChar

public boolean moveForwardChar(int count)
Moves count characters 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 new position of iter is different from its original position, and dereferenceable (the last iterator in the buffer is not dereferenceable). If count is 0, the function does nothing and returns FALSE.

Parameters:
count - Number of characters to move, may be negative

Returns:
Whether iter moved and is dereferenceable


moveForwardCursorPosition

public boolean moveForwardCursorPosition()
Moves iter forward by a single cursor position. Cursor positions are (unsurprisingly) positions where the cursor can appear. Perhaps surprisingly, there may not be a cursor position between all characters. The most common example for European languages would be a carriage return/newline sequence. For some Unicode characters, the equivalent of say the letter "a" with an accent mark will be represented as two characters, first the letter then a "combining mark" that causes the accent to be rendered; so the cursor can't go between those two characters. See also the PangoLogAttr structure and pango_break() function.


moveForwardCursorPosition

public boolean moveForwardCursorPosition(int count)


moveForwardLine

public boolean moveForwardLine()
Moves iter to the start of the next 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.


moveForwardLine

public boolean moveForwardLine(int count)
Moves count 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.


moveForwardSentenceEnd

public boolean moveForwardSentenceEnd()
Moves forward to the next sentence end. (If iter is at the end of a sentence, moves to the next end of sentence.) Sentence boundaries are determined by Pango and should be correct for nearly any language (if not, the correct fix would be to the Pango text boundary algorithms).


moveForwardSentenceEnd

public boolean moveForwardSentenceEnd(int count)
Calls moveForwardSentenceEnd() count times (or until it returns FALSE). If count is negative, moves backward instead of forward.


moveForwardToggle

public boolean moveForwardToggle(TextTag tag)
Moves forward to the next toggle (on or off) of the TextTag tag. If no matching tag toggles are found, returns FALSE, otherwise TRUE. Does not return toggles located at iter, only toggles after iter. Sets iter to the location of the toggle, or to the end of the buffer if no toggle is found.


moveForwardWordEnd

public boolean moveForwardWordEnd()
Moves forward to the next word end. (If iter is currently on a word end, moves forward to the next one after that.) Word breaks are determined by Pango and should be correct for nearly any language (if not, the correct fix would be to the Pango word break algorithms).


moveForwardWordEnd

public boolean moveForwardWordEnd(int count)
Calls moveForwardWordEnd() up to count times.


moveToEnd

public void moveToEnd()
Moves iter forward to the "end iterator," which points one past the last valid character in the buffer. getChar() called on the end iterator returns 0, which is convenient for writing loops.


moveToLineEnd

public boolean moveToLineEnd()
Moves the iterator to point to the paragraph delimiter characters, which will be either a newline, a carriage return, a carriage return/newline in sequence, or the Unicode paragraph separator character. If the iterator is already at the paragraph delimiter characters, moves to the paragraph delimiter characters for the next line. If iter is on the last line in the buffer, which does not end in paragraph delimiters, moves to the end iterator (end of the last line), and returns FALSE.


searchBackward

public boolean searchBackward(String str,
                              TextSearchFlags flags,
                              TextIter matchStart,
                              TextIter matchEnd,
                              TextIter limit)

Parameters:
str - A search string
flags - Flags affecting how the search is done
matchStart - Return location for start of match
matchEnd - Return location for end of match
limit - Bound for the searchof the buffer

Returns:
Whether a match was found


searchForward

public boolean searchForward(String str,
                             TextSearchFlags flags,
                             TextIter matchStart,
                             TextIter matchEnd,
                             TextIter limit)
Searches forward for str. Any match is returned by setting matchStart to the first character of the match and matchEnd to the first character after the match. The search will not continue past limit. Note that a search is a linear or O(n) operation, so you may wish to use limit to avoid locking up your UI on large buffers.

If the TextSearchFlags.VISIBLE flag is present, the match may have invisible text interspersed in str. i.e. str will be a possibly-noncontiguous subsequence of the matched range. similarly, if you specify TextSeachFlags.ONLY, the match may have pixbufs or child widgets mixed inside the matched range. If these flags are not given, the match must be exact; the special 0xFFFC character in str will match embedded pixbufs or child widgets.

Parameters:
str - A search string
flags - Flags affecting how the search is done
matchStart - Return location for start of match
matchEnd - Return location for end of match
limit - Bound for the searchof the buffer

Returns:
Whether a match was found


setCharOffset

public void setCharOffset(int charOffset)
Sets iter to point to charOffset. The charOffset counts from the start of the entire text buffer, starting with 0.


setLine

public void setLine(int lineNumber)
Moves iterator iter to the start of the line lineNumber. If lineNumber is negative or larger than the number of lines in the buffer, moves iter to the start of the last line in the buffer.


setLineOffset

public void setLineOffset(int charOnLine)
Moves iter within a line, to a new character (not byte) offset. The given character offset must be less than or equal to the number of characters in the line; if equal, iter moves to the start of the next line.


setVisibleLineOffset

public void setVisibleLineOffset(int charOnLine)
Like setLineOffset(int), but the offset is in visible characters, ie text with a tag making it invisible is not counted in the offset.