gtksource

package
v0.0.0-...-8276faa Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 12, 2024 License: MPL-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

GType values.

GType values.

GType values.

GType values.

GType values.

GType values.

GType values.

GType values.

View Source
var (
	GTypeCompletionContext = coreglib.Type(C.gtk_source_completion_context_get_type())
)

GType values.

GType values.

GType values.

View Source
var (
	GTypeCompletionProposal = coreglib.Type(C.gtk_source_completion_proposal_get_type())
)

GType values.

View Source
var (
	GTypeCompletionProvider = coreglib.Type(C.gtk_source_completion_provider_get_type())
)

GType values.

View Source
var (
	GTypeCompletionWords = coreglib.Type(C.gtk_source_completion_words_get_type())
)

GType values.

GType values.

GType values.

GType values.

GType values.

View Source
var (
	GTypeGutterRendererPixbuf = coreglib.Type(C.gtk_source_gutter_renderer_pixbuf_get_type())
)

GType values.

View Source
var (
	GTypeGutterRendererText = coreglib.Type(C.gtk_source_gutter_renderer_text_get_type())
)

GType values.

GType values.

View Source
var (
	GTypeLanguageManager = coreglib.Type(C.gtk_source_language_manager_get_type())
)

GType values.

GType values.

GType values.

GType values.

View Source
var (
	GTypePrintCompositor = coreglib.Type(C.gtk_source_print_compositor_get_type())
)

GType values.

GType values.

GType values.

GType values.

GType values.

GType values.

GType values.

View Source
var (
	GTypeStyleSchemeChooser = coreglib.Type(C.gtk_source_style_scheme_chooser_get_type())
)

GType values.

View Source
var (
	GTypeStyleSchemeChooserButton = coreglib.Type(C.gtk_source_style_scheme_chooser_button_get_type())
)

GType values.

View Source
var (
	GTypeStyleSchemeChooserWidget = coreglib.Type(C.gtk_source_style_scheme_chooser_widget_get_type())
)

GType values.

View Source
var (
	GTypeStyleSchemeManager = coreglib.Type(C.gtk_source_style_scheme_manager_get_type())
)

GType values.

GType values.

GType values.

Functions

func CompletionErrorQuark

func CompletionErrorQuark() glib.Quark

The function returns the following values:

func FileLoaderErrorQuark

func FileLoaderErrorQuark() glib.Quark

The function returns the following values:

func FileSaverErrorQuark

func FileSaverErrorQuark() glib.Quark

The function returns the following values:

func UtilsEscapeSearchText

func UtilsEscapeSearchText(text string) string

UtilsEscapeSearchText: use this function to escape the following characters: \n, \r, \t and \.

For a regular expression search, use g_regex_escape_string() instead.

One possible use case is to take the TextBuffer's selection and put it in a search entry. The selection can contain tabulations, newlines, etc. So it's better to escape those special characters to better fit in the search entry.

See also: gtk_source_utils_unescape_search_text().

<warning> Warning: the escape and unescape functions are not reciprocal! For example, escape (unescape (\)) = \\. So avoid cycles such as: search entry -> unescape -> search settings -> escape -> search entry. The original search entry text may be modified. </warning>.

The function takes the following parameters:

  • text to escape.

The function returns the following values:

  • utf8: escaped text.

func UtilsUnescapeSearchText

func UtilsUnescapeSearchText(text string) string

UtilsUnescapeSearchText: use this function before gtk_source_search_settings_set_search_text(), to unescape the following sequences of characters: \n, \r, \t and \\. The purpose is to easily write those characters in a search entry.

Note that unescaping the search text is not needed for regular expression searches.

See also: gtk_source_utils_escape_search_text().

The function takes the following parameters:

  • text to unescape.

The function returns the following values:

  • utf8: unescaped text.

Types

type BackgroundPatternType

type BackgroundPatternType C.gint
const (
	// SourceBackgroundPatternTypeNone: no pattern.
	SourceBackgroundPatternTypeNone BackgroundPatternType = iota
	// SourceBackgroundPatternTypeGrid: grid pattern.
	SourceBackgroundPatternTypeGrid
)

func (BackgroundPatternType) String

func (b BackgroundPatternType) String() string

String returns the name in string for BackgroundPatternType.

type BracketMatchType

type BracketMatchType C.gint
const (
	// SourceBracketMatchNone: there is no bracket to match.
	SourceBracketMatchNone BracketMatchType = iota
	// SourceBracketMatchOutOfRange: matching a bracket failed because the
	// maximum range was reached.
	SourceBracketMatchOutOfRange
	// SourceBracketMatchNotFound: matching bracket was not found.
	SourceBracketMatchNotFound
	// SourceBracketMatchFound: matching bracket was found.
	SourceBracketMatchFound
)

func (BracketMatchType) String

func (b BracketMatchType) String() string

String returns the name in string for BracketMatchType.

type Buffer

type Buffer struct {
	gtk.TextBuffer
	// contains filtered or unexported fields
}

func NewBuffer

func NewBuffer(table *gtk.TextTagTable) *Buffer

NewBuffer creates a new source buffer.

The function takes the following parameters:

  • table (optional) or NULL to create a new one.

The function returns the following values:

  • buffer: new source buffer.

func NewBufferWithLanguage

func NewBufferWithLanguage(language *Language) *Buffer

NewBufferWithLanguage creates a new source buffer using the highlighting patterns in language. This is equivalent to creating a new source buffer with a new tag table and then calling gtk_source_buffer_set_language().

The function takes the following parameters:

  • language: SourceLanguage.

The function returns the following values:

  • buffer: new source buffer which will highlight text according to the highlighting patterns in language.

func (*Buffer) BackwardIterToSourceMark

func (buffer *Buffer) BackwardIterToSourceMark(iter *gtk.TextIter, category string) bool

BackwardIterToSourceMark moves iter to the position of the previous SourceMark of the given category. Returns TRUE if iter was moved. If category is NULL, the previous source mark can be of any category.

The function takes the following parameters:

  • iter: iterator.
  • category (optional) to search for, or NULL.

The function returns the following values:

  • ok: whether iter was moved.

func (*Buffer) BeginNotUndoableAction

func (buffer *Buffer) BeginNotUndoableAction()

BeginNotUndoableAction marks the beginning of a not undoable action on the buffer, disabling the undo manager. Typically you would call this function before initially setting the contents of the buffer (e.g. when loading a file in a text editor).

You may nest gtk_source_buffer_begin_not_undoable_action() / gtk_source_buffer_end_not_undoable_action() blocks.

func (*Buffer) CanRedo

func (buffer *Buffer) CanRedo() bool

CanRedo determines whether a source buffer can redo the last action (i.e. if the last operation was an undo).

The function returns the following values:

  • ok: TRUE if a redo is possible.

func (*Buffer) CanUndo

func (buffer *Buffer) CanUndo() bool

CanUndo determines whether a source buffer can undo the last action.

The function returns the following values:

  • ok: TRUE if it's possible to undo the last action.

func (*Buffer) ChangeCase

func (buffer *Buffer) ChangeCase(caseType ChangeCaseType, start, end *gtk.TextIter)

ChangeCase changes the case of the text between the specified iterators.

The function takes the following parameters:

  • caseType: how to change the case.
  • start: TextIter.
  • end: TextIter.

func (*Buffer) ConnectBracketMatched

func (buffer *Buffer) ConnectBracketMatched(f func(iter *gtk.TextIter, state BracketMatchType)) coreglib.SignalHandle

ConnectBracketMatched: iter is set to a valid iterator pointing to the matching bracket if state is GTK_SOURCE_BRACKET_MATCH_FOUND. Otherwise iter is meaningless.

The signal is emitted only when the state changes, typically when the cursor moves.

A use-case for this signal is to show messages in a Statusbar.

func (*Buffer) ConnectHighlightUpdated

func (buffer *Buffer) ConnectHighlightUpdated(f func(start, end *gtk.TextIter)) coreglib.SignalHandle

ConnectHighlightUpdated signal is emitted when the syntax highlighting and [context classes][context-classes] are updated in a certain region of the buffer.

func (*Buffer) ConnectRedo

func (buffer *Buffer) ConnectRedo(f func()) coreglib.SignalHandle

ConnectRedo signal is emitted to redo the last undo operation.

func (*Buffer) ConnectSourceMarkUpdated

func (buffer *Buffer) ConnectSourceMarkUpdated(f func(mark *gtk.TextMark)) coreglib.SignalHandle

ConnectSourceMarkUpdated signal is emitted each time a mark is added to, moved or removed from the buffer.

func (*Buffer) ConnectUndo

func (buffer *Buffer) ConnectUndo(f func()) coreglib.SignalHandle

ConnectUndo signal is emitted to undo the last user action which modified the buffer.

func (*Buffer) ContextClassesAtIter

func (buffer *Buffer) ContextClassesAtIter(iter *gtk.TextIter) []string

ContextClassesAtIter: get all defined context classes at iter.

See the SourceBuffer description for the list of default context classes.

The function takes the following parameters:

  • iter: TextIter.

The function returns the following values:

  • utf8s: new NULL terminated array of context class names. Use g_strfreev() to free the array if it is no longer needed.

func (*Buffer) CreateSourceMark

func (buffer *Buffer) CreateSourceMark(name, category string, where *gtk.TextIter) *Mark

CreateSourceMark creates a source mark in the buffer of category category. A source mark is a TextMark but organised into categories. Depending on the category a pixbuf can be specified that will be displayed along the line of the mark.

Like a TextMark, a SourceMark can be anonymous if the passed name is NULL. Also, the buffer owns the marks so you shouldn't unreference it.

Marks always have left gravity and are moved to the beginning of the line when the user deletes the line they were in.

Typical uses for a source mark are bookmarks, breakpoints, current executing instruction indication in a source file, etc..

The function takes the following parameters:

  • name (optional) of the mark, or NULL.
  • category: string defining the mark category.
  • where: location to place the mark.

The function returns the following values:

  • mark: new SourceMark, owned by the buffer.

func (*Buffer) EndNotUndoableAction

func (buffer *Buffer) EndNotUndoableAction()

EndNotUndoableAction marks the end of a not undoable action on the buffer. When the last not undoable block is closed through the call to this function, the list of undo actions is cleared and the undo manager is re-enabled.

func (*Buffer) EnsureHighlight

func (buffer *Buffer) EnsureHighlight(start, end *gtk.TextIter)

EnsureHighlight forces buffer to analyze and highlight the given area synchronously.

<note> <para> This is a potentially slow operation and should be used only when you need to make sure that some text not currently visible is highlighted, for instance before printing. </para> </note>.

The function takes the following parameters:

  • start of the area to highlight.
  • end of the area to highlight.

func (*Buffer) ForwardIterToSourceMark

func (buffer *Buffer) ForwardIterToSourceMark(iter *gtk.TextIter, category string) bool

ForwardIterToSourceMark moves iter to the position of the next SourceMark of the given category. Returns TRUE if iter was moved. If category is NULL, the next source mark can be of any category.

The function takes the following parameters:

  • iter: iterator.
  • category (optional) to search for, or NULL.

The function returns the following values:

  • ok: whether iter was moved.

func (*Buffer) HighlightMatchingBrackets

func (buffer *Buffer) HighlightMatchingBrackets() bool

HighlightMatchingBrackets determines whether bracket match highlighting is activated for the source buffer.

The function returns the following values:

  • ok: TRUE if the source buffer will highlight matching brackets.

func (*Buffer) HighlightSyntax

func (buffer *Buffer) HighlightSyntax() bool

HighlightSyntax determines whether syntax highlighting is activated in the source buffer.

The function returns the following values:

  • ok: TRUE if syntax highlighting is enabled, FALSE otherwise.

func (*Buffer) ImplicitTrailingNewline

func (buffer *Buffer) ImplicitTrailingNewline() bool

The function returns the following values:

  • ok: whether the buffer has an implicit trailing newline.

func (*Buffer) IterBackwardToContextClassToggle

func (buffer *Buffer) IterBackwardToContextClassToggle(iter *gtk.TextIter, contextClass string) bool

IterBackwardToContextClassToggle moves backward to the next toggle (on or off) of the context class. If no matching context class toggles are found, returns FALSE, otherwise TRUE. Does not return toggles located at iter, only toggles after iter. Sets iter to the location of the toggle, or to the end of the buffer if no toggle is found.

See the SourceBuffer description for the list of default context classes.

The function takes the following parameters:

  • iter: TextIter.
  • contextClass: context class.

The function returns the following values:

  • ok: whether we found a context class toggle before iter.

func (*Buffer) IterForwardToContextClassToggle

func (buffer *Buffer) IterForwardToContextClassToggle(iter *gtk.TextIter, contextClass string) bool

IterForwardToContextClassToggle moves forward to the next toggle (on or off) of the context class. If no matching context class toggles are found, returns FALSE, otherwise TRUE. Does not return toggles located at iter, only toggles after iter. Sets iter to the location of the toggle, or to the end of the buffer if no toggle is found.

See the SourceBuffer description for the list of default context classes.

The function takes the following parameters:

  • iter: TextIter.
  • contextClass: context class.

The function returns the following values:

  • ok: whether we found a context class toggle after iter.

func (*Buffer) IterHasContextClass

func (buffer *Buffer) IterHasContextClass(iter *gtk.TextIter, contextClass string) bool

IterHasContextClass: check if the class context_class is set on iter.

See the SourceBuffer description for the list of default context classes.

The function takes the following parameters:

  • iter: TextIter.
  • contextClass class to search for.

The function returns the following values:

  • ok: whether iter has the context class.

func (*Buffer) JoinLines

func (buffer *Buffer) JoinLines(start, end *gtk.TextIter)

JoinLines joins the lines of text between the specified iterators.

The function takes the following parameters:

  • start: TextIter.
  • end: TextIter.

func (*Buffer) Language

func (buffer *Buffer) Language() *Language

Language returns the SourceLanguage associated with the buffer, see gtk_source_buffer_set_language(). The returned object should not be unreferenced by the user.

The function returns the following values:

  • language (optional) associated with the buffer, or NULL.

func (*Buffer) MaxUndoLevels

func (buffer *Buffer) MaxUndoLevels() int

MaxUndoLevels determines the number of undo levels the buffer will track for buffer edits.

The function returns the following values:

  • gint: maximum number of possible undo levels or -1 if no limit is set.

func (*Buffer) Redo

func (buffer *Buffer) Redo()

Redo redoes the last undo operation. Use gtk_source_buffer_can_redo() to check whether a call to this function will have any effect.

This function emits the SourceBuffer::redo signal.

func (*Buffer) RemoveSourceMarks

func (buffer *Buffer) RemoveSourceMarks(start, end *gtk.TextIter, category string)

RemoveSourceMarks: remove all marks of category between start and end from the buffer. If category is NULL, all marks in the range will be removed.

The function takes the following parameters:

  • start: TextIter.
  • end: TextIter.
  • category (optional) to search for, or NULL.

func (*Buffer) SetHighlightMatchingBrackets

func (buffer *Buffer) SetHighlightMatchingBrackets(highlight bool)

SetHighlightMatchingBrackets controls the bracket match highlighting function in the buffer. If activated, when you position your cursor over a bracket character (a parenthesis, a square bracket, etc.) the matching opening or closing bracket character will be highlighted.

The function takes the following parameters:

  • highlight: TRUE if you want matching brackets highlighted.

func (*Buffer) SetHighlightSyntax

func (buffer *Buffer) SetHighlightSyntax(highlight bool)

SetHighlightSyntax controls whether syntax is highlighted in the buffer.

If highlight is TRUE, the text will be highlighted according to the syntax patterns specified in the SourceLanguage set with gtk_source_buffer_set_language().

If highlight is FALSE, syntax highlighting is disabled and all the TextTag objects that have been added by the syntax highlighting engine are removed from the buffer.

The function takes the following parameters:

  • highlight: TRUE to enable syntax highlighting, FALSE to disable it.

func (*Buffer) SetImplicitTrailingNewline

func (buffer *Buffer) SetImplicitTrailingNewline(implicitTrailingNewline bool)

SetImplicitTrailingNewline sets whether the buffer has an implicit trailing newline.

If an explicit trailing newline is present in a TextBuffer, TextView shows it as an empty line. This is generally not what the user expects.

If implicit_trailing_newline is TRUE (the default value): - when a SourceFileLoader loads the content of a file into the buffer, the trailing newline (if present in the file) is not inserted into the buffer. - when a SourceFileSaver saves the content of the buffer into a file, a trailing newline is added to the file.

On the other hand, if implicit_trailing_newline is FALSE, the file's content is not modified when loaded into the buffer, and the buffer's content is not modified when saved into a file.

The function takes the following parameters:

  • implicitTrailingNewline: new value.

func (*Buffer) SetLanguage

func (buffer *Buffer) SetLanguage(language *Language)

SetLanguage associates a SourceLanguage with the buffer.

Note that a SourceLanguage affects not only the syntax highlighting, but also the [context classes][context-classes]. If you want to disable just the syntax highlighting, see gtk_source_buffer_set_highlight_syntax().

The buffer holds a reference to language.

The function takes the following parameters:

  • language (optional) to set, or NULL.

func (*Buffer) SetMaxUndoLevels

func (buffer *Buffer) SetMaxUndoLevels(maxUndoLevels int)

SetMaxUndoLevels sets the number of undo levels for user actions the buffer will track. If the number of user actions exceeds the limit set by this function, older actions will be discarded.

If max_undo_levels is -1, the undo/redo is unlimited.

If max_undo_levels is 0, the undo/redo is disabled.

The function takes the following parameters:

  • maxUndoLevels: desired maximum number of undo levels.

func (*Buffer) SetStyleScheme

func (buffer *Buffer) SetStyleScheme(scheme *StyleScheme)

SetStyleScheme sets a SourceStyleScheme to be used by the buffer and the view.

Note that a SourceStyleScheme affects not only the syntax highlighting, but also other SourceView features such as highlighting the current line, matching brackets, the line numbers, etc.

Instead of setting a NULL scheme, it is better to disable syntax highlighting with gtk_source_buffer_set_highlight_syntax(), and setting the SourceStyleScheme with the "classic" or "tango" ID, because those two style schemes follow more closely the GTK+ theme (for example for the background color).

The buffer holds a reference to scheme.

The function takes the following parameters:

  • scheme (optional) or NULL.

func (*Buffer) SetUndoManager

func (buffer *Buffer) SetUndoManager(manager UndoManagerer)

SetUndoManager: set the buffer undo manager. If manager is NULL the default undo manager will be set.

The function takes the following parameters:

  • manager (optional) or NULL.

func (*Buffer) SortLines

func (buffer *Buffer) SortLines(start, end *gtk.TextIter, flags SortFlags, column int)

SortLines: sort the lines of text between the specified iterators.

The function takes the following parameters:

  • start: TextIter.
  • end: TextIter.
  • flags specifying how the sort should behave.
  • column: sort considering the text starting at the given column.

func (*Buffer) SourceMarksAtIter

func (buffer *Buffer) SourceMarksAtIter(iter *gtk.TextIter, category string) []*Mark

SourceMarksAtIter returns the list of marks of the given category at iter. If category is NULL it returns all marks at iter.

The function takes the following parameters:

  • iter: iterator.
  • category (optional) to search for, or NULL.

The function returns the following values:

  • sList: a newly allocated List.

func (*Buffer) SourceMarksAtLine

func (buffer *Buffer) SourceMarksAtLine(line int, category string) []*Mark

SourceMarksAtLine returns the list of marks of the given category at line. If category is NULL, all marks at line are returned.

The function takes the following parameters:

  • line number.
  • category (optional) to search for, or NULL.

The function returns the following values:

  • sList: a newly allocated List.

func (*Buffer) StyleScheme

func (buffer *Buffer) StyleScheme() *StyleScheme

StyleScheme returns the SourceStyleScheme associated with the buffer, see gtk_source_buffer_set_style_scheme(). The returned object should not be unreferenced by the user.

The function returns the following values:

  • styleScheme (optional) with the buffer, or NULL.

func (*Buffer) Undo

func (buffer *Buffer) Undo()

Undo undoes the last user action which modified the buffer. Use gtk_source_buffer_can_undo() to check whether a call to this function will have any effect.

This function emits the SourceBuffer::undo signal.

func (*Buffer) UndoManager

func (buffer *Buffer) UndoManager() *UndoManager

UndoManager returns the SourceUndoManager associated with the buffer, see gtk_source_buffer_set_undo_manager(). The returned object should not be unreferenced by the user.

The function returns the following values:

  • undoManager (optional) associated with the buffer, or NULL.

type BufferClass

type BufferClass struct {
	// contains filtered or unexported fields
}

BufferClass: instance of this type is always passed by reference.

func (*BufferClass) ParentClass

func (b *BufferClass) ParentClass() *gtk.TextBufferClass

type BufferOverrides

type BufferOverrides struct {
	// The function takes the following parameters:
	//
	//   - iter
	//   - state
	//
	BracketMatched func(iter *gtk.TextIter, state BracketMatchType)
	// Redo redoes the last undo operation. Use gtk_source_buffer_can_redo() to
	// check whether a call to this function will have any effect.
	//
	// This function emits the SourceBuffer::redo signal.
	Redo func()
	// Undo undoes the last user action which modified the buffer. Use
	// gtk_source_buffer_can_undo() to check whether a call to this function
	// will have any effect.
	//
	// This function emits the SourceBuffer::undo signal.
	Undo func()
}

BufferOverrides contains methods that are overridable.

type ChangeCaseType

type ChangeCaseType C.gint
const (
	// SourceChangeCaseLower: change case to lowercase.
	SourceChangeCaseLower ChangeCaseType = iota
	// SourceChangeCaseUpper: change case to uppercase.
	SourceChangeCaseUpper
	// SourceChangeCaseToggle: toggle case of each character.
	SourceChangeCaseToggle
	// SourceChangeCaseTitle: capitalize each word.
	SourceChangeCaseTitle
)

func (ChangeCaseType) String

func (c ChangeCaseType) String() string

String returns the name in string for ChangeCaseType.

type Completion

type Completion struct {
	*coreglib.Object

	gtk.Buildable
	// contains filtered or unexported fields
}

func (*Completion) AddProvider

func (completion *Completion) AddProvider(provider CompletionProviderer) error

AddProvider: add a new SourceCompletionProvider to the completion object. This will add a reference provider, so make sure to unref your own copy when you no longer need it.

The function takes the following parameters:

  • provider: SourceCompletionProvider.

func (*Completion) BlockInteractive

func (completion *Completion) BlockInteractive()

BlockInteractive: block interactive completion. This can be used to disable interactive completion when inserting or deleting text from the buffer associated with the completion. Use gtk_source_completion_unblock_interactive() to enable interactive completion again.

