View

open class View(val gtksourceViewPointer: <Error class: unknown class><<Error class: unknown class>>)

Subclass of class@Gtk.TextView.

GtkSourceView is the main class of the GtkSourceView library. Use a class@Buffer to display text with a GtkSourceView.

This class provides:

  • Show the line numbers;

  • Show a right margin;

  • Highlight the current line;

  • Indentation settings;

  • Configuration for the Home and End keyboard keys;

  • Configure and show line marks;

  • And a few other things.

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 iface@Gtk.Buildable interface exposes the property@View:completion object with the internal-child "completion".

An example of a UI definition fragment with GtkSourceView:

<object class="GtkSourceView" id="source_view">
<property name="tab-width">4</property>
<property name="auto-indent">True</property>
<child internal-child="completion">
<object class="GtkSourceCompletion">
<property name="select-on-show">False</property>
</object>
</child>
</object>

Changing the Font

Gtk CSS provides the best way to change the font for a GtkSourceView in a manner that allows for components like class@Map to scale the desired font.

GtkCssProvider *provider = gtk_css_provider_new ();
gtk_css_provider_load_from_data (provider,
"textview { font-family: Monospace; font-size: 8pt; }",
-1,
NULL);
gtk_style_context_add_provider (gtk_widget_get_style_context (view),
GTK_STYLE_PROVIDER (provider),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
g_object_unref (provider);

If you need to adjust the font or size of font within a portion of the document only, you should use a class@Gtk.TextTag with the property@Gtk.TextTag:family or property@Gtk.TextTag:scale set so that the font size may be scaled relative to the default font set in CSS.

Skipped during bindings generation

  • parameter priority: Unsupported pointer to primitive type

  • signal push-snippet: Unsupported parameter location : location: In/Out parameter is not supported

Inheritors

Constructors

Link copied to clipboard
constructor()

Creates a new GtkSourceView.

constructor(buffer: Buffer)

Creates a new #GtkSourceView widget displaying the buffer @buffer.

constructor(gtksourceViewPointer: <Error class: unknown class><<Error class: unknown class>>)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard

Draw a specific background pattern on the view.

Link copied to clipboard

The completion object associated with the view

Link copied to clipboard

The property denotes if snippets should be expanded when the user presses Tab after having typed a word matching the snippets found in class@SnippetManager.

Link copied to clipboard
open val gtkAccessiblePointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard
open val gtkAccessibleTextPointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard
open val gtkBuildablePointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard
open val gtkConstraintTargetPointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard
open val gtkScrollablePointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard
val gtksourceViewPointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard
Link copied to clipboard
open var indenter: Indenter?

The property is a iface@Indenter to use to indent as the user types into the class@View.

Link copied to clipboard
Link copied to clipboard
open var indentWidth: <Error class: unknown class>

Width of an indentation step expressed in number of spaces.

Link copied to clipboard
Link copied to clipboard
open var rightMarginPosition: <Error class: unknown class>

Position of the right margin.

Link copied to clipboard

Whether to display line mark pixbufs

Link copied to clipboard

Whether to display line numbers

Link copied to clipboard

Whether to display the right margin.

Link copied to clipboard

Whether smart Backspace should be used.

Link copied to clipboard

Set the behavior of the HOME and END keys.

Link copied to clipboard

The class@SpaceDrawer object associated with the view.4

Link copied to clipboard
open var tabWidth: <Error class: unknown class>

Width of a tab character expressed in number of spaces.

Functions

Link copied to clipboard

Emits the "change-case" signal. See onChangeCase.

Link copied to clipboard
fun emitChangeNumber(count: <Error class: unknown class>)

Emits the "change-number" signal. See onChangeNumber.

Link copied to clipboard

Emits the "join-lines" signal. See onJoinLines.

Link copied to clipboard
fun emitLineMarkActivated(iter: <Error class: unknown class>, button: <Error class: unknown class>, state: <Error class: unknown class>, nPresses: <Error class: unknown class>)

Emits the "line-mark-activated" signal. See onLineMarkActivated.

Link copied to clipboard

Emits the "move-lines" signal. See onMoveLines.

Link copied to clipboard
fun emitMoveToMatchingBracket(extendSelection: Boolean)

Emits the "move-to-matching-bracket" signal. See onMoveToMatchingBracket.

Link copied to clipboard
fun emitMoveWords(count: <Error class: unknown class>)

Emits the "move-words" signal. See onMoveWords.

Link copied to clipboard

Emits the "show-completion" signal. See onShowCompletion.

Link copied to clipboard
fun emitSmartHomeEnd(iter: <Error class: unknown class>, count: <Error class: unknown class>)

Emits the "smart-home-end" signal. See onSmartHomeEnd.

Link copied to clipboard
open fun getGutterView(windowType: <Error class: unknown class>): Gutter

Returns the class@Gutter object associated with @window_type for @view.

Link copied to clipboard
open fun getHover(): Hover

Gets the class@Hover associated with @view.

Link copied to clipboard
open fun getVisualColumn(iter: <Error class: unknown class>): <Error class: unknown class>

Determines the visual column at @iter taking into consideration the property@View:tab-width of @view.

Link copied to clipboard
open fun indentLines(start: <Error class: unknown class>, end: <Error class: unknown class>)

Inserts one indentation level at the beginning of the specified lines. The empty lines are not indented.

Link copied to clipboard
fun onChangeCase(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: (caseType: ChangeCaseType) -> Unit): <Error class: unknown class>

Keybinding signal to change case of the text at the current cursor position.

Link copied to clipboard
fun onChangeNumber(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: (<Error class: unknown class>) -> Unit): <Error class: unknown class>

Keybinding signal to edit a number at the current cursor position.

Link copied to clipboard
fun onJoinLines(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: () -> Unit): <Error class: unknown class>

Keybinding signal to join the lines currently selected.

Link copied to clipboard
fun onLineMarkActivated(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: (<Error class: unknown class>, <Error class: unknown class>, <Error class: unknown class>, <Error class: unknown class>) -> Unit): <Error class: unknown class>

Emitted when a line mark has been activated (for instance when there was a button press in the line marks gutter).

Link copied to clipboard
fun onMoveLines(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: (down: Boolean) -> Unit): <Error class: unknown class>

The signal is a keybinding which gets emitted when the user initiates moving a line.

Link copied to clipboard
fun onMoveToMatchingBracket(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: (extendSelection: Boolean) -> Unit): <Error class: unknown class>

Keybinding signal to move the cursor to the matching bracket.

Link copied to clipboard
fun onMoveWords(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: (<Error class: unknown class>) -> Unit): <Error class: unknown class>

The signal is a keybinding which gets emitted when the user initiates moving a word.

Link copied to clipboard
fun onShowCompletion(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: () -> Unit): <Error class: unknown class>

The signal is a key binding signal which gets emitted when the user requests a completion, by pressing Controlspace.

Link copied to clipboard
fun onSmartHomeEnd(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: (<Error class: unknown class>, <Error class: unknown class>) -> Unit): <Error class: unknown class>

Emitted when a the cursor was moved according to the smart home end setting.

Link copied to clipboard
open fun pushSnippet(snippet: Snippet, location: <Error class: unknown class>? = null)

Inserts a new snippet at @location

Link copied to clipboard
open fun setMarkAttributes(category: String, attributes: MarkAttributes, priority: <Error class: unknown class>)

Sets attributes and priority for the @category.

Link copied to clipboard
open fun unindentLines(start: <Error class: unknown class>, end: <Error class: unknown class>)

Removes one indentation level at the beginning of the specified lines.