org.gnu.gtk
Class Editable

java.lang.Object
  |
  +--org.gnu.glib.GObject
        |
        +--org.gnu.gtk.GtkObject
              |
              +--org.gnu.gtk.Widget
                    |
                    +--org.gnu.gtk.Editable
Direct Known Subclasses:
Entry

public class Editable
extends Widget

The Editable class is the base class for widgets for editing text, such as Entry. It cannot be instantiated by itself. The editable class contains functions for generically manipulating an editable widget, a large number of action events used for key bindings, and several events that an application can connect to to modify the behavior of a widget.


Method Summary
 void addListener(EditableListener listener)
          Register an object to handle spin events.
 void copyClipboard()
          Causes the characters in the current selection to be copied to the clipboard.
 void cutClipboard()
          Causes the characters in the current selection to be copied to the clipboard and then deleted from the widget.
 void deleteSelection()
          Deletes the contents of the current selection.
 void deleteText(int start, int end)
          Delete a sequence of characters.
 java.lang.String getCharacters(int start, int end)
          Retrieve a sequence of characters.
 int getCursorPosition()
          Retrieves the current cursor position.
 boolean getEditable()
          Retrieves whether the text contained in the widget is editable.
 java.lang.Class getEventListenerClass(java.lang.String signal)
           
 GtkEventType getEventType(java.lang.String signal)
           
static Type getType()
          Retrieve the runtime type used by the GLib library.
 int insertText(java.lang.String text, int offset)
          Insert text at a given point
 void pasteClipboard()
          Causes the contents of the clipboard to be pasted into this widget at the current cursor position.
 void removeListener(EditableListener listener)
          Removes a listener
 void selectRegion(int start, int end)
          Select a region of text.
 void setCursorPosition(int position)
          Sets the cursor position
 void setEditable(boolean isEditable)
          Determines if the user can edit the text contained in the widget.
 
Methods inherited from class org.gnu.gtk.Widget
activate, addListener, addListener, addListener, addListener, addListener, addListener, createContext, createLayout, destroy, draw, drawArea, drawArea, getAccessible, getColormap, getContext, getModifierStyle, getName, getParent, getParentWindow, getPointer, getSensitive, getStyle, getToplevel, grabDefault, grabFocus, hasFocus, hide, hideAll, intersect, isAncestor, makeWidget, modifyStyle, popColormap, pushColormap, realize, removeListener, removeListener, removeListener, removeListener, removeListener, removeListener, reparent, setBackgroundColor, setBaseColor, setColormap, setDoubleBuffered, setDragDestination, setDragSource, setFont, setForegroundColor, setMinimumSize, setName, setNoDragDestination, setNoDragSource, setSensitive, setTextColor, shapeCombineMask, show, showAll
 
Methods inherited from class org.gnu.glib.GObject
addEventHandler, addEventHandler, addEventHandler, addEventHandler, addEventHandler, addEventHandler, equals, getData, getHandle, removeEventHandler, setData
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

selectRegion

public void selectRegion(int start,
                         int end)
Select a region of text. The characters that are selected are those characters at positions from start up to, but not including end. If end is negative, then the characters selected will be those characters from start to the end of the text


insertText

public int insertText(java.lang.String text,
                      int offset)
Insert text at a given point

Parameters:
text - The text to insert.
offset - The offset into the buffer to begin the insert.
Returns:
The current offset after the text has been inserted.

deleteText

public void deleteText(int start,
                       int end)
Delete a sequence of characters. The characters that are deleted are those characters from position start up to, but not including end. If end is a negative number then the characters to be deleted are from start until the end of the text.


getCharacters

public java.lang.String getCharacters(int start,
                                      int end)
Retrieve a sequence of characters. The characters that are retrieved are those characters from position start up to, but not including end. If end is negative, then the characters retrieved will be those characters from start until the end of the text.


cutClipboard

public void cutClipboard()
Causes the characters in the current selection to be copied to the clipboard and then deleted from the widget.


copyClipboard

public void copyClipboard()
Causes the characters in the current selection to be copied to the clipboard.


pasteClipboard

public void pasteClipboard()
Causes the contents of the clipboard to be pasted into this widget at the current cursor position.


deleteSelection

public void deleteSelection()
Deletes the contents of the current selection.


setCursorPosition

public void setCursorPosition(int position)
Sets the cursor position

Parameters:
position - The position of the cursor. The cursor is displayed before the character with the given (base 0) index in the widget. The value must be less than or equal to the number of characters in the widget.

getCursorPosition

public int getCursorPosition()
Retrieves the current cursor position.

Returns:
A 0 based integer that identifies the offset position of the cursor from the beginning of the text.

setEditable

public void setEditable(boolean isEditable)
Determines if the user can edit the text contained in the widget.

Parameters:
isEditable - true if the user can edit the text.

getEditable

public boolean getEditable()
Retrieves whether the text contained in the widget is editable.

Returns:
true if the text is editable.

addListener

public void addListener(EditableListener listener)
Register an object to handle spin events.

See Also:
EditableListener

removeListener

public void removeListener(EditableListener listener)
Removes a listener

See Also:
addListener(EditableListener)

getEventListenerClass

public java.lang.Class getEventListenerClass(java.lang.String signal)
Overrides:
getEventListenerClass in class Widget

getEventType

public GtkEventType getEventType(java.lang.String signal)
Overrides:
getEventType in class Widget

getType

public static Type getType()
Retrieve the runtime type used by the GLib library.


Please send any bug reports, comments, or suggestions for the API or documentation to java-gnome-developer@lists.sf.net