This function may be called multiple times. It will continue to block interactive completion until gtk_source_completion_unblock_interactive() has been called the same number of times.

func (*Completion) ConnectActivateProposal

func (completion *Completion) ConnectActivateProposal(f func()) coreglib.SignalHandle

ConnectActivateProposal signal is a keybinding signal which gets emitted when the user initiates a proposal activation.

Applications should not connect to it, but may emit it with g_signal_emit_by_name() if they need to control the proposal activation programmatically.

func (*Completion) ConnectHide

func (completion *Completion) ConnectHide(f func()) coreglib.SignalHandle

ConnectHide is emitted when the completion window is hidden. The default handler will actually hide the window.

func (*Completion) ConnectMoveCursor

func (completion *Completion) ConnectMoveCursor(f func(step gtk.ScrollStep, num int)) coreglib.SignalHandle

ConnectMoveCursor signal is a keybinding signal which gets emitted when the user initiates a cursor movement.

The <keycap>Up</keycap>, <keycap>Down</keycap>, <keycap>PageUp</keycap>, <keycap>PageDown</keycap>, <keycap>Home</keycap> and <keycap>End</keycap> keys are bound to the normal behavior expected by those keys.

When step is equal to GTK_SCROLL_PAGES, the page size is defined by the SourceCompletion:proposal-page-size property. It is used for the <keycap>PageDown</keycap> and <keycap>PageUp</keycap> keys.

Applications should not connect to it, but may emit it with g_signal_emit_by_name() if they need to control the cursor programmatically.

func (*Completion) ConnectMovePage

func (completion *Completion) ConnectMovePage(f func(step gtk.ScrollStep, num int)) coreglib.SignalHandle

ConnectMovePage signal is a keybinding signal which gets emitted when the user initiates a page movement (i.e. switches between provider pages).

<keycombo><keycap>Control</keycap><keycap>Left</keycap></keycombo> is for going to the previous provider. <keycombo><keycap>Control</keycap><keycap>Right</keycap></keycombo> is for going to the next provider. <keycombo><keycap>Control</keycap><keycap>Home</keycap></keycombo> is for displaying all the providers. <keycombo><keycap>Control</keycap><keycap>End</keycap></keycombo> is for going to the last provider.

When step is equal to K_SCROLL_PAGES, the page size is defined by the SourceCompletion:provider-page-size property.

Applications should not connect to it, but may emit it with g_signal_emit_by_name() if they need to control the page selection programmatically.

func (*Completion) ConnectPopulateContext

func (completion *Completion) ConnectPopulateContext(f func(context *CompletionContext)) coreglib.SignalHandle

ConnectPopulateContext is emitted just before starting to populate the completion with providers. You can use this signal to add additional attributes in the context.

func (*Completion) ConnectShow

func (completion *Completion) ConnectShow(f func()) coreglib.SignalHandle

ConnectShow is emitted when the completion window is shown. The default handler will actually show the window.

func (*Completion) CreateContext

func (completion *Completion) CreateContext(position *gtk.TextIter) *CompletionContext

CreateContext: create a new SourceCompletionContext for completion. The position where the completion occurs can be specified by position. If position is NULL, the current cursor position will be used.

The function takes the following parameters:

  • position (optional) or NULL.

The function returns the following values:

  • completionContext: new SourceCompletionContext. The reference being returned is a 'floating' reference, so if you invoke gtk_source_completion_show() with this context you don't need to unref it.

func (*Completion) Hide

func (completion *Completion) Hide()

Hide hides the completion if it is active (visible).

func (*Completion) InfoWindow

func (completion *Completion) InfoWindow() *CompletionInfo

InfoWindow: info widget is the window where the completion displays optional extra information of the proposal.

The function returns the following values:

  • completionInfo window associated with completion.

func (*Completion) MoveWindow deprecated

func (completion *Completion) MoveWindow(iter *gtk.TextIter)

MoveWindow: move the completion window to a specific iter.

Deprecated: Use gtk_source_completion_provider_get_start_iter() instead.

The function takes the following parameters:

  • iter: TextIter.

func (*Completion) Providers

func (completion *Completion) Providers() []*CompletionProvider

Providers: get list of providers registered on completion. The returned list is owned by the completion and should not be freed.

The function returns the following values:

  • list of SourceCompletionProvider.

func (*Completion) RemoveProvider

func (completion *Completion) RemoveProvider(provider CompletionProviderer) error

RemoveProvider: remove provider from the completion.

The function takes the following parameters:

  • provider: SourceCompletionProvider.

func (*Completion) Show

func (completion *Completion) Show(providers []CompletionProviderer, context *CompletionContext) bool

Show starts a new completion with the specified SourceCompletionContext and a list of potential candidate providers for completion.

It can be convenient for showing a completion on-the-fly, without the need to add or remove providers to the SourceCompletion.

Another solution is to add providers with gtk_source_completion_add_provider(), and implement gtk_source_completion_provider_match() for each provider.

The function takes the following parameters:

  • providers (optional): a list of SourceCompletionProvider, or NULL.
  • context which to start the completion.

The function returns the following values:

  • ok: TRUE if it was possible to the show completion window.

func (*Completion) UnblockInteractive

func (completion *Completion) UnblockInteractive()

UnblockInteractive: unblock interactive completion. This can be used after using gtk_source_completion_block_interactive() to enable interactive completion again.

func (*Completion) View

func (completion *Completion) View() *View

View associated with completion, or NULL if the view has been destroyed.

The function returns the following values:

  • view (optional) associated with completion, or NULL.

type CompletionActivation

type CompletionActivation C.guint
const (
	// SourceCompletionActivationNone: none.
	SourceCompletionActivationNone CompletionActivation = 0b0
	// SourceCompletionActivationInteractive: interactive activation.
	// By default, it occurs on each insertion in the TextBuffer. This can be
	// blocked temporarily with gtk_source_completion_block_interactive().
	SourceCompletionActivationInteractive CompletionActivation = 0b1
	// SourceCompletionActivationUserRequested: user requested
	// activation. By default, it occurs when the user presses
	// <keycombo><keycap>Control</keycap><keycap>space</keycap></keycombo>.
	SourceCompletionActivationUserRequested CompletionActivation = 0b10
)

func (CompletionActivation) Has

Has returns true if c contains other.

func (CompletionActivation) String

func (c CompletionActivation) String() string

String returns the names in string for CompletionActivation.

type CompletionClass

type CompletionClass struct {
	// contains filtered or unexported fields
}

CompletionClass: instance of this type is always passed by reference.

type CompletionContext

type CompletionContext struct {
	coreglib.InitiallyUnowned
	// contains filtered or unexported fields
}

func (*CompletionContext) Activation

func (context *CompletionContext) Activation() CompletionActivation

Activation: get the context activation.

The function returns the following values:

  • completionActivation: context activation.

func (*CompletionContext) AddProposals

func (context *CompletionContext) AddProposals(provider CompletionProviderer, proposals []CompletionProposaller, finished bool)

AddProposals providers can use this function to add proposals to the completion. They can do so asynchronously by means of the finished argument. Providers must ensure that they always call this function with finished set to TRUE once each population (even if no proposals need to be added). Population occurs when the gtk_source_completion_provider_populate() function is called.

The function takes the following parameters:

  • provider: SourceCompletionProvider.
  • proposals (optional): list of proposals to add.
  • finished: whether the provider is finished adding proposals.

func (*CompletionContext) ConnectCancelled

func (context *CompletionContext) ConnectCancelled(f func()) coreglib.SignalHandle

ConnectCancelled is emitted when the current population of proposals has been cancelled. Providers adding proposals asynchronously should connect to this signal to know when to cancel running proposal queries.

func (*CompletionContext) Iter

func (context *CompletionContext) Iter() (*gtk.TextIter, bool)

Iter: get the iter at which the completion was invoked. Providers can use this to determine how and if to match proposals.

The function returns the following values:

  • iter: TextIter.
  • ok: TRUE if iter is correctly set, FALSE otherwise.

type CompletionContextClass

type CompletionContextClass struct {
	// contains filtered or unexported fields
}

CompletionContextClass: instance of this type is always passed by reference.

type CompletionContextOverrides

type CompletionContextOverrides struct {
	Cancelled func()
}

CompletionContextOverrides contains methods that are overridable.

type CompletionError

type CompletionError C.gint

CompletionError: error code used with GTK_SOURCE_COMPLETION_ERROR in a #GError returned from a completion-related function.

const (
	// SourceCompletionErrorAlreadyBound already bound to the SourceCompletion
	// object.
	SourceCompletionErrorAlreadyBound CompletionError = iota
	// SourceCompletionErrorNotBound is not bound to the SourceCompletion
	// object.
	SourceCompletionErrorNotBound
)

func (CompletionError) String

func (c CompletionError) String() string

String returns the name in string for CompletionError.

type CompletionInfo

type CompletionInfo struct {
	gtk.Window
	// contains filtered or unexported fields
}

func NewCompletionInfo

func NewCompletionInfo() *CompletionInfo

The function returns the following values:

  • completionInfo: new GtkSourceCompletionInfo.

func (*CompletionInfo) ConnectBeforeShow

func (info *CompletionInfo) ConnectBeforeShow(f func()) coreglib.SignalHandle

ConnectBeforeShow: this signal is emitted before any "show" management. You can connect to this signal if you want to change some properties or position before the real "show".

func (*CompletionInfo) MoveToIter

func (info *CompletionInfo) MoveToIter(view *gtk.TextView, iter *gtk.TextIter)

MoveToIter moves the SourceCompletionInfo to iter. If iter is NULL info is moved to the cursor position. Moving will respect the Gravity setting of the info window and will ensure the line at iter is not occluded by the window.

The function takes the following parameters:

  • view on which the info window should be positioned.
  • iter (optional): TextIter.

func (*CompletionInfo) SetWidget deprecated

func (info *CompletionInfo) SetWidget(widget gtk.Widgetter)

SetWidget sets the content widget of the info window. See that the previous widget will lose a reference and it can be destroyed, so if you do not want this to happen you must use g_object_ref() before calling this method.

Deprecated: Use gtk_container_add() instead. If there is already a child widget, remove it with gtk_container_remove().

The function takes the following parameters:

  • widget (optional): Widget.

func (*CompletionInfo) Widget deprecated

func (info *CompletionInfo) Widget() gtk.Widgetter

Widget: get the current content widget.

Deprecated: Use gtk_bin_get_child() instead.

The function returns the following values:

  • widget: current content widget.

type CompletionInfoClass

type CompletionInfoClass struct {
	// contains filtered or unexported fields
}

CompletionInfoClass: instance of this type is always passed by reference.

func (*CompletionInfoClass) ParentClass

func (c *CompletionInfoClass) ParentClass() *gtk.WindowClass

type CompletionInfoOverrides

type CompletionInfoOverrides struct {
	BeforeShow func()
}

CompletionInfoOverrides contains methods that are overridable.

type CompletionItem

type CompletionItem struct {
	*coreglib.Object

	CompletionProposal
	// contains filtered or unexported fields
}

func NewCompletionItem deprecated

func NewCompletionItem(label, text string, icon *gdkpixbuf.Pixbuf, info string) *CompletionItem

NewCompletionItem: create a new SourceCompletionItem with label label, icon icon and extra information info. Both icon and info can be NULL in which case there will be no icon shown and no extra information available.

Deprecated: Use gtk_source_completion_item_new2() instead.

The function takes the following parameters:

  • label: item label.
  • text: item text.
  • icon (optional): item icon.
  • info (optional): item extra information.

The function returns the following values:

  • completionItem: new SourceCompletionItem.

func NewCompletionItem2

func NewCompletionItem2() *CompletionItem

NewCompletionItem2 creates a new SourceCompletionItem. The desired properties need to be set afterwards.

The function returns the following values:

  • completionItem: new SourceCompletionItem.

func NewCompletionItemFromStock deprecated

func NewCompletionItemFromStock(label, text, stock, info string) *CompletionItem

NewCompletionItemFromStock creates a new SourceCompletionItem from a stock item. If label is NULL, the stock label will be used.

Deprecated: Use gtk_source_completion_item_new2() instead.

The function takes the following parameters:

  • label (optional): item label.
  • text: item text.
  • stock icon.
  • info (optional): item extra information.

The function returns the following values:

  • completionItem: new SourceCompletionItem.

func NewCompletionItemWithMarkup deprecated

func NewCompletionItemWithMarkup(markup, text string, icon *gdkpixbuf.Pixbuf, info string) *CompletionItem

NewCompletionItemWithMarkup: create a new SourceCompletionItem with markup label markup, icon icon and extra information info. Both icon and info can be NULL in which case there will be no icon shown and no extra information available.

Deprecated: Use gtk_source_completion_item_new2() instead.

The function takes the following parameters:

  • markup: item markup label.
  • text: item text.
  • icon (optional): item icon.
  • info (optional): item extra information.

The function returns the following values:

  • completionItem: new SourceCompletionItem.

func (*CompletionItem) SetGIcon

func (item *CompletionItem) SetGIcon(gicon gio.Iconner)

The function takes the following parameters:

  • gicon (optional) or NULL.

func (*CompletionItem) SetIcon

func (item *CompletionItem) SetIcon(icon *gdkpixbuf.Pixbuf)

The function takes the following parameters:

  • icon (optional) or NULL.

func (*CompletionItem) SetIconName

func (item *CompletionItem) SetIconName(iconName string)

The function takes the following parameters:

  • iconName (optional): icon name, or NULL.

func (*CompletionItem) SetInfo

func (item *CompletionItem) SetInfo(info string)

The function takes the following parameters:

  • info (optional): info, or NULL.

func (*CompletionItem) SetLabel

func (item *CompletionItem) SetLabel(label string)

The function takes the following parameters:

  • label (optional): label, or NULL.

func (*CompletionItem) SetMarkup

func (item *CompletionItem) SetMarkup(markup string)

The function takes the following parameters:

  • markup (optional): markup, or NULL.

func (*CompletionItem) SetText

func (item *CompletionItem) SetText(text string)

The function takes the following parameters:

  • text (optional): text, or NULL.

type CompletionItemClass

type CompletionItemClass struct {
	// contains filtered or unexported fields
}

CompletionItemClass: instance of this type is always passed by reference.

type CompletionItemOverrides

type CompletionItemOverrides struct {
}

CompletionItemOverrides contains methods that are overridable.

type CompletionOverrides

type CompletionOverrides struct {
	ActivateProposal func()
	// Hide hides the completion if it is active (visible).
	Hide func()
	// The function takes the following parameters:
	//
	//   - step
	//   - num
	//
	MoveCursor func(step gtk.ScrollStep, num int)
	// The function takes the following parameters:
	//
	//   - step
	//   - num
	//
	MovePage func(step gtk.ScrollStep, num int)
	// The function takes the following parameters:
	//
	PopulateContext func(context *CompletionContext)
	// The function takes the following parameters:
	//
	//   - provider
	//   - proposal
	//
	// The function returns the following values:
	//
	ProposalActivated func(provider CompletionProviderer, proposal CompletionProposaller) bool
	Show              func()
}

CompletionOverrides contains methods that are overridable.

type CompletionProposal

type CompletionProposal struct {
	*coreglib.Object
	// contains filtered or unexported fields
}

CompletionProposal wraps an interface. This means the user can get the underlying type by calling Cast().

func (*CompletionProposal) Changed

func (proposal *CompletionProposal) Changed()

Changed emits the "changed" signal on proposal. This should be called by implementations whenever the name, icon or info of the proposal has changed.

func (*CompletionProposal) ConnectChanged

func (proposal *CompletionProposal) ConnectChanged(f func()) coreglib.SignalHandle

ConnectChanged is emitted when the proposal has changed. The completion popup will react to this by updating the shown information.

func (*CompletionProposal) Equal

func (proposal *CompletionProposal) Equal(other CompletionProposaller) bool

Equal: get whether two proposal objects are the same. This is used to (together with gtk_source_completion_proposal_hash()) to match proposals in the completion model. By default, it uses direct equality (g_direct_equal()).

The function takes the following parameters:

  • other: SourceCompletionProposal.

The function returns the following values:

  • ok: TRUE if proposal and object are the same proposal.

func (*CompletionProposal) GIcon

func (proposal *CompletionProposal) GIcon() *gio.Icon

GIcon gets the #GIcon for the icon of proposal.

The function returns the following values:

  • icon (optional) with the icon of proposal.

func (*CompletionProposal) Hash

func (proposal *CompletionProposal) Hash() uint

Hash: get the hash value of proposal. This is used to (together with gtk_source_completion_proposal_equal()) to match proposals in the completion model. By default, it uses a direct hash (g_direct_hash()).

The function returns the following values:

  • guint: hash value of proposal.

func (*CompletionProposal) Icon

func (proposal *CompletionProposal) Icon() *gdkpixbuf.Pixbuf

Icon gets the Pixbuf for the icon of proposal.

The function returns the following values:

  • pixbuf (optional) with the icon of proposal.

func (*CompletionProposal) IconName

func (proposal *CompletionProposal) IconName() string

IconName gets the icon name of proposal.

The function returns the following values:

  • utf8 (optional): icon name of proposal.

func (*CompletionProposal) Info

func (proposal *CompletionProposal) Info() string

Info gets extra information associated to the proposal. This information will be used to present the user with extra, detailed information about the selected proposal. The returned string must be freed with g_free().

The function returns the following values:

  • utf8 (optional): newly-allocated string containing extra information of proposal or NULL if no extra information is associated to proposal.

func (*CompletionProposal) Label

func (proposal *CompletionProposal) Label() string

Label gets the label of proposal. The label is shown in the list of proposals as plain text. If you need any markup (such as bold or italic text), you have to implement gtk_source_completion_proposal_get_markup(). The returned string must be freed with g_free().

The function returns the following values:

  • utf8: new string containing the label of proposal.

func (*CompletionProposal) Markup

func (proposal *CompletionProposal) Markup() string

Markup gets the label of proposal with markup. The label is shown in the list of proposals and may contain markup. This will be used instead of gtk_source_completion_proposal_get_label() if implemented. The returned string must be freed with g_free().

The function returns the following values:

  • utf8: new string containing the label of proposal with markup.

func (*CompletionProposal) Text

func (proposal *CompletionProposal) Text() string

Text gets the text of proposal. The text that is inserted into the text buffer when the proposal is activated by the default activation. You are free to implement a custom activation handler in the provider and not implement this function. For more information, see gtk_source_completion_provider_activate_proposal(). The returned string must be freed with g_free().

The function returns the following values:

  • utf8: new string containing the text of proposal.

type CompletionProposalIface

type CompletionProposalIface struct {
	// contains filtered or unexported fields
}

CompletionProposalIface: virtual function table for SourceCompletionProposal.

An instance of this type is always passed by reference.

type CompletionProposaller

type CompletionProposaller interface {
	coreglib.Objector

	// Changed emits the "changed" signal on proposal.
	Changed()
	// Equal: get whether two proposal objects are the same.
	Equal(other CompletionProposaller) bool
	// GIcon gets the #GIcon for the icon of proposal.
	GIcon() *gio.Icon
	// Icon gets the Pixbuf for the icon of proposal.
	Icon() *gdkpixbuf.Pixbuf
	// IconName gets the icon name of proposal.
	IconName() string
	// Info gets extra information associated to the proposal.
	Info() string
	// Label gets the label of proposal.
	Label() string
	// Markup gets the label of proposal with markup.
	Markup() string
	// Text gets the text of proposal.
	Text() string
	// Hash: get the hash value of proposal.
	Hash() uint

	// Changed is emitted when the proposal has changed.
	ConnectChanged(func()) coreglib.SignalHandle
}

CompletionProposaller describes CompletionProposal's interface methods.

type CompletionProvider

type CompletionProvider struct {
	*coreglib.Object
	// contains filtered or unexported fields
}

CompletionProvider wraps an interface. This means the user can get the underlying type by calling Cast().

func (*CompletionProvider) ActivateProposal

func (provider *CompletionProvider) ActivateProposal(proposal CompletionProposaller, iter *gtk.TextIter) bool

ActivateProposal: activate proposal at iter. When this functions returns FALSE, the default activation of proposal will take place which replaces the word at iter with the text of proposal (see gtk_source_completion_proposal_get_text()).

Here is how the default activation selects the boundaries of the word to replace. The end of the word is iter. For the start of the word, it depends on whether a start iter is defined for proposal (see gtk_source_completion_provider_get_start_iter()). If a start iter is defined, the start of the word is the start iter. Else, the word (as long as possible) will contain only alphanumerical and the "_" characters.

The function takes the following parameters:

  • proposal: SourceCompletionProposal.
  • iter: TextIter.

The function returns the following values:

  • ok: TRUE to indicate that the proposal activation has been handled, FALSE otherwise.

func (*CompletionProvider) Activation

func (provider *CompletionProvider) Activation() CompletionActivation

Activation: get with what kind of activation the provider should be activated.

The function returns the following values:

  • completionActivation: combination of SourceCompletionActivation.

func (*CompletionProvider) GIcon

func (provider *CompletionProvider) GIcon() *gio.Icon

GIcon gets the #GIcon for the icon of provider.

The function returns the following values:

  • icon (optional) to be used for the provider, or NULL if the provider does not have a special icon.

func (*CompletionProvider) Icon

func (provider *CompletionProvider) Icon() *gdkpixbuf.Pixbuf

Icon: get the Pixbuf for the icon of the provider.

The function returns the following values:

  • pixbuf (optional): icon to be used for the provider, or NULL if the provider does not have a special icon.

func (*CompletionProvider) IconName

func (provider *CompletionProvider) IconName() string

IconName gets the icon name of provider.

The function returns the following values:

  • utf8 (optional): icon name to be used for the provider, or NULL if the provider does not have a special icon.

func (*CompletionProvider) InfoWidget

func (provider *CompletionProvider) InfoWidget(proposal CompletionProposaller) gtk.Widgetter

InfoWidget: get a customized info widget to show extra information of a proposal. This allows for customized widgets on a proposal basis, although in general providers will have the same custom widget for all their proposals and proposal can be ignored. The implementation of this function is optional.

If this function is not implemented, the default widget is a Label. The return value of gtk_source_completion_proposal_get_info() is used as the content of the Label.

<note> <para> If implemented, gtk_source_completion_provider_update_info() <emphasis>must</emphasis> also be implemented. </para> </note>.

The function takes the following parameters:

  • proposal: currently selected SourceCompletionProposal.

The function returns the following values:

  • widget (optional): custom Widget to show extra information about proposal, or NULL if the provider does not have a special info widget.

func (*CompletionProvider) InteractiveDelay

func (provider *CompletionProvider) InteractiveDelay() int

InteractiveDelay: get the delay in milliseconds before starting interactive completion for this provider. A value of -1 indicates to use the default value as set by the SourceCompletion:auto-complete-delay property.

The function returns the following values:

  • gint: interactive delay in milliseconds.

func (*CompletionProvider) Match

func (provider *CompletionProvider) Match(context *CompletionContext) bool

Match: get whether the provider match the context of completion detailed in context.

The function takes the following parameters:

  • context: SourceCompletionContext.

The function returns the following values:

  • ok: TRUE if provider matches the completion context, FALSE otherwise.

func (*CompletionProvider) Name

func (provider *CompletionProvider) Name() string

Name: get the name of the provider. This should be a translatable name for display to the user. For example: _("Document word completion provider"). The returned string must be freed with g_free().

The function returns the following values:

  • utf8: new string containing the name of the provider.

func (*CompletionProvider) Populate

func (provider *CompletionProvider) Populate(context *CompletionContext)

Populate context with proposals from provider added with the gtk_source_completion_context_add_proposals() function.

The function takes the following parameters:

  • context: SourceCompletionContext.

func (*CompletionProvider) Priority

func (provider *CompletionProvider) Priority() int

Priority: get the provider priority. The priority determines the order in which proposals appear in the completion popup. Higher priorities are sorted before lower priorities. The default priority is 0.

The function returns the following values:

  • gint: provider priority.

func (*CompletionProvider) StartIter

func (provider *CompletionProvider) StartIter(context *CompletionContext, proposal CompletionProposaller) (*gtk.TextIter, bool)

StartIter: get the TextIter at which the completion for proposal starts. When implemented, this information is used to position the completion window accordingly when a proposal is selected in the completion window. The proposal text inside the completion window is aligned on iter.

If this function is not implemented, the word boundary is taken to position the completion window. See gtk_source_completion_provider_activate_proposal() for an explanation on the word boundaries.

When the proposal is activated, the default handler uses iter as the start of the word to replace. See gtk_source_completion_provider_activate_proposal() for more information.

The function takes the following parameters:

  • context: SourceCompletionContext.
  • proposal: SourceCompletionProposal.

The function returns the following values:

  • iter: TextIter.
  • ok: TRUE if iter was set for proposal, FALSE otherwise.

func (*CompletionProvider) UpdateInfo

func (provider *CompletionProvider) UpdateInfo(proposal CompletionProposaller, info *CompletionInfo)

UpdateInfo: update extra information shown in info for proposal.

<note> <para> This function <emphasis>must</emphasis> be implemented when gtk_source_completion_provider_get_info_widget() is implemented. </para> </note>.

The function takes the following parameters:

  • proposal: SourceCompletionProposal.
  • info: SourceCompletionInfo.

type CompletionProviderIface

type CompletionProviderIface struct {
	// contains filtered or unexported fields
}

CompletionProviderIface: virtual function table for SourceCompletionProvider.

An instance of this type is always passed by reference.

type CompletionProviderer

type CompletionProviderer interface {
	coreglib.Objector

	// ActivateProposal: activate proposal at iter.
	ActivateProposal(proposal CompletionProposaller, iter *gtk.TextIter) bool
	// Activation: get with what kind of activation the provider should be
	// activated.
	Activation() CompletionActivation
	// GIcon gets the #GIcon for the icon of provider.
	GIcon() *gio.Icon
	// Icon: get the Pixbuf for the icon of the provider.
	Icon() *gdkpixbuf.Pixbuf
	// IconName gets the icon name of provider.
	IconName() string
	// InfoWidget: get a customized info widget to show extra information of a
	// proposal.
	InfoWidget(proposal CompletionProposaller) gtk.Widgetter
	// InteractiveDelay: get the delay in milliseconds before starting
	// interactive completion for this provider.
	InteractiveDelay() int
	// Name: get the name of the provider.
	Name() string
	// Priority: get the provider priority.
	Priority() int
	// StartIter: get the TextIter at which the completion for proposal starts.
	StartIter(context *CompletionContext, proposal CompletionProposaller) (*gtk.TextIter, bool)
	// Match: get whether the provider match the context of completion detailed
	// in context.
	Match(context *CompletionContext) bool
	// Populate context with proposals from provider added with the
	// gtk_source_completion_context_add_proposals() function.
	Populate(context *CompletionContext)
	// UpdateInfo: update extra information shown in info for proposal.
	UpdateInfo(proposal CompletionProposaller, info *CompletionInfo)
}

CompletionProviderer describes CompletionProvider's interface methods.

type CompletionWords

type CompletionWords struct {
	*coreglib.Object

	CompletionProvider
	// contains filtered or unexported fields
}

func NewCompletionWords

func NewCompletionWords(name string, icon *gdkpixbuf.Pixbuf) *CompletionWords

The function takes the following parameters:

  • name (optional) for the provider, or NULL.
  • icon (optional): specific icon for the provider, or NULL.

The function returns the following values:

  • completionWords: new SourceCompletionWords provider.

func (*CompletionWords) Register

func (words *CompletionWords) Register(buffer *gtk.TextBuffer)

Register registers buffer in the words provider.

The function takes the following parameters:

  • buffer: TextBuffer.

func (*CompletionWords) Unregister

func (words *CompletionWords) Unregister(buffer *gtk.TextBuffer)

Unregister unregisters buffer from the words provider.

The function takes the following parameters:

  • buffer: TextBuffer.

type CompletionWordsClass

type CompletionWordsClass struct {
	// contains filtered or unexported fields
}

CompletionWordsClass: instance of this type is always passed by reference.

type CompletionWordsOverrides

type CompletionWordsOverrides struct {
}

CompletionWordsOverrides contains methods that are overridable.

type CompressionType

type CompressionType C.gint
const (
	// SourceCompressionTypeNone: plain text.
	SourceCompressionTypeNone CompressionType = iota
	// SourceCompressionTypeGzip: gzip compression.
	SourceCompressionTypeGzip
)

func (CompressionType) String

func (c CompressionType) String() string

String returns the name in string for CompressionType.

type DrawSpacesFlags deprecated

type DrawSpacesFlags C.guint

DrawSpacesFlags determine what kind of spaces whould be drawn. If none of GTK_SOURCE_DRAW_SPACES_LEADING, GTK_SOURCE_DRAW_SPACES_TEXT or GTK_SOURCE_DRAW_SPACES_TRAILING is specified, whitespaces at any position in the line will be drawn (i.e. it has the same effect as specifying all of them).

Deprecated: Use SourceSpaceTypeFlags and SourceSpaceLocationFlags instead.

const (
	// SourceDrawSpacesSpace: whether the space character should be drawn.
	SourceDrawSpacesSpace DrawSpacesFlags = 0b1
	// SourceDrawSpacesTab: whether the tab character should be drawn.
	SourceDrawSpacesTab DrawSpacesFlags = 0b10
	// SourceDrawSpacesNewline: whether the line breaks should be drawn. If the
	// SourceBuffer:implicit-trailing-newline property is TRUE, a line break is
	// also drawn at the end of the buffer.
	SourceDrawSpacesNewline DrawSpacesFlags = 0b100
	// SourceDrawSpacesNbsp: whether the non-breaking whitespaces should be
	// drawn.
	SourceDrawSpacesNbsp DrawSpacesFlags = 0b1000
	// SourceDrawSpacesLeading: whether leading whitespaces should be drawn.
	SourceDrawSpacesLeading DrawSpacesFlags = 0b10000
	// SourceDrawSpacesText: whether whitespaces inside text should be drawn.
	SourceDrawSpacesText DrawSpacesFlags = 0b100000
	// SourceDrawSpacesTrailing: whether trailing whitespaces should be drawn.
	SourceDrawSpacesTrailing DrawSpacesFlags = 0b1000000
	// SourceDrawSpacesAll: wheter all kind of spaces should be drawn.
	SourceDrawSpacesAll DrawSpacesFlags = 0b1111111
)

func (DrawSpacesFlags) Has

func (d DrawSpacesFlags) Has(other DrawSpacesFlags) bool

Has returns true if d contains other.

func (DrawSpacesFlags) String

func (d DrawSpacesFlags) String() string

String returns the names in string for DrawSpacesFlags.

type Encoding

type Encoding struct {
	// contains filtered or unexported fields
}

Encoding: instance of this type is always passed by reference.

func EncodingGetAll

func EncodingGetAll() []*Encoding

EncodingGetAll gets all encodings.

The function returns the following values:

  • sList: list of all SourceEncoding's. Free with g_slist_free().

func EncodingGetCurrent

func EncodingGetCurrent() *Encoding

EncodingGetCurrent gets the SourceEncoding for the current locale. See also g_get_charset().

The function returns the following values:

  • encoding: current locale encoding.

func EncodingGetDefaultCandidates

func EncodingGetDefaultCandidates() []*Encoding

EncodingGetDefaultCandidates gets the list of default candidate encodings to try when loading a file. See gtk_source_file_loader_set_candidate_encodings().

This function returns a different list depending on the current locale (i.e. language, country and default encoding). The UTF-8 encoding and the current locale encoding are guaranteed to be present in the returned list.

The function returns the following values:

  • sList: list of default candidate encodings. Free with g_slist_free().

func EncodingGetFromCharset

func EncodingGetFromCharset(charset string) *Encoding

EncodingGetFromCharset gets a SourceEncoding from a character set such as "UTF-8" or "ISO-8859-1".

The function takes the following parameters:

  • charset: character set.

The function returns the following values:

  • encoding (optional): corresponding SourceEncoding, or NULL if not found.

func EncodingGetUTF8

func EncodingGetUTF8() *Encoding

The function returns the following values:

  • encoding: UTF-8 encoding.

func (*Encoding) Charset

func (enc *Encoding) Charset() string

Charset gets the character set of the SourceEncoding, such as "UTF-8" or "ISO-8859-1".

The function returns the following values:

  • utf8: character set of the SourceEncoding.

func (*Encoding) Copy

func (enc *Encoding) Copy() *Encoding

Copy: used by language bindings.

The function returns the following values:

  • encoding: copy of enc.

func (*Encoding) Name

func (enc *Encoding) Name() string

Name gets the name of the SourceEncoding such as "Unicode" or "Western".

The function returns the following values:

  • utf8: name of the SourceEncoding.

func (*Encoding) String

func (enc *Encoding) String() string

The function returns the following values:

  • utf8: string representation. Free with g_free() when no longer needed.

type File

type File struct {
	*coreglib.Object
	// contains filtered or unexported fields
}

func NewFile

func NewFile() *File

The function returns the following values:

  • file: new SourceFile object.

func (*File) CheckFileOnDisk

func (file *File) CheckFileOnDisk()

CheckFileOnDisk checks synchronously the file on disk, to know whether the file is externally modified, or has been deleted, and whether the file is read-only.

SourceFile doesn't create a Monitor to track those properties, so this function needs to be called instead. Creating lots of Monitor's would take lots of resources.

Since this function is synchronous, it is advised to call it only on local files. See gtk_source_file_is_local().

func (*File) CompressionType

func (file *File) CompressionType() CompressionType

The function returns the following values:

  • compressionType: compression type.

func (*File) Encoding

func (file *File) Encoding() *Encoding

Encoding: encoding is initially NULL. After a successful file loading or saving operation, the encoding is non-NULL.

The function returns the following values:

  • encoding: character encoding.

func (*File) IsDeleted

func (file *File) IsDeleted() bool

IsDeleted returns whether the file has been deleted. If the SourceFile:location is NULL, returns FALSE.

To have an up-to-date value, you must first call gtk_source_file_check_file_on_disk().

The function returns the following values:

  • ok: whether the file has been deleted.

func (*File) IsExternallyModified

func (file *File) IsExternallyModified() bool

IsExternallyModified returns whether the file is externally modified. If the SourceFile:location is NULL, returns FALSE.

To have an up-to-date value, you must first call gtk_source_file_check_file_on_disk().

The function returns the following values:

  • ok: whether the file is externally modified.

func (*File) IsLocal

func (file *File) IsLocal() bool

IsLocal returns whether the file is local. If the SourceFile:location is NULL, returns FALSE.

The function returns the following values:

  • ok: whether the file is local.

func (*File) IsReadonly

func (file *File) IsReadonly() bool

IsReadonly returns whether the file is read-only. If the SourceFile:location is NULL, returns FALSE.

To have an up-to-date value, you must first call gtk_source_file_check_file_on_disk().

The function returns the following values:

  • ok: whether the file is read-only.

func (*File) Location

func (file *File) Location() *gio.File

The function returns the following values:

  • ret: #GFile.

func (*File) NewlineType

func (file *File) NewlineType() NewlineType

The function returns the following values:

  • newlineType: newline type.

func (*File) SetLocation

func (file *File) SetLocation(location gio.Filer)

SetLocation sets the location.

The function takes the following parameters:

  • location (optional): new #GFile, or NULL.

type FileClass

type FileClass struct {
	// contains filtered or unexported fields
}

FileClass: instance of this type is always passed by reference.

func (*FileClass) Padding

func (f *FileClass) Padding() [10]unsafe.Pointer

type FileLoader

type FileLoader struct {
	*coreglib.Object
	// contains filtered or unexported fields
}

func NewFileLoader

func NewFileLoader(buffer *Buffer, file *File) *FileLoader

NewFileLoader creates a new SourceFileLoader object. The contents is read from the SourceFile's location. If not already done, call gtk_source_file_set_location() before calling this constructor. The previous location is anyway not needed, because as soon as the file loading begins, the buffer is emptied.

The function takes the following parameters:

  • buffer to load the contents into.
  • file: SourceFile.

The function returns the following values:

  • fileLoader: new SourceFileLoader object.

func NewFileLoaderFromStream

func NewFileLoaderFromStream(buffer *Buffer, file *File, stream gio.InputStreamer) *FileLoader

NewFileLoaderFromStream creates a new SourceFileLoader object. The contents is read from stream.

The function takes the following parameters:

  • buffer to load the contents into.
  • file: SourceFile.
  • stream to load, e.g. stdin.

The function returns the following values:

  • fileLoader: new SourceFileLoader object.

func (*FileLoader) Buffer

func (loader *FileLoader) Buffer() *Buffer

The function returns the following values:

  • buffer to load the contents into.

func (*FileLoader) CompressionType

func (loader *FileLoader) CompressionType() CompressionType

The function returns the following values:

  • compressionType: detected compression type.

func (*FileLoader) Encoding

func (loader *FileLoader) Encoding() *Encoding

The function returns the following values:

  • encoding: detected file encoding.

func (*FileLoader) File

func (loader *FileLoader) File() *File

The function returns the following values:

  • file: SourceFile.

func (*FileLoader) InputStream

func (loader *FileLoader) InputStream() gio.InputStreamer

The function returns the following values:

  • inputStream (optional) to load, or NULL if a #GFile is used.

func (*FileLoader) LoadFinish

func (loader *FileLoader) LoadFinish(result gio.AsyncResulter) error

LoadFinish finishes a file loading started with gtk_source_file_loader_load_async().

If the contents has been loaded, the following SourceFile properties will be updated: the location, the encoding, the newline type and the compression type.

The function takes the following parameters:

  • result: Result.

func (*FileLoader) Location

func (loader *FileLoader) Location() *gio.File

The function returns the following values:

  • file (optional) to load, or NULL if an input stream is used.

func (*FileLoader) NewlineType

func (loader *FileLoader) NewlineType() NewlineType

The function returns the following values:

  • newlineType: detected newline type.

func (*FileLoader) SetCandidateEncodings

func (loader *FileLoader) SetCandidateEncodings(candidateEncodings []*Encoding)

SetCandidateEncodings sets the candidate encodings for the file loading. The encodings are tried in the same order as the list.

For convenience, candidate_encodings can contain duplicates. Only the first occurrence of a duplicated encoding is kept in the list.

By default the candidate encodings are (in that order in the list): 1. If set, the SourceFile's encoding as returned by gtk_source_file_get_encoding(). 2. The default candidates as returned by gtk_source_encoding_get_default_candidates().

The function takes the following parameters:

  • candidateEncodings: list of SourceEncoding<!-- -->s.

type FileLoaderClass

type FileLoaderClass struct {
	// contains filtered or unexported fields
}

FileLoaderClass: instance of this type is always passed by reference.

func (*FileLoaderClass) Padding

func (f *FileLoaderClass) Padding() [10]unsafe.Pointer

type FileLoaderError

type FileLoaderError C.gint

FileLoaderError: error code used with the GTK_SOURCE_FILE_LOADER_ERROR domain.

const (
	// SourceFileLoaderErrorTooBig: file is too big.
	SourceFileLoaderErrorTooBig FileLoaderError = iota
	// SourceFileLoaderErrorEncodingAutoDetectionFailed: it is not possible to
	// detect the encoding automatically.
	SourceFileLoaderErrorEncodingAutoDetectionFailed
	// SourceFileLoaderErrorConversionFallback: there was an encoding conversion
	// error and it was needed to use a fallback character.
	SourceFileLoaderErrorConversionFallback
)

func (FileLoaderError) String

func (f FileLoaderError) String() string

String returns the name in string for FileLoaderError.

type FileLoaderOverrides

type FileLoaderOverrides struct {
}

FileLoaderOverrides contains methods that are overridable.

type FileOverrides

type FileOverrides struct {
}

FileOverrides contains methods that are overridable.

type FileSaver

type FileSaver struct {
	*coreglib.Object
	// contains filtered or unexported fields
}

func NewFileSaver

func NewFileSaver(buffer *Buffer, file *File) *FileSaver

NewFileSaver creates a new SourceFileSaver object. The buffer will be saved to the SourceFile's location.

This constructor is suitable for a simple "save" operation, when the file already contains a non-NULL SourceFile:location.

The function takes the following parameters:

  • buffer to save.
  • file: SourceFile.

The function returns the following values:

  • fileSaver: new SourceFileSaver object.

func NewFileSaverWithTarget

func NewFileSaverWithTarget(buffer *Buffer, file *File, targetLocation gio.Filer) *FileSaver

NewFileSaverWithTarget creates a new SourceFileSaver object with a target location. When the file saving is finished successfully, target_location is set to the file's SourceFile:location property. If an error occurs, the previous valid location is still available in SourceFile.

This constructor is suitable for a "save as" operation, or for saving a new buffer for the first time.

The function takes the following parameters:

  • buffer to save.
  • file: SourceFile.
  • targetLocation where to save the buffer to.

The function returns the following values:

  • fileSaver: new SourceFileSaver object.

func (*FileSaver) Buffer

func (saver *FileSaver) Buffer() *Buffer

The function returns the following values:

  • buffer to save.

func (*FileSaver) CompressionType

func (saver *FileSaver) CompressionType() CompressionType

The function returns the following values:

  • compressionType: compression type.

func (*FileSaver) Encoding

func (saver *FileSaver) Encoding() *Encoding

The function returns the following values:

  • encoding: encoding.

func (*FileSaver) File

func (saver *FileSaver) File() *File

The function returns the following values:

  • file: SourceFile.

func (*FileSaver) Flags

func (saver *FileSaver) Flags() FileSaverFlags

The function returns the following values:

  • fileSaverFlags: flags.

func (*FileSaver) Location

func (saver *FileSaver) Location() *gio.File

The function returns the following values:

  • file where to save the buffer to.

func (*FileSaver) NewlineType

func (saver *FileSaver) NewlineType() NewlineType

The function returns the following values:

  • newlineType: newline type.

func (*FileSaver) SaveFinish

func (saver *FileSaver) SaveFinish(result gio.AsyncResulter) error

SaveFinish finishes a file saving started with gtk_source_file_saver_save_async().

If the file has been saved successfully, the following SourceFile properties will be updated: the location, the encoding, the newline type and the compression type.

Since the 3.20 version, gtk_text_buffer_set_modified() is called with FALSE if the file has been saved successfully.

The function takes the following parameters:

  • result: Result.

func (*FileSaver) SetCompressionType

func (saver *FileSaver) SetCompressionType(compressionType CompressionType)

SetCompressionType sets the compression type. By default the compression type is taken from the SourceFile.

The function takes the following parameters:

  • compressionType: new compression type.

func (*FileSaver) SetEncoding

func (saver *FileSaver) SetEncoding(encoding *Encoding)

SetEncoding sets the encoding. If encoding is NULL, the UTF-8 encoding will be set. By default the encoding is taken from the SourceFile.

The function takes the following parameters:

  • encoding (optional): new encoding, or NULL for UTF-8.

func (*FileSaver) SetFlags

func (saver *FileSaver) SetFlags(flags FileSaverFlags)

The function takes the following parameters:

  • flags: new flags.

func (*FileSaver) SetNewlineType

func (saver *FileSaver) SetNewlineType(newlineType NewlineType)

SetNewlineType sets the newline type. By default the newline type is taken from the SourceFile.

The function takes the following parameters:

  • newlineType: new newline type.

type FileSaverClass

type FileSaverClass struct {
	// contains filtered or unexported fields
}

FileSaverClass: instance of this type is always passed by reference.

func (*FileSaverClass) Padding

func (f *FileSaverClass) Padding() [10]unsafe.Pointer

type FileSaverError

type FileSaverError C.gint

FileSaverError: error code used with the GTK_SOURCE_FILE_SAVER_ERROR domain.

const (
	// SourceFileSaverErrorInvalidChars: buffer contains invalid characters.
	SourceFileSaverErrorInvalidChars FileSaverError = iota
	// SourceFileSaverErrorExternallyModified: file is externally modified.
	SourceFileSaverErrorExternallyModified
)

func (FileSaverError) String

func (f FileSaverError) String() string

String returns the name in string for FileSaverError.

type FileSaverFlags

type FileSaverFlags C.guint

FileSaverFlags flags to define the behavior of a SourceFileSaver.

const (
	// SourceFileSaverFlagsNone: no flags.
	SourceFileSaverFlagsNone FileSaverFlags = 0b0
	// SourceFileSaverFlagsIgnoreInvalidChars: ignore invalid characters.
	SourceFileSaverFlagsIgnoreInvalidChars FileSaverFlags = 0b1
	// SourceFileSaverFlagsIgnoreModificationTime: save file despite external
	// modifications.
	SourceFileSaverFlagsIgnoreModificationTime FileSaverFlags = 0b10
	// SourceFileSaverFlagsCreateBackup: create a backup before saving the file.
	SourceFileSaverFlagsCreateBackup FileSaverFlags = 0b100
)

func (FileSaverFlags) Has

func (f FileSaverFlags) Has(other FileSaverFlags) bool

Has returns true if f contains other.

func (FileSaverFlags) String

func (f FileSaverFlags) String() string

String returns the names in string for FileSaverFlags.

type FileSaverOverrides

type FileSaverOverrides struct {
}

FileSaverOverrides contains methods that are overridable.

type Gutter

type Gutter struct {
	*coreglib.Object
	// contains filtered or unexported fields
}

func (*Gutter) Insert

func (gutter *Gutter) Insert(renderer GutterRendererer, position int) bool

Insert renderer into the gutter. If renderer is yet unowned then gutter claims its ownership. Otherwise just increases renderer's reference count. renderer cannot be already inserted to another gutter.

The function takes the following parameters:

  • renderer: gutter renderer (must inherit from SourceGutterRenderer).
  • position: renderer position.

The function returns the following values:

  • ok: TRUE if operation succeeded. Otherwise FALSE.

func (*Gutter) Padding

func (gutter *Gutter) Padding(xpad, ypad *int)

Padding: deprecated: Use gtk_source_gutter_renderer_get_padding() instead.

The function takes the following parameters:

  • xpad
  • ypad

func (*Gutter) QueueDraw

func (gutter *Gutter) QueueDraw()

QueueDraw invalidates the drawable area of the gutter. You can use this to force a redraw of the gutter if something has changed and needs to be redrawn.

func (*Gutter) Remove

func (gutter *Gutter) Remove(renderer GutterRendererer)

Remove removes renderer from gutter.

The function takes the following parameters:

  • renderer: SourceGutterRenderer.

func (*Gutter) RendererAtPos

func (gutter *Gutter) RendererAtPos(x, y int) GutterRendererer

RendererAtPos finds the SourceGutterRenderer at (x, y).

The function takes the following parameters:

  • x position to get identified.
  • y position to get identified.

The function returns the following values:

  • gutterRenderer (optional): renderer at (x, y) or NULL.

func (*Gutter) Reorder

func (gutter *Gutter) Reorder(renderer GutterRendererer, position int)

Reorder reorders renderer in gutter to new position.

The function takes the following parameters:

  • renderer: CellRenderer.
  • position: new renderer position.

func (*Gutter) SetPadding

func (gutter *Gutter) SetPadding(xpad, ypad int)

SetPadding: deprecated: Use gtk_source_gutter_renderer_set_padding() instead.

The function takes the following parameters:

  • xpad
  • ypad

func (*Gutter) View

func (gutter *Gutter) View() *View

The function returns the following values:

  • view: associated SourceView.

func (*Gutter) Window deprecated

func (gutter *Gutter) Window() gdk.Windower

Window: get the Window of the gutter. The window will only be available when the gutter has at least one, non-zero width, cell renderer packed.

Deprecated: Use gtk_text_view_get_window() instead.

The function returns the following values:

  • window of the gutter, or NULL if the gutter has no window.

func (*Gutter) WindowType

func (gutter *Gutter) WindowType() gtk.TextWindowType

The function returns the following values:

  • textWindowType of gutter.

type GutterClass

type GutterClass struct {
	// contains filtered or unexported fields
}

GutterClass: instance of this type is always passed by reference.

type GutterOverrides

type GutterOverrides struct {
}

GutterOverrides contains methods that are overridable.

type GutterRenderer

type GutterRenderer struct {
	coreglib.InitiallyUnowned
	// contains filtered or unexported fields
}

func BaseGutterRenderer

func BaseGutterRenderer(obj GutterRendererer) *GutterRenderer

BaseGutterRenderer returns the underlying base object.

func (*GutterRenderer) Activate

func (renderer *GutterRenderer) Activate(iter *gtk.TextIter, area *gdk.Rectangle, event *gdk.Event)

Activate emits the SourceGutterRenderer::activate signal of the renderer. This is called from SourceGutter and should never have to be called manually.

The function takes the following parameters:

  • iter at the start of the line where the renderer is activated.
  • area of the cell area where the renderer is activated.
  • event that triggered the activation.

func (*GutterRenderer) Alignment

func (renderer *GutterRenderer) Alignment() (xalign, yalign float32)

Alignment: get the x-alignment and y-alignment of the gutter renderer.

The function returns the following values:

  • xalign (optional): return location for the x-alignment, or NULL to ignore.
  • yalign (optional): return location for the y-alignment, or NULL to ignore.

func (*GutterRenderer) AlignmentMode

func (renderer *GutterRenderer) AlignmentMode() GutterRendererAlignmentMode

AlignmentMode: get the alignment mode. The alignment mode describes the manner in which the renderer is aligned (see :xalign and :yalign).

The function returns the following values:

  • gutterRendererAlignmentMode: SourceGutterRendererAlignmentMode.

func (*GutterRenderer) Background

func (renderer *GutterRenderer) Background() (*gdk.RGBA, bool)

Background: get the background color of the renderer.

The function returns the following values:

  • color (optional): return value for a RGBA.
  • ok: TRUE if the background color is set, FALSE otherwise.

func (*GutterRenderer) Begin

func (renderer *GutterRenderer) Begin(cr *cairo.Context, backgroundArea, cellArea *gdk.Rectangle, start, end *gtk.TextIter)

Begin: called when drawing a region begins. The region to be drawn is indicated by start and end. The purpose is to allow the implementation to precompute some state before the draw method is called for each cell.

The function takes the following parameters:

  • cr: #cairo_t.
  • backgroundArea: Rectangle.
  • cellArea: Rectangle.
  • start: TextIter.
  • end: TextIter.

func (*GutterRenderer) ConnectActivate

func (renderer *GutterRenderer) ConnectActivate(f func(iter *gtk.TextIter, area *gdk.Rectangle, event *gdk.Event)) coreglib.SignalHandle

ConnectActivate signal is emitted when the renderer is activated.

func (*GutterRenderer) ConnectQueryActivatable

func (renderer *GutterRenderer) ConnectQueryActivatable(f func(iter *gtk.TextIter, area *gdk.Rectangle, event *gdk.Event) (ok bool)) coreglib.SignalHandle

ConnectQueryActivatable signal is emitted when the renderer can possibly be activated.

func (*GutterRenderer) ConnectQueryData

func (renderer *GutterRenderer) ConnectQueryData(f func(start, end *gtk.TextIter, state GutterRendererState)) coreglib.SignalHandle

ConnectQueryData signal is emitted when the renderer needs to be filled with data just before a cell is drawn. This can be used by general renderer implementations to allow render data to be filled in externally.

func (*GutterRenderer) ConnectQueryTooltip

func (renderer *GutterRenderer) ConnectQueryTooltip(f func(iter *gtk.TextIter, area *gdk.Rectangle, x, y int, tooltip *gtk.Tooltip) (ok bool)) coreglib.SignalHandle

ConnectQueryTooltip signal is emitted when the renderer can show a tooltip.

func (*GutterRenderer) ConnectQueueDraw

func (renderer *GutterRenderer) ConnectQueueDraw(f func()) coreglib.SignalHandle

ConnectQueueDraw signal is emitted when the renderer needs to be redrawn. Use gtk_source_gutter_renderer_queue_draw() to emit this signal from an implementation of the SourceGutterRenderer interface.

func (*GutterRenderer) Draw

func (renderer *GutterRenderer) Draw(cr *cairo.Context, backgroundArea, cellArea *gdk.Rectangle, start, end *gtk.TextIter, state GutterRendererState)

Draw: main renderering method. Implementations should implement this method to draw onto the cairo context. The background_area indicates the total area of the cell to be drawn. The cell_area indicates the area where content can be drawn (text, images, etc).

The background_area is the cell_area plus the padding on each side (two times the SourceGutterRenderer:xpad horizontally and two times the SourceGutterRenderer:ypad vertically, so that the cell_area is centered inside background_area).

The state argument indicates the current state of the renderer and should be taken into account to properly draw the different possible states (cursor, prelit, selected) if appropriate.

The function takes the following parameters:

  • cr: cairo render context.
  • backgroundArea indicating the total area to be drawn.
  • cellArea indicating the area to draw content.
  • start: TextIter.
  • end: TextIter.
  • state: SourceGutterRendererState.

func (*GutterRenderer) End

func (renderer *GutterRenderer) End()

End: called when drawing a region of lines has ended.

func (*GutterRenderer) Padding

func (renderer *GutterRenderer) Padding() (xpad, ypad int)

Padding: get the x-padding and y-padding of the gutter renderer.

The function returns the following values:

  • xpad (optional): return location for the x-padding, or NULL to ignore.
  • ypad (optional): return location for the y-padding, or NULL to ignore.

func (*GutterRenderer) QueryActivatable

func (renderer *GutterRenderer) QueryActivatable(iter *gtk.TextIter, area *gdk.Rectangle, event *gdk.Event) bool

QueryActivatable: get whether the renderer is activatable at the location in event. This is called from SourceGutter to determine whether a renderer is activatable using the mouse pointer.

The function takes the following parameters:

  • iter at the start of the line to be activated.
  • area of the cell area to be activated.
  • event that triggered the query.

The function returns the following values:

  • ok: TRUE if the renderer can be activated, FALSE otherwise.

func (*GutterRenderer) QueryData

func (renderer *GutterRenderer) QueryData(start, end *gtk.TextIter, state GutterRendererState)

QueryData: emit the SourceGutterRenderer::query-data signal. This function is called to query for data just before rendering a cell. This is called from the SourceGutter. Implementations can override the default signal handler or can connect a signal handler externally to the SourceGutterRenderer::query-data signal.

The function takes the following parameters:

  • start: TextIter.
  • end: TextIter.
  • state: SourceGutterRendererState.

func (*GutterRenderer) QueryTooltip

func (renderer *GutterRenderer) QueryTooltip(iter *gtk.TextIter, area *gdk.Rectangle, x, y int, tooltip *gtk.Tooltip) bool

QueryTooltip emits the SourceGutterRenderer::query-tooltip signal. This function is called from SourceGutter. Implementations can override the default signal handler or can connect to the signal externally.

The function takes the following parameters:

  • iter: TextIter.
  • area: Rectangle.
  • x position of the tooltip.
  • y position of the tooltip.
  • tooltip: Tooltip.

The function returns the following values:

  • ok: TRUE if the tooltip has been set, FALSE otherwise.

func (*GutterRenderer) QueueDraw

func (renderer *GutterRenderer) QueueDraw()

QueueDraw emits the SourceGutterRenderer::queue-draw signal of the renderer. Call this from an implementation to inform that the renderer has changed such that it needs to redraw.

func (*GutterRenderer) SetAlignment

func (renderer *GutterRenderer) SetAlignment(xalign, yalign float32)

SetAlignment: set the alignment of the gutter renderer. Both xalign and yalign can be -1, which means the values will not be changed (this allows changing only one of the values).

xalign is the horizontal alignment. Set to 0 for a left alignment. 1 for a right alignment. And 0.5 for centering the cells. yalign is the vertical alignment. Set to 0 for a top alignment. 1 for a bottom alignment.

The function takes the following parameters:

  • xalign: x-alignment.
  • yalign: y-alignment.

func (*GutterRenderer) SetAlignmentMode

func (renderer *GutterRenderer) SetAlignmentMode(mode GutterRendererAlignmentMode)

SetAlignmentMode: set the alignment mode. The alignment mode describes the manner in which the renderer is aligned (see :xalign and :yalign).

The function takes the following parameters:

  • mode: SourceGutterRendererAlignmentMode.

func (*GutterRenderer) SetBackground

func (renderer *GutterRenderer) SetBackground(color *gdk.RGBA)

SetBackground: set the background color of the renderer. If color is set to NULL, the renderer will not have a background color.

The function takes the following parameters:

  • color (optional) or NULL.

func (*GutterRenderer) SetPadding

func (renderer *GutterRenderer) SetPadding(xpad, ypad int)

SetPadding: set the padding of the gutter renderer. Both xpad and ypad can be -1, which means the values will not be changed (this allows changing only one of the values).

xpad is the left and right padding. ypad is the top and bottom padding.

The function takes the following parameters:

  • xpad: x-padding.
  • ypad: y-padding.

func (*GutterRenderer) SetSize

func (renderer *GutterRenderer) SetSize(size int)

SetSize sets the size of the renderer. A value of -1 specifies that the size is to be determined dynamically.

The function takes the following parameters:

  • size: size.

func (*GutterRenderer) SetVisible

func (renderer *GutterRenderer) SetVisible(visible bool)

SetVisible: set whether the gutter renderer is visible.

The function takes the following parameters:

  • visible: visibility.

func (*GutterRenderer) Size

func (renderer *GutterRenderer) Size() int

Size: get the size of the renderer.

The function returns the following values:

  • gint: size of the renderer.

func (*GutterRenderer) View

func (renderer *GutterRenderer) View() *gtk.TextView

View: get the view associated to the gutter renderer.

The function returns the following values:

  • textView: TextView.

func (*GutterRenderer) Visible

func (renderer *GutterRenderer) Visible() bool

Visible: get whether the gutter renderer is visible.

The function returns the following values:

  • ok: TRUE if the renderer is visible, FALSE otherwise.

func (*GutterRenderer) WindowType

func (renderer *GutterRenderer) WindowType() gtk.TextWindowType

WindowType: get the TextWindowType associated with the gutter renderer.

The function returns the following values:

  • textWindowType: TextWindowType.

type GutterRendererAlignmentMode

type GutterRendererAlignmentMode C.gint

GutterRendererAlignmentMode: alignment mode of the renderer, when a cell spans multiple lines (due to text wrapping).

const (
	// SourceGutterRendererAlignmentModeCell: full cell.
	SourceGutterRendererAlignmentModeCell GutterRendererAlignmentMode = iota
	// SourceGutterRendererAlignmentModeFirst: first line.
	SourceGutterRendererAlignmentModeFirst
	// SourceGutterRendererAlignmentModeLast: last line.
	SourceGutterRendererAlignmentModeLast
)

func (GutterRendererAlignmentMode) String

String returns the name in string for GutterRendererAlignmentMode.

type GutterRendererClass

type GutterRendererClass struct {
	// contains filtered or unexported fields
}

GutterRendererClass: instance of this type is always passed by reference.

type GutterRendererOverrides

type GutterRendererOverrides struct {
	// Activate emits the SourceGutterRenderer::activate signal of the renderer.
	// This is called from SourceGutter and should never have to be called
	// manually.
	//
	// The function takes the following parameters:
	//
	//   - iter at the start of the line where the renderer is activated.
	//   - area of the cell area where the renderer is activated.
	//   - event that triggered the activation.
	//
	Activate func(iter *gtk.TextIter, area *gdk.Rectangle, event *gdk.Event)
	// Begin: called when drawing a region begins. The region to be drawn is
	// indicated by start and end. The purpose is to allow the implementation to
	// precompute some state before the draw method is called for each cell.
	//
	// The function takes the following parameters:
	//
	//   - cr: #cairo_t.
	//   - backgroundArea: Rectangle.
	//   - cellArea: Rectangle.
	//   - start: TextIter.
	//   - end: TextIter.
	//
	Begin func(cr *cairo.Context, backgroundArea, cellArea *gdk.Rectangle, start, end *gtk.TextIter)
	// ChangeBuffer: this is called when the text buffer changes for renderer.
	//
	// The function takes the following parameters:
	//
	//   - oldBuffer (optional): old TextBuffer.
	//
	ChangeBuffer func(oldBuffer *gtk.TextBuffer)
	// ChangeView: this is called when the text view changes for renderer.
	//
	// The function takes the following parameters:
	//
	//   - oldView (optional): old TextView.
	//
	ChangeView func(oldView *gtk.TextView)
	// Draw: main renderering method. Implementations should implement this
	// method to draw onto the cairo context. The background_area indicates
	// the total area of the cell to be drawn. The cell_area indicates the area
	// where content can be drawn (text, images, etc).
	//
	// The background_area is the cell_area plus the padding on each side
	// (two times the SourceGutterRenderer:xpad horizontally and two times the
	// SourceGutterRenderer:ypad vertically, so that the cell_area is centered
	// inside background_area).
	//
	// The state argument indicates the current state of the renderer and should
	// be taken into account to properly draw the different possible states
	// (cursor, prelit, selected) if appropriate.
	//
	// The function takes the following parameters:
	//
	//   - cr: cairo render context.
	//   - backgroundArea indicating the total area to be drawn.
	//   - cellArea indicating the area to draw content.
	//   - start: TextIter.
	//   - end: TextIter.
	//   - state: SourceGutterRendererState.
	//
	Draw func(cr *cairo.Context, backgroundArea, cellArea *gdk.Rectangle, start, end *gtk.TextIter, state GutterRendererState)
	// End: called when drawing a region of lines has ended.
	End func()
	// QueryActivatable: get whether the renderer is activatable at the location
	// in event. This is called from SourceGutter to determine whether a
	// renderer is activatable using the mouse pointer.
	//
	// The function takes the following parameters:
	//
	//   - iter at the start of the line to be activated.
	//   - area of the cell area to be activated.
	//   - event that triggered the query.
	//
	// The function returns the following values:
	//
	//   - ok: TRUE if the renderer can be activated, FALSE otherwise.
	//
	QueryActivatable func(iter *gtk.TextIter, area *gdk.Rectangle, event *gdk.Event) bool
	// QueryData: emit the SourceGutterRenderer::query-data signal.
	// This function is called to query for data just before rendering a cell.
	// This is called from the SourceGutter. Implementations can override the
	// default signal handler or can connect a signal handler externally to the
	// SourceGutterRenderer::query-data signal.
	//
	// The function takes the following parameters:
	//
	//   - start: TextIter.
	//   - end: TextIter.
	//   - state: SourceGutterRendererState.
	//
	QueryData func(start, end *gtk.TextIter, state GutterRendererState)
	// QueryTooltip emits the SourceGutterRenderer::query-tooltip signal.
	// This function is called from SourceGutter. Implementations can override
	// the default signal handler or can connect to the signal externally.
	//
	// The function takes the following parameters:
	//
	//   - iter: TextIter.
	//   - area: Rectangle.
	//   - x position of the tooltip.
	//   - y position of the tooltip.
	//   - tooltip: Tooltip.
	//
	// The function returns the following values:
	//
	//   - ok: TRUE if the tooltip has been set, FALSE otherwise.
	//
	QueryTooltip func(iter *gtk.TextIter, area *gdk.Rectangle, x, y int, tooltip *gtk.Tooltip) bool
	// QueueDraw emits the SourceGutterRenderer::queue-draw signal of the
	// renderer. Call this from an implementation to inform that the renderer
	// has changed such that it needs to redraw.
	QueueDraw func()
}

GutterRendererOverrides contains methods that are overridable.

type GutterRendererPixbuf

type GutterRendererPixbuf struct {
	GutterRenderer
	// contains filtered or unexported fields
}

func NewGutterRendererPixbuf

func NewGutterRendererPixbuf() *GutterRendererPixbuf

NewGutterRendererPixbuf: create a new SourceGutterRendererPixbuf.

The function returns the following values:

  • gutterRendererPixbuf: SourceGutterRenderer.

func (*GutterRendererPixbuf) GIcon

func (renderer *GutterRendererPixbuf) GIcon() *gio.Icon

GIcon: get the gicon of the renderer.

The function returns the following values:

  • icon: #GIcon.

func (*GutterRendererPixbuf) IconName

func (renderer *GutterRendererPixbuf) IconName() string

The function returns the following values:

func (*GutterRendererPixbuf) Pixbuf

func (renderer *GutterRendererPixbuf) Pixbuf() *gdkpixbuf.Pixbuf

Pixbuf: get the pixbuf of the renderer.

The function returns the following values:

  • pixbuf: Pixbuf.

func (*GutterRendererPixbuf) SetGIcon

func (renderer *GutterRendererPixbuf) SetGIcon(icon gio.Iconner)

The function takes the following parameters:

  • icon (optional): icon, or NULL.

func (*GutterRendererPixbuf) SetIconName

func (renderer *GutterRendererPixbuf) SetIconName(iconName string)

The function takes the following parameters:

  • iconName (optional): icon name, or NULL.

func (*GutterRendererPixbuf) SetPixbuf

func (renderer *GutterRendererPixbuf) SetPixbuf(pixbuf *gdkpixbuf.Pixbuf)

The function takes the following parameters:

  • pixbuf (optional): pixbuf, or NULL.

func (*GutterRendererPixbuf) SetStockID

func (renderer *GutterRendererPixbuf) SetStockID(stockId string)

SetStockID: deprecated: Don't use this function.

The function takes the following parameters:

  • stockId (optional): stock id.

func (*GutterRendererPixbuf) StockID

func (renderer *GutterRendererPixbuf) StockID() string

StockID: deprecated: Don't use this function.

The function returns the following values:

  • utf8: stock id.

type GutterRendererPixbufClass

type GutterRendererPixbufClass struct {
	// contains filtered or unexported fields
}

GutterRendererPixbufClass: instance of this type is always passed by reference.

type GutterRendererPixbufOverrides

type GutterRendererPixbufOverrides struct {
}

GutterRendererPixbufOverrides contains methods that are overridable.

type GutterRendererState

type GutterRendererState C.guint
const (
	// SourceGutterRendererStateNormal: normal state.
	SourceGutterRendererStateNormal GutterRendererState = 0b0
	// SourceGutterRendererStateCursor: area in the renderer represents the line
	// on which the insert cursor is currently positioned.
	SourceGutterRendererStateCursor GutterRendererState = 0b1
	// SourceGutterRendererStatePrelit: mouse pointer is currently over the
	// activatable area of the renderer.
	SourceGutterRendererStatePrelit GutterRendererState = 0b10
	// SourceGutterRendererStateSelected: area in the renderer represents a line
	// in the buffer which contains part of the selection.
	SourceGutterRendererStateSelected GutterRendererState = 0b100
)

func (GutterRendererState) Has

Has returns true if g contains other.

func (GutterRendererState) String

func (g GutterRendererState) String() string

String returns the names in string for GutterRendererState.

type GutterRendererText

type GutterRendererText struct {
	GutterRenderer
	// contains filtered or unexported fields
}

func NewGutterRendererText

func NewGutterRendererText() *GutterRendererText

NewGutterRendererText: create a new SourceGutterRendererText.

The function returns the following values:

  • gutterRendererText: SourceGutterRenderer.

func (*GutterRendererText) Measure

func (renderer *GutterRendererText) Measure(text string) (width, height int)

Measure measures the text provided using the pango layout used by the SourceGutterRendererText.

The function takes the following parameters:

  • text to measure.

The function returns the following values:

  • width (optional): location to store the width of the text in pixels, or NULL.
  • height (optional): location to store the height of the text in pixels, or NULL.

func (*GutterRendererText) MeasureMarkup

func (renderer *GutterRendererText) MeasureMarkup(markup string) (width, height int)

MeasureMarkup measures the pango markup provided using the pango layout used by the SourceGutterRendererText.

The function takes the following parameters:

  • markup: pango markup to measure.

The function returns the following values:

  • width (optional): location to store the width of the text in pixels, or NULL.
  • height (optional): location to store the height of the text in pixels, or NULL.

func (*GutterRendererText) SetMarkup

func (renderer *GutterRendererText) SetMarkup(markup string, length int)

The function takes the following parameters:

  • markup
  • length

func (*GutterRendererText) SetText

func (renderer *GutterRendererText) SetText(text string, length int)

The function takes the following parameters:

  • text
  • length

type GutterRendererTextClass

type GutterRendererTextClass struct {
	// contains filtered or unexported fields
}

GutterRendererTextClass: instance of this type is always passed by reference.

type GutterRendererTextOverrides

type GutterRendererTextOverrides struct {
}

GutterRendererTextOverrides contains methods that are overridable.

type GutterRendererer

type GutterRendererer interface {
	coreglib.Objector
	// contains filtered or unexported methods
}

GutterRendererer describes types inherited from class GutterRenderer.

To get the original type, the caller must assert this to an interface or another type.

type Language

type Language struct {
	*coreglib.Object
	// contains filtered or unexported fields
}

func (*Language) Globs

func (language *Language) Globs() []string

Globs returns the globs associated to this language. This is just an utility wrapper around gtk_source_language_get_metadata() to retrieve the "globs" metadata property and split it into an array.

The function returns the following values:

  • utf8s (optional): a newly-allocated NULL terminated array containing the globs or NULL if no globs are found. The returned array must be freed with g_strfreev().

func (*Language) Hidden

func (language *Language) Hidden() bool

Hidden returns whether the language should be hidden from the user.

The function returns the following values:

  • ok: TRUE if the language should be hidden, FALSE otherwise.

func (*Language) ID

func (language *Language) ID() string

ID returns the ID of the language. The ID is not locale-dependent. The returned string is owned by language and should not be freed or modified.

The function returns the following values:

  • utf8: ID of language.

func (*Language) MIMETypes

func (language *Language) MIMETypes() []string

MIMETypes returns the mime types associated to this language. This is just an utility wrapper around gtk_source_language_get_metadata() to retrieve the "mimetypes" metadata property and split it into an array.

The function returns the following values:

  • utf8s (optional): a newly-allocated NULL terminated array containing the mime types or NULL if no mime types are found. The returned array must be freed with g_strfreev().

func (*Language) Metadata

func (language *Language) Metadata(name string) string

The function takes the following parameters:

  • name: metadata property name.

The function returns the following values:

  • utf8 (optional): value of property name stored in the metadata of language or NULL if language does not contain the specified metadata property. The returned string is owned by language and should not be freed or modified.

func (*Language) Name

func (language *Language) Name() string

Name returns the localized name of the language. The returned string is owned by language and should not be freed or modified.

The function returns the following values:

  • utf8: name of language.

func (*Language) Section

func (language *Language) Section() string

Section returns the localized section of the language. Each language belong to a section (ex. HTML belogs to the Markup section). The returned string is owned by language and should not be freed or modified.

The function returns the following values:

  • utf8: section of language.

func (*Language) StyleFallback

func (language *Language) StyleFallback(styleId string) string

StyleFallback returns the ID of the style to use if the specified style_id is not present in the current style scheme.

The function takes the following parameters:

  • styleId: style ID.

The function returns the following values:

  • utf8 (optional): ID of the style to use if the specified style_id is not present in the current style scheme or NULL if the style has no fallback defined. The returned string is owned by the language and must not be modified.

func (*Language) StyleIDs

func (language *Language) StyleIDs() []string

StyleIDs returns the ids of the styles defined by this language.

The function returns the following values:

  • utf8s (optional): a newly-allocated NULL terminated array containing ids of the styles defined by this language or NULL if no style is defined. The returned array must be freed with g_strfreev().

func (*Language) StyleName

func (language *Language) StyleName(styleId string) string

StyleName returns the name of the style with ID style_id defined by this language.

The function takes the following parameters:

  • styleId: style ID.

The function returns the following values:

  • utf8 (optional): name of the style with ID style_id defined by this language or NULL if the style has no name or there is no style with ID style_id defined by this language. The returned string is owned by the language and must not be modified.

type LanguageClass

type LanguageClass struct {
	// contains filtered or unexported fields
}

LanguageClass: instance of this type is always passed by reference.

type LanguageManager

type LanguageManager struct {
	*coreglib.Object
	// contains filtered or unexported fields
}

func LanguageManagerGetDefault

func LanguageManagerGetDefault() *LanguageManager

LanguageManagerGetDefault returns the default SourceLanguageManager instance.

The function returns the following values:

  • languageManager value is owned by GtkSourceView library and must not be unref'ed.

func NewLanguageManager

func NewLanguageManager() *LanguageManager

NewLanguageManager creates a new language manager. If you do not need more than one language manager or a private language manager instance then use gtk_source_language_manager_get_default() instead.

The function returns the following values:

  • languageManager: new SourceLanguageManager.

func (*LanguageManager) GuessLanguage

func (lm *LanguageManager) GuessLanguage(filename, contentType string) *Language

GuessLanguage picks a SourceLanguage for given file name and content type, according to the information in lang files. Either filename or content_type may be NULL. This function can be used as follows:

<informalexample><programlisting> GtkSourceLanguage *lang; lang = gtk_source_language_manager_guess_language (filename, NULL); gtk_source_buffer_set_language (buffer, lang); </programlisting></informalexample>

or

<informalexample><programlisting> GtkSourceLanguage *lang = NULL; gboolean result_uncertain; gchar *content_type;

content_type = g_content_type_guess (filename, NULL, 0, &result_uncertain);
if (result_uncertain)
  {
    g_free (content_type);
    content_type = NULL;
  }

lang = gtk_source_language_manager_guess_language (manager, filename, content_type);
gtk_source_buffer_set_language (buffer, lang);

g_free (content_type);

</programlisting></informalexample>

etc. Use gtk_source_language_get_mime_types() and gtk_source_language_get_globs() if you need full control over file -> language mapping.

The function takes the following parameters:

  • filename (optional) in Glib filename encoding, or NULL.
  • contentType (optional): content type (as in GIO API), or NULL.

The function returns the following values:

  • language (optional) or NULL if there is no suitable language for given filename and/or content_type. Return value is owned by lm and should not be freed.

func (*LanguageManager) Language

func (lm *LanguageManager) Language(id string) *Language

Language gets the SourceLanguage identified by the given id in the language manager.

The function takes the following parameters:

  • id: language id.

The function returns the following values:

  • language (optional) or NULL if there is no language identified by the given id. Return value is owned by lm and should not be freed.

func (*LanguageManager) LanguageIDs

func (lm *LanguageManager) LanguageIDs() []string

LanguageIDs returns the ids of the available languages.

The function returns the following values:

  • utf8s (optional): a NULL-terminated array of strings containing the ids of the available languages or NULL if no language is available. The array is sorted alphabetically according to the language name. The array is owned by lm and must not be modified.

func (*LanguageManager) SearchPath

func (lm *LanguageManager) SearchPath() []string

SearchPath gets the list directories where lm looks for language files.

The function returns the following values:

  • utf8s: NULL-terminated array containg a list of language files directories. The array is owned by lm and must not be modified.

func (*LanguageManager) SetSearchPath

func (lm *LanguageManager) SetSearchPath(dirs []string)

SetSearchPath sets the list of directories where the lm looks for language files. If dirs is NULL, the search path is reset to default.

<note> <para> At the moment this function can be called only before the language files are loaded for the first time. In practice to set a custom search path for a SourceLanguageManager, you have to call this function right after creating it. </para> </note>.

The function takes the following parameters:

  • dirs (optional): a NULL-terminated array of strings or NULL.

type LanguageManagerClass

type LanguageManagerClass struct {
	// contains filtered or unexported fields
}

LanguageManagerClass: instance of this type is always passed by reference.

type LanguageManagerOverrides

type LanguageManagerOverrides struct {
}

LanguageManagerOverrides contains methods that are overridable.

type LanguageOverrides

type LanguageOverrides struct {
}

LanguageOverrides contains methods that are overridable.

type Map

type Map struct {
	View
	// contains filtered or unexported fields
}

func NewMap

func NewMap() *Map

NewMap creates a new SourceMap.

The function returns the following values:

  • _map: new SourceMap.

func (*Map) GetView

func (_map *Map) GetView() *View

GetView gets the SourceMap:view property, which is the view this widget is mapping.

The function returns the following values:

  • view (optional) or NULL.

func (*Map) SetView

func (_map *Map) SetView(view *View)

SetView sets the view that map will be doing the mapping to.

The function takes the following parameters:

  • view: SourceView.

type MapClass

type MapClass struct {
	// contains filtered or unexported fields
}

MapClass: instance of this type is always passed by reference.

func (*MapClass) Padding

func (m *MapClass) Padding() [10]unsafe.Pointer

func (*MapClass) ParentClass

func (m *MapClass) ParentClass() *ViewClass

type MapOverrides

type MapOverrides struct {
}

MapOverrides contains methods that are overridable.

type Mark

type Mark struct {
	gtk.TextMark
	// contains filtered or unexported fields
}

func NewMark

func NewMark(name, category string) *Mark

NewMark creates a text mark. Add it to a buffer using gtk_text_buffer_add_mark(). If name is NULL, the mark is anonymous; otherwise, the mark can be retrieved by name using gtk_text_buffer_get_mark(). Normally marks are created using the utility function gtk_source_buffer_create_source_mark().

The function takes the following parameters:

  • name: name of the SourceMark, can be NULL when not using a name.
  • category is used to classify marks according to common characteristics (e.g. all the marks representing a bookmark could belong to the "bookmark" category, or all the marks representing a compilation error could belong to "error" category).

The function returns the following values:

  • mark: new SourceMark that can be added using gtk_text_buffer_add_mark().

func (*Mark) Category

func (mark *Mark) Category() string

Category returns the mark category.

The function returns the following values:

  • utf8: category of the SourceMark.

func (*Mark) Next

func (mark *Mark) Next(category string) *Mark

Next returns the next SourceMark in the buffer or NULL if the mark was not added to a buffer. If there is no next mark, NULL will be returned.

If category is NULL, looks for marks of any category.

The function takes the following parameters:

  • category (optional): string specifying the mark category, or NULL.

The function returns the following values:

  • ret (optional): next SourceMark, or NULL.

func (*Mark) Prev

func (mark *Mark) Prev(category string) *Mark

Prev returns the previous SourceMark in the buffer or NULL if the mark was not added to a buffer. If there is no previous mark, NULL is returned.

If category is NULL, looks for marks of any category.

The function takes the following parameters:

  • category: string specifying the mark category, or NULL.

The function returns the following values:

  • ret (optional) previous SourceMark, or NULL.

type MarkAttributes

type MarkAttributes struct {
	*coreglib.Object
	// contains filtered or unexported fields
}

func NewMarkAttributes

func NewMarkAttributes() *MarkAttributes

NewMarkAttributes creates a new source mark attributes.

The function returns the following values:

  • markAttributes: new source mark attributes.

func (*MarkAttributes) Background

func (attributes *MarkAttributes) Background() (*gdk.RGBA, bool)

Background stores background color in background.

The function returns the following values:

  • background: RGBA.
  • ok: whether background color for attributes was set.

func (*MarkAttributes) ConnectQueryTooltipMarkup

func (attributes *MarkAttributes) ConnectQueryTooltipMarkup(f func(mark *Mark) (utf8 string)) coreglib.SignalHandle

ConnectQueryTooltipMarkup: code should connect to this signal to provide a tooltip for given mark. The tooltip can contain a markup.

func (*MarkAttributes) ConnectQueryTooltipText

func (attributes *MarkAttributes) ConnectQueryTooltipText(f func(mark *Mark) (utf8 string)) coreglib.SignalHandle

ConnectQueryTooltipText: code should connect to this signal to provide a tooltip for given mark. The tooltip should be just a plain text.

func (*MarkAttributes) GIcon

func (attributes *MarkAttributes) GIcon() *gio.Icon

GIcon gets a #GIcon to be used as a base for rendered icon. Note that the icon can be NULL if it wasn't set earlier.

The function returns the following values:

  • icon: icon. The icon belongs to attributes and should not be unreffed.

func (*MarkAttributes) IconName

func (attributes *MarkAttributes) IconName() string

IconName gets a name of an icon to be used as a base for rendered icon. Note that the icon name can be NULL if it wasn't set earlier.

The function returns the following values:

  • utf8: icon name. The string belongs to attributes and should not be freed.

func (*MarkAttributes) Pixbuf

func (attributes *MarkAttributes) Pixbuf() *gdkpixbuf.Pixbuf

Pixbuf gets a Pixbuf to be used as a base for rendered icon. Note that the pixbuf can be NULL if it wasn't set earlier.

The function returns the following values:

  • pixbuf: pixbuf. The pixbuf belongs to attributes and should not be unreffed.

func (*MarkAttributes) RenderIcon

func (attributes *MarkAttributes) RenderIcon(widget gtk.Widgetter, size int) *gdkpixbuf.Pixbuf

RenderIcon renders an icon of given size. The base of the icon is set by the last call to one of: gtk_source_mark_attributes_set_pixbuf(), gtk_source_mark_attributes_set_gicon(), gtk_source_mark_attributes_set_icon_name() or gtk_source_mark_attributes_set_stock_id(). size cannot be lower than 1.

The function takes the following parameters:

  • widget of which style settings may be used.
  • size of the rendered icon.

The function returns the following values:

  • pixbuf: rendered pixbuf. The pixbuf belongs to attributes and should not be unreffed.

func (*MarkAttributes) SetBackground

func (attributes *MarkAttributes) SetBackground(background *gdk.RGBA)

SetBackground sets background color to the one given in background.

The function takes the following parameters:

  • background: RGBA.

func (*MarkAttributes) SetGIcon

func (attributes *MarkAttributes) SetGIcon(gicon gio.Iconner)

SetGIcon sets an icon to be used as a base for rendered icon.

The function takes the following parameters:

  • gicon to be used.

func (*MarkAttributes) SetIconName

func (attributes *MarkAttributes) SetIconName(iconName string)

SetIconName sets a name of an icon to be used as a base for rendered icon.

The function takes the following parameters:

  • iconName: name of an icon to be used.

func (*MarkAttributes) SetPixbuf

func (attributes *MarkAttributes) SetPixbuf(pixbuf *gdkpixbuf.Pixbuf)

SetPixbuf sets a pixbuf to be used as a base for rendered icon.

The function takes the following parameters:

  • pixbuf to be used.

func (*MarkAttributes) SetStockID deprecated

func (attributes *MarkAttributes) SetStockID(stockId string)

SetStockID sets stock id to be used as a base for rendered icon.

Deprecated: Don't use this function.

The function takes the following parameters:

  • stockId: stock id.

func (*MarkAttributes) StockID deprecated

func (attributes *MarkAttributes) StockID() string

StockID gets a stock id of an icon used by this attributes. Note that the stock id can be NULL if it wasn't set earlier.

Deprecated: Don't use this function.

The function returns the following values:

  • utf8: stock id. Returned string is owned by attributes and shouldn't be freed.

func (*MarkAttributes) TooltipMarkup

func (attributes *MarkAttributes) TooltipMarkup(mark *Mark) string

TooltipMarkup queries for a tooltip by emitting a SourceMarkAttributes::query-tooltip-markup signal. The tooltip may contain a markup.

The function takes the following parameters:

  • mark: SourceMark.

The function returns the following values:

  • utf8: tooltip. The returned string should be freed by using g_free() when done with it.

func (*MarkAttributes) TooltipText

func (attributes *MarkAttributes) TooltipText(mark *Mark) string

TooltipText queries for a tooltip by emitting a SourceMarkAttributes::query-tooltip-text signal. The tooltip is a plain text.

The function takes the following parameters:

  • mark: SourceMark.

The function returns the following values:

  • utf8: tooltip. The returned string should be freed by using g_free() when done with it.

type MarkAttributesClass

type MarkAttributesClass struct {
	// contains filtered or unexported fields
}

MarkAttributesClass: instance of this type is always passed by reference.

type MarkAttributesOverrides

type MarkAttributesOverrides struct {
}

MarkAttributesOverrides contains methods that are overridable.

type MarkClass

type MarkClass struct {
	// contains filtered or unexported fields
}

MarkClass: instance of this type is always passed by reference.

func (*MarkClass) ParentClass

func (m *MarkClass) ParentClass() *gtk.TextMarkClass

type MarkOverrides

type MarkOverrides struct {
}

MarkOverrides contains methods that are overridable.

type NewlineType

type NewlineType C.gint
const (
	// SourceNewlineTypeLf: line feed, used on UNIX.
	SourceNewlineTypeLf NewlineType = iota
	// SourceNewlineTypeCr: carriage return, used on Mac.
	SourceNewlineTypeCr
	// SourceNewlineTypeCrLf: carriage return followed by a line feed, used on
	// Windows.
	SourceNewlineTypeCrLf
)

func (NewlineType) String

func (n NewlineType) String() string

String returns the name in string for NewlineType.

type PrintCompositor

type PrintCompositor struct {
	*coreglib.Object
	// contains filtered or unexported fields
}

func NewPrintCompositor

func NewPrintCompositor(buffer *Buffer) *PrintCompositor

NewPrintCompositor creates a new print compositor that can be used to print buffer.

The function takes the following parameters:

  • buffer to print.

The function returns the following values:

  • printCompositor: new print compositor object.

func NewPrintCompositorFromView

func NewPrintCompositorFromView(view *View) *PrintCompositor

NewPrintCompositorFromView creates a new print compositor that can be used to print the buffer associated with view. This constructor sets some configuration properties to make the printed output match view as much as possible. The properties set are SourcePrintCompositor:tab-width, SourcePrintCompositor:highlight-syntax, SourcePrintCompositor:wrap-mode, SourcePrintCompositor:body-font-name and SourcePrintCompositor:print-line-numbers.

The function takes the following parameters:

  • view to get configuration from.

The function returns the following values:

  • printCompositor: new print compositor object.

func (*PrintCompositor) BodyFontName

func (compositor *PrintCompositor) BodyFontName() string

BodyFontName returns the name of the font used to print the text body. The returned string must be freed with g_free().

The function returns the following values:

  • utf8: new string containing the name of the font used to print the text body.

func (*PrintCompositor) BottomMargin

func (compositor *PrintCompositor) BottomMargin(unit gtk.Unit) float64

BottomMargin gets the bottom margin in units of unit.

The function takes the following parameters:

  • unit for the return value.

The function returns the following values:

  • gdouble: bottom margin.

func (*PrintCompositor) Buffer

func (compositor *PrintCompositor) Buffer() *Buffer

Buffer gets the SourceBuffer associated with the compositor. The returned object reference is owned by the compositor object and should not be unreferenced.

The function returns the following values:

  • buffer associated with the compositor.

func (*PrintCompositor) DrawPage

func (compositor *PrintCompositor) DrawPage(context *gtk.PrintContext, pageNr int)

DrawPage: draw page page_nr for printing on the the Cairo context encapsuled in context.

This method has been designed to be called in the handler of the PrintOperation::draw_page signal as shown in the following example:

<informalexample><programlisting> // Signal handler for the GtkPrintOperation::draw_page signal

static void draw_page (GtkPrintOperation *operation, GtkPrintContext *context, gint page_nr, gpointer user_data) { GtkSourcePrintCompositor *compositor;

    compositor = GTK_SOURCE_PRINT_COMPOSITOR (user_data);

    gtk_source_print_compositor_draw_page (compositor,
                                           context,
                                           page_nr);
}

</programlisting></informalexample>.

The function takes the following parameters:

  • context encapsulating the context information that is required when drawing the page for printing.
  • pageNr: number of the page to print.

func (*PrintCompositor) FooterFontName

func (compositor *PrintCompositor) FooterFontName() string

FooterFontName returns the name of the font used to print the page footer. The returned string must be freed with g_free().

The function returns the following values:

  • utf8: new string containing the name of the font used to print the page footer.

func (*PrintCompositor) HeaderFontName

func (compositor *PrintCompositor) HeaderFontName() string

HeaderFontName returns the name of the font used to print the page header. The returned string must be freed with g_free().

The function returns the following values:

  • utf8: new string containing the name of the font used to print the page header.

func (*PrintCompositor) HighlightSyntax

func (compositor *PrintCompositor) HighlightSyntax() bool

HighlightSyntax determines whether the printed text will be highlighted according to the buffer rules. Note that highlighting will happen only if the buffer to print has highlighting activated.

The function returns the following values:

  • ok: TRUE if the printed output will be highlighted.

func (*PrintCompositor) LeftMargin

func (compositor *PrintCompositor) LeftMargin(unit gtk.Unit) float64

LeftMargin gets the left margin in units of unit.

The function takes the following parameters:

  • unit for the return value.

The function returns the following values:

  • gdouble: left margin.

func (*PrintCompositor) LineNumbersFontName

func (compositor *PrintCompositor) LineNumbersFontName() string

LineNumbersFontName returns the name of the font used to print line numbers on the left margin. The returned string must be freed with g_free().

The function returns the following values:

  • utf8: new string containing the name of the font used to print line numbers on the left margin.

func (*PrintCompositor) NPages

func (compositor *PrintCompositor) NPages() int

NPages returns the number of pages in the document or <code>-1</code> if the document has not been completely paginated.

The function returns the following values:

  • gint: number of pages in the document or <code>-1</code> if the document has not been completely paginated.

func (*PrintCompositor) Paginate

func (compositor *PrintCompositor) Paginate(context *gtk.PrintContext) bool

Paginate the document associated with the compositor.

In order to support non-blocking pagination, document is paginated in small chunks. Each time gtk_source_print_compositor_paginate() is invoked, a chunk of the document is paginated. To paginate the entire document, gtk_source_print_compositor_paginate() must be invoked multiple times. It returns TRUE if the document has been completely paginated, otherwise it returns FALSE.

This method has been designed to be invoked in the handler of the PrintOperation::paginate signal, as shown in the following example:

<informalexample><programlisting> // Signal handler for the GtkPrintOperation::paginate signal

static gboolean paginate (GtkPrintOperation *operation, GtkPrintContext *context, gpointer user_data) { GtkSourcePrintCompositor *compositor;

    compositor = GTK_SOURCE_PRINT_COMPOSITOR (user_data);

    if (gtk_source_print_compositor_paginate (compositor, context))
    {
        gint n_pages;

        n_pages = gtk_source_print_compositor_get_n_pages (compositor);
        gtk_print_operation_set_n_pages (operation, n_pages);

        return TRUE;
    }

    return FALSE;
}

</programlisting></informalexample>

