public class SourceView extends TextView
GtkSourceView extends GTK's TextView and adds features that are
useful for building text or source-code editors. It provides syntax
highlighting for various languages, undo/redo, control over indentation and
more.
SourceView is the view part of the GtkSourceView library and is always used
together with a SourceBuffer as its model.
SourceBuffer buffer; SourceView view; ... view = new SourceView(buffer);
| Modifier and Type | Class and Description |
|---|---|
static interface |
SourceView.Redo
The handler interface used for redo signals.
|
static interface |
SourceView.Undo
The handler interface used for undo signals.
|
TextView.PopulatePopupWidget.ButtonPressEvent, Widget.ButtonReleaseEvent, Widget.Destroy, Widget.Draw, Widget.EnterNotifyEvent, Widget.FocusInEvent, Widget.FocusOutEvent, Widget.Hide, Widget.KeyPressEvent, Widget.KeyReleaseEvent, Widget.LeaveNotifyEvent, Widget.MapEvent, Widget.MotionNotifyEvent, Widget.PopupMenu, Widget.QueryTooltip, Widget.ScrollEvent, Widget.SizeAllocate, Widget.UnmapEvent, Widget.VisibilityNotifyEvent| Constructor and Description |
|---|
SourceView(SourceBuffer buffer)
Create a new SourceView that displays the SourceBuffer.
|
| Modifier and Type | Method and Description |
|---|---|
void |
connect(SourceView.Redo handler)
Connect a handler to receive
SourceView.Redo signals. |
void |
connect(SourceView.Undo handler)
Connect a handler to receive
SourceView.Undo signals. |
boolean |
getAutoIndent()
Return whether audo-indentation is enabled of not.
|
boolean |
getHighlightCurrentLine()
Returns whether the current line is highlighted or not.
|
boolean |
getInsertSpacesInsteadOfTabs()
Returns whether spaces are used instead of the tab character.
|
int |
getRightMarginPosition()
Return the position of the line that indicates the right margin of the
text.
|
boolean |
getShowLineNumbers()
Returns whether line numbers are shown next to the text or not.
|
boolean |
getShowRightMargin()
Returns whether the line indicating the right margin is shown or not.
|
int |
getTabWidth()
Return the number of spaces that are used for the tab character.
|
void |
setAutoIndent(boolean enable)
Enable/disable auto-indentation.
|
void |
setHighlightCurrentLine(boolean highlight)
Enable or disable the highlighting of the current line.
|
void |
setInsertSpacesInsteadOfTabs(boolean enable)
Insert spaces instead of the tab character.
|
void |
setRightMarginPosition(int position)
Set the position of the line that indicates the right margin of the
text.
|
void |
setShowLineNumbers(boolean show)
Enable or disable the display of line numbers next to the text.
|
void |
setShowRightMargin(boolean show)
Show a line that indicates the right margin of the text.
|
void |
setTabWidth(int width)
Set the number of spaces that are used for the tab character.
|
add, add, attachSpell, attachSpell, connect, convertBufferToWindowCoordsX, convertBufferToWindowCoordsY, convertWindowToBufferCoordsX, convertWindowToBufferCoordsY, getBuffer, getCursorVisible, getEditable, getIterAtLocation, getLineRange, getLineY, getLocation, getSpell, getVisibleRectangle, getWindow, getWrapMode, moveChild, placeCursorOnscreen, scrollTo, scrollTo, scrollTo, scrollTo, setAcceptsTab, setBorderWindowSize, setBuffer, setCursorVisible, setEditable, setJustify, setMarginLeft, setMarginRight, setPaddingAboveParagraph, setPaddingBelowParagraph, setPaddingInsideParagraph, setWrapModeadd, getChildren, remove, setBorderWidthactivate, addEvents, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, destroy, getAllocatedHeight, getAllocatedWidth, getAllocation, getCanDefault, getCanFocus, getHasFocus, getName, getParent, getPreferredHeightForWidthMinimum, getPreferredHeightForWidthNatural, getPreferredHeightMinimum, getPreferredHeightNatural, getPreferredWidthForHeightMinimum, getPreferredWidthForHeightNatural, getPreferredWidthMinimum, getPreferredWidthNatural, getRequestMode, getRequisition, getSensitive, getStyleContext, getToplevel, getWindow, grabAdd, grabDefault, grabFocus, grabRemove, hide, isSensitive, overrideBackground, overrideColor, overrideFont, queueDraw, queueDrawArea, realize, setAlignHorizontal, setAlignVertical, setCanDefault, setCanFocus, setEvents, setExpandHorizontal, setExpandVertical, setName, setSensitive, setSizeRequest, setTooltipMarkup, setTooltipText, show, showAllpublic SourceView(SourceBuffer buffer)
public void connect(SourceView.Redo handler)
SourceView.Redo signals. It
is emitted whenever something is redone in the editor window, e.g. by
hitting Shift+Ctrl+Z.public void connect(SourceView.Undo handler)
SourceView.Undo signals. It
is emitted whenever something is undone in the editor window, e.g. by
hitting Ctrl+Z.public boolean getAutoIndent()
public boolean getHighlightCurrentLine()
public boolean getInsertSpacesInsteadOfTabs()
public int getRightMarginPosition()
public boolean getShowLineNumbers()
public boolean getShowRightMargin()
public int getTabWidth()
public void setAutoIndent(boolean enable)
public void setHighlightCurrentLine(boolean highlight)
public void setInsertSpacesInsteadOfTabs(boolean enable)
public void setRightMarginPosition(int position)
public void setShowLineNumbers(boolean show)
public void setShowRightMargin(boolean show)
public void setTabWidth(int width)