|
java-gnome version 4.0.15 | ||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||
Objectorg.freedesktop.bindings.Pointer
org.freedesktop.bindings.Proxy
org.gnome.glib.Object
org.gnome.gtk.TextMark
public class TextMark
A stable reference to a specific position within a TextBuffer.
TextIters are transient pointers to positions within TextBuffers which are
invalidated when their TextBuffer is modified, so you can't "save" them. If
you need to preserve a position for later reuse, then get a TextMark by
calling TextBuffer's createMark() on it.
There are two "standard" TextMarks available in all TextBuffers, relating
to the cursor and the current selection. See getInsert() and getSelectionBound().
Instances of this class fill the same role for TextBuffers that
TreeRowReference does in providing stability for rows pointed to
transiently by TreeIters that come from TreeModels.
| Field Summary | |
|---|---|
static boolean |
LEFT
Left-gravity. |
static boolean |
RIGHT
Right-gravity. |
| Method Summary | |
|---|---|
TextBuffer |
getBuffer()
Get the TextBuffer that this TextMark points into. |
TextIter |
getIter()
Get a currently valid TextIter indicating where in the TextBuffer this TextMark is pointing. |
| Methods inherited from class org.freedesktop.bindings.Pointer |
|---|
toString |
| Methods inherited from class Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final boolean LEFT
createMark(). The
TextMark will stay fixed to the left if text is added there.
public static final boolean RIGHT
createMark(). The
TextMark will move to the right if text is added there. The
insert TextMark (your cursor) has right-gravity.
| Method Detail |
|---|
public TextBuffer getBuffer()
public TextIter getIter()
The usual caveats about changes invalidating iterators apply, but if
you use these inline you will have no problems. For example, given
TextMarks start, end and a TextTag of some
sort, you could easily do:
buffer.applyTag(bold, start.getIter(), end.getIter());which is very straight forward. If you are using the same position repeatedly, however, and not changing the TextBuffer, then it is far more efficient to convert the TextMark into a TextIter once and use that directly.
|
![]() java-gnome |
||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||