If you don't need to do pagination in chunks, you can simply do it all in the PrintOperation::begin-print handler, and set the number of pages from there, like in the following example:

<informalexample><programlisting> // Signal handler for the GtkPrintOperation::begin-print signal

static void begin_print (GtkPrintOperation *operation, GtkPrintContext *context, gpointer user_data) { GtkSourcePrintCompositor *compositor; gint n_pages;

    compositor = GTK_SOURCE_PRINT_COMPOSITOR (user_data);

    while (!gtk_source_print_compositor_paginate (compositor, context));

    n_pages = gtk_source_print_compositor_get_n_pages (compositor);
    gtk_print_operation_set_n_pages (operation, n_pages);
}

</programlisting></informalexample>.

The function takes the following parameters:

  • context whose parameters (e.g. paper size, print margins, etc.) are used by the the compositor to paginate the document.

The function returns the following values:

  • ok: TRUE if the document has been completely paginated, FALSE otherwise.

func (*PrintCompositor) PaginationProgress

func (compositor *PrintCompositor) PaginationProgress() float64

PaginationProgress returns the current fraction of the document pagination that has been completed.

The function returns the following values:

  • gdouble: fraction from 0.0 to 1.0 inclusive.

func (*PrintCompositor) PrintFooter

func (compositor *PrintCompositor) PrintFooter() bool

PrintFooter determines if a footer is set to be printed for each page. A footer will be printed if this function returns TRUE <emphasis>and</emphasis> some format strings have been specified with gtk_source_print_compositor_set_footer_format().

The function returns the following values:

  • ok: TRUE if the footer is set to be printed.

func (*PrintCompositor) PrintHeader

func (compositor *PrintCompositor) PrintHeader() bool

PrintHeader determines if a header is set to be printed for each page. A header will be printed if this function returns TRUE <emphasis>and</emphasis> some format strings have been specified with gtk_source_print_compositor_set_header_format().

The function returns the following values:

  • ok: TRUE if the header is set to be printed.

func (*PrintCompositor) PrintLineNumbers

func (compositor *PrintCompositor) PrintLineNumbers() uint

PrintLineNumbers returns the interval used for line number printing. If the value is 0, no line numbers will be printed. The default value is 1 (i.e. numbers printed in all lines).

The function returns the following values:

  • guint: interval of printed line numbers.

func (*PrintCompositor) RightMargin

func (compositor *PrintCompositor) RightMargin(unit gtk.Unit) float64

RightMargin gets the right margin in units of unit.

The function takes the following parameters:

  • unit for the return value.

The function returns the following values:

  • gdouble: right margin.

func (*PrintCompositor) SetBodyFontName

func (compositor *PrintCompositor) SetBodyFontName(fontName string)

SetBodyFontName sets the default font for the printed text.

font_name should be a string representation of a font description Pango can understand. (e.g. &quot;Monospace 10&quot;). See pango_font_description_from_string() for a description of the format of the string representation.

This function cannot be called anymore after the first call to the gtk_source_print_compositor_paginate() function.

The function takes the following parameters:

  • fontName: name of the default font for the body text.

func (*PrintCompositor) SetBottomMargin

func (compositor *PrintCompositor) SetBottomMargin(margin float64, unit gtk.Unit)

SetBottomMargin sets the bottom margin used by compositor.

The function takes the following parameters:

  • margin: new bottom margin in units of unit.
  • unit units for margin.

func (*PrintCompositor) SetFooterFontName

func (compositor *PrintCompositor) SetFooterFontName(fontName string)

SetFooterFontName sets the font for printing the page footer. If NULL is supplied, the default font (i.e. the one being used for the text) will be used instead.

font_name should be a string representation of a font description Pango can understand. (e.g. &quot;Monospace 10&quot;). See pango_font_description_from_string() for a description of the format of the string representation.

This function cannot be called anymore after the first call to the gtk_source_print_compositor_paginate() function.

The function takes the following parameters:

  • fontName (optional): name of the font for the footer text, or NULL.

func (*PrintCompositor) SetFooterFormat

func (compositor *PrintCompositor) SetFooterFormat(separator bool, left, center, right string)

SetFooterFormat: see gtk_source_print_compositor_set_header_format() for more information about the parameters.

The function takes the following parameters:

  • separator: TRUE if you want a separator line to be printed.
  • left (optional): format string to print on the left of the footer.
  • center (optional): format string to print on the center of the footer.
  • right (optional): format string to print on the right of the footer.

func (*PrintCompositor) SetHeaderFontName

func (compositor *PrintCompositor) SetHeaderFontName(fontName string)

SetHeaderFontName sets the font for printing the page header. If NULL is supplied, the default font (i.e. the one being used for the text) will be used instead.

font_name should be a string representation of a font description Pango can understand. (e.g. &quot;Monospace 10&quot;). See pango_font_description_from_string() for a description of the format of the string representation.

This function cannot be called anymore after the first call to the gtk_source_print_compositor_paginate() function.

The function takes the following parameters:

  • fontName (optional): name of the font for header text, or NULL.

func (*PrintCompositor) SetHeaderFormat

func (compositor *PrintCompositor) SetHeaderFormat(separator bool, left, center, right string)

SetHeaderFormat sets strftime like header format strings, to be printed on the left, center and right of the top of each page. The strings may include strftime(3) codes which will be expanded at print time. A subset of strftime() codes are accepted, see g_date_time_format() for more details on the accepted format specifiers. Additionally the following format specifiers are accepted:

- #N: the page number

- #Q: the page count.

separator specifies if a solid line should be drawn to separate the header from the document text.

If NULL is given for any of the three arguments, that particular string will not be printed.

For the header to be printed, in addition to specifying format strings, you need to enable header printing with gtk_source_print_compositor_set_print_header().

This function cannot be called anymore after the first call to the gtk_source_print_compositor_paginate() function.

The function takes the following parameters:

  • separator: TRUE if you want a separator line to be printed.
  • left (optional): format string to print on the left of the header.
  • center (optional): format string to print on the center of the header.
  • right (optional): format string to print on the right of the header.

func (*PrintCompositor) SetHighlightSyntax

func (compositor *PrintCompositor) SetHighlightSyntax(highlight bool)

SetHighlightSyntax sets whether the printed text will be highlighted according to the buffer rules. Both color and font style are applied.

This function cannot be called anymore after the first call to the gtk_source_print_compositor_paginate() function.

The function takes the following parameters:

  • highlight: whether syntax should be highlighted.

func (*PrintCompositor) SetLeftMargin

func (compositor *PrintCompositor) SetLeftMargin(margin float64, unit gtk.Unit)

SetLeftMargin sets the left margin used by compositor.

The function takes the following parameters:

  • margin: new left margin in units of unit.
  • unit units for margin.

func (*PrintCompositor) SetLineNumbersFontName

func (compositor *PrintCompositor) SetLineNumbersFontName(fontName string)

SetLineNumbersFontName sets the font for printing line numbers on the left margin. If NULL is supplied, the default font (i.e. the one being used for the text) will be used instead.

font_name should be a string representation of a font description Pango can understand. (e.g. &quot;Monospace 10&quot;). See pango_font_description_from_string() for a description of the format of the string representation.

This function cannot be called anymore after the first call to the gtk_source_print_compositor_paginate() function.

The function takes the following parameters:

  • fontName (optional): name of the font for line numbers, or NULL.

func (*PrintCompositor) SetPrintFooter

func (compositor *PrintCompositor) SetPrintFooter(print bool)

SetPrintFooter sets whether you want to print a footer in each page. The footer consists of three pieces of text and an optional line separator, configurable with gtk_source_print_compositor_set_footer_format().

Note that by default the footer format is unspecified, and if it's empty it will not be printed, regardless of this setting.

This function cannot be called anymore after the first call to the gtk_source_print_compositor_paginate() function.

The function takes the following parameters:

  • print: TRUE if you want the footer to be printed.

func (*PrintCompositor) SetPrintHeader

func (compositor *PrintCompositor) SetPrintHeader(print bool)

SetPrintHeader sets whether you want to print a header in each page. The header consists of three pieces of text and an optional line separator, configurable with gtk_source_print_compositor_set_header_format().

Note that by default the header format is unspecified, and if it's empty it will not be printed, regardless of this setting.

This function cannot be called anymore after the first call to the gtk_source_print_compositor_paginate() function.

The function takes the following parameters:

  • print: TRUE if you want the header to be printed.

func (*PrintCompositor) SetPrintLineNumbers

func (compositor *PrintCompositor) SetPrintLineNumbers(interval uint)

SetPrintLineNumbers sets the interval for printed line numbers. If interval is 0 no numbers will be printed. If greater than 0, a number will be printed every interval lines (i.e. 1 will print all line numbers).

Maximum accepted value for interval is 100.

This function cannot be called anymore after the first call to the gtk_source_print_compositor_paginate() function.

The function takes the following parameters:

  • interval for printed line numbers.

func (*PrintCompositor) SetRightMargin

func (compositor *PrintCompositor) SetRightMargin(margin float64, unit gtk.Unit)

SetRightMargin sets the right margin used by compositor.

The function takes the following parameters:

  • margin: new right margin in units of unit.
  • unit units for margin.

func (*PrintCompositor) SetTabWidth

func (compositor *PrintCompositor) SetTabWidth(width uint)

SetTabWidth sets the width of tabulation in characters for printed text.

This function cannot be called anymore after the first call to the gtk_source_print_compositor_paginate() function.

The function takes the following parameters:

  • width of tab in characters.

func (*PrintCompositor) SetTopMargin

func (compositor *PrintCompositor) SetTopMargin(margin float64, unit gtk.Unit)

SetTopMargin sets the top margin used by compositor.

The function takes the following parameters:

  • margin: new top margin in units of unit.
  • unit units for margin.

func (*PrintCompositor) SetWrapMode

func (compositor *PrintCompositor) SetWrapMode(wrapMode gtk.WrapMode)

SetWrapMode sets the line wrapping mode for the printed text.

This function cannot be called anymore after the first call to the gtk_source_print_compositor_paginate() function.

The function takes the following parameters:

  • wrapMode: WrapMode.

func (*PrintCompositor) TabWidth

func (compositor *PrintCompositor) TabWidth() uint

TabWidth returns the width of tabulation in characters for printed text.

The function returns the following values:

  • guint: width of tab.

func (*PrintCompositor) TopMargin

func (compositor *PrintCompositor) TopMargin(unit gtk.Unit) float64

TopMargin gets the top margin in units of unit.

The function takes the following parameters:

  • unit for the return value.

The function returns the following values:

  • gdouble: top margin.

func (*PrintCompositor) WrapMode

func (compositor *PrintCompositor) WrapMode() gtk.WrapMode

WrapMode gets the line wrapping mode for the printed text.

The function returns the following values:

  • wrapMode: line wrap mode.

type PrintCompositorClass

type PrintCompositorClass struct {
	// contains filtered or unexported fields
}

PrintCompositorClass: instance of this type is always passed by reference.

type PrintCompositorOverrides

type PrintCompositorOverrides struct {
}

PrintCompositorOverrides contains methods that are overridable.

type Region

type Region struct {
	*coreglib.Object
	// contains filtered or unexported fields
}

func NewRegion

func NewRegion(buffer *gtk.TextBuffer) *Region

The function takes the following parameters:

  • buffer: TextBuffer.

The function returns the following values:

  • region: new SourceRegion object for buffer.

func (*Region) AddRegion

func (region *Region) AddRegion(regionToAdd *Region)

AddRegion adds region_to_add to region. region_to_add is not modified.

The function takes the following parameters:

  • regionToAdd (optional) to add to region, or NULL.

func (*Region) AddSubregion

func (region *Region) AddSubregion(Start, End *gtk.TextIter)

AddSubregion adds the subregion delimited by _start and _end to region.

The function takes the following parameters:

  • Start: start of the subregion.
  • End: end of the subregion.

func (*Region) Bounds

func (region *Region) Bounds() (start, end *gtk.TextIter, ok bool)

Bounds gets the start and end bounds of the region.

The function returns the following values:

  • start (optional): iterator to initialize with the start of region, or NULL.
  • end (optional): iterator to initialize with the end of region, or NULL.
  • ok: TRUE if start and end have been set successfully (if non-NULL), or FALSE if the region is empty.

func (*Region) Buffer

func (region *Region) Buffer() *gtk.TextBuffer

The function returns the following values:

  • textBuffer (optional): TextBuffer.

func (*Region) IntersectRegion

func (region1 *Region) IntersectRegion(region2 *Region) *Region

IntersectRegion returns the intersection between region1 and region2. region1 and region2 are not modified.

The function takes the following parameters:

  • region2 (optional) or NULL.

The function returns the following values:

  • region (optional): intersection as a SourceRegion object.

func (*Region) IntersectSubregion

func (region *Region) IntersectSubregion(Start, End *gtk.TextIter) *Region

IntersectSubregion returns the intersection between region and the subregion delimited by _start and _end. region is not modified.

The function takes the following parameters:

  • Start: start of the subregion.
  • End: end of the subregion.

The function returns the following values:

  • ret (optional): intersection as a new SourceRegion.

func (*Region) IsEmpty

func (region *Region) IsEmpty() bool

IsEmpty returns whether the region is empty. A NULL region is considered empty.

The function returns the following values:

  • ok: whether the region is empty.

func (*Region) StartRegionIter

func (region *Region) StartRegionIter() *RegionIter

StartRegionIter initializes a SourceRegionIter to the first subregion of region. If region is empty, iter will be initialized to the end iterator.

The function returns the following values:

  • iter: iterator to initialize to the first subregion.

func (*Region) String

func (region *Region) String() string

String gets a string represention of region, for debugging purposes.

The returned string contains the character offsets of the subregions. It doesn't include a newline character at the end of the string.

The function returns the following values:

  • utf8 (optional): string represention of region. Free with g_free() when no longer needed.

func (*Region) SubtractRegion

func (region *Region) SubtractRegion(regionToSubtract *Region)

SubtractRegion subtracts region_to_subtract from region. region_to_subtract is not modified.

The function takes the following parameters:

  • regionToSubtract (optional) to subtract from region, or NULL.

func (*Region) SubtractSubregion

func (region *Region) SubtractSubregion(Start, End *gtk.TextIter)

SubtractSubregion subtracts the subregion delimited by _start and _end from region.

The function takes the following parameters:

  • Start: start of the subregion.
  • End: end of the subregion.

type RegionClass

type RegionClass struct {
	// contains filtered or unexported fields
}

RegionClass: instance of this type is always passed by reference.

func (*RegionClass) Padding

func (r *RegionClass) Padding() [8]unsafe.Pointer

type RegionIter

type RegionIter struct {
	// contains filtered or unexported fields
}

RegionIter is an opaque datatype; ignore all its fields. Initialize the iter with gtk_source_region_get_start_region_iter().

An instance of this type is always passed by reference.

func (*RegionIter) IsEnd

func (iter *RegionIter) IsEnd() bool

The function returns the following values:

  • ok: whether iter is the end iterator.

func (*RegionIter) Next

func (iter *RegionIter) Next() bool

Next moves iter to the next subregion.

The function returns the following values:

  • ok: TRUE if iter moved and is dereferenceable, or FALSE if iter has been set to the end iterator.

func (*RegionIter) Subregion

func (iter *RegionIter) Subregion() (start *gtk.TextIter, end *gtk.TextIter, ok bool)

Subregion gets the subregion at this iterator.

The function returns the following values:

  • start (optional): iterator to initialize with the subregion start, or NULL.
  • end (optional): iterator to initialize with the subregion end, or NULL.
  • ok: TRUE if start and end have been set successfully (if non-NULL), or FALSE if iter is the end iterator or if the region is empty.

type RegionOverrides

type RegionOverrides struct {
}

RegionOverrides contains methods that are overridable.

type SearchContext

type SearchContext struct {
	*coreglib.Object
	// contains filtered or unexported fields
}

func NewSearchContext

func NewSearchContext(buffer *Buffer, settings *SearchSettings) *SearchContext

NewSearchContext creates a new search context, associated with buffer, and customized with settings. If settings is NULL, a new SourceSearchSettings object will be created, that you can retrieve with gtk_source_search_context_get_settings().

The function takes the following parameters:

  • buffer: SourceBuffer.
  • settings (optional) or NULL.

The function returns the following values:

  • searchContext: new search context.

func (*SearchContext) Backward deprecated

func (search *SearchContext) Backward(iter *gtk.TextIter) (matchStart, matchEnd *gtk.TextIter, ok bool)

Backward synchronous backward search. It is recommended to use the asynchronous functions instead, to not block the user interface. However, if you are sure that the buffer is small, this function is more convenient to use.

Deprecated: Use gtk_source_search_context_backward2() instead.

The function takes the following parameters:

  • iter: start of search.

The function returns the following values:

  • matchStart (optional): return location for start of match, or NULL.
  • matchEnd (optional): return location for end of match, or NULL.
  • ok: whether a match was found.

func (*SearchContext) Backward2

func (search *SearchContext) Backward2(iter *gtk.TextIter) (matchStart, matchEnd *gtk.TextIter, hasWrappedAround, ok bool)

Backward2 synchronous backward search. It is recommended to use the asynchronous functions instead, to not block the user interface. However, if you are sure that the buffer is small, this function is more convenient to use.

The difference with gtk_source_search_context_backward() is that the has_wrapped_around out parameter has been added for convenience.

If the SourceSearchSettings:wrap-around property is FALSE, this function doesn't try to wrap around.

The has_wrapped_around out parameter is set independently of whether a match is found. So if this function returns FALSE, has_wrapped_around will have the same value as the SourceSearchSettings:wrap-around property.

The function takes the following parameters:

  • iter: start of search.

The function returns the following values:

  • matchStart (optional): return location for start of match, or NULL.
  • matchEnd (optional): return location for end of match, or NULL.
  • hasWrappedAround (optional): return location to know whether the search has wrapped around, or NULL.
  • ok: whether a match was found.

func (*SearchContext) BackwardFinish deprecated

func (search *SearchContext) BackwardFinish(result gio.AsyncResulter) (matchStart, matchEnd *gtk.TextIter, goerr error)

BackwardFinish finishes a backward search started with gtk_source_search_context_backward_async().

Deprecated: Use gtk_source_search_context_backward_finish2() instead.

The function takes the following parameters:

  • result: Result.

The function returns the following values:

  • matchStart (optional): return location for start of match, or NULL.
  • matchEnd (optional): return location for end of match, or NULL.

func (*SearchContext) BackwardFinish2

func (search *SearchContext) BackwardFinish2(result gio.AsyncResulter) (matchStart, matchEnd *gtk.TextIter, hasWrappedAround bool, goerr error)

BackwardFinish2 finishes a backward search started with gtk_source_search_context_backward_async().

See the documentation of gtk_source_search_context_backward2() for more details.

The function takes the following parameters:

  • result: Result.

The function returns the following values:

  • matchStart (optional): return location for start of match, or NULL.
  • matchEnd (optional): return location for end of match, or NULL.
  • hasWrappedAround (optional): return location to know whether the search has wrapped around, or NULL.

func (*SearchContext) Buffer

func (search *SearchContext) Buffer() *Buffer

The function returns the following values:

  • buffer: associated buffer.

func (*SearchContext) Forward deprecated

func (search *SearchContext) Forward(iter *gtk.TextIter) (matchStart, matchEnd *gtk.TextIter, ok bool)

Forward synchronous forward search. It is recommended to use the asynchronous functions instead, to not block the user interface. However, if you are sure that the buffer is small, this function is more convenient to use.

Deprecated: Use gtk_source_search_context_forward2() instead.

The function takes the following parameters:

  • iter: start of search.

The function returns the following values:

  • matchStart (optional): return location for start of match, or NULL.
  • matchEnd (optional): return location for end of match, or NULL.
  • ok: whether a match was found.

func (*SearchContext) Forward2

func (search *SearchContext) Forward2(iter *gtk.TextIter) (matchStart, matchEnd *gtk.TextIter, hasWrappedAround, ok bool)

Forward2 synchronous forward search. It is recommended to use the asynchronous functions instead, to not block the user interface. However, if you are sure that the buffer is small, this function is more convenient to use.

The difference with gtk_source_search_context_forward() is that the has_wrapped_around out parameter has been added for convenience.

If the SourceSearchSettings:wrap-around property is FALSE, this function doesn't try to wrap around.

The has_wrapped_around out parameter is set independently of whether a match is found. So if this function returns FALSE, has_wrapped_around will have the same value as the SourceSearchSettings:wrap-around property.

The function takes the following parameters:

  • iter: start of search.

The function returns the following values:

  • matchStart (optional): return location for start of match, or NULL.
  • matchEnd (optional): return location for end of match, or NULL.
  • hasWrappedAround (optional): return location to know whether the search has wrapped around, or NULL.
  • ok: whether a match was found.

func (*SearchContext) ForwardFinish deprecated

func (search *SearchContext) ForwardFinish(result gio.AsyncResulter) (matchStart, matchEnd *gtk.TextIter, goerr error)

ForwardFinish finishes a forward search started with gtk_source_search_context_forward_async().

Deprecated: Use gtk_source_search_context_forward_finish2() instead.

The function takes the following parameters:

  • result: Result.

The function returns the following values:

  • matchStart (optional): return location for start of match, or NULL.
  • matchEnd (optional): return location for end of match, or NULL.

func (*SearchContext) ForwardFinish2

func (search *SearchContext) ForwardFinish2(result gio.AsyncResulter) (matchStart, matchEnd *gtk.TextIter, hasWrappedAround bool, goerr error)

ForwardFinish2 finishes a forward search started with gtk_source_search_context_forward_async().

See the documentation of gtk_source_search_context_forward2() for more details.

The function takes the following parameters:

  • result: Result.

The function returns the following values:

  • matchStart (optional): return location for start of match, or NULL.
  • matchEnd (optional): return location for end of match, or NULL.
  • hasWrappedAround (optional): return location to know whether the search has wrapped around, or NULL.

func (*SearchContext) Highlight

func (search *SearchContext) Highlight() bool

The function returns the following values:

  • ok: whether to highlight the search occurrences.

func (*SearchContext) MatchStyle

func (search *SearchContext) MatchStyle() *Style

The function returns the following values:

  • style to apply on search matches.

func (*SearchContext) OccurrencePosition

func (search *SearchContext) OccurrencePosition(matchStart, matchEnd *gtk.TextIter) int

OccurrencePosition gets the position of a search occurrence. If the buffer is not already fully scanned, the position may be unknown, and -1 is returned. If 0 is returned, it means that this part of the buffer has already been scanned, and that match_start and match_end don't delimit an occurrence.

The function takes the following parameters:

  • matchStart: start of the occurrence.
  • matchEnd: end of the occurrence.

