|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.gnu.glib.Struct
org.gnu.glib.Boxed
org.gnu.gtk.TextIter
public class TextIter
The Text Editor objects are discussed in detail in the TextView
widget overview.
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. |
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(java.lang.String str,
TextSearchFlags flags,
TextIter matchStart,
TextIter matchEnd,
TextIter limit)
Same as searchForward(String, TextSearchFlags, TextIter ,
TextIter , TextIter) , but moves backward. |
boolean |
searchForward(java.lang.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, getBoxedFromHandle, hashCode |
Methods inherited from class org.gnu.glib.Struct |
---|
getHandle, getNullHandle |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public TextBuffer getBuffer()
public int getOffset()
public int getLineNumber()
public int getLineOffset()
public int getVisibleLineOffset()
public char getChar()
public Pixbuf getPixbuf()
null
is returned.
public boolean isPixbuf()
public TextChildAnchor getChildAnchor()
null
is returned.
public boolean isChildAnchor()
public boolean beginsTag(TextTag tag)
hasTag(TextTag)
tells you whether an iterator is within a tagged range.
tag
- A TextTag
public boolean endsTag(TextTag tag)
hasTag(TextTag)
tells you whether an iterator is within a tagged range.
tag
- A TextTag
public boolean hasTag(TextTag tag)
public boolean getEditable(boolean defaultSetting)
defaultSetting
will be returned.
You don't want to use this function to decide whether text can be
inserted at iter, because for insertion you don't want to know whether
the char at iter is inside an editable range, you want to know whether a
new character inserted at iter would be inside an editable range. Use
getCanInsert(boolean)
to handle this case.
defaultSetting
- TRUE if text is editable by default
public boolean getCanInsert(boolean defaultSetting)
defaultSetting
- TRUE if text is editable by default
public boolean getStartsWord()
public boolean getEndsWord()
public boolean getInsideWord()
public boolean getStartsLine()
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.
public boolean getEndsLine()
public boolean getStartsSentence()
public boolean getEndsSentence()
public boolean getInsideSentence()
public boolean getIsCursorPosition()
public int getCharsInLine()
public boolean getAttributes(TextAttributes values)
TextView.getDefaultAttributes()
.
This will modify values, applying the effects of any tags present at iter. If any tags affected values, the function returns TRUE.
values
- A TextAttributes to be filled in
public Language getLanguage()
public boolean getIsEndIter()
public boolean getIsStartIter()
public boolean moveForwardChar()
public boolean moveBackwardChar()
public boolean moveForwardChar(int count)
count
- Number of characters to move, may be negative
public boolean moveBackwardChar(int count)
count
- Number of characters to move
public boolean moveForwardLine()
public boolean moveBackwardLine()
public boolean moveForwardLine(int count)
public boolean moveBackwardLine(int count)
public boolean moveForwardWordEnd(int count)
moveForwardWordEnd()
up to count
times.
public boolean moveBackwardWordStart(int count)
moveBackwardWordStart()
up to count
times.
public boolean moveForwardWordEnd()
public boolean moveBackwardWordStart()
public boolean moveForwardCursorPosition()
public boolean moveBackwardCursorPosition()
moveForwardCursorPosition()
, but moves backward.
public boolean moveForwardCursorPosition(int count)
moveForwardCursorPosition()
for details.
public boolean moveBackwardCursorPosition(int count)
moveBackwardCursorPosition()
for details.
public boolean moveBackwardSentenceStart()
public boolean moveBackwardSentenceStart(int count)
moveBackwardSentenceStart()
up to count
times, or until it returns FALSE. If count is negative, moves forward
instead of backward.
public boolean moveForwardSentenceEnd()
public boolean moveForwardSentenceEnd(int count)
moveForwardSentenceEnd()
count
times (or
until it returns FALSE). If count is negative, moves backward instead of
forward.
public void setCharOffset(int charOffset)
charOffset
. The charOffset counts
from the start of the entire text buffer, starting with 0.
public void setLine(int lineNumber)
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.
public void setLineOffset(int charOnLine)
public void setVisibleLineOffset(int charOnLine)
setLineOffset(int)
, but the offset is in visible
characters, ie text with a tag making it invisible is not counted in the
offset.
public void moveToEnd()
getChar()
called on the end
iterator returns 0, which is convenient for writing loops.
public boolean moveToLineEnd()
public boolean moveForwardToggle(TextTag tag)
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.
public boolean moveBackwardToggle(TextTag tag)
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.
public boolean searchForward(java.lang.String str, TextSearchFlags flags, TextIter matchStart, TextIter matchEnd, TextIter limit)
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.
str
- A search stringflags
- Flags affecting how the search is donematchStart
- Return location for start of matchmatchEnd
- Return location for end of matchlimit
- Bound for the searchof the buffer
public boolean searchBackward(java.lang.String str, TextSearchFlags flags, TextIter matchStart, TextIter matchEnd, TextIter limit)
searchForward(String, TextSearchFlags, TextIter ,
TextIter , TextIter)
, but moves backward.
str
- A search stringflags
- Flags affecting how the search is donematchStart
- Return location for start of matchmatchEnd
- Return location for end of matchlimit
- Bound for the searchof the buffer
public boolean equals(TextIter other)
other
- Iterator to test
public int cmp(TextIter other)
other
- Iterator to test
public boolean inRange(TextIter start, TextIter end)
start
- Start of rangeend
- End of range
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |