View


Object Hierarchy:

GtkSource.View GtkSource.View GtkSource.View Gtk.TextView Gtk.TextView Gtk.TextView->GtkSource.View Gtk.Widget Gtk.Widget Gtk.Widget->Gtk.TextView GLib.InitiallyUnowned GLib.InitiallyUnowned GLib.InitiallyUnowned->Gtk.Widget GLib.Object GLib.Object GLib.Object->GLib.InitiallyUnowned Gtk.Accessible Gtk.Accessible Gtk.Accessible->GtkSource.View Gtk.Accessible->Gtk.TextView Gtk.Accessible->Gtk.Widget Gtk.Buildable Gtk.Buildable Gtk.Buildable->GtkSource.View Gtk.Buildable->Gtk.TextView Gtk.Buildable->Gtk.Widget Gtk.ConstraintTarget Gtk.ConstraintTarget Gtk.ConstraintTarget->GtkSource.View Gtk.ConstraintTarget->Gtk.TextView Gtk.ConstraintTarget->Gtk.Widget Gtk.Scrollable Gtk.Scrollable Gtk.Scrollable->GtkSource.View Gtk.Scrollable->Gtk.TextView

Description:

[ CCode ( type_id = "gtk_source_view_get_type ()" ) ]
public class View : TextView, Accessible, Buildable, ConstraintTarget, Scrollable

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 [[email protected]] interface exposes the [property@View:completion] object with the internal-child "completion".

An example of a UI definition fragment with GtkSourceView: ```xml <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.

```c 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 [[email protected]] with the [ [email protected]:family] or [[email protected]:scale] set so that the font size may be scaled relative to the default font set in CSS.

All known sub-classes:

Namespace: GtkSource
Package: gtksourceview-5

Content:

Properties:

Creation methods:

Methods:

Signals:

Inherited Members:

All known members inherited from class Gtk.TextView
All known members inherited from class Gtk.Widget
All known members inherited from class GLib.Object
All known members inherited from interface Gtk.Accessible
All known members inherited from interface Gtk.Buildable
All known members inherited from interface Gtk.Scrollable



2022 vala-language.org