The function returns the following values:

  • gint: position of the search occurrence. The first occurrence has the position 1 (not 0). Returns 0 if match_start and match_end don't delimit an occurrence. Returns -1 if the position is not yet known.

func (*SearchContext) OccurrencesCount

func (search *SearchContext) OccurrencesCount() int

OccurrencesCount gets the total number of search occurrences. If the buffer is not already fully scanned, the total number of occurrences is unknown, and -1 is returned.

The function returns the following values:

  • gint: total number of search occurrences, or -1 if unknown.

func (*SearchContext) RegexError

func (search *SearchContext) RegexError() error

RegexError: regular expression patterns must follow certain rules. If SourceSearchSettings:search-text breaks a rule, the error can be retrieved with this function. The error domain is REGEX_ERROR.

Free the return value with g_error_free().

The function returns the following values:

  • err (optional) or NULL if the pattern is valid.

func (*SearchContext) Replace deprecated

func (search *SearchContext) Replace(matchStart, matchEnd *gtk.TextIter, replace string, replaceLength int) error

Replace replaces a search match by another text. If match_start and match_end doesn't correspond to a search match, FALSE is returned.

For a regular expression replacement, you can check if replace is valid by calling g_regex_check_replacement(). The replace text can contain backreferences; read the g_regex_replace() documentation for more details.

Deprecated: Use gtk_source_search_context_replace2() instead.

The function takes the following parameters:

  • matchStart: start of the match to replace.
  • matchEnd: end of the match to replace.
  • replace: replacement text.
  • replaceLength: length of replace in bytes, or -1.

func (*SearchContext) Replace2

func (search *SearchContext) Replace2(matchStart, matchEnd *gtk.TextIter, replace string, replaceLength int) error

Replace2 replaces a search match by another text. If match_start and match_end doesn't correspond to a search match, FALSE is returned.

Unlike with gtk_source_search_context_replace(), the match_start and match_end iters are revalidated to point to the replacement text boundaries.

For a regular expression replacement, you can check if replace is valid by calling g_regex_check_replacement(). The replace text can contain backreferences; read the g_regex_replace() documentation for more details.

The function takes the following parameters:

  • matchStart: start of the match to replace.
  • matchEnd: end of the match to replace.
  • replace: replacement text.
  • replaceLength: length of replace in bytes, or -1.

func (*SearchContext) ReplaceAll

func (search *SearchContext) ReplaceAll(replace string, replaceLength int) (uint, error)

ReplaceAll replaces all search matches by another text. It is a synchronous function, so it can block the user interface.

For a regular expression replacement, you can check if replace is valid by calling g_regex_check_replacement(). The replace text can contain backreferences; read the g_regex_replace() documentation for more details.

The function takes the following parameters:

  • replace: replacement text.
  • replaceLength: length of replace in bytes, or -1.

The function returns the following values:

  • guint: number of replaced matches.

func (*SearchContext) SetHighlight

func (search *SearchContext) SetHighlight(highlight bool)

SetHighlight enables or disables the search occurrences highlighting.

The function takes the following parameters:

  • highlight: setting.

func (*SearchContext) SetMatchStyle

func (search *SearchContext) SetMatchStyle(matchStyle *Style)

SetMatchStyle: set the style to apply on search matches. If match_style is NULL, default theme's scheme 'match-style' will be used. To enable or disable the search highlighting, use gtk_source_search_context_set_highlight().

The function takes the following parameters:

  • matchStyle (optional) or NULL.

func (*SearchContext) SetSettings deprecated

func (search *SearchContext) SetSettings(settings *SearchSettings)

SetSettings: associate a SourceSearchSettings with the search context. If settings is NULL, a new one will be created.

The search context holds a reference to settings.

Deprecated: The SourceSearchContext:settings property will become a construct-only property in a future version. Create a new SourceSearchContext instead, or change the SourceSearchSettings properties. When the SourceSearchContext:settings property will become construct-only, it will be possible to simplify some code that needed to listen to the notify::settings signal.

The function takes the following parameters:

  • settings (optional): new SourceSearchSettings, or NULL.

func (*SearchContext) Settings

func (search *SearchContext) Settings() *SearchSettings

The function returns the following values:

  • searchSettings: search settings.

type SearchContextClass

type SearchContextClass struct {
	// contains filtered or unexported fields
}

SearchContextClass: instance of this type is always passed by reference.

func (*SearchContextClass) Padding

func (s *SearchContextClass) Padding() [10]unsafe.Pointer

type SearchContextOverrides

type SearchContextOverrides struct {
}

SearchContextOverrides contains methods that are overridable.

type SearchSettings

type SearchSettings struct {
	*coreglib.Object
	// contains filtered or unexported fields
}

func NewSearchSettings

func NewSearchSettings() *SearchSettings

NewSearchSettings creates a new search settings object.

The function returns the following values:

  • searchSettings: new search settings object.

func (*SearchSettings) AtWordBoundaries

func (settings *SearchSettings) AtWordBoundaries() bool

The function returns the following values:

  • ok: whether to search at word boundaries.

func (*SearchSettings) CaseSensitive

func (settings *SearchSettings) CaseSensitive() bool

The function returns the following values:

  • ok: whether the search is case sensitive.

func (*SearchSettings) RegexEnabled

func (settings *SearchSettings) RegexEnabled() bool

The function returns the following values:

  • ok: whether to search by regular expressions.

func (*SearchSettings) SearchText

func (settings *SearchSettings) SearchText() string

SearchText gets the text to search. The return value must not be freed.

You may be interested to call gtk_source_utils_escape_search_text() after this function.

The function returns the following values:

  • utf8 (optional): text to search, or NULL if the search is disabled.

func (*SearchSettings) SetAtWordBoundaries

func (settings *SearchSettings) SetAtWordBoundaries(atWordBoundaries bool)

SetAtWordBoundaries: change whether the search is done at word boundaries. If at_word_boundaries is TRUE, a search match must start and end a word. The match can span multiple words. See also gtk_text_iter_starts_word() and gtk_text_iter_ends_word().

The function takes the following parameters:

  • atWordBoundaries: setting.

func (*SearchSettings) SetCaseSensitive

func (settings *SearchSettings) SetCaseSensitive(caseSensitive bool)

SetCaseSensitive enables or disables the case sensitivity for the search.

The function takes the following parameters:

  • caseSensitive: setting.

func (*SearchSettings) SetRegexEnabled

func (settings *SearchSettings) SetRegexEnabled(regexEnabled bool)

SetRegexEnabled enables or disables whether to search by regular expressions. If enabled, the SourceSearchSettings:search-text property contains the pattern of the regular expression.

SourceSearchContext uses #GRegex when regex search is enabled. See the Regular expression syntax (https://developer.gnome.org/glib/stable/glib-regex-syntax.html) page in the GLib reference manual.

The function takes the following parameters:

  • regexEnabled: setting.

func (*SearchSettings) SetSearchText

func (settings *SearchSettings) SetSearchText(searchText string)

SetSearchText sets the text to search. If search_text is NULL or is empty, the search will be disabled. A copy of search_text will be made, so you can safely free search_text after a call to this function.

You may be interested to call gtk_source_utils_unescape_search_text() before this function.

The function takes the following parameters:

  • searchText (optional): nul-terminated text to search, or NULL to disable the search.

func (*SearchSettings) SetWrapAround

func (settings *SearchSettings) SetWrapAround(wrapAround bool)

SetWrapAround enables or disables the wrap around search. If wrap_around is TRUE, the forward search continues at the beginning of the buffer if no search occurrences are found. Similarly, the backward search continues to search at the end of the buffer.

The function takes the following parameters:

  • wrapAround: setting.

func (*SearchSettings) WrapAround

func (settings *SearchSettings) WrapAround() bool

The function returns the following values:

  • ok: whether to wrap around the search.

type SearchSettingsClass

type SearchSettingsClass struct {
	// contains filtered or unexported fields
}

SearchSettingsClass: instance of this type is always passed by reference.

func (*SearchSettingsClass) Padding

func (s *SearchSettingsClass) Padding() [10]unsafe.Pointer

type SearchSettingsOverrides

type SearchSettingsOverrides struct {
}

SearchSettingsOverrides contains methods that are overridable.

type SmartHomeEndType

type SmartHomeEndType C.gint
const (
	// SourceSmartHomeEndDisabled: smart-home-end disabled.
	SourceSmartHomeEndDisabled SmartHomeEndType = iota
	// SourceSmartHomeEndBefore: move to the first/last non-whitespace character
	// on the first press of the HOME/END keys and to the beginning/end of the
	// line on the second press.
	SourceSmartHomeEndBefore
	// SourceSmartHomeEndAfter: move to the beginning/end of the line on the
	// first press of the HOME/END keys and to the first/last non-whitespace
	// character on the second press.
	SourceSmartHomeEndAfter
	// SourceSmartHomeEndAlways always move to the first/last non-whitespace
	// character when the HOME/END keys are pressed.
	SourceSmartHomeEndAlways
)

func (SmartHomeEndType) String

func (s SmartHomeEndType) String() string

String returns the name in string for SmartHomeEndType.

type SortFlags

type SortFlags C.guint
const (
	// SourceSortFlagsNone: no flags specified.
	SourceSortFlagsNone SortFlags = 0b0
	// SourceSortFlagsCaseSensitive: case sensitive sort.
	SourceSortFlagsCaseSensitive SortFlags = 0b1
	// SourceSortFlagsReverseOrder: sort in reverse order.
	SourceSortFlagsReverseOrder SortFlags = 0b10
	// SourceSortFlagsRemoveDuplicates: remove duplicates.
	SourceSortFlagsRemoveDuplicates SortFlags = 0b100
)

func (SortFlags) Has

func (s SortFlags) Has(other SortFlags) bool

Has returns true if s contains other.

func (SortFlags) String

func (s SortFlags) String() string

String returns the names in string for SortFlags.

type SpaceDrawer

type SpaceDrawer struct {
	*coreglib.Object
	// contains filtered or unexported fields
}

func NewSpaceDrawer

func NewSpaceDrawer() *SpaceDrawer

NewSpaceDrawer creates a new SourceSpaceDrawer object. Useful for storing space drawing settings independently of a SourceView.

The function returns the following values:

  • spaceDrawer: new SourceSpaceDrawer.

func (*SpaceDrawer) BindMatrixSetting

func (drawer *SpaceDrawer) BindMatrixSetting(settings *gio.Settings, key string, flags gio.SettingsBindFlags)

BindMatrixSetting binds the SourceSpaceDrawer:matrix property to a #GSettings key.

The #GSettings key must be of the same type as the SourceSpaceDrawer:matrix property, that is, "au".

The g_settings_bind() function cannot be used, because the default GIO mapping functions don't support #GVariant properties (maybe it will be supported by a future GIO version, in which case this function can be deprecated).

The function takes the following parameters:

  • settings #GSettings object.
  • key settings key to bind.
  • flags for the binding.

func (*SpaceDrawer) EnableMatrix

func (drawer *SpaceDrawer) EnableMatrix() bool

The function returns the following values:

  • ok: whether the SourceSpaceDrawer:matrix property is enabled.

func (*SpaceDrawer) Matrix

func (drawer *SpaceDrawer) Matrix() *glib.Variant

Matrix gets the value of the SourceSpaceDrawer:matrix property, as a #GVariant. An empty array can be returned in case the matrix is a zero matrix.

The gtk_source_space_drawer_get_types_for_locations() function may be more convenient to use.

The function returns the following values:

  • variant value as a new floating #GVariant instance.

func (*SpaceDrawer) SetEnableMatrix

func (drawer *SpaceDrawer) SetEnableMatrix(enableMatrix bool)

SetEnableMatrix sets whether the SourceSpaceDrawer:matrix property is enabled.

The function takes the following parameters:

  • enableMatrix: new value.

func (*SpaceDrawer) SetMatrix

func (drawer *SpaceDrawer) SetMatrix(matrix *glib.Variant)

SetMatrix sets a new value to the SourceSpaceDrawer:matrix property, as a #GVariant. If matrix is NULL, then an empty array is set.

If matrix is floating, it is consumed.

The gtk_source_space_drawer_set_types_for_locations() function may be more convenient to use.

The function takes the following parameters:

  • matrix (optional): new matrix value, or NULL.

func (*SpaceDrawer) SetTypesForLocations

func (drawer *SpaceDrawer) SetTypesForLocations(locations SpaceLocationFlags, types SpaceTypeFlags)

SetTypesForLocations modifies the SourceSpaceDrawer:matrix property at the specified locations.

The function takes the following parameters:

  • locations: one or several SourceSpaceLocationFlags.
  • types: combination of SourceSpaceTypeFlags.

func (*SpaceDrawer) TypesForLocations

func (drawer *SpaceDrawer) TypesForLocations(locations SpaceLocationFlags) SpaceTypeFlags

TypesForLocations: if only one location is specified, this function returns what kind of white spaces are drawn at that location. The value is retrieved from the SourceSpaceDrawer:matrix property.

If several locations are specified, this function returns the logical AND for those locations. Which means that if a certain kind of white space is present in the return value, then that kind of white space is drawn at all the specified locations.

The function takes the following parameters:

  • locations: one or several SourceSpaceLocationFlags.

The function returns the following values:

  • spaceTypeFlags: combination of SourceSpaceTypeFlags.

type SpaceDrawerClass

type SpaceDrawerClass struct {
	// contains filtered or unexported fields
}

SpaceDrawerClass: instance of this type is always passed by reference.

func (*SpaceDrawerClass) Padding

func (s *SpaceDrawerClass) Padding() [20]unsafe.Pointer

type SpaceDrawerOverrides

type SpaceDrawerOverrides struct {
}

SpaceDrawerOverrides contains methods that are overridable.

type SpaceLocationFlags

type SpaceLocationFlags C.guint

SpaceLocationFlags contains flags for white space locations.

If a line contains only white spaces (no text), the white spaces match both GTK_SOURCE_SPACE_LOCATION_LEADING and GTK_SOURCE_SPACE_LOCATION_TRAILING.

const (
	// SourceSpaceLocationNone: no flags.
	SourceSpaceLocationNone SpaceLocationFlags = 0b0
	// SourceSpaceLocationLeading: leading white spaces on a line, i.e.
	// the indentation.
	SourceSpaceLocationLeading SpaceLocationFlags = 0b1
	// SourceSpaceLocationInsideText: white spaces inside a line of text.
	SourceSpaceLocationInsideText SpaceLocationFlags = 0b10
	// SourceSpaceLocationTrailing: trailing white spaces on a line.
	SourceSpaceLocationTrailing SpaceLocationFlags = 0b100
	// SourceSpaceLocationAll: white spaces anywhere.
	SourceSpaceLocationAll SpaceLocationFlags = 0b111
)

func (SpaceLocationFlags) Has

Has returns true if s contains other.

func (SpaceLocationFlags) String

func (s SpaceLocationFlags) String() string

String returns the names in string for SpaceLocationFlags.

type SpaceTypeFlags

type SpaceTypeFlags C.guint

SpaceTypeFlags contains flags for white space types.

const (
	// SourceSpaceTypeNone: no flags.
	SourceSpaceTypeNone SpaceTypeFlags = 0b0
	// SourceSpaceTypeSpace: space character.
	SourceSpaceTypeSpace SpaceTypeFlags = 0b1
	// SourceSpaceTypeTab: tab character.
	SourceSpaceTypeTab SpaceTypeFlags = 0b10
	// SourceSpaceTypeNewline: line break character. If the
	// SourceBuffer:implicit-trailing-newline property is TRUE,
	// SourceSpaceDrawer also draws a line break at the end of the buffer.
	SourceSpaceTypeNewline SpaceTypeFlags = 0b100
	// SourceSpaceTypeNbsp: non-breaking space character.
	SourceSpaceTypeNbsp SpaceTypeFlags = 0b1000
	// SourceSpaceTypeAll: all white spaces.
	SourceSpaceTypeAll SpaceTypeFlags = 0b1111
)

func (SpaceTypeFlags) Has

func (s SpaceTypeFlags) Has(other SpaceTypeFlags) bool

Has returns true if s contains other.

func (SpaceTypeFlags) String

func (s SpaceTypeFlags) String() string

String returns the names in string for SpaceTypeFlags.

type Style

type Style struct {
	*coreglib.Object
	// contains filtered or unexported fields
}

func (*Style) Apply

func (style *Style) Apply(tag *gtk.TextTag)

Apply: this function modifies the TextTag properties that are related to the SourceStyle properties. Other TextTag properties are left untouched.

If style is non-NULL, applies style to tag.

If style is NULL, the related *-set properties of TextTag are set to FALSE.

The function takes the following parameters:

  • tag to apply styles to.

func (*Style) Copy

func (style *Style) Copy() *Style

Copy creates a copy of style, that is a new SourceStyle instance which has the same attributes set.

The function returns the following values:

  • ret: copy of style, call g_object_unref() when you are done with it.

type StyleScheme

type StyleScheme struct {
	*coreglib.Object
	// contains filtered or unexported fields
}

func (*StyleScheme) Authors

func (scheme *StyleScheme) Authors() []string

The function returns the following values:

  • utf8s (optional): a NULL-terminated array containing the scheme authors or NULL if no author is specified by the style scheme.

func (*StyleScheme) Description

func (scheme *StyleScheme) Description() string

The function returns the following values:

  • utf8 (optional): scheme description (if defined), or NULL.

func (*StyleScheme) Filename

func (scheme *StyleScheme) Filename() string

The function returns the following values:

  • utf8 (optional): scheme file name if the scheme was created parsing a style scheme file or NULL in the other cases.

func (*StyleScheme) ID

func (scheme *StyleScheme) ID() string

The function returns the following values:

  • utf8: scheme id.

func (*StyleScheme) Name

func (scheme *StyleScheme) Name() string

The function returns the following values:

  • utf8: scheme name.

func (*StyleScheme) Style

func (scheme *StyleScheme) Style(styleId string) *Style

The function takes the following parameters:

  • styleId: id of the style to retrieve.

The function returns the following values:

  • style (optional) which corresponds to style_id in the scheme, or NULL when no style with this name found. It is owned by scheme and may not be unref'ed.

type StyleSchemeChooser

type StyleSchemeChooser struct {
	*coreglib.Object
	// contains filtered or unexported fields
}

StyleSchemeChooser wraps an interface. This means the user can get the underlying type by calling Cast().

func (*StyleSchemeChooser) SetStyleScheme

func (chooser *StyleSchemeChooser) SetStyleScheme(scheme *StyleScheme)

SetStyleScheme sets the scheme.

The function takes the following parameters:

  • scheme: SourceStyleScheme.

func (*StyleSchemeChooser) StyleScheme

func (chooser *StyleSchemeChooser) StyleScheme() *StyleScheme

StyleScheme gets the currently-selected scheme.

The function returns the following values:

  • styleScheme: currently-selected scheme.

type StyleSchemeChooserButton

type StyleSchemeChooserButton struct {
	gtk.Button

	*coreglib.Object
	StyleSchemeChooser
	// contains filtered or unexported fields
}

func NewStyleSchemeChooserButton

func NewStyleSchemeChooserButton() *StyleSchemeChooserButton

NewStyleSchemeChooserButton creates a new SourceStyleSchemeChooserButton.

The function returns the following values:

  • styleSchemeChooserButton: new SourceStyleSchemeChooserButton.

type StyleSchemeChooserButtonClass

type StyleSchemeChooserButtonClass struct {
	// contains filtered or unexported fields
}

StyleSchemeChooserButtonClass: instance of this type is always passed by reference.

func (*StyleSchemeChooserButtonClass) Parent

func (s *StyleSchemeChooserButtonClass) Parent() *gtk.ButtonClass

type StyleSchemeChooserButtonOverrides

type StyleSchemeChooserButtonOverrides struct {
}

StyleSchemeChooserButtonOverrides contains methods that are overridable.

type StyleSchemeChooserInterface

type StyleSchemeChooserInterface struct {
	// contains filtered or unexported fields
}

StyleSchemeChooserInterface: instance of this type is always passed by reference.

func (*StyleSchemeChooserInterface) Padding

func (s *StyleSchemeChooserInterface) Padding() [12]unsafe.Pointer

type StyleSchemeChooserWidget

type StyleSchemeChooserWidget struct {
	gtk.Bin

	*coreglib.Object
	StyleSchemeChooser
	// contains filtered or unexported fields
}

func NewStyleSchemeChooserWidget

func NewStyleSchemeChooserWidget() *StyleSchemeChooserWidget

NewStyleSchemeChooserWidget creates a new SourceStyleSchemeChooserWidget.

The function returns the following values:

  • styleSchemeChooserWidget: new SourceStyleSchemeChooserWidget.

type StyleSchemeChooserWidgetClass

type StyleSchemeChooserWidgetClass struct {
	// contains filtered or unexported fields
}

StyleSchemeChooserWidgetClass: instance of this type is always passed by reference.

func (*StyleSchemeChooserWidgetClass) Parent

func (s *StyleSchemeChooserWidgetClass) Parent() *gtk.BinClass

type StyleSchemeChooserWidgetOverrides

type StyleSchemeChooserWidgetOverrides struct {
}

StyleSchemeChooserWidgetOverrides contains methods that are overridable.

type StyleSchemeChooserer

type StyleSchemeChooserer interface {
	coreglib.Objector

	// StyleScheme gets the currently-selected scheme.
	StyleScheme() *StyleScheme
	// SetStyleScheme sets the scheme.
	SetStyleScheme(scheme *StyleScheme)
}

StyleSchemeChooserer describes StyleSchemeChooser's interface methods.

type StyleSchemeClass

type StyleSchemeClass struct {
	// contains filtered or unexported fields
}

StyleSchemeClass: instance of this type is always passed by reference.

type StyleSchemeManager

type StyleSchemeManager struct {
	*coreglib.Object
	// contains filtered or unexported fields
}

func NewStyleSchemeManager

func NewStyleSchemeManager() *StyleSchemeManager

NewStyleSchemeManager creates a new style manager. If you do not need more than one style manager then use gtk_source_style_scheme_manager_get_default() instead.

The function returns the following values:

  • styleSchemeManager: new SourceStyleSchemeManager.

func StyleSchemeManagerGetDefault

func StyleSchemeManagerGetDefault() *StyleSchemeManager

StyleSchemeManagerGetDefault returns the default SourceStyleSchemeManager instance.

The function returns the following values:

  • styleSchemeManager Return value is owned by GtkSourceView library and must not be unref'ed.

func (*StyleSchemeManager) AppendSearchPath

func (manager *StyleSchemeManager) AppendSearchPath(path string)

AppendSearchPath appends path to the list of directories where the manager looks for style scheme files. See gtk_source_style_scheme_manager_set_search_path() for details.

