Interface

GtkSourceIndenter

Description [src]

interface GtkSource.Indenter : GObject.Object

Auto-indentation interface.

By default, GtkSourceView can auto-indent as you type when GtkSourceView:auto-indent is enabled. The indentation simply copies the previous lines indentation.

This can be changed by implementing GtkSourceIndenter and setting the GtkSourceView:indenter property.

Implementors of this interface should implement both GtkSource.IndenterInterface.is_trigger and GtkSource.IndenterInterface.indent.

GtkSource.IndenterInterface.is_trigger is called upon key-press to determine of the key press should trigger an indentation. The default implementation of the interface checks to see if the key was GDK_KEY_Return or GDK_KEY_KP_Enter without GDK_SHIFT_MASK set.

GtkSource.IndenterInterface.indent is called after text has been inserted into GtkSourceBuffer when GtkSource.IndenterInterface.is_trigger returned TRUE. The GtkTextIter is placed directly after the inserted character or characters.

It may be beneficial to move the insertion mark using gtk_text_buffer_select_range() depending on how the indenter changes the indentation.

All changes are encapsulated within a single user action so that the user may undo them using standard undo/redo accelerators.

Prerequisite

In order to implement Indenter, your type must inherit fromGObject.

Instance methods

gtk_source_indenter_indent

This function should be implemented to alter the indentation of text within the view.

gtk_source_indenter_is_trigger

This function is used to determine if a key pressed should cause the indenter to automatically indent.

Interface structure

struct GtkSourceIndenterInterface {
  GTypeInterface parent_iface;
  gboolean (* is_trigger) (
    GtkSourceIndenter* self,
    GtkSourceView* view,
    const GtkTextIter* location,
    GdkModifierType state,
    guint keyval
  );
  void (* indent) (
    GtkSourceIndenter* self,
    GtkSourceView* view,
    GtkTextIter* iter
  );
  
}

The virtual function table for GtkSourceIndenter.

Interface members
parent_iface
GTypeInterface
 

No description available.

is_trigger
gboolean (* is_trigger) (
    GtkSourceIndenter* self,
    GtkSourceView* view,
    const GtkTextIter* location,
    GdkModifierType state,
    guint keyval
  )
 

The virtual function pointer for gtk_source_indenter_is_trigger().

indent
void (* indent) (
    GtkSourceIndenter* self,
    GtkSourceView* view,
    GtkTextIter* iter
  )
 

The virtual function pointer for gtk_source_indenter_indent().

Virtual methods

GtkSource.Indenter.indent

This function should be implemented to alter the indentation of text within the view.

GtkSource.Indenter.is_trigger

This function is used to determine if a key pressed should cause the indenter to automatically indent.