- connectChangeCase
ulong connectChangeCase(T callback, Flag!"After" after)
Connect to ChangeCase signal.
- connectChangeNumber
ulong connectChangeNumber(T callback, Flag!"After" after)
Connect to ChangeNumber signal.
- connectJoinLines
ulong connectJoinLines(T callback, Flag!"After" after)
Connect to JoinLines signal.
- connectLineMarkActivated
ulong connectLineMarkActivated(T callback, Flag!"After" after)
Connect to LineMarkActivated signal.
- connectMoveLines
ulong connectMoveLines(T callback, Flag!"After" after)
Connect to MoveLines signal.
- connectMoveToMatchingBracket
ulong connectMoveToMatchingBracket(T callback, Flag!"After" after)
Connect to MoveToMatchingBracket signal.
- connectMoveWords
ulong connectMoveWords(T callback, Flag!"After" after)
Connect to MoveWords signal.
- connectShowCompletion
ulong connectShowCompletion(T callback, Flag!"After" after)
Connect to ShowCompletion signal.
- connectSmartHomeEnd
ulong connectSmartHomeEnd(T callback, Flag!"After" after)
Connect to SmartHomeEnd signal.
- getAutoIndent
bool getAutoIndent()
Returns whether auto-indentation of text is enabled.
- getBackgroundPattern
gtksource.types.BackgroundPatternType getBackgroundPattern()
Returns the #GtkSourceBackgroundPatternType specifying if and how
the background pattern should be displayed for this view.
- getCompletion
gtksource.completion.Completion getCompletion()
Gets the classCompletion associated with view.
- getEnableSnippets
bool getEnableSnippets()
Gets the propertyView:enable-snippets property.
- getGutter
gtksource.gutter.Gutter getGutter(gtk.types.TextWindowType windowType)
Returns the classGutter object associated with window_type for view.
- getHighlightCurrentLine
bool getHighlightCurrentLine()
Returns whether the current line is highlighted.
- getHover
gtksource.hover.Hover getHover()
Gets the classHover associated with view.
- getIndentOnTab
bool getIndentOnTab()
Returns whether when the tab key is pressed the current selection
should get indented instead of replaced with the \t character.
- getIndentWidth
int getIndentWidth()
Returns the number of spaces to use for each step of indent.
- getIndenter
gtksource.indenter.Indenter getIndenter()
Gets the propertyView:indenter property.
- getInsertSpacesInsteadOfTabs
bool getInsertSpacesInsteadOfTabs()
Returns whether when inserting a tabulator character it should
be replaced by a group of space characters.
- getMarkAttributes
gtksource.mark_attributes.MarkAttributes getMarkAttributes(string category, int priority)
Gets attributes and priority for the category.
- getRightMarginPosition
uint getRightMarginPosition()
Gets the position of the right margin in the given view.
- getShowLineMarks
bool getShowLineMarks()
Returns whether line marks are displayed beside the text.
- getShowLineNumbers
bool getShowLineNumbers()
Returns whether line numbers are displayed beside the text.
- getShowRightMargin
bool getShowRightMargin()
Returns whether a right margin is displayed.
- getSmartBackspace
bool getSmartBackspace()
Returns true if pressing the Backspace key will try to delete spaces
up to the previous tab stop.
- getSmartHomeEnd
gtksource.types.SmartHomeEndType getSmartHomeEnd()
Returns a enumSmartHomeEndType end value specifying
how the cursor will move when HOME and END keys are pressed.
- getSpaceDrawer
gtksource.space_drawer.SpaceDrawer getSpaceDrawer()
Gets the classSpaceDrawer associated with view.
- getTabWidth
uint getTabWidth()
Returns the width of tabulation in characters.
- getVisualColumn
uint getVisualColumn(gtk.text_iter.TextIter iter)
Determines the visual column at iter taking into consideration the
propertyView:tab-width of view.
- indentLines
void indentLines(gtk.text_iter.TextIter start, gtk.text_iter.TextIter end)
Inserts one indentation level at the beginning of the specified lines. The
empty lines are not indented.
- pushSnippet
void pushSnippet(gtksource.snippet.Snippet snippet, gtk.text_iter.TextIter location)
Inserts a new snippet at location
- self
View self()
Returns this, for use in with statements.
- setAutoIndent
void setAutoIndent(bool enable)
If true auto-indentation of text is enabled.
- setBackgroundPattern
void setBackgroundPattern(gtksource.types.BackgroundPatternType backgroundPattern)
Set if and how the background pattern should be displayed.
- setEnableSnippets
void setEnableSnippets(bool enableSnippets)
Sets the propertyView:enable-snippets property.
- setHighlightCurrentLine
void setHighlightCurrentLine(bool highlight)
If highlight is true the current line will be highlighted.
- setIndentOnTab
void setIndentOnTab(bool enable)
If true, when the tab key is pressed when several lines are selected, the
selected lines are indented of one level instead of being replaced with a \t
character. Shift+Tab unindents the selection.
- setIndentWidth
void setIndentWidth(int width)
Sets the number of spaces to use for each step of indent when the tab key is
pressed.
- setIndenter
void setIndenter(gtksource.indenter.Indenter indenter)
Sets the indenter for view to indenter.
- setInsertSpacesInsteadOfTabs
void setInsertSpacesInsteadOfTabs(bool enable)
If true a tab key pressed is replaced by a group of space characters.
- setMarkAttributes
void setMarkAttributes(string category, gtksource.mark_attributes.MarkAttributes attributes, int priority)
Sets attributes and priority for the category.
- setRightMarginPosition
void setRightMarginPosition(uint pos)
Sets the position of the right margin in the given view.
- setShowLineMarks
void setShowLineMarks(bool show)
If true line marks will be displayed beside the text.
- setShowLineNumbers
void setShowLineNumbers(bool show)
If true line numbers will be displayed beside the text.
- setShowRightMargin
void setShowRightMargin(bool show)
If true a right margin is displayed.
- setSmartBackspace
void setSmartBackspace(bool smartBackspace)
When set to true, pressing the Backspace key will try to delete spaces
up to the previous tab stop.
- setSmartHomeEnd
void setSmartHomeEnd(gtksource.types.SmartHomeEndType smartHomeEnd)
Set the desired movement of the cursor when HOME and END keys
are pressed.
- setTabWidth
void setTabWidth(uint width)
Sets the width of tabulation in characters.
- unindentLines
void unindentLines(gtk.text_iter.TextIter start, gtk.text_iter.TextIter end)
Removes one indentation level at the beginning of the
specified lines.
- autoIndent
bool autoIndent [@property getter]
- autoIndent
bool autoIndent [@property setter]
- backgroundPattern
gtksource.types.BackgroundPatternType backgroundPattern [@property getter]
Get backgroundPattern property.
- backgroundPattern
gtksource.types.BackgroundPatternType backgroundPattern [@property setter]
Set backgroundPattern property.
- completion
gtksource.completion.Completion completion [@property getter]
- enableSnippets
bool enableSnippets [@property getter]
Get enableSnippets property.
- enableSnippets
bool enableSnippets [@property setter]
Set enableSnippets property.
- gType
GType gType [@property getter]
- highlightCurrentLine
bool highlightCurrentLine [@property getter]
- highlightCurrentLine
bool highlightCurrentLine [@property setter]
- indentOnTab
bool indentOnTab [@property getter]
- indentOnTab
bool indentOnTab [@property setter]
- indentWidth
int indentWidth [@property getter]
Get indentWidth property.
- indentWidth
int indentWidth [@property setter]
Set indentWidth property.
- indenter
gtksource.indenter.Indenter indenter [@property getter]
- indenter
gtksource.indenter.Indenter indenter [@property setter]
- insertSpacesInsteadOfTabs
bool insertSpacesInsteadOfTabs [@property getter]
- insertSpacesInsteadOfTabs
bool insertSpacesInsteadOfTabs [@property setter]
- rightMarginPosition
uint rightMarginPosition [@property getter]
Get rightMarginPosition property.
- rightMarginPosition
uint rightMarginPosition [@property setter]
Set rightMarginPosition property.
- showLineMarks
bool showLineMarks [@property getter]
Get showLineMarks property.
- showLineMarks
bool showLineMarks [@property setter]
Set showLineMarks property.
- showLineNumbers
bool showLineNumbers [@property getter]
Get showLineNumbers property.
- showLineNumbers
bool showLineNumbers [@property setter]
Set showLineNumbers property.
- showRightMargin
bool showRightMargin [@property getter]
Get showRightMargin property.
- showRightMargin
bool showRightMargin [@property setter]
Set showRightMargin property.
- smartBackspace
bool smartBackspace [@property getter]
Get smartBackspace property.
- smartBackspace
bool smartBackspace [@property setter]
Set smartBackspace property.
- smartHomeEnd
gtksource.types.SmartHomeEndType smartHomeEnd [@property getter]
Get smartHomeEnd property.
- smartHomeEnd
gtksource.types.SmartHomeEndType smartHomeEnd [@property setter]
Set smartHomeEnd property.
- spaceDrawer
gtksource.space_drawer.SpaceDrawer spaceDrawer [@property getter]
Get spaceDrawer property.
- tabWidth
uint tabWidth [@property getter]
- tabWidth
uint tabWidth [@property setter]
- getGType
GType getGType()
- gType
GType gType [@property getter]
- self
TextView self()
Returns this, for use in with statements.
- acceptsTab
bool acceptsTab [@property getter]
- acceptsTab
bool acceptsTab [@property setter]
- bottomMargin
int bottomMargin [@property getter]
Get bottomMargin property.
- bottomMargin
int bottomMargin [@property setter]
Set bottomMargin property.
- buffer
gtk.text_buffer.TextBuffer buffer [@property getter]
- buffer
gtk.text_buffer.TextBuffer buffer [@property setter]
- cursorVisible
bool cursorVisible [@property getter]
Get cursorVisible property.
- cursorVisible
bool cursorVisible [@property setter]
Set cursorVisible property.
- editable
bool editable [@property getter]
- editable
bool editable [@property setter]
- extraMenu
gio.menu_model.MenuModel extraMenu [@property getter]
- extraMenu
gio.menu_model.MenuModel extraMenu [@property setter]
- imModule
string imModule [@property getter]
- imModule
string imModule [@property setter]
- indent
int indent [@property getter]
- indent
int indent [@property setter]
- inputHints
gtk.types.InputHints inputHints [@property getter]
- inputHints
gtk.types.InputHints inputHints [@property setter]
- inputPurpose
gtk.types.InputPurpose inputPurpose [@property getter]
Get inputPurpose property.
- inputPurpose
gtk.types.InputPurpose inputPurpose [@property setter]
Set inputPurpose property.
- justification
gtk.types.Justification justification [@property getter]
- justification
gtk.types.Justification justification [@property setter]
- leftMargin
int leftMargin [@property getter]
- leftMargin
int leftMargin [@property setter]
- monospace
bool monospace [@property getter]
- monospace
bool monospace [@property setter]
- overwrite
bool overwrite [@property getter]
- overwrite
bool overwrite [@property setter]
- pixelsAboveLines
int pixelsAboveLines [@property getter]
- pixelsAboveLines
int pixelsAboveLines [@property setter]
- pixelsBelowLines
int pixelsBelowLines [@property getter]
- pixelsBelowLines
int pixelsBelowLines [@property setter]
- pixelsInsideWrap
int pixelsInsideWrap [@property getter]
- pixelsInsideWrap
int pixelsInsideWrap [@property setter]
- rightMargin
int rightMargin [@property getter]
Get rightMargin property.
- rightMargin
int rightMargin [@property setter]
Set rightMargin property.
- tabs
pango.tab_array.TabArray tabs [@property getter]
- tabs
pango.tab_array.TabArray tabs [@property setter]
- topMargin
int topMargin [@property getter]
- topMargin
int topMargin [@property setter]
- wrapMode
gtk.types.WrapMode wrapMode [@property getter]
- wrapMode
gtk.types.WrapMode wrapMode [@property setter]
- newWithBuffer
gtk.text_view.TextView newWithBuffer(gtk.text_buffer.TextBuffer buffer)
- addChildAtAnchor
void addChildAtAnchor(gtk.widget.Widget child, gtk.text_child_anchor.TextChildAnchor anchor)
Adds a child widget in the text buffer, at the given anchor.
- addOverlay
void addOverlay(gtk.widget.Widget child, int xpos, int ypos)
- backwardDisplayLine
bool backwardDisplayLine(gtk.text_iter.TextIter iter)
Moves the given iter backward by one display (wrapped) line.
- backwardDisplayLineStart
bool backwardDisplayLineStart(gtk.text_iter.TextIter iter)
Moves the given iter backward to the next display line start.
- bufferToWindowCoords
void bufferToWindowCoords(gtk.types.TextWindowType win, int bufferX, int bufferY, int windowX, int windowY)
Converts buffer coordinates to window coordinates.
- forwardDisplayLine
bool forwardDisplayLine(gtk.text_iter.TextIter iter)
Moves the given iter forward by one display (wrapped) line.
- forwardDisplayLineEnd
bool forwardDisplayLineEnd(gtk.text_iter.TextIter iter)
Moves the given iter forward to the next display line end.
- getAcceptsTab
bool getAcceptsTab()
Returns whether pressing the <kbd>Tab</kbd> key inserts a tab characters.
- getBottomMargin
int getBottomMargin()
Gets the bottom margin for text in the text_view.
- getBuffer
gtk.text_buffer.TextBuffer getBuffer()
- getCursorLocations
void getCursorLocations(gtk.text_iter.TextIter iter, gdk.rectangle.Rectangle strong, gdk.rectangle.Rectangle weak)
Determine the positions of the strong and weak cursors if the
insertion point is at iter.
- getCursorVisible
bool getCursorVisible()
Find out whether the cursor should be displayed.
- getEditable
bool getEditable()
- getExtraMenu
gio.menu_model.MenuModel getExtraMenu()
Gets the menu model that gets added to the context menu
or null if none has been set.
- getGutter
gtk.widget.Widget getGutter(gtk.types.TextWindowType win)
- getIndent
int getIndent()
Gets the default indentation of paragraphs in text_view.
- getInputHints
gtk.types.InputHints getInputHints()
- getInputPurpose
gtk.types.InputPurpose getInputPurpose()
- getIterAtLocation
bool getIterAtLocation(gtk.text_iter.TextIter iter, int x, int y)
Retrieves the iterator at buffer coordinates x and y.
- getIterAtPosition
bool getIterAtPosition(gtk.text_iter.TextIter iter, int trailing, int x, int y)
Retrieves the iterator pointing to the character at buffer
coordinates x and y.
- getIterLocation
void getIterLocation(gtk.text_iter.TextIter iter, gdk.rectangle.Rectangle location)
Gets a rectangle which roughly contains the character at iter.
- getJustification
gtk.types.Justification getJustification()
Gets the default justification of paragraphs in text_view.
- getLeftMargin
int getLeftMargin()
Gets the default left margin size of paragraphs in the text_view.
- getLineAtY
void getLineAtY(gtk.text_iter.TextIter targetIter, int y, int lineTop)
- getLineYrange
void getLineYrange(gtk.text_iter.TextIter iter, int y, int height)
Gets the y coordinate of the top of the line containing iter,
and the height of the line.
- getLtrContext
pango.context.Context getLtrContext()
- getMonospace
bool getMonospace()
- getOverwrite
bool getOverwrite()
- getPixelsAboveLines
int getPixelsAboveLines()
Gets the default number of pixels to put above paragraphs.
- getPixelsBelowLines
int getPixelsBelowLines()
Gets the default number of pixels to put below paragraphs.
- getPixelsInsideWrap
int getPixelsInsideWrap()
Gets the default number of pixels to put between wrapped lines
inside a paragraph.
- getRightMargin
int getRightMargin()
Gets the default right margin for text in text_view.
- getRtlContext
pango.context.Context getRtlContext()
- getTabs
pango.tab_array.TabArray getTabs()
Gets the default tabs for text_view.
- getTopMargin
int getTopMargin()
Gets the top margin for text in the text_view.
- getVisibleRect
void getVisibleRect(gdk.rectangle.Rectangle visibleRect)
Fills visible_rect with the currently-visible
region of the buffer, in buffer coordinates.
- getWrapMode
gtk.types.WrapMode getWrapMode()
Gets the line wrapping for the view.
- imContextFilterKeypress
bool imContextFilterKeypress(gdk.event.Event event)
- moveMarkOnscreen
bool moveMarkOnscreen(gtk.text_mark.TextMark mark)
Moves a mark within the buffer so that it's
located within the currently-visible text area.
- moveOverlay
void moveOverlay(gtk.widget.Widget child, int xpos, int ypos)
Updates the position of a child.
- moveVisually
bool moveVisually(gtk.text_iter.TextIter iter, int count)
Move the iterator a given number of characters visually, treating
it as the strong cursor position.
- placeCursorOnscreen
bool placeCursorOnscreen()
Moves the cursor to the currently visible region of the
buffer.
- remove
void remove(gtk.widget.Widget child)
Removes a child widget from text_view.
- resetCursorBlink
void resetCursorBlink()
Ensures that the cursor is shown.
- resetImContext
void resetImContext()
Reset the input method context of the text view if needed.
- scrollMarkOnscreen
void scrollMarkOnscreen(gtk.text_mark.TextMark mark)
Scrolls text_view the minimum distance such that mark is contained
within the visible area of the widget.
- scrollToIter
bool scrollToIter(gtk.text_iter.TextIter iter, double withinMargin, bool useAlign, double xalign, double yalign)
Scrolls text_view so that iter is on the screen in the position
indicated by xalign and yalign.
- scrollToMark
void scrollToMark(gtk.text_mark.TextMark mark, double withinMargin, bool useAlign, double xalign, double yalign)
Scrolls text_view so that mark is on the screen in the position
indicated by xalign and yalign.
- setAcceptsTab
void setAcceptsTab(bool acceptsTab)
Sets the behavior of the text widget when the <kbd>Tab</kbd> key is pressed.
- setBottomMargin
void setBottomMargin(int bottomMargin)
Sets the bottom margin for text in text_view.
- setBuffer
void setBuffer(gtk.text_buffer.TextBuffer buffer)
Sets buffer as the buffer being displayed by text_view.
- setCursorVisible
void setCursorVisible(bool setting)
Toggles whether the insertion point should be displayed.
- setEditable
void setEditable(bool setting)
- setExtraMenu
void setExtraMenu(gio.menu_model.MenuModel model)
Sets a menu model to add when constructing the context
menu for text_view.
- setGutter
void setGutter(gtk.types.TextWindowType win, gtk.widget.Widget widget)
Places widget into the gutter specified by win.
- setIndent
void setIndent(int indent)
Sets the default indentation for paragraphs in text_view.
- setInputHints
void setInputHints(gtk.types.InputHints hints)
- setInputPurpose
void setInputPurpose(gtk.types.InputPurpose purpose)
- setJustification
void setJustification(gtk.types.Justification justification)
Sets the default justification of text in text_view.
- setLeftMargin
void setLeftMargin(int leftMargin)
Sets the default left margin for text in text_view.
- setMonospace
void setMonospace(bool monospace)
- setOverwrite
void setOverwrite(bool overwrite)
- setPixelsAboveLines
void setPixelsAboveLines(int pixelsAboveLines)
Sets the default number of blank pixels above paragraphs in text_view.
- setPixelsBelowLines
void setPixelsBelowLines(int pixelsBelowLines)
Sets the default number of pixels of blank space
to put below paragraphs in text_view.
- setPixelsInsideWrap
void setPixelsInsideWrap(int pixelsInsideWrap)
Sets the default number of pixels of blank space to leave between
display/wrapped lines within a paragraph.
- setRightMargin
void setRightMargin(int rightMargin)
Sets the default right margin for text in the text view.
- setTabs
void setTabs(pango.tab_array.TabArray tabs)
Sets the default tab stops for paragraphs in text_view.
- setTopMargin
void setTopMargin(int topMargin)
Sets the top margin for text in text_view.
- setWrapMode
void setWrapMode(gtk.types.WrapMode wrapMode)
Sets the line wrapping for the view.
- startsDisplayLine
bool startsDisplayLine(gtk.text_iter.TextIter iter)
Determines whether iter is at the start of a display line.
- windowToBufferCoords
void windowToBufferCoords(gtk.types.TextWindowType win, int windowX, int windowY, int bufferX, int bufferY)
Converts coordinates on the window identified by win to buffer
coordinates.
- connectBackspace
ulong connectBackspace(T callback, Flag!"After" after)
Connect to Backspace signal.
- connectCopyClipboard
ulong connectCopyClipboard(T callback, Flag!"After" after)
Connect to CopyClipboard signal.
- connectCutClipboard
ulong connectCutClipboard(T callback, Flag!"After" after)
Connect to CutClipboard signal.
- connectDeleteFromCursor
ulong connectDeleteFromCursor(T callback, Flag!"After" after)
Connect to DeleteFromCursor signal.
- connectExtendSelection
ulong connectExtendSelection(T callback, Flag!"After" after)
Connect to ExtendSelection signal.
- connectInsertAtCursor
ulong connectInsertAtCursor(T callback, Flag!"After" after)
Connect to InsertAtCursor signal.
- connectInsertEmoji
ulong connectInsertEmoji(T callback, Flag!"After" after)
Connect to InsertEmoji signal.
- connectMoveCursor
ulong connectMoveCursor(T callback, Flag!"After" after)
Connect to MoveCursor signal.
- connectMoveViewport
ulong connectMoveViewport(T callback, Flag!"After" after)
Connect to MoveViewport signal.
- connectPasteClipboard
ulong connectPasteClipboard(T callback, Flag!"After" after)
Connect to PasteClipboard signal.
- connectPreeditChanged
ulong connectPreeditChanged(T callback, Flag!"After" after)
Connect to PreeditChanged signal.
- connectSelectAll
ulong connectSelectAll(T callback, Flag!"After" after)
Connect to SelectAll signal.
- connectSetAnchor
ulong connectSetAnchor(T callback, Flag!"After" after)
Connect to SetAnchor signal.
- connectToggleCursorVisible
ulong connectToggleCursorVisible(T callback, Flag!"After" after)
Connect to ToggleCursorVisible signal.
- connectToggleOverwrite
ulong connectToggleOverwrite(T callback, Flag!"After" after)
Connect to ToggleOverwrite signal.
Subclass of gtk.text_view.TextView.
gtksource.view.View is the main class of the GtkSourceView library. Use a class@Buffer to display text with a gtksource.view.View.
This class provides:
An easy way to test all these features is to use the test-widget mini-program provided in the GtkSourceView repository, in the tests/ directory.
GtkSourceView as GtkBuildable
The GtkSourceView implementation of the gtk.buildable.Buildable interface exposes the property@View:completion object with the internal-child "completion".
An example of a UI definition fragment with GtkSourceView:
Changing the Font
Gtk CSS provides the best way to change the font for a gtksource.view.View in a manner that allows for components like class@Map to scale the desired font.
If you need to adjust the font or size of font within a portion of the document only, you should use a gtk.text_tag.TextTag with the gtk.text_tag.TextTag.family or gtk.text_tag.TextTag.scale set so that the font size may be scaled relative to the default font set in CSS.