The function takes the following parameters:

  • path: directory or a filename.

func (*StyleSchemeManager) ForceRescan

func (manager *StyleSchemeManager) ForceRescan()

ForceRescan: mark any currently cached information about the available style scehems as invalid. All the available style schemes will be reloaded next time the manager is accessed.

func (*StyleSchemeManager) PrependSearchPath

func (manager *StyleSchemeManager) PrependSearchPath(path string)

PrependSearchPath prepends path to the list of directories where the manager looks for style scheme files. See gtk_source_style_scheme_manager_set_search_path() for details.

The function takes the following parameters:

  • path: directory or a filename.

func (*StyleSchemeManager) Scheme

func (manager *StyleSchemeManager) Scheme(schemeId string) *StyleScheme

Scheme looks up style scheme by id.

The function takes the following parameters:

  • schemeId: style scheme id to find.

The function returns the following values:

  • styleScheme object. Returned value is owned by manager and must not be unref'ed.

func (*StyleSchemeManager) SchemeIDs

func (manager *StyleSchemeManager) SchemeIDs() []string

SchemeIDs returns the ids of the available style schemes.

The function returns the following values:

  • utf8s (optional): a NULL-terminated array of strings containing the ids of the available style schemes or NULL if no style scheme is available. The array is sorted alphabetically according to the scheme name. The array is owned by the manager and must not be modified.

func (*StyleSchemeManager) SearchPath

func (manager *StyleSchemeManager) SearchPath() []string

SearchPath returns the current search path for the manager. See gtk_source_style_scheme_manager_set_search_path() for details.

The function returns the following values:

  • utf8s: NULL-terminated array of string containing the search path. The array is owned by the manager and must not be modified.

func (*StyleSchemeManager) SetSearchPath

func (manager *StyleSchemeManager) SetSearchPath(path []string)

SetSearchPath sets the list of directories where the manager looks for style scheme files. If path is NULL, the search path is reset to default.

The function takes the following parameters:

  • path (optional): a NULL-terminated array of strings or NULL.

type StyleSchemeManagerClass

type StyleSchemeManagerClass struct {
	// contains filtered or unexported fields
}

StyleSchemeManagerClass: instance of this type is always passed by reference.

type StyleSchemeManagerOverrides

type StyleSchemeManagerOverrides struct {
}

StyleSchemeManagerOverrides contains methods that are overridable.

type StyleSchemeOverrides

type StyleSchemeOverrides struct {
}

StyleSchemeOverrides contains methods that are overridable.

type Tag

type Tag struct {
	gtk.TextTag
	// contains filtered or unexported fields
}

func NewTag

func NewTag(name string) *Tag

NewTag creates a SourceTag. Configure the tag using object arguments, i.e. using g_object_set().

For usual cases, gtk_source_buffer_create_source_tag() is more convenient to use.

The function takes the following parameters:

  • name (optional): tag name, or NULL.

The function returns the following values:

  • tag: new SourceTag.

type TagClass

type TagClass struct {
	// contains filtered or unexported fields
}

TagClass: instance of this type is always passed by reference.

func (*TagClass) Padding

func (t *TagClass) Padding() [10]unsafe.Pointer

func (*TagClass) ParentClass

func (t *TagClass) ParentClass() *gtk.TextTagClass

type TagOverrides

type TagOverrides struct {
}

TagOverrides contains methods that are overridable.

type UndoManager

type UndoManager struct {
	*coreglib.Object
	// contains filtered or unexported fields
}

UndoManager wraps an interface. This means the user can get the underlying type by calling Cast().

func (*UndoManager) BeginNotUndoableAction

func (manager *UndoManager) BeginNotUndoableAction()

BeginNotUndoableAction: begin a not undoable action on the buffer. All changes between this call and the call to gtk_source_undo_manager_end_not_undoable_action() cannot be undone. This function should be re-entrant.

func (*UndoManager) CanRedo

func (manager *UndoManager) CanRedo() bool

CanRedo: get whether there are redo operations available.

The function returns the following values:

  • ok: TRUE if there are redo operations available, FALSE otherwise.

func (*UndoManager) CanRedoChanged

func (manager *UndoManager) CanRedoChanged()

CanRedoChanged emits the SourceUndoManager::can-redo-changed signal.

func (*UndoManager) CanUndo

func (manager *UndoManager) CanUndo() bool

CanUndo: get whether there are undo operations available.

The function returns the following values:

  • ok: TRUE if there are undo operations available, FALSE otherwise.

func (*UndoManager) CanUndoChanged

func (manager *UndoManager) CanUndoChanged()

CanUndoChanged emits the SourceUndoManager::can-undo-changed signal.

func (*UndoManager) ConnectCanRedoChanged

func (manager *UndoManager) ConnectCanRedoChanged(f func()) coreglib.SignalHandle

ConnectCanRedoChanged is emitted when the ability to redo has changed.

func (*UndoManager) ConnectCanUndoChanged

func (manager *UndoManager) ConnectCanUndoChanged(f func()) coreglib.SignalHandle

ConnectCanUndoChanged is emitted when the ability to undo has changed.

func (*UndoManager) EndNotUndoableAction

func (manager *UndoManager) EndNotUndoableAction()

EndNotUndoableAction ends a not undoable action on the buffer.

func (*UndoManager) Redo

func (manager *UndoManager) Redo()

Redo: perform a single redo. Calling this function when there are no redo operations available is an error. Use gtk_source_undo_manager_can_redo() to find out if there are redo operations available.

func (*UndoManager) Undo

func (manager *UndoManager) Undo()

Undo: perform a single undo. Calling this function when there are no undo operations available is an error. Use gtk_source_undo_manager_can_undo() to find out if there are undo operations available.

type UndoManagerIface

type UndoManagerIface struct {
	// contains filtered or unexported fields
}

UndoManagerIface: instance of this type is always passed by reference.

type UndoManagerer

type UndoManagerer interface {
	coreglib.Objector

	// BeginNotUndoableAction: begin a not undoable action on the buffer.
	BeginNotUndoableAction()
	// CanRedo: get whether there are redo operations available.
	CanRedo() bool
	// CanRedoChanged emits the SourceUndoManager::can-redo-changed signal.
	CanRedoChanged()
	// CanUndo: get whether there are undo operations available.
	CanUndo() bool
	// CanUndoChanged emits the SourceUndoManager::can-undo-changed signal.
	CanUndoChanged()
	// EndNotUndoableAction ends a not undoable action on the buffer.
	EndNotUndoableAction()
	// Redo: perform a single redo.
	Redo()
	// Undo: perform a single undo.
	Undo()

	// Can-redo-changed is emitted when the ability to redo has changed.
	ConnectCanRedoChanged(func()) coreglib.SignalHandle
	// Can-undo-changed is emitted when the ability to undo has changed.
	ConnectCanUndoChanged(func()) coreglib.SignalHandle
}

UndoManagerer describes UndoManager's interface methods.

type View

type View struct {
	gtk.TextView
	// contains filtered or unexported fields
}

func NewView

func NewView() *View

NewView creates a new SourceView.

By default, an empty SourceBuffer will be lazily created and can be retrieved with gtk_text_view_get_buffer().

If you want to specify your own buffer, either override the TextViewClass create_buffer factory method, or use gtk_source_view_new_with_buffer().

The function returns the following values:

  • view: new SourceView.

func NewViewWithBuffer

func NewViewWithBuffer(buffer *Buffer) *View

NewViewWithBuffer creates a new SourceView widget displaying the buffer buffer. One buffer can be shared among many widgets.

The function takes the following parameters:

  • buffer: SourceBuffer.

The function returns the following values:

  • view: new SourceView.

func (*View) AutoIndent

func (view *View) AutoIndent() bool

AutoIndent returns whether auto-indentation of text is enabled.

The function returns the following values:

  • ok: TRUE if auto indentation is enabled.

func (*View) BackgroundPattern

func (view *View) BackgroundPattern() BackgroundPatternType

BackgroundPattern returns the SourceBackgroundPatternType specifying if and how the background pattern should be displayed for this view.

The function returns the following values:

  • backgroundPatternType: SourceBackgroundPatternType.

func (*View) Completion

func (view *View) Completion() *Completion

Completion gets the SourceCompletion associated with view. The returned object is guaranteed to be the same for the lifetime of view. Each SourceView object has a different SourceCompletion.

The function returns the following values:

  • completion associated with view.

func (*View) ConnectChangeCase

func (view *View) ConnectChangeCase(f func(caseType ChangeCaseType)) coreglib.SignalHandle

ConnectChangeCase: keybinding signal to change case of the text at the current cursor position.

func (*View) ConnectChangeNumber

func (view *View) ConnectChangeNumber(f func(count int)) coreglib.SignalHandle

ConnectChangeNumber: keybinding signal to edit a number at the current cursor position.

func (*View) ConnectJoinLines

func (view *View) ConnectJoinLines(f func()) coreglib.SignalHandle

ConnectJoinLines: keybinding signal to join the lines currently selected.

func (*View) ConnectLineMarkActivated

func (view *View) ConnectLineMarkActivated(f func(iter *gtk.TextIter, event *gdk.Event)) coreglib.SignalHandle

ConnectLineMarkActivated is emitted when a line mark has been activated (for instance when there was a button press in the line marks gutter). You can use iter to determine on which line the activation took place.

func (*View) ConnectMoveLines

func (view *View) ConnectMoveLines(f func(copy bool, count int)) coreglib.SignalHandle

ConnectMoveLines signal is a keybinding which gets emitted when the user initiates moving a line. The default binding key is Alt+Up/Down arrow. And moves the currently selected lines, or the current line by count. For the moment, only count of -1 or 1 is valid.

The copy parameter is deprecated, it has never been used by GtkSourceView (the value is always FALSE) and was buggy.

func (*View) ConnectMoveToMatchingBracket

func (view *View) ConnectMoveToMatchingBracket(f func(extendSelection bool)) coreglib.SignalHandle

ConnectMoveToMatchingBracket: keybinding signal to move the cursor to the matching bracket.

func (*View) ConnectMoveWords

func (view *View) ConnectMoveWords(f func(count int)) coreglib.SignalHandle

ConnectMoveWords signal is a keybinding which gets emitted when the user initiates moving a word. The default binding key is Alt+Left/Right Arrow and moves the current selection, or the current word by one word.

func (*View) ConnectRedo

func (view *View) ConnectRedo(f func()) coreglib.SignalHandle

func (*View) ConnectShowCompletion

func (view *View) ConnectShowCompletion(f func()) coreglib.SignalHandle

ConnectShowCompletion signal is a key binding signal which gets emitted when the user requests a completion, by pressing <keycombo><keycap>Control</keycap><keycap>space</keycap></keycombo>.

This will create a SourceCompletionContext with the activation type as GTK_SOURCE_COMPLETION_ACTIVATION_USER_REQUESTED.

Applications should not connect to it, but may emit it with g_signal_emit_by_name() if they need to activate the completion by another means, for example with another key binding or a menu entry.

func (*View) ConnectSmartHomeEnd

func (view *View) ConnectSmartHomeEnd(f func(iter *gtk.TextIter, count int)) coreglib.SignalHandle

ConnectSmartHomeEnd is emitted when a the cursor was moved according to the smart home end setting. The signal is emitted after the cursor is moved, but during the GtkTextView::move-cursor action. This can be used to find out whether the cursor was moved by a normal home/end or by a smart home/end.

func (*View) ConnectUndo

func (view *View) ConnectUndo(f func()) coreglib.SignalHandle

func (*View) DrawSpaces deprecated

func (view *View) DrawSpaces() DrawSpacesFlags

DrawSpaces returns the SourceDrawSpacesFlags specifying if and how spaces should be displayed for this view.

Deprecated: Use gtk_source_space_drawer_get_types_for_locations() instead.

The function returns the following values:

  • drawSpacesFlags 0 if no spaces should be drawn.

func (*View) Gutter

func (view *View) Gutter(windowType gtk.TextWindowType) *Gutter

Gutter returns the SourceGutter object associated with window_type for view. Only GTK_TEXT_WINDOW_LEFT and GTK_TEXT_WINDOW_RIGHT are supported, respectively corresponding to the left and right gutter. The line numbers and mark category icons are rendered in the left gutter.

The function takes the following parameters:

  • windowType: gutter window type.

The function returns the following values:

  • gutter: SourceGutter.

func (*View) HighlightCurrentLine

func (view *View) HighlightCurrentLine() bool

HighlightCurrentLine returns whether the current line is highlighted.

The function returns the following values:

  • ok: TRUE if the current line is highlighted.

func (*View) IndentLines

func (view *View) IndentLines(start, end *gtk.TextIter)

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

The function takes the following parameters:

  • start of the first line to indent.
  • end of the last line to indent.

func (*View) IndentOnTab

func (view *View) IndentOnTab() bool

IndentOnTab returns whether when the tab key is pressed the current selection should get indented instead of replaced with the \t character.

The function returns the following values:

  • ok: TRUE if the selection is indented when tab is pressed.

func (*View) IndentWidth

func (view *View) IndentWidth() int

IndentWidth returns the number of spaces to use for each step of indent. See gtk_source_view_set_indent_width() for details.

The function returns the following values:

  • gint: indent width.

func (*View) InsertSpacesInsteadOfTabs

func (view *View) InsertSpacesInsteadOfTabs() bool

InsertSpacesInsteadOfTabs returns whether when inserting a tabulator character it should be replaced by a group of space characters.

The function returns the following values:

  • ok: TRUE if spaces are inserted instead of tabs.

func (*View) MarkAttributes

func (view *View) MarkAttributes(category string, priority *int) *MarkAttributes

MarkAttributes gets attributes and priority for the category.

The function takes the following parameters:

  • category: category.
  • priority: place where priority of the category will be stored.

The function returns the following values:

  • markAttributes for the category. The object belongs to view, so it must not be unreffed.

func (*View) RightMarginPosition

func (view *View) RightMarginPosition() uint

RightMarginPosition gets the position of the right margin in the given view.

The function returns the following values:

  • guint: position of the right margin.

func (*View) SetAutoIndent

func (view *View) SetAutoIndent(enable bool)

SetAutoIndent: if TRUE auto-indentation of text is enabled.

When Enter is pressed to create a new line, the auto-indentation inserts the same indentation as the previous line. This is <emphasis>not</emphasis> a "smart indentation" where an indentation level is added or removed depending on the context.

The function takes the following parameters:

  • enable: whether to enable auto indentation.

func (*View) SetBackgroundPattern

func (view *View) SetBackgroundPattern(backgroundPattern BackgroundPatternType)

SetBackgroundPattern: set if and how the background pattern should be displayed.

The function takes the following parameters:

  • backgroundPattern: SourceBackgroundPatternType.

func (*View) SetDrawSpaces deprecated

func (view *View) SetDrawSpaces(flags DrawSpacesFlags)

SetDrawSpaces: set if and how the spaces should be visualized. Specifying flags as 0 will disable display of spaces.

For a finer-grained method, there is also the GtkSourceTag's SourceTag:draw-spaces property.

Deprecated: Use gtk_source_space_drawer_set_types_for_locations() instead.

The function takes the following parameters:

  • flags specifing how white spaces should be displayed.

func (*View) SetHighlightCurrentLine

func (view *View) SetHighlightCurrentLine(highlight bool)

SetHighlightCurrentLine: if highlight is TRUE the current line will be highlighted.

The function takes the following parameters:

  • highlight: whether to highlight the current line.

func (*View) SetIndentOnTab

func (view *View) SetIndentOnTab(enable bool)

SetIndentOnTab: 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.

If the first or last line is not selected completely, it is also indented or unindented.

When the selection doesn't span several lines, the tab key always replaces the selection with a normal \t character.

The function takes the following parameters:

  • enable: whether to indent a block when tab is pressed.

func (*View) SetIndentWidth

func (view *View) SetIndentWidth(width int)

SetIndentWidth sets the number of spaces to use for each step of indent when the tab key is pressed. If width is -1, the value of the SourceView:tab-width property will be used.

The SourceView:indent-width interacts with the SourceView:insert-spaces-instead-of-tabs property and SourceView:tab-width. An example will be clearer: if the SourceView:indent-width is 4 and SourceView:tab-width is 8 and SourceView:insert-spaces-instead-of-tabs is FALSE, then pressing the tab key at the beginning of a line will insert 4 spaces. So far so good. Pressing the tab key a second time will remove the 4 spaces and insert a \t character instead (since SourceView:tab-width is 8). On the other hand, if SourceView:insert-spaces-instead-of-tabs is TRUE, the second tab key pressed will insert 4 more spaces for a total of 8 spaces in the TextBuffer.

The test-widget program (available in the GtkSourceView repository) may be useful to better understand the indentation settings (enable the space drawing!).

The function takes the following parameters:

  • width: indent width in characters.

func (*View) SetInsertSpacesInsteadOfTabs

func (view *View) SetInsertSpacesInsteadOfTabs(enable bool)

SetInsertSpacesInsteadOfTabs: if TRUE a tab key pressed is replaced by a group of space characters. Of course it is still possible to insert a real \t programmatically with the TextBuffer API.

The function takes the following parameters:

  • enable: whether to insert spaces instead of tabs.

func (*View) SetMarkAttributes

func (view *View) SetMarkAttributes(category string, attributes *MarkAttributes, priority int)

SetMarkAttributes sets attributes and priority for the category.

The function takes the following parameters:

  • category: category.
  • attributes: mark attributes.
  • priority of the category.

func (*View) SetRightMarginPosition

func (view *View) SetRightMarginPosition(pos uint)

SetRightMarginPosition sets the position of the right margin in the given view.

The function takes the following parameters:

  • pos: width in characters where to position the right margin.

func (*View) SetShowLineMarks

func (view *View) SetShowLineMarks(show bool)

SetShowLineMarks: if TRUE line marks will be displayed beside the text.

The function takes the following parameters:

  • show: whether line marks should be displayed.

func (*View) SetShowLineNumbers

func (view *View) SetShowLineNumbers(show bool)

SetShowLineNumbers: if TRUE line numbers will be displayed beside the text.

The function takes the following parameters:

  • show: whether line numbers should be displayed.

func (*View) SetShowRightMargin

func (view *View) SetShowRightMargin(show bool)

SetShowRightMargin: if TRUE a right margin is displayed.

The function takes the following parameters:

  • show: whether to show a right margin.

func (*View) SetSmartBackspace

func (view *View) SetSmartBackspace(smartBackspace bool)

SetSmartBackspace: when set to TRUE, pressing the Backspace key will try to delete spaces up to the previous tab stop.

The function takes the following parameters:

  • smartBackspace: whether to enable smart Backspace handling.

func (*View) SetSmartHomeEnd

func (view *View) SetSmartHomeEnd(smartHomeEnd SmartHomeEndType)

SetSmartHomeEnd: set the desired movement of the cursor when HOME and END keys are pressed.

The function takes the following parameters:

  • smartHomeEnd: desired behavior among SourceSmartHomeEndType.

func (*View) SetTabWidth

func (view *View) SetTabWidth(width uint)

SetTabWidth sets the width of tabulation in characters. The TextBuffer still contains \t characters, but they can take a different visual width in a SourceView widget.

The function takes the following parameters:

  • width of tab in characters.

func (*View) ShowLineMarks

func (view *View) ShowLineMarks() bool

ShowLineMarks returns whether line marks are displayed beside the text.

The function returns the following values:

  • ok: TRUE if the line marks are displayed.

func (*View) ShowLineNumbers

func (view *View) ShowLineNumbers() bool

ShowLineNumbers returns whether line numbers are displayed beside the text.

The function returns the following values:

  • ok: TRUE if the line numbers are displayed.

func (*View) ShowRightMargin

func (view *View) ShowRightMargin() bool

ShowRightMargin returns whether a right margin is displayed.

The function returns the following values:

  • ok: TRUE if the right margin is shown.

func (*View) SmartBackspace

func (view *View) SmartBackspace() bool

SmartBackspace returns TRUE if pressing the Backspace key will try to delete spaces up to the previous tab stop.

The function returns the following values:

  • ok: TRUE if smart Backspace handling is enabled.

func (*View) SmartHomeEnd

func (view *View) SmartHomeEnd() SmartHomeEndType

SmartHomeEnd returns a SourceSmartHomeEndType end value specifying how the cursor will move when HOME and END keys are pressed.

The function returns the following values:

  • smartHomeEndType: SourceSmartHomeEndType value.

func (*View) SpaceDrawer

func (view *View) SpaceDrawer() *SpaceDrawer

SpaceDrawer gets the SourceSpaceDrawer associated with view. The returned object is guaranteed to be the same for the lifetime of view. Each SourceView object has a different SourceSpaceDrawer.

The function returns the following values:

  • spaceDrawer associated with view.

func (*View) TabWidth

func (view *View) TabWidth() uint

TabWidth returns the width of tabulation in characters.

The function returns the following values:

  • guint: width of tab.

func (*View) UnindentLines

func (view *View) UnindentLines(start, end *gtk.TextIter)

UnindentLines removes one indentation level at the beginning of the specified lines.

The function takes the following parameters:

  • start of the first line to indent.
  • end of the last line to indent.

func (*View) VisualColumn

func (view *View) VisualColumn(iter *gtk.TextIter) uint

VisualColumn determines the visual column at iter taking into consideration the SourceView:tab-width of view.

The function takes the following parameters:

  • iter: position in view.

The function returns the following values:

  • guint: visual column at iter.

type ViewClass

type ViewClass struct {
	// contains filtered or unexported fields
}

ViewClass: instance of this type is always passed by reference.

func (*ViewClass) ParentClass

func (v *ViewClass) ParentClass() *gtk.TextViewClass

type ViewGutterPosition

type ViewGutterPosition C.gint
const (
	// SourceViewGutterPositionLines: gutter position of the lines renderer.
	SourceViewGutterPositionLines ViewGutterPosition = -30
	// SourceViewGutterPositionMarks: gutter position of the marks renderer.
	SourceViewGutterPositionMarks ViewGutterPosition = -20
)

func (ViewGutterPosition) String

func (v ViewGutterPosition) String() string

String returns the name in string for ViewGutterPosition.

type ViewOverrides

type ViewOverrides struct {
	// The function takes the following parameters:
	//
	//   - iter
	//   - event
	//
	LineMarkActivated func(iter *gtk.TextIter, event *gdk.Event)
	// The function takes the following parameters:
	//
	//   - copy
	//   - step
	//
	MoveLines func(copy bool, step int)
	// The function takes the following parameters:
	//
	MoveWords      func(step int)
	Redo           func()
	ShowCompletion func()
	Undo           func()
}

ViewOverrides contains methods that are overridable.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL