///
///
///
///
///
///
///
///
///
///
///
///
///
///
/**
* Type Definitions for Gjs (https://gjs.guide/)
*
* These type definitions are automatically generated, do not edit them by hand.
* If you found a bug fix it in `ts-for-gir` or create a bug report on https://github.com/gjsify/ts-for-gir
*
* The based EJS template file is used for the generated .d.ts file of each GIR module like Gtk-4.0, GObject-2.0, ...
*/
declare module 'gi://GtkSource?version=4' {
// Module dependencies
import type Gtk from 'gi://Gtk?version=3.0';
import type xlib from 'gi://xlib?version=2.0';
import type Gdk from 'gi://Gdk?version=3.0';
import type cairo from 'cairo';
import type GObject from 'gi://GObject?version=2.0';
import type GLib from 'gi://GLib?version=2.0';
import type Pango from 'gi://Pango?version=1.0';
import type HarfBuzz from 'gi://HarfBuzz?version=0.0';
import type freetype2 from 'gi://freetype2?version=2.0';
import type Gio from 'gi://Gio?version=2.0';
import type GModule from 'gi://GModule?version=2.0';
import type GdkPixbuf from 'gi://GdkPixbuf?version=2.0';
import type Atk from 'gi://Atk?version=1.0';
export namespace GtkSource {
/**
* GtkSource-4
*/
export namespace BackgroundPatternType {
export const $gtype: GObject.GType;
}
enum BackgroundPatternType {
/**
* no pattern
*/
NONE,
/**
* grid pattern
*/
GRID,
}
export namespace BracketMatchType {
export const $gtype: GObject.GType;
}
enum BracketMatchType {
/**
* there is no bracket to match.
*/
NONE,
/**
* matching a bracket
* failed because the maximum range was reached.
*/
OUT_OF_RANGE,
/**
* a matching bracket was not found.
*/
NOT_FOUND,
/**
* a matching bracket was found.
*/
FOUND,
}
export namespace ChangeCaseType {
export const $gtype: GObject.GType;
}
enum ChangeCaseType {
/**
* change case to lowercase.
*/
LOWER,
/**
* change case to uppercase.
*/
UPPER,
/**
* toggle case of each character.
*/
TOGGLE,
/**
* capitalize each word.
*/
TITLE,
}
/**
* An error code used with %GTK_SOURCE_COMPLETION_ERROR in a #GError returned
* from a completion-related function.
*/
class CompletionError extends GLib.Error {
static $gtype: GObject.GType;
// Static fields
/**
* The #GtkSourceCompletionProvider
* is already bound to the #GtkSourceCompletion object.
*/
static ALREADY_BOUND: number;
/**
* The #GtkSourceCompletionProvider is
* not bound to the #GtkSourceCompletion object.
*/
static NOT_BOUND: number;
// Constructors
constructor(options: { message: string; code: number });
_init(...args: any[]): void;
// Static methods
static quark(): GLib.Quark;
}
export namespace CompressionType {
export const $gtype: GObject.GType;
}
enum CompressionType {
/**
* plain text.
*/
NONE,
/**
* gzip compression.
*/
GZIP,
}
/**
* An error code used with the %GTK_SOURCE_FILE_LOADER_ERROR domain.
*/
class FileLoaderError extends GLib.Error {
static $gtype: GObject.GType;
// Static fields
/**
* The file is too big.
*/
static TOO_BIG: number;
/**
* It is not
* possible to detect the encoding automatically.
*/
static ENCODING_AUTO_DETECTION_FAILED: number;
/**
* There was an encoding
* conversion error and it was needed to use a fallback character.
*/
static CONVERSION_FALLBACK: number;
// Constructors
constructor(options: { message: string; code: number });
_init(...args: any[]): void;
// Static methods
static quark(): GLib.Quark;
}
/**
* An error code used with the %GTK_SOURCE_FILE_SAVER_ERROR domain.
*/
class FileSaverError extends GLib.Error {
static $gtype: GObject.GType;
// Static fields
/**
* The buffer contains invalid
* characters.
*/
static INVALID_CHARS: number;
/**
* The file is externally
* modified.
*/
static EXTERNALLY_MODIFIED: number;
// Constructors
constructor(options: { message: string; code: number });
_init(...args: any[]): void;
// Static methods
static quark(): GLib.Quark;
}
/**
* The alignment mode of the renderer, when a cell spans multiple lines (due to
* text wrapping).
*/
/**
* The alignment mode of the renderer, when a cell spans multiple lines (due to
* text wrapping).
*/
export namespace GutterRendererAlignmentMode {
export const $gtype: GObject.GType;
}
enum GutterRendererAlignmentMode {
/**
* The full cell.
*/
CELL,
/**
* The first line.
*/
FIRST,
/**
* The last line.
*/
LAST,
}
export namespace NewlineType {
export const $gtype: GObject.GType;
}
enum NewlineType {
/**
* line feed, used on UNIX.
*/
LF,
/**
* carriage return, used on Mac.
*/
CR,
/**
* carriage return followed by a line feed, used
* on Windows.
*/
CR_LF,
}
export namespace SmartHomeEndType {
export const $gtype: GObject.GType;
}
enum SmartHomeEndType {
/**
* smart-home-end disabled.
*/
DISABLED,
/**
* 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.
*/
BEFORE,
/**
* 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.
*/
AFTER,
/**
* always move to the first/last
* non-whitespace character when the HOME/END keys are pressed.
*/
ALWAYS,
}
export namespace ViewGutterPosition {
export const $gtype: GObject.GType;
}
enum ViewGutterPosition {
/**
* the gutter position of the lines
* renderer
*/
LINES,
/**
* the gutter position of the marks
* renderer
*/
MARKS,
}
function completion_error_quark(): GLib.Quark;
/**
* Gets all encodings.
* @returns a list of all #GtkSourceEncoding's. Free with g_slist_free().
*/
function encoding_get_all(): Encoding[];
/**
* Gets the #GtkSourceEncoding for the current locale. See also g_get_charset().
* @returns the current locale encoding.
*/
function encoding_get_current(): Encoding;
/**
* 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.
* @returns the list of default candidate encodings. Free with g_slist_free().
*/
function encoding_get_default_candidates(): Encoding[];
/**
* Gets a #GtkSourceEncoding from a character set such as "UTF-8" or
* "ISO-8859-1".
* @param charset a character set.
* @returns the corresponding #GtkSourceEncoding, or %NULL if not found.
*/
function encoding_get_from_charset(charset: string): Encoding | null;
function encoding_get_utf8(): Encoding;
function file_loader_error_quark(): GLib.Quark;
function file_saver_error_quark(): GLib.Quark;
/**
* Free the resources allocated by GtkSourceView. For example it unrefs the
* singleton objects.
*
* It is not mandatory to call this function, it's just to be friendlier to
* memory debugging tools. This function is meant to be called at the end of
* main(). It can be called several times.
*/
function finalize(): void;
/**
* Initializes the GtkSourceView library (e.g. for the internationalization).
*
* This function can be called several times, but is meant to be called at the
* beginning of main(), before any other GtkSourceView function call.
*/
function init(): void;
/**
* 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 #GtkTextBuffer'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: 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.
*
* @param text the text to escape.
* @returns the escaped @text.
*/
function utils_escape_search_text(text: string): string;
/**
* 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().
* @param text the text to unescape.
* @returns the unescaped @text.
*/
function utils_unescape_search_text(text: string): string;
export namespace CompletionActivation {
export const $gtype: GObject.GType;
}
enum CompletionActivation {
/**
* None.
*/
NONE,
/**
* Interactive activation. By
* default, it occurs on each insertion in the #GtkTextBuffer. This can be
* blocked temporarily with gtk_source_completion_block_interactive().
*/
INTERACTIVE,
/**
* User requested activation.
* By default, it occurs when the user presses
* Controlspace.
*/
USER_REQUESTED,
}
/**
* Flags to define the behavior of a #GtkSourceFileSaver.
*/
/**
* Flags to define the behavior of a #GtkSourceFileSaver.
*/
export namespace FileSaverFlags {
export const $gtype: GObject.GType;
}
enum FileSaverFlags {
/**
* No flags.
*/
NONE,
/**
* Ignore invalid characters.
*/
IGNORE_INVALID_CHARS,
/**
* Save file despite external modifications.
*/
IGNORE_MODIFICATION_TIME,
/**
* Create a backup before saving the file.
*/
CREATE_BACKUP,
}
export namespace GutterRendererState {
export const $gtype: GObject.GType;
}
enum GutterRendererState {
/**
* normal state
*/
NORMAL,
/**
* area in the renderer represents the
* line on which the insert cursor is currently positioned
*/
CURSOR,
/**
* the mouse pointer is currently
* over the activatable area of the renderer
*/
PRELIT,
/**
* area in the renderer represents
* a line in the buffer which contains part of the selection
*/
SELECTED,
}
export namespace SortFlags {
export const $gtype: GObject.GType;
}
enum SortFlags {
/**
* no flags specified
*/
NONE,
/**
* case sensitive sort
*/
CASE_SENSITIVE,
/**
* sort in reverse order
*/
REVERSE_ORDER,
/**
* remove duplicates
*/
REMOVE_DUPLICATES,
}
/**
* #GtkSourceSpaceLocationFlags 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.
*/
/**
* #GtkSourceSpaceLocationFlags 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.
*/
export namespace SpaceLocationFlags {
export const $gtype: GObject.GType;
}
enum SpaceLocationFlags {
/**
* No flags.
*/
NONE,
/**
* Leading white spaces on a line, i.e. the
* indentation.
*/
LEADING,
/**
* White spaces inside a line of text.
*/
INSIDE_TEXT,
/**
* Trailing white spaces on a line.
*/
TRAILING,
/**
* White spaces anywhere.
*/
ALL,
}
/**
* #GtkSourceSpaceTypeFlags contains flags for white space types.
*/
/**
* #GtkSourceSpaceTypeFlags contains flags for white space types.
*/
export namespace SpaceTypeFlags {
export const $gtype: GObject.GType;
}
enum SpaceTypeFlags {
/**
* No flags.
*/
NONE,
/**
* Space character.
*/
SPACE,
/**
* Tab character.
*/
TAB,
/**
* Line break character. If the
* #GtkSourceBuffer:implicit-trailing-newline property is %TRUE,
* #GtkSourceSpaceDrawer also draws a line break at the end of the buffer.
*/
NEWLINE,
/**
* Non-breaking space character.
*/
NBSP,
/**
* All white spaces.
*/
ALL,
}
namespace Buffer {
// Signal callback interfaces
interface BracketMatched {
(iter: Gtk.TextIter | null, state: BracketMatchType): void;
}
interface HighlightUpdated {
(start: Gtk.TextIter, end: Gtk.TextIter): void;
}
interface Redo {
(): void;
}
interface SourceMarkUpdated {
(mark: Gtk.TextMark): void;
}
interface Undo {
(): void;
}
// Constructor properties interface
interface ConstructorProps extends Gtk.TextBuffer.ConstructorProps {
can_redo: boolean;
canRedo: boolean;
can_undo: boolean;
canUndo: boolean;
highlight_matching_brackets: boolean;
highlightMatchingBrackets: boolean;
highlight_syntax: boolean;
highlightSyntax: boolean;
implicit_trailing_newline: boolean;
implicitTrailingNewline: boolean;
language: Language;
max_undo_levels: number;
maxUndoLevels: number;
style_scheme: StyleScheme;
styleScheme: StyleScheme;
undo_manager: UndoManager;
undoManager: UndoManager;
}
}
class Buffer extends Gtk.TextBuffer {
static $gtype: GObject.GType;
// Properties
get can_redo(): boolean;
get canRedo(): boolean;
get can_undo(): boolean;
get canUndo(): boolean;
/**
* Whether to highlight matching brackets in the buffer.
*/
get highlight_matching_brackets(): boolean;
set highlight_matching_brackets(val: boolean);
/**
* Whether to highlight matching brackets in the buffer.
*/
get highlightMatchingBrackets(): boolean;
set highlightMatchingBrackets(val: boolean);
/**
* Whether to highlight syntax in the buffer.
*/
get highlight_syntax(): boolean;
set highlight_syntax(val: boolean);
/**
* Whether to highlight syntax in the buffer.
*/
get highlightSyntax(): boolean;
set highlightSyntax(val: boolean);
/**
* Whether the buffer has an implicit trailing newline. See
* gtk_source_buffer_set_implicit_trailing_newline().
*/
get implicit_trailing_newline(): boolean;
set implicit_trailing_newline(val: boolean);
/**
* Whether the buffer has an implicit trailing newline. See
* gtk_source_buffer_set_implicit_trailing_newline().
*/
get implicitTrailingNewline(): boolean;
set implicitTrailingNewline(val: boolean);
get language(): Language;
set language(val: Language);
/**
* Number of undo levels for the buffer. -1 means no limit. This property
* will only affect the default undo manager.
*/
get max_undo_levels(): number;
set max_undo_levels(val: number);
/**
* Number of undo levels for the buffer. -1 means no limit. This property
* will only affect the default undo manager.
*/
get maxUndoLevels(): number;
set maxUndoLevels(val: number);
/**
* Style scheme. It contains styles for syntax highlighting, optionally
* foreground, background, cursor color, current line color, and matching
* brackets style.
*/
get style_scheme(): StyleScheme;
set style_scheme(val: StyleScheme);
/**
* Style scheme. It contains styles for syntax highlighting, optionally
* foreground, background, cursor color, current line color, and matching
* brackets style.
*/
get styleScheme(): StyleScheme;
set styleScheme(val: StyleScheme);
get undo_manager(): UndoManager;
set undo_manager(val: UndoManager);
get undoManager(): UndoManager;
set undoManager(val: UndoManager);
// Constructors
constructor(properties?: Partial, ...args: any[]);
_init(...args: any[]): void;
static ['new'](table?: Gtk.TextTagTable | null): Buffer;
static new_with_language(language: Language): Buffer;
// Signals
connect(id: string, callback: (...args: any[]) => any): number;
connect_after(id: string, callback: (...args: any[]) => any): number;
emit(id: string, ...args: any[]): void;
connect(
signal: 'bracket-matched',
callback: (_source: this, iter: Gtk.TextIter | null, state: BracketMatchType) => void,
): number;
connect_after(
signal: 'bracket-matched',
callback: (_source: this, iter: Gtk.TextIter | null, state: BracketMatchType) => void,
): number;
emit(signal: 'bracket-matched', iter: Gtk.TextIter | null, state: BracketMatchType): void;
connect(
signal: 'highlight-updated',
callback: (_source: this, start: Gtk.TextIter, end: Gtk.TextIter) => void,
): number;
connect_after(
signal: 'highlight-updated',
callback: (_source: this, start: Gtk.TextIter, end: Gtk.TextIter) => void,
): number;
emit(signal: 'highlight-updated', start: Gtk.TextIter, end: Gtk.TextIter): void;
connect(signal: 'redo', callback: (_source: this) => void): number;
connect_after(signal: 'redo', callback: (_source: this) => void): number;
emit(signal: 'redo'): void;
connect(signal: 'source-mark-updated', callback: (_source: this, mark: Gtk.TextMark) => void): number;
connect_after(signal: 'source-mark-updated', callback: (_source: this, mark: Gtk.TextMark) => void): number;
emit(signal: 'source-mark-updated', mark: Gtk.TextMark): void;
connect(signal: 'undo', callback: (_source: this) => void): number;
connect_after(signal: 'undo', callback: (_source: this) => void): number;
emit(signal: 'undo'): void;
// Virtual methods
vfunc_bracket_matched(iter: Gtk.TextIter, state: BracketMatchType): void;
/**
* 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 #GtkSourceBuffer::redo signal.
*/
vfunc_redo(): void;
/**
* 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 #GtkSourceBuffer::undo signal.
*/
vfunc_undo(): void;
// Methods
/**
* Moves `iter` to the position of the previous #GtkSourceMark of the given
* category. Returns %TRUE if `iter` was moved. If `category` is NULL, the
* previous source mark can be of any category.
* @param iter an iterator.
* @param category category to search for, or %NULL
* @returns whether @iter was moved.
*/
backward_iter_to_source_mark(iter: Gtk.TextIter, category?: string | null): [boolean, Gtk.TextIter];
/**
* 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.
*/
begin_not_undoable_action(): void;
/**
* Changes the case of the text between the specified iterators.
* @param case_type how to change the case.
* @param start a #GtkTextIter.
* @param end a #GtkTextIter.
*/
change_case(case_type: ChangeCaseType | null, start: Gtk.TextIter, end: Gtk.TextIter): void;
/**
* Creates a source mark in the `buffer` of category `category`. A source mark is
* a #GtkTextMark 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 #GtkTextMark, a #GtkSourceMark 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..
* @param name the name of the mark, or %NULL.
* @param category a string defining the mark category.
* @param where location to place the mark.
* @returns a new #GtkSourceMark, owned by the buffer.
*/
create_source_mark(name: string | null, category: string, where: Gtk.TextIter): Mark;
/**
* 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.
*/
end_not_undoable_action(): void;
/**
* Forces buffer to analyze and highlight the given area synchronously.
*
*
*
* 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.
*
*
* @param start start of the area to highlight.
* @param end end of the area to highlight.
*/
ensure_highlight(start: Gtk.TextIter, end: Gtk.TextIter): void;
/**
* Moves `iter` to the position of the next #GtkSourceMark of the given
* `category`. Returns %TRUE if `iter` was moved. If `category` is NULL, the
* next source mark can be of any category.
* @param iter an iterator.
* @param category category to search for, or %NULL
* @returns whether @iter was moved.
*/
forward_iter_to_source_mark(iter: Gtk.TextIter, category?: string | null): [boolean, Gtk.TextIter];
/**
* Get all defined context classes at `iter`.
*
* See the #GtkSourceBuffer description for the list of default context classes.
* @param iter a #GtkTextIter.
* @returns a new %NULL terminated array of context class names. Use g_strfreev() to free the array if it is no longer needed.
*/
get_context_classes_at_iter(iter: Gtk.TextIter): string[];
/**
* Determines whether bracket match highlighting is activated for the
* source buffer.
* @returns %TRUE if the source buffer will highlight matching brackets.
*/
get_highlight_matching_brackets(): boolean;
/**
* Determines whether syntax highlighting is activated in the source
* buffer.
* @returns %TRUE if syntax highlighting is enabled, %FALSE otherwise.
*/
get_highlight_syntax(): boolean;
get_implicit_trailing_newline(): boolean;
/**
* Returns the #GtkSourceLanguage associated with the buffer,
* see gtk_source_buffer_set_language(). The returned object should not be
* unreferenced by the user.
* @returns the #GtkSourceLanguage associated with the buffer, or %NULL.
*/
get_language(): Language | null;
/**
* Determines the number of undo levels the buffer will track for buffer edits.
* @returns the maximum number of possible undo levels or -1 if no limit is set.
*/
get_max_undo_levels(): number;
/**
* Returns the list of marks of the given category at `iter`. If `category`
* is %NULL it returns all marks at `iter`.
* @param iter an iterator.
* @param category category to search for, or %NULL
* @returns a newly allocated #GSList.
*/
get_source_marks_at_iter(iter: Gtk.TextIter, category?: string | null): Mark[];
/**
* Returns the list of marks of the given category at `line`.
* If `category` is %NULL, all marks at `line` are returned.
* @param line a line number.
* @param category category to search for, or %NULL
* @returns a newly allocated #GSList.
*/
get_source_marks_at_line(line: number, category?: string | null): Mark[];
/**
* Returns the #GtkSourceStyleScheme associated with the buffer,
* see gtk_source_buffer_set_style_scheme().
* The returned object should not be unreferenced by the user.
* @returns the #GtkSourceStyleScheme associated with the buffer, or %NULL.
*/
get_style_scheme(): StyleScheme | null;
/**
* Returns the #GtkSourceUndoManager associated with the buffer,
* see gtk_source_buffer_set_undo_manager(). The returned object should not be
* unreferenced by the user.
* @returns the #GtkSourceUndoManager associated with the buffer, or %NULL.
*/
get_undo_manager(): UndoManager | null;
/**
* 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 #GtkSourceBuffer description for the list of default context classes.
* @param iter a #GtkTextIter.
* @param context_class the context class.
* @returns whether we found a context class toggle before @iter
*/
iter_backward_to_context_class_toggle(iter: Gtk.TextIter, context_class: string): [boolean, Gtk.TextIter];
/**
* 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 #GtkSourceBuffer description for the list of default context classes.
* @param iter a #GtkTextIter.
* @param context_class the context class.
* @returns whether we found a context class toggle after @iter
*/
iter_forward_to_context_class_toggle(iter: Gtk.TextIter, context_class: string): [boolean, Gtk.TextIter];
/**
* Check if the class `context_class` is set on `iter`.
*
* See the #GtkSourceBuffer description for the list of default context classes.
* @param iter a #GtkTextIter.
* @param context_class class to search for.
* @returns whether @iter has the context class.
*/
iter_has_context_class(iter: Gtk.TextIter, context_class: string): boolean;
/**
* Joins the lines of text between the specified iterators.
* @param start a #GtkTextIter.
* @param end a #GtkTextIter.
*/
join_lines(start: Gtk.TextIter, end: Gtk.TextIter): void;
/**
* 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 #GtkSourceBuffer::redo signal.
*/
redo(): void;
/**
* Remove all marks of `category` between `start` and `end` from the buffer.
* If `category` is NULL, all marks in the range will be removed.
* @param start a #GtkTextIter.
* @param end a #GtkTextIter.
* @param category category to search for, or %NULL.
*/
remove_source_marks(start: Gtk.TextIter, end: Gtk.TextIter, category?: string | null): void;
/**
* 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.
* @param highlight %TRUE if you want matching brackets highlighted.
*/
set_highlight_matching_brackets(highlight: boolean): void;
/**
* 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 #GtkSourceLanguage set with
* gtk_source_buffer_set_language().
*
* If `highlight` is %FALSE, syntax highlighting is disabled and all the
* #GtkTextTag objects that have been added by the syntax highlighting engine
* are removed from the buffer.
* @param highlight %TRUE to enable syntax highlighting, %FALSE to disable it.
*/
set_highlight_syntax(highlight: boolean): void;
/**
* Sets whether the `buffer` has an implicit trailing newline.
*
* If an explicit trailing newline is present in a #GtkTextBuffer, #GtkTextView
* 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 #GtkSourceFileLoader 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 #GtkSourceFileSaver 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.
* @param implicit_trailing_newline the new value.
*/
set_implicit_trailing_newline(implicit_trailing_newline: boolean): void;
/**
* Associates a #GtkSourceLanguage with the buffer.
*
* Note that a #GtkSourceLanguage 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`.
* @param language a #GtkSourceLanguage to set, or %NULL.
*/
set_language(language?: Language | null): void;
/**
* 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.
* @param max_undo_levels the desired maximum number of undo levels.
*/
set_max_undo_levels(max_undo_levels: number): void;
/**
* Sets a #GtkSourceStyleScheme to be used by the buffer and the view.
*
* Note that a #GtkSourceStyleScheme affects not only the syntax highlighting,
* but also other #GtkSourceView 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
* #GtkSourceStyleScheme 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`.
* @param scheme a #GtkSourceStyleScheme or %NULL.
*/
set_style_scheme(scheme?: StyleScheme | null): void;
/**
* Set the buffer undo manager. If `manager` is %NULL the default undo manager
* will be set.
* @param manager A #GtkSourceUndoManager or %NULL.
*/
set_undo_manager(manager?: UndoManager | null): void;
/**
* Sort the lines of text between the specified iterators.
* @param start a #GtkTextIter.
* @param end a #GtkTextIter.
* @param flags #GtkSourceSortFlags specifying how the sort should behave
* @param column sort considering the text starting at the given column
*/
sort_lines(start: Gtk.TextIter, end: Gtk.TextIter, flags: SortFlags | null, column: number): void;
/**
* 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 #GtkSourceBuffer::undo signal.
*/
undo(): void;
}
namespace Completion {
// Signal callback interfaces
interface ActivateProposal {
(): void;
}
interface Hide {
(): void;
}
interface MoveCursor {
(step: Gtk.ScrollStep, num: number): void;
}
interface MovePage {
(step: Gtk.ScrollStep, num: number): void;
}
interface PopulateContext {
(context: CompletionContext): void;
}
interface Show {
(): void;
}
// Constructor properties interface
interface ConstructorProps extends GObject.Object.ConstructorProps, Gtk.Buildable.ConstructorProps {
accelerators: number;
auto_complete_delay: number;
autoCompleteDelay: number;
proposal_page_size: number;
proposalPageSize: number;
provider_page_size: number;
providerPageSize: number;
remember_info_visibility: boolean;
rememberInfoVisibility: boolean;
select_on_show: boolean;
selectOnShow: boolean;
show_headers: boolean;
showHeaders: boolean;
show_icons: boolean;
showIcons: boolean;
view: View;
}
}
class Completion extends GObject.Object implements Gtk.Buildable {
static $gtype: GObject.GType;
// Properties
/**
* Number of keyboard accelerators to show for the first proposals. For
* example, to activate the first proposal, the user can press
* Alt1.
*/
get accelerators(): number;
set accelerators(val: number);
/**
* Determines the popup delay (in milliseconds) at which the completion
* will be shown for interactive completion.
*/
get auto_complete_delay(): number;
set auto_complete_delay(val: number);
/**
* Determines the popup delay (in milliseconds) at which the completion
* will be shown for interactive completion.
*/
get autoCompleteDelay(): number;
set autoCompleteDelay(val: number);
/**
* The scroll page size of the proposals in the completion window. In
* other words, when PageDown or
* PageUp is pressed, the selected
* proposal becomes the one which is located one page size backward or
* forward.
*
* See also the #GtkSourceCompletion::move-cursor signal.
*/
get proposal_page_size(): number;
set proposal_page_size(val: number);
/**
* The scroll page size of the proposals in the completion window. In
* other words, when PageDown or
* PageUp is pressed, the selected
* proposal becomes the one which is located one page size backward or
* forward.
*
* See also the #GtkSourceCompletion::move-cursor signal.
*/
get proposalPageSize(): number;
set proposalPageSize(val: number);
/**
* The scroll page size of the provider pages in the completion window.
*
* See the #GtkSourceCompletion::move-page signal.
*/
get provider_page_size(): number;
set provider_page_size(val: number);
/**
* The scroll page size of the provider pages in the completion window.
*
* See the #GtkSourceCompletion::move-page signal.
*/
get providerPageSize(): number;
set providerPageSize(val: number);
/**
* Determines whether the visibility of the info window should be
* saved when the completion is hidden, and restored when the completion
* is shown again.
*/
get remember_info_visibility(): boolean;
set remember_info_visibility(val: boolean);
/**
* Determines whether the visibility of the info window should be
* saved when the completion is hidden, and restored when the completion
* is shown again.
*/
get rememberInfoVisibility(): boolean;
set rememberInfoVisibility(val: boolean);
/**
* Determines whether the first proposal should be selected when the
* completion is first shown.
*/
get select_on_show(): boolean;
set select_on_show(val: boolean);
/**
* Determines whether the first proposal should be selected when the
* completion is first shown.
*/
get selectOnShow(): boolean;
set selectOnShow(val: boolean);
/**
* Determines whether provider headers should be shown in the proposal
* list. It can be useful to disable when there is only one provider.
*/
get show_headers(): boolean;
set show_headers(val: boolean);
/**
* Determines whether provider headers should be shown in the proposal
* list. It can be useful to disable when there is only one provider.
*/
get showHeaders(): boolean;
set showHeaders(val: boolean);
/**
* Determines whether provider and proposal icons should be shown in
* the completion popup.
*/
get show_icons(): boolean;
set show_icons(val: boolean);
/**
* Determines whether provider and proposal icons should be shown in
* the completion popup.
*/
get showIcons(): boolean;
set showIcons(val: boolean);
/**
* The #GtkSourceView bound to the completion object.
*/
get view(): View;
// Constructors
constructor(properties?: Partial, ...args: any[]);
_init(...args: any[]): void;
// Signals
connect(id: string, callback: (...args: any[]) => any): number;
connect_after(id: string, callback: (...args: any[]) => any): number;
emit(id: string, ...args: any[]): void;
connect(signal: 'activate-proposal', callback: (_source: this) => void): number;
connect_after(signal: 'activate-proposal', callback: (_source: this) => void): number;
emit(signal: 'activate-proposal'): void;
connect(signal: 'hide', callback: (_source: this) => void): number;
connect_after(signal: 'hide', callback: (_source: this) => void): number;
emit(signal: 'hide'): void;
connect(
signal: 'move-cursor',
callback: (_source: this, step: Gtk.ScrollStep, num: number) => void,
): number;
connect_after(
signal: 'move-cursor',
callback: (_source: this, step: Gtk.ScrollStep, num: number) => void,
): number;
emit(signal: 'move-cursor', step: Gtk.ScrollStep, num: number): void;
connect(signal: 'move-page', callback: (_source: this, step: Gtk.ScrollStep, num: number) => void): number;
connect_after(
signal: 'move-page',
callback: (_source: this, step: Gtk.ScrollStep, num: number) => void,
): number;
emit(signal: 'move-page', step: Gtk.ScrollStep, num: number): void;
connect(signal: 'populate-context', callback: (_source: this, context: CompletionContext) => void): number;
connect_after(
signal: 'populate-context',
callback: (_source: this, context: CompletionContext) => void,
): number;
emit(signal: 'populate-context', context: CompletionContext): void;
connect(signal: 'show', callback: (_source: this) => void): number;
connect_after(signal: 'show', callback: (_source: this) => void): number;
emit(signal: 'show'): void;
// Virtual methods
vfunc_activate_proposal(): void;
/**
* Hides the completion if it is active (visible).
*/
vfunc_hide(): void;
vfunc_move_cursor(step: Gtk.ScrollStep, num: number): void;
vfunc_move_page(step: Gtk.ScrollStep, num: number): void;
vfunc_populate_context(context: CompletionContext): void;
vfunc_proposal_activated(provider: CompletionProvider, proposal: CompletionProposal): boolean;
vfunc_show(): void;
// Methods
/**
* Add a new #GtkSourceCompletionProvider to the completion object. This will
* add a reference `provider,` so make sure to unref your own copy when you
* no longer need it.
* @param provider a #GtkSourceCompletionProvider.
* @returns %TRUE if @provider was successfully added, otherwise if @error is provided, it will be set with the error and %FALSE is returned.
*/
add_provider(provider: CompletionProvider): boolean;
/**
* 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.
*/
block_interactive(): void;
/**
* Create a new #GtkSourceCompletionContext for `completion`. The position where
* the completion occurs can be specified by `position`. If `position` is %NULL,
* the current cursor position will be used.
* @param position a #GtkTextIter, or %NULL.
* @returns a new #GtkSourceCompletionContext. The reference being returned is a 'floating' reference, so if you invoke gtk_source_completion_start() with this context you don't need to unref it.
*/
create_context(position?: Gtk.TextIter | null): CompletionContext;
/**
* The info widget is the window where the completion displays optional extra
* information of the proposal.
* @returns The #GtkSourceCompletionInfo window associated with @completion.
*/
get_info_window(): CompletionInfo;
/**
* Get list of providers registered on `completion`. The returned list is owned
* by the completion and should not be freed.
* @returns list of #GtkSourceCompletionProvider.
*/
get_providers(): CompletionProvider[];
/**
* The #GtkSourceView associated with `completion,` or %NULL if the view has been
* destroyed.
* @returns The #GtkSourceView associated with @completion, or %NULL.
*/
get_view(): View | null;
/**
* Hides the completion if it is active (visible).
*/
hide(): void;
/**
* Remove `provider` from the completion.
* @param provider a #GtkSourceCompletionProvider.
* @returns %TRUE if @provider was successfully removed, otherwise if @error is provided, it will be set with the error and %FALSE is returned.
*/
remove_provider(provider: CompletionProvider): boolean;
/**
* Starts a new completion with the specified #GtkSourceCompletionContext 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 #GtkSourceCompletion.
*
* Another solution is to add providers with
* gtk_source_completion_add_provider(), and implement
* gtk_source_completion_provider_match() for each provider.
* @param providers a list of #GtkSourceCompletionProvider, or %NULL.
* @param context The #GtkSourceCompletionContext with which to start the completion.
* @returns %TRUE if it was possible to the show completion window.
*/
start(providers: CompletionProvider[] | null, context: CompletionContext): boolean;
/**
* Unblock interactive completion. This can be used after using
* gtk_source_completion_block_interactive() to enable interactive completion
* again.
*/
unblock_interactive(): void;
// Inherited methods
/**
* Adds a child to `buildable`. `type` is an optional string
* describing how the child should be added.
* @param builder a #GtkBuilder
* @param child child to add
* @param type kind of child or %NULL
*/
add_child(builder: Gtk.Builder, child: GObject.Object, type?: string | null): void;
/**
* Constructs a child of `buildable` with the name `name`.
*
* #GtkBuilder calls this function if a “constructor” has been
* specified in the UI definition.
* @param builder #GtkBuilder used to construct this object
* @param name name of child to construct
* @returns the constructed child
*/
construct_child(builder: Gtk.Builder, name: string): T;
/**
* This is similar to gtk_buildable_parser_finished() but is
* called once for each custom tag handled by the `buildable`.
* @param builder a #GtkBuilder
* @param child child object or %NULL for non-child tags
* @param tagname the name of the tag
* @param data user data created in custom_tag_start
*/
custom_finished(
builder: Gtk.Builder,
child: GObject.Object | null,
tagname: string,
data?: any | null,
): void;
/**
* This is called at the end of each custom element handled by
* the buildable.
* @param builder #GtkBuilder used to construct this object
* @param child child object or %NULL for non-child tags
* @param tagname name of tag
* @param data user data that will be passed in to parser functions
*/
custom_tag_end(
builder: Gtk.Builder,
child: GObject.Object | null,
tagname: string,
data?: any | null,
): void;
/**
* This is called for each unknown element under ``.
* @param builder a #GtkBuilder used to construct this object
* @param child child object or %NULL for non-child tags
* @param tagname name of tag
* @returns %TRUE if a object has a custom implementation, %FALSE if it doesn't.
*/
custom_tag_start(
builder: Gtk.Builder,
child: GObject.Object | null,
tagname: string,
): [boolean, GLib.MarkupParser, any];
/**
* Get the internal child called `childname` of the `buildable` object.
* @param builder a #GtkBuilder
* @param childname name of child
* @returns the internal child of the buildable object
*/
get_internal_child(builder: Gtk.Builder, childname: string): T;
/**
* Gets the name of the `buildable` object.
*
* #GtkBuilder sets the name based on the
* [GtkBuilder UI definition][BUILDER-UI]
* used to construct the `buildable`.
* @returns the name set with gtk_buildable_set_name()
*/
get_name(): string;
/**
* Called when the builder finishes the parsing of a
* [GtkBuilder UI definition][BUILDER-UI].
* Note that this will be called once for each time
* gtk_builder_add_from_file() or gtk_builder_add_from_string()
* is called on a builder.
* @param builder a #GtkBuilder
*/
parser_finished(builder: Gtk.Builder): void;
/**
* Sets the property name `name` to `value` on the `buildable` object.
* @param builder a #GtkBuilder
* @param name name of property
* @param value value of property
*/
set_buildable_property(builder: Gtk.Builder, name: string, value: GObject.Value | any): void;
/**
* Sets the name of the `buildable` object.
* @param name name to set
*/
set_name(name: string): void;
/**
* Adds a child to `buildable`. `type` is an optional string
* describing how the child should be added.
* @param builder a #GtkBuilder
* @param child child to add
* @param type kind of child or %NULL
*/
vfunc_add_child(builder: Gtk.Builder, child: GObject.Object, type?: string | null): void;
/**
* Constructs a child of `buildable` with the name `name`.
*
* #GtkBuilder calls this function if a “constructor” has been
* specified in the UI definition.
* @param builder #GtkBuilder used to construct this object
* @param name name of child to construct
*/
vfunc_construct_child(builder: Gtk.Builder, name: string): T;
/**
* This is similar to gtk_buildable_parser_finished() but is
* called once for each custom tag handled by the `buildable`.
* @param builder a #GtkBuilder
* @param child child object or %NULL for non-child tags
* @param tagname the name of the tag
* @param data user data created in custom_tag_start
*/
vfunc_custom_finished(
builder: Gtk.Builder,
child: GObject.Object | null,
tagname: string,
data?: any | null,
): void;
/**
* This is called at the end of each custom element handled by
* the buildable.
* @param builder #GtkBuilder used to construct this object
* @param child child object or %NULL for non-child tags
* @param tagname name of tag
* @param data user data that will be passed in to parser functions
*/
vfunc_custom_tag_end(
builder: Gtk.Builder,
child: GObject.Object | null,
tagname: string,
data?: any | null,
): void;
/**
* This is called for each unknown element under ``.
* @param builder a #GtkBuilder used to construct this object
* @param child child object or %NULL for non-child tags
* @param tagname name of tag
*/
vfunc_custom_tag_start(
builder: Gtk.Builder,
child: GObject.Object | null,
tagname: string,
): [boolean, GLib.MarkupParser, any];
/**
* Get the internal child called `childname` of the `buildable` object.
* @param builder a #GtkBuilder
* @param childname name of child
*/
vfunc_get_internal_child(builder: Gtk.Builder, childname: string): T;
/**
* Gets the name of the `buildable` object.
*
* #GtkBuilder sets the name based on the
* [GtkBuilder UI definition][BUILDER-UI]
* used to construct the `buildable`.
*/
vfunc_get_name(): string;
/**
* Called when the builder finishes the parsing of a
* [GtkBuilder UI definition][BUILDER-UI].
* Note that this will be called once for each time
* gtk_builder_add_from_file() or gtk_builder_add_from_string()
* is called on a builder.
* @param builder a #GtkBuilder
*/
vfunc_parser_finished(builder: Gtk.Builder): void;
/**
* Sets the property name `name` to `value` on the `buildable` object.
* @param builder a #GtkBuilder
* @param name name of property
* @param value value of property
*/
vfunc_set_buildable_property(builder: Gtk.Builder, name: string, value: GObject.Value | any): void;
/**
* Sets the name of the `buildable` object.
* @param name name to set
*/
vfunc_set_name(name: string): void;
/**
* Creates a binding between `source_property` on `source` and `target_property`
* on `target`.
*
* Whenever the `source_property` is changed the `target_property` is
* updated using the same value. For instance:
*
*
* ```c
* g_object_bind_property (action, "active", widget, "sensitive", 0);
* ```
*
*
* Will result in the "sensitive" property of the widget #GObject instance to be
* updated with the same value of the "active" property of the action #GObject
* instance.
*
* If `flags` contains %G_BINDING_BIDIRECTIONAL then the binding will be mutual:
* if `target_property` on `target` changes then the `source_property` on `source`
* will be updated as well.
*
* The binding will automatically be removed when either the `source` or the
* `target` instances are finalized. To remove the binding without affecting the
* `source` and the `target` you can just call g_object_unref() on the returned
* #GBinding instance.
*
* Removing the binding by calling g_object_unref() on it must only be done if
* the binding, `source` and `target` are only used from a single thread and it
* is clear that both `source` and `target` outlive the binding. Especially it
* is not safe to rely on this if the binding, `source` or `target` can be
* finalized from different threads. Keep another reference to the binding and
* use g_binding_unbind() instead to be on the safe side.
*
* A #GObject can have multiple bindings.
* @param source_property the property on @source to bind
* @param target the target #GObject
* @param target_property the property on @target to bind
* @param flags flags to pass to #GBinding
* @returns the #GBinding instance representing the binding between the two #GObject instances. The binding is released whenever the #GBinding reference count reaches zero.
*/
bind_property(
source_property: string,
target: GObject.Object,
target_property: string,
flags: GObject.BindingFlags | null,
): GObject.Binding;
/**
* Complete version of g_object_bind_property().
*
* Creates a binding between `source_property` on `source` and `target_property`
* on `target,` allowing you to set the transformation functions to be used by
* the binding.
*
* If `flags` contains %G_BINDING_BIDIRECTIONAL then the binding will be mutual:
* if `target_property` on `target` changes then the `source_property` on `source`
* will be updated as well. The `transform_from` function is only used in case
* of bidirectional bindings, otherwise it will be ignored
*
* The binding will automatically be removed when either the `source` or the
* `target` instances are finalized. This will release the reference that is
* being held on the #GBinding instance; if you want to hold on to the
* #GBinding instance, you will need to hold a reference to it.
*
* To remove the binding, call g_binding_unbind().
*
* A #GObject can have multiple bindings.
*
* The same `user_data` parameter will be used for both `transform_to`
* and `transform_from` transformation functions; the `notify` function will
* be called once, when the binding is removed. If you need different data
* for each transformation function, please use
* g_object_bind_property_with_closures() instead.
* @param source_property the property on @source to bind
* @param target the target #GObject
* @param target_property the property on @target to bind
* @param flags flags to pass to #GBinding
* @param transform_to the transformation function from the @source to the @target, or %NULL to use the default
* @param transform_from the transformation function from the @target to the @source, or %NULL to use the default
* @param notify a function to call when disposing the binding, to free resources used by the transformation functions, or %NULL if not required
* @returns the #GBinding instance representing the binding between the two #GObject instances. The binding is released whenever the #GBinding reference count reaches zero.
*/
bind_property_full(
source_property: string,
target: GObject.Object,
target_property: string,
flags: GObject.BindingFlags | null,
transform_to?: GObject.BindingTransformFunc | null,
transform_from?: GObject.BindingTransformFunc | null,
notify?: GLib.DestroyNotify | null,
): GObject.Binding;
// Conflicted with GObject.Object.bind_property_full
bind_property_full(...args: never[]): any;
/**
* This function is intended for #GObject implementations to re-enforce
* a [floating][floating-ref] object reference. Doing this is seldom
* required: all #GInitiallyUnowneds are created with a floating reference
* which usually just needs to be sunken by calling g_object_ref_sink().
*/
force_floating(): void;
/**
* Increases the freeze count on `object`. If the freeze count is
* non-zero, the emission of "notify" signals on `object` is
* stopped. The signals are queued until the freeze count is decreased
* to zero. Duplicate notifications are squashed so that at most one
* #GObject::notify signal is emitted for each property modified while the
* object is frozen.
*
* This is necessary for accessors that modify multiple properties to prevent
* premature notification while the object is still being modified.
*/
freeze_notify(): void;
/**
* Gets a named field from the objects table of associations (see g_object_set_data()).
* @param key name of the key for that association
* @returns the data if found, or %NULL if no such data exists.
*/
get_data(key: string): any | null;
/**
* Gets a property of an object.
*
* The value can be:
* - an empty GObject.Value initialized by G_VALUE_INIT, which will be automatically initialized with the expected type of the property (since GLib 2.60)
* - a GObject.Value initialized with the expected type of the property
* - a GObject.Value initialized with a type to which the expected type of the property can be transformed
*
* In general, a copy is made of the property contents and the caller is responsible for freeing the memory by calling GObject.Value.unset.
*
* Note that GObject.Object.get_property is really intended for language bindings, GObject.Object.get is much more convenient for C programming.
* @param property_name The name of the property to get
* @param value Return location for the property value. Can be an empty GObject.Value initialized by G_VALUE_INIT (auto-initialized with expected type since GLib 2.60), a GObject.Value initialized with the expected property type, or a GObject.Value initialized with a transformable type
*/
get_property(property_name: string, value: GObject.Value | any): any;
/**
* This function gets back user data pointers stored via
* g_object_set_qdata().
* @param quark A #GQuark, naming the user data pointer
* @returns The user data pointer set, or %NULL
*/
get_qdata(quark: GLib.Quark): any | null;
/**
* Gets `n_properties` properties for an `object`.
* Obtained properties will be set to `values`. All properties must be valid.
* Warnings will be emitted and undefined behaviour may result if invalid
* properties are passed in.
* @param names the names of each property to get
* @param values the values of each property to get
*/
getv(names: string[], values: (GObject.Value | any)[]): void;
/**
* Checks whether `object` has a [floating][floating-ref] reference.
* @returns %TRUE if @object has a floating reference
*/
is_floating(): boolean;
/**
* Emits a "notify" signal for the property `property_name` on `object`.
*
* When possible, eg. when signaling a property change from within the class
* that registered the property, you should use g_object_notify_by_pspec()
* instead.
*
* Note that emission of the notify signal may be blocked with
* g_object_freeze_notify(). In this case, the signal emissions are queued
* and will be emitted (in reverse order) when g_object_thaw_notify() is
* called.
* @param property_name the name of a property installed on the class of @object.
*/
notify(property_name: string): void;
/**
* Emits a "notify" signal for the property specified by `pspec` on `object`.
*
* This function omits the property name lookup, hence it is faster than
* g_object_notify().
*
* One way to avoid using g_object_notify() from within the
* class that registered the properties, and using g_object_notify_by_pspec()
* instead, is to store the GParamSpec used with
* g_object_class_install_property() inside a static array, e.g.:
*
*
* ```c
* typedef enum
* {
* PROP_FOO = 1,
* PROP_LAST
* } MyObjectProperty;
*
* static GParamSpec *properties[PROP_LAST];
*
* static void
* my_object_class_init (MyObjectClass *klass)
* {
* properties[PROP_FOO] = g_param_spec_int ("foo", NULL, NULL,
* 0, 100,
* 50,
* G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
* g_object_class_install_property (gobject_class,
* PROP_FOO,
* properties[PROP_FOO]);
* }
* ```
*
*
* and then notify a change on the "foo" property with:
*
*
* ```c
* g_object_notify_by_pspec (self, properties[PROP_FOO]);
* ```
*
* @param pspec the #GParamSpec of a property installed on the class of @object.
*/
notify_by_pspec(pspec: GObject.ParamSpec): void;
/**
* Increases the reference count of `object`.
*
* Since GLib 2.56, if `GLIB_VERSION_MAX_ALLOWED` is 2.56 or greater, the type
* of `object` will be propagated to the return type (using the GCC typeof()
* extension), so any casting the caller needs to do on the return type must be
* explicit.
* @returns the same @object
*/
ref(): GObject.Object;
/**
* Increase the reference count of `object,` and possibly remove the
* [floating][floating-ref] reference, if `object` has a floating reference.
*
* In other words, if the object is floating, then this call "assumes
* ownership" of the floating reference, converting it to a normal
* reference by clearing the floating flag while leaving the reference
* count unchanged. If the object is not floating, then this call
* adds a new normal reference increasing the reference count by one.
*
* Since GLib 2.56, the type of `object` will be propagated to the return type
* under the same conditions as for g_object_ref().
* @returns @object
*/
ref_sink(): GObject.Object;
/**
* Releases all references to other objects. This can be used to break
* reference cycles.
*
* This function should only be called from object system implementations.
*/
run_dispose(): void;
/**
* Each object carries around a table of associations from
* strings to pointers. This function lets you set an association.
*
* If the object already had an association with that name,
* the old association will be destroyed.
*
* Internally, the `key` is converted to a #GQuark using g_quark_from_string().
* This means a copy of `key` is kept permanently (even after `object` has been
* finalized) — so it is recommended to only use a small, bounded set of values
* for `key` in your program, to avoid the #GQuark storage growing unbounded.
* @param key name of the key
* @param data data to associate with that key
*/
set_data(key: string, data?: any | null): void;
/**
* Sets a property on an object.
* @param property_name The name of the property to set
* @param value The value to set the property to
*/
set_property(property_name: string, value: GObject.Value | any): void;
/**
* Remove a specified datum from the object's data associations,
* without invoking the association's destroy handler.
* @param key name of the key
* @returns the data if found, or %NULL if no such data exists.
*/
steal_data(key: string): any | null;
/**
* This function gets back user data pointers stored via
* g_object_set_qdata() and removes the `data` from object
* without invoking its destroy() function (if any was
* set).
* Usually, calling this function is only required to update
* user data pointers with a destroy notifier, for example:
*
* ```c
* void
* object_add_to_user_list (GObject *object,
* const gchar *new_string)
* {
* // the quark, naming the object data
* GQuark quark_string_list = g_quark_from_static_string ("my-string-list");
* // retrieve the old string list
* GList *list = g_object_steal_qdata (object, quark_string_list);
*
* // prepend new string
* list = g_list_prepend (list, g_strdup (new_string));
* // this changed 'list', so we need to set it again
* g_object_set_qdata_full (object, quark_string_list, list, free_string_list);
* }
* static void
* free_string_list (gpointer data)
* {
* GList *node, *list = data;
*
* for (node = list; node; node = node->next)
* g_free (node->data);
* g_list_free (list);
* }
* ```
*
* Using g_object_get_qdata() in the above example, instead of
* g_object_steal_qdata() would have left the destroy function set,
* and thus the partial string list would have been freed upon
* g_object_set_qdata_full().
* @param quark A #GQuark, naming the user data pointer
* @returns The user data pointer set, or %NULL
*/
steal_qdata(quark: GLib.Quark): any | null;
/**
* Reverts the effect of a previous call to
* g_object_freeze_notify(). The freeze count is decreased on `object`
* and when it reaches zero, queued "notify" signals are emitted.
*
* Duplicate notifications for each property are squashed so that at most one
* #GObject::notify signal is emitted for each property, in the reverse order
* in which they have been queued.
*
* It is an error to call this function when the freeze count is zero.
*/
thaw_notify(): void;
/**
* Decreases the reference count of `object`. When its reference count
* drops to 0, the object is finalized (i.e. its memory is freed).
*
* If the pointer to the #GObject may be reused in future (for example, if it is
* an instance variable of another object), it is recommended to clear the
* pointer to %NULL rather than retain a dangling pointer to a potentially
* invalid #GObject instance. Use g_clear_object() for this.
*/
unref(): void;
/**
* This function essentially limits the life time of the `closure` to
* the life time of the object. That is, when the object is finalized,
* the `closure` is invalidated by calling g_closure_invalidate() on
* it, in order to prevent invocations of the closure with a finalized
* (nonexisting) object. Also, g_object_ref() and g_object_unref() are
* added as marshal guards to the `closure,` to ensure that an extra
* reference count is held on `object` during invocation of the
* `closure`. Usually, this function will be called on closures that
* use this `object` as closure data.
* @param closure #GClosure to watch
*/
watch_closure(closure: GObject.Closure): void;
/**
* the `constructed` function is called by g_object_new() as the
* final step of the object creation process. At the point of the call, all
* construction properties have been set on the object. The purpose of this
* call is to allow for object initialisation steps that can only be performed
* after construction properties have been set. `constructed` implementors
* should chain up to the `constructed` call of their parent class to allow it
* to complete its initialisation.
*/
vfunc_constructed(): void;
/**
* emits property change notification for a bunch
* of properties. Overriding `dispatch_properties_changed` should be rarely
* needed.
* @param n_pspecs
* @param pspecs
*/
vfunc_dispatch_properties_changed(n_pspecs: number, pspecs: GObject.ParamSpec): void;
/**
* the `dispose` function is supposed to drop all references to other
* objects, but keep the instance otherwise intact, so that client method
* invocations still work. It may be run multiple times (due to reference
* loops). Before returning, `dispose` should chain up to the `dispose` method
* of the parent class.
*/
vfunc_dispose(): void;
/**
* instance finalization function, should finish the finalization of
* the instance begun in `dispose` and chain up to the `finalize` method of the
* parent class.
*/
vfunc_finalize(): void;
/**
* the generic getter for all properties of this type. Should be
* overridden for every type with properties.
* @param property_id
* @param value
* @param pspec
*/
vfunc_get_property(property_id: number, value: GObject.Value | any, pspec: GObject.ParamSpec): void;
/**
* Emits a "notify" signal for the property `property_name` on `object`.
*
* When possible, eg. when signaling a property change from within the class
* that registered the property, you should use g_object_notify_by_pspec()
* instead.
*
* Note that emission of the notify signal may be blocked with
* g_object_freeze_notify(). In this case, the signal emissions are queued
* and will be emitted (in reverse order) when g_object_thaw_notify() is
* called.
* @param pspec
*/
vfunc_notify(pspec: GObject.ParamSpec): void;
/**
* the generic setter for all properties of this type. Should be
* overridden for every type with properties. If implementations of
* `set_property` don't emit property change notification explicitly, this will
* be done implicitly by the type system. However, if the notify signal is
* emitted explicitly, the type system will not emit it a second time.
* @param property_id
* @param value
* @param pspec
*/
vfunc_set_property(property_id: number, value: GObject.Value | any, pspec: GObject.ParamSpec): void;
/**
* Disconnects a handler from an instance so it will not be called during any future or currently ongoing emissions of the signal it has been connected to.
* @param id Handler ID of the handler to be disconnected
*/
disconnect(id: number): void;
/**
* Sets multiple properties of an object at once. The properties argument should be a dictionary mapping property names to values.
* @param properties Object containing the properties to set
*/
set(properties: { [key: string]: any }): void;
/**
* Blocks a handler of an instance so it will not be called during any signal emissions
* @param id Handler ID of the handler to be blocked
*/
block_signal_handler(id: number): void;
/**
* Unblocks a handler so it will be called again during any signal emissions
* @param id Handler ID of the handler to be unblocked
*/
unblock_signal_handler(id: number): void;
/**
* Stops a signal's emission by the given signal name. This will prevent the default handler and any subsequent signal handlers from being invoked.
* @param detailedName Name of the signal to stop emission of
*/
stop_emission_by_name(detailedName: string): void;
}
namespace CompletionContext {
// Signal callback interfaces
interface Cancelled {
(): void;
}
// Constructor properties interface
interface ConstructorProps extends GObject.InitiallyUnowned.ConstructorProps {
activation: CompletionActivation;
completion: Completion;
iter: Gtk.TextIter;
}
}
class CompletionContext extends GObject.InitiallyUnowned {
static $gtype: GObject.GType;
// Properties
/**
* The completion activation
*/
get activation(): CompletionActivation;
set activation(val: CompletionActivation);
/**
* The #GtkSourceCompletion associated with the context.
*/
get completion(): Completion;
/**
* The #GtkTextIter at which the completion is invoked.
*/
get iter(): Gtk.TextIter;
set iter(val: Gtk.TextIter);
// Constructors
constructor(properties?: Partial, ...args: any[]);
_init(...args: any[]): void;
// Signals
connect(id: string, callback: (...args: any[]) => any): number;
connect_after(id: string, callback: (...args: any[]) => any): number;
emit(id: string, ...args: any[]): void;
connect(signal: 'cancelled', callback: (_source: this) => void): number;
connect_after(signal: 'cancelled', callback: (_source: this) => void): number;
emit(signal: 'cancelled'): void;
// Virtual methods
vfunc_cancelled(): void;
// Methods
/**
* 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.
* @param provider a #GtkSourceCompletionProvider.
* @param proposals The list of proposals to add.
* @param finished Whether the provider is finished adding proposals.
*/
add_proposals(
provider: CompletionProvider,
proposals: CompletionProposal[] | null,
finished: boolean,
): void;
/**
* Get the context activation.
* @returns The context activation.
*/
get_activation(): CompletionActivation;
/**
* Get the iter at which the completion was invoked. Providers can use this
* to determine how and if to match proposals.
* @returns %TRUE if @iter is correctly set, %FALSE otherwise.
*/
get_iter(): [boolean, Gtk.TextIter];
}
namespace CompletionInfo {
// Constructor properties interface
interface ConstructorProps
extends Gtk.Window.ConstructorProps,
Atk.ImplementorIface.ConstructorProps,
Gtk.Buildable.ConstructorProps {}
}
class CompletionInfo extends Gtk.Window implements Atk.ImplementorIface, Gtk.Buildable {
static $gtype: GObject.GType;
// Constructors
constructor(properties?: Partial, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): CompletionInfo;
// Methods
/**
* Moves the #GtkSourceCompletionInfo to `iter`. If `iter` is %NULL `info` is
* moved to the cursor position. Moving will respect the #GdkGravity setting
* of the info window and will ensure the line at `iter` is not occluded by
* the window.
* @param view a #GtkTextView on which the info window should be positioned.
* @param iter a #GtkTextIter.
*/
move_to_iter(view: Gtk.TextView, iter?: Gtk.TextIter | null): void;
// Inherited methods
/**
* Creates a binding between `source_property` on `source` and `target_property`
* on `target`.
*
* Whenever the `source_property` is changed the `target_property` is
* updated using the same value. For instance:
*
*
* ```c
* g_object_bind_property (action, "active", widget, "sensitive", 0);
* ```
*
*
* Will result in the "sensitive" property of the widget #GObject instance to be
* updated with the same value of the "active" property of the action #GObject
* instance.
*
* If `flags` contains %G_BINDING_BIDIRECTIONAL then the binding will be mutual:
* if `target_property` on `target` changes then the `source_property` on `source`
* will be updated as well.
*
* The binding will automatically be removed when either the `source` or the
* `target` instances are finalized. To remove the binding without affecting the
* `source` and the `target` you can just call g_object_unref() on the returned
* #GBinding instance.
*
* Removing the binding by calling g_object_unref() on it must only be done if
* the binding, `source` and `target` are only used from a single thread and it
* is clear that both `source` and `target` outlive the binding. Especially it
* is not safe to rely on this if the binding, `source` or `target` can be
* finalized from different threads. Keep another reference to the binding and
* use g_binding_unbind() instead to be on the safe side.
*
* A #GObject can have multiple bindings.
* @param source_property the property on @source to bind
* @param target the target #GObject
* @param target_property the property on @target to bind
* @param flags flags to pass to #GBinding
* @returns the #GBinding instance representing the binding between the two #GObject instances. The binding is released whenever the #GBinding reference count reaches zero.
*/
bind_property(
source_property: string,
target: GObject.Object,
target_property: string,
flags: GObject.BindingFlags | null,
): GObject.Binding;
/**
* Complete version of g_object_bind_property().
*
* Creates a binding between `source_property` on `source` and `target_property`
* on `target,` allowing you to set the transformation functions to be used by
* the binding.
*
* If `flags` contains %G_BINDING_BIDIRECTIONAL then the binding will be mutual:
* if `target_property` on `target` changes then the `source_property` on `source`
* will be updated as well. The `transform_from` function is only used in case
* of bidirectional bindings, otherwise it will be ignored
*
* The binding will automatically be removed when either the `source` or the
* `target` instances are finalized. This will release the reference that is
* being held on the #GBinding instance; if you want to hold on to the
* #GBinding instance, you will need to hold a reference to it.
*
* To remove the binding, call g_binding_unbind().
*
* A #GObject can have multiple bindings.
*
* The same `user_data` parameter will be used for both `transform_to`
* and `transform_from` transformation functions; the `notify` function will
* be called once, when the binding is removed. If you need different data
* for each transformation function, please use
* g_object_bind_property_with_closures() instead.
* @param source_property the property on @source to bind
* @param target the target #GObject
* @param target_property the property on @target to bind
* @param flags flags to pass to #GBinding
* @param transform_to the transformation function from the @source to the @target, or %NULL to use the default
* @param transform_from the transformation function from the @target to the @source, or %NULL to use the default
* @param notify a function to call when disposing the binding, to free resources used by the transformation functions, or %NULL if not required
* @returns the #GBinding instance representing the binding between the two #GObject instances. The binding is released whenever the #GBinding reference count reaches zero.
*/
bind_property_full(
source_property: string,
target: GObject.Object,
target_property: string,
flags: GObject.BindingFlags | null,
transform_to?: GObject.BindingTransformFunc | null,
transform_from?: GObject.BindingTransformFunc | null,
notify?: GLib.DestroyNotify | null,
): GObject.Binding;
// Conflicted with GObject.Object.bind_property_full
bind_property_full(...args: never[]): any;
/**
* This function is intended for #GObject implementations to re-enforce
* a [floating][floating-ref] object reference. Doing this is seldom
* required: all #GInitiallyUnowneds are created with a floating reference
* which usually just needs to be sunken by calling g_object_ref_sink().
*/
force_floating(): void;
/**
* Increases the freeze count on `object`. If the freeze count is
* non-zero, the emission of "notify" signals on `object` is
* stopped. The signals are queued until the freeze count is decreased
* to zero. Duplicate notifications are squashed so that at most one
* #GObject::notify signal is emitted for each property modified while the
* object is frozen.
*
* This is necessary for accessors that modify multiple properties to prevent
* premature notification while the object is still being modified.
*/
freeze_notify(): void;
/**
* Gets a named field from the objects table of associations (see g_object_set_data()).
* @param key name of the key for that association
* @returns the data if found, or %NULL if no such data exists.
*/
get_data(key: string): any | null;
/**
* Gets a property of an object.
*
* The value can be:
* - an empty GObject.Value initialized by G_VALUE_INIT, which will be automatically initialized with the expected type of the property (since GLib 2.60)
* - a GObject.Value initialized with the expected type of the property
* - a GObject.Value initialized with a type to which the expected type of the property can be transformed
*
* In general, a copy is made of the property contents and the caller is responsible for freeing the memory by calling GObject.Value.unset.
*
* Note that GObject.Object.get_property is really intended for language bindings, GObject.Object.get is much more convenient for C programming.
* @param property_name The name of the property to get
* @param value Return location for the property value. Can be an empty GObject.Value initialized by G_VALUE_INIT (auto-initialized with expected type since GLib 2.60), a GObject.Value initialized with the expected property type, or a GObject.Value initialized with a transformable type
*/
get_property(property_name: string, value: GObject.Value | any): any;
/**
* This function gets back user data pointers stored via
* g_object_set_qdata().
* @param quark A #GQuark, naming the user data pointer
* @returns The user data pointer set, or %NULL
*/
get_qdata(quark: GLib.Quark): any | null;
/**
* Gets `n_properties` properties for an `object`.
* Obtained properties will be set to `values`. All properties must be valid.
* Warnings will be emitted and undefined behaviour may result if invalid
* properties are passed in.
* @param names the names of each property to get
* @param values the values of each property to get
*/
getv(names: string[], values: (GObject.Value | any)[]): void;
/**
* Checks whether `object` has a [floating][floating-ref] reference.
* @returns %TRUE if @object has a floating reference
*/
is_floating(): boolean;
/**
* Emits a "notify" signal for the property `property_name` on `object`.
*
* When possible, eg. when signaling a property change from within the class
* that registered the property, you should use g_object_notify_by_pspec()
* instead.
*
* Note that emission of the notify signal may be blocked with
* g_object_freeze_notify(). In this case, the signal emissions are queued
* and will be emitted (in reverse order) when g_object_thaw_notify() is
* called.
* @param property_name the name of a property installed on the class of @object.
*/
notify(property_name: string): void;
/**
* Emits a "notify" signal for the property specified by `pspec` on `object`.
*
* This function omits the property name lookup, hence it is faster than
* g_object_notify().
*
* One way to avoid using g_object_notify() from within the
* class that registered the properties, and using g_object_notify_by_pspec()
* instead, is to store the GParamSpec used with
* g_object_class_install_property() inside a static array, e.g.:
*
*
* ```c
* typedef enum
* {
* PROP_FOO = 1,
* PROP_LAST
* } MyObjectProperty;
*
* static GParamSpec *properties[PROP_LAST];
*
* static void
* my_object_class_init (MyObjectClass *klass)
* {
* properties[PROP_FOO] = g_param_spec_int ("foo", NULL, NULL,
* 0, 100,
* 50,
* G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
* g_object_class_install_property (gobject_class,
* PROP_FOO,
* properties[PROP_FOO]);
* }
* ```
*
*
* and then notify a change on the "foo" property with:
*
*
* ```c
* g_object_notify_by_pspec (self, properties[PROP_FOO]);
* ```
*
* @param pspec the #GParamSpec of a property installed on the class of @object.
*/
notify_by_pspec(pspec: GObject.ParamSpec): void;
/**
* Increases the reference count of `object`.
*
* Since GLib 2.56, if `GLIB_VERSION_MAX_ALLOWED` is 2.56 or greater, the type
* of `object` will be propagated to the return type (using the GCC typeof()
* extension), so any casting the caller needs to do on the return type must be
* explicit.
* @returns the same @object
*/
ref(): GObject.Object;
/**
* Increase the reference count of `object,` and possibly remove the
* [floating][floating-ref] reference, if `object` has a floating reference.
*
* In other words, if the object is floating, then this call "assumes
* ownership" of the floating reference, converting it to a normal
* reference by clearing the floating flag while leaving the reference
* count unchanged. If the object is not floating, then this call
* adds a new normal reference increasing the reference count by one.
*
* Since GLib 2.56, the type of `object` will be propagated to the return type
* under the same conditions as for g_object_ref().
* @returns @object
*/
ref_sink(): GObject.Object;
/**
* Releases all references to other objects. This can be used to break
* reference cycles.
*
* This function should only be called from object system implementations.
*/
run_dispose(): void;
/**
* Each object carries around a table of associations from
* strings to pointers. This function lets you set an association.
*
* If the object already had an association with that name,
* the old association will be destroyed.
*
* Internally, the `key` is converted to a #GQuark using g_quark_from_string().
* This means a copy of `key` is kept permanently (even after `object` has been
* finalized) — so it is recommended to only use a small, bounded set of values
* for `key` in your program, to avoid the #GQuark storage growing unbounded.
* @param key name of the key
* @param data data to associate with that key
*/
set_data(key: string, data?: any | null): void;
/**
* Sets a property on an object.
* @param property_name The name of the property to set
* @param value The value to set the property to
*/
set_property(property_name: string, value: GObject.Value | any): void;
/**
* Remove a specified datum from the object's data associations,
* without invoking the association's destroy handler.
* @param key name of the key
* @returns the data if found, or %NULL if no such data exists.
*/
steal_data(key: string): any | null;
/**
* This function gets back user data pointers stored via
* g_object_set_qdata() and removes the `data` from object
* without invoking its destroy() function (if any was
* set).
* Usually, calling this function is only required to update
* user data pointers with a destroy notifier, for example:
*
* ```c
* void
* object_add_to_user_list (GObject *object,
* const gchar *new_string)
* {
* // the quark, naming the object data
* GQuark quark_string_list = g_quark_from_static_string ("my-string-list");
* // retrieve the old string list
* GList *list = g_object_steal_qdata (object, quark_string_list);
*
* // prepend new string
* list = g_list_prepend (list, g_strdup (new_string));
* // this changed 'list', so we need to set it again
* g_object_set_qdata_full (object, quark_string_list, list, free_string_list);
* }
* static void
* free_string_list (gpointer data)
* {
* GList *node, *list = data;
*
* for (node = list; node; node = node->next)
* g_free (node->data);
* g_list_free (list);
* }
* ```
*
* Using g_object_get_qdata() in the above example, instead of
* g_object_steal_qdata() would have left the destroy function set,
* and thus the partial string list would have been freed upon
* g_object_set_qdata_full().
* @param quark A #GQuark, naming the user data pointer
* @returns The user data pointer set, or %NULL
*/
steal_qdata(quark: GLib.Quark): any | null;
/**
* Reverts the effect of a previous call to
* g_object_freeze_notify(). The freeze count is decreased on `object`
* and when it reaches zero, queued "notify" signals are emitted.
*
* Duplicate notifications for each property are squashed so that at most one
* #GObject::notify signal is emitted for each property, in the reverse order
* in which they have been queued.
*
* It is an error to call this function when the freeze count is zero.
*/
thaw_notify(): void;
/**
* Decreases the reference count of `object`. When its reference count
* drops to 0, the object is finalized (i.e. its memory is freed).
*
* If the pointer to the #GObject may be reused in future (for example, if it is
* an instance variable of another object), it is recommended to clear the
* pointer to %NULL rather than retain a dangling pointer to a potentially
* invalid #GObject instance. Use g_clear_object() for this.
*/
unref(): void;
/**
* This function essentially limits the life time of the `closure` to
* the life time of the object. That is, when the object is finalized,
* the `closure` is invalidated by calling g_closure_invalidate() on
* it, in order to prevent invocations of the closure with a finalized
* (nonexisting) object. Also, g_object_ref() and g_object_unref() are
* added as marshal guards to the `closure,` to ensure that an extra
* reference count is held on `object` during invocation of the
* `closure`. Usually, this function will be called on closures that
* use this `object` as closure data.
* @param closure #GClosure to watch
*/
watch_closure(closure: GObject.Closure): void;
/**
* the `constructed` function is called by g_object_new() as the
* final step of the object creation process. At the point of the call, all
* construction properties have been set on the object. The purpose of this
* call is to allow for object initialisation steps that can only be performed
* after construction properties have been set. `constructed` implementors
* should chain up to the `constructed` call of their parent class to allow it
* to complete its initialisation.
*/
vfunc_constructed(): void;
/**
* emits property change notification for a bunch
* of properties. Overriding `dispatch_properties_changed` should be rarely
* needed.
* @param n_pspecs
* @param pspecs
*/
vfunc_dispatch_properties_changed(n_pspecs: number, pspecs: GObject.ParamSpec): void;
/**
* the `dispose` function is supposed to drop all references to other
* objects, but keep the instance otherwise intact, so that client method
* invocations still work. It may be run multiple times (due to reference
* loops). Before returning, `dispose` should chain up to the `dispose` method
* of the parent class.
*/
vfunc_dispose(): void;
/**
* instance finalization function, should finish the finalization of
* the instance begun in `dispose` and chain up to the `finalize` method of the
* parent class.
*/
vfunc_finalize(): void;
/**
* the generic getter for all properties of this type. Should be
* overridden for every type with properties.
* @param property_id
* @param value
* @param pspec
*/
vfunc_get_property(property_id: number, value: GObject.Value | any, pspec: GObject.ParamSpec): void;
/**
* Emits a "notify" signal for the property `property_name` on `object`.
*
* When possible, eg. when signaling a property change from within the class
* that registered the property, you should use g_object_notify_by_pspec()
* instead.
*
* Note that emission of the notify signal may be blocked with
* g_object_freeze_notify(). In this case, the signal emissions are queued
* and will be emitted (in reverse order) when g_object_thaw_notify() is
* called.
* @param pspec
*/
vfunc_notify(pspec: GObject.ParamSpec): void;
/**
* the generic setter for all properties of this type. Should be
* overridden for every type with properties. If implementations of
* `set_property` don't emit property change notification explicitly, this will
* be done implicitly by the type system. However, if the notify signal is
* emitted explicitly, the type system will not emit it a second time.
* @param property_id
* @param value
* @param pspec
*/
vfunc_set_property(property_id: number, value: GObject.Value | any, pspec: GObject.ParamSpec): void;
/**
* Disconnects a handler from an instance so it will not be called during any future or currently ongoing emissions of the signal it has been connected to.
* @param id Handler ID of the handler to be disconnected
*/
disconnect(id: number): void;
/**
* Sets multiple properties of an object at once. The properties argument should be a dictionary mapping property names to values.
* @param properties Object containing the properties to set
*/
set(properties: { [key: string]: any }): void;
/**
* Blocks a handler of an instance so it will not be called during any signal emissions
* @param id Handler ID of the handler to be blocked
*/
block_signal_handler(id: number): void;
/**
* Unblocks a handler so it will be called again during any signal emissions
* @param id Handler ID of the handler to be unblocked
*/
unblock_signal_handler(id: number): void;
/**
* Stops a signal's emission by the given signal name. This will prevent the default handler and any subsequent signal handlers from being invoked.
* @param detailedName Name of the signal to stop emission of
*/
stop_emission_by_name(detailedName: string): void;
}
namespace CompletionItem {
// Constructor properties interface
interface ConstructorProps extends GObject.Object.ConstructorProps, CompletionProposal.ConstructorProps {
gicon: Gio.Icon;
icon: GdkPixbuf.Pixbuf;
icon_name: string;
iconName: string;
info: string;
label: string;
markup: string;
text: string;
}
}
class CompletionItem extends GObject.Object implements CompletionProposal {
static $gtype: GObject.GType;
// Properties
/**
* The #GIcon for the icon to be shown for this proposal.
*/
get gicon(): Gio.Icon;
set gicon(val: Gio.Icon);
/**
* The #GdkPixbuf for the icon to be shown for this proposal.
*/
get icon(): GdkPixbuf.Pixbuf;
set icon(val: GdkPixbuf.Pixbuf);
/**
* The icon name for the icon to be shown for this proposal.
*/
get icon_name(): string;
set icon_name(val: string);
/**
* The icon name for the icon to be shown for this proposal.
*/
get iconName(): string;
set iconName(val: string);
/**
* Optional extra information to be shown for this proposal.
*/
get info(): string;
set info(val: string);
/**
* Label to be shown for this proposal.
*/
get label(): string;
set label(val: string);
/**
* Label with markup to be shown for this proposal.
*/
get markup(): string;
set markup(val: string);
/**
* Proposal text.
*/
get text(): string;
set text(val: string);
// Constructors
constructor(properties?: Partial, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): CompletionItem;
// Methods
set_gicon(gicon?: Gio.Icon | null): void;
set_icon(icon?: GdkPixbuf.Pixbuf | null): void;
set_icon_name(icon_name?: string | null): void;
set_info(info?: string | null): void;
set_label(label?: string | null): void;
set_markup(markup?: string | null): void;
set_text(text?: string | null): void;
// Inherited methods
/**
* Emits the "changed" signal on `proposal`. This should be called by
* implementations whenever the name, icon or info of the proposal has
* changed.
*/
changed(): void;
/**
* 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()).
* @param other a #GtkSourceCompletionProposal.
* @returns %TRUE if @proposal and @object are the same proposal
*/
equal(other: CompletionProposal): boolean;
/**
* Gets the #GIcon for the icon of `proposal`.
* @returns A #GIcon with the icon of @proposal.
*/
get_gicon(): Gio.Icon | null;
/**
* Gets the #GdkPixbuf for the icon of `proposal`.
* @returns A #GdkPixbuf with the icon of @proposal.
*/
get_icon(): GdkPixbuf.Pixbuf | null;
/**
* Gets the icon name of `proposal`.
* @returns The icon name of @proposal.
*/
get_icon_name(): string | null;
/**
* 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().
* @returns a newly-allocated string containing extra information of @proposal or %NULL if no extra information is associated to @proposal.
*/
get_info(): string | null;
/**
* 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().
* @returns a new string containing the label of @proposal.
*/
get_label(): string;
/**
* 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().
* @returns a new string containing the label of @proposal with markup.
*/
get_markup(): string;
/**
* 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().
* @returns a new string containing the text of @proposal.
*/
get_text(): string;
/**
* 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()).
* @returns The hash value of @proposal.
*/
hash(): number;
/**
* Emits the "changed" signal on `proposal`. This should be called by
* implementations whenever the name, icon or info of the proposal has
* changed.
*/
vfunc_changed(): void;
/**
* 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()).
* @param other a #GtkSourceCompletionProposal.
*/
vfunc_equal(other: CompletionProposal): boolean;
/**
* Gets the #GIcon for the icon of `proposal`.
*/
vfunc_get_gicon(): Gio.Icon | null;
/**
* Gets the #GdkPixbuf for the icon of `proposal`.
*/
vfunc_get_icon(): GdkPixbuf.Pixbuf | null;
/**
* Gets the icon name of `proposal`.
*/
vfunc_get_icon_name(): string | null;
/**
* 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().
*/
vfunc_get_info(): string | null;
/**
* 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().
*/
vfunc_get_label(): string;
/**
* 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().
*/
vfunc_get_markup(): string;
/**
* 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().
*/
vfunc_get_text(): string;
/**
* 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()).
*/
vfunc_hash(): number;
/**
* Creates a binding between `source_property` on `source` and `target_property`
* on `target`.
*
* Whenever the `source_property` is changed the `target_property` is
* updated using the same value. For instance:
*
*
* ```c
* g_object_bind_property (action, "active", widget, "sensitive", 0);
* ```
*
*
* Will result in the "sensitive" property of the widget #GObject instance to be
* updated with the same value of the "active" property of the action #GObject
* instance.
*
* If `flags` contains %G_BINDING_BIDIRECTIONAL then the binding will be mutual:
* if `target_property` on `target` changes then the `source_property` on `source`
* will be updated as well.
*
* The binding will automatically be removed when either the `source` or the
* `target` instances are finalized. To remove the binding without affecting the
* `source` and the `target` you can just call g_object_unref() on the returned
* #GBinding instance.
*
* Removing the binding by calling g_object_unref() on it must only be done if
* the binding, `source` and `target` are only used from a single thread and it
* is clear that both `source` and `target` outlive the binding. Especially it
* is not safe to rely on this if the binding, `source` or `target` can be
* finalized from different threads. Keep another reference to the binding and
* use g_binding_unbind() instead to be on the safe side.
*
* A #GObject can have multiple bindings.
* @param source_property the property on @source to bind
* @param target the target #GObject
* @param target_property the property on @target to bind
* @param flags flags to pass to #GBinding
* @returns the #GBinding instance representing the binding between the two #GObject instances. The binding is released whenever the #GBinding reference count reaches zero.
*/
bind_property(
source_property: string,
target: GObject.Object,
target_property: string,
flags: GObject.BindingFlags | null,
): GObject.Binding;
/**
* Complete version of g_object_bind_property().
*
* Creates a binding between `source_property` on `source` and `target_property`
* on `target,` allowing you to set the transformation functions to be used by
* the binding.
*
* If `flags` contains %G_BINDING_BIDIRECTIONAL then the binding will be mutual:
* if `target_property` on `target` changes then the `source_property` on `source`
* will be updated as well. The `transform_from` function is only used in case
* of bidirectional bindings, otherwise it will be ignored
*
* The binding will automatically be removed when either the `source` or the
* `target` instances are finalized. This will release the reference that is
* being held on the #GBinding instance; if you want to hold on to the
* #GBinding instance, you will need to hold a reference to it.
*
* To remove the binding, call g_binding_unbind().
*
* A #GObject can have multiple bindings.
*
* The same `user_data` parameter will be used for both `transform_to`
* and `transform_from` transformation functions; the `notify` function will
* be called once, when the binding is removed. If you need different data
* for each transformation function, please use
* g_object_bind_property_with_closures() instead.
* @param source_property the property on @source to bind
* @param target the target #GObject
* @param target_property the property on @target to bind
* @param flags flags to pass to #GBinding
* @param transform_to the transformation function from the @source to the @target, or %NULL to use the default
* @param transform_from the transformation function from the @target to the @source, or %NULL to use the default
* @param notify a function to call when disposing the binding, to free resources used by the transformation functions, or %NULL if not required
* @returns the #GBinding instance representing the binding between the two #GObject instances. The binding is released whenever the #GBinding reference count reaches zero.
*/
bind_property_full(
source_property: string,
target: GObject.Object,
target_property: string,
flags: GObject.BindingFlags | null,
transform_to?: GObject.BindingTransformFunc | null,
transform_from?: GObject.BindingTransformFunc | null,
notify?: GLib.DestroyNotify | null,
): GObject.Binding;
// Conflicted with GObject.Object.bind_property_full
bind_property_full(...args: never[]): any;
/**
* This function is intended for #GObject implementations to re-enforce
* a [floating][floating-ref] object reference. Doing this is seldom
* required: all #GInitiallyUnowneds are created with a floating reference
* which usually just needs to be sunken by calling g_object_ref_sink().
*/
force_floating(): void;
/**
* Increases the freeze count on `object`. If the freeze count is
* non-zero, the emission of "notify" signals on `object` is
* stopped. The signals are queued until the freeze count is decreased
* to zero. Duplicate notifications are squashed so that at most one
* #GObject::notify signal is emitted for each property modified while the
* object is frozen.
*
* This is necessary for accessors that modify multiple properties to prevent
* premature notification while the object is still being modified.
*/
freeze_notify(): void;
/**
* Gets a named field from the objects table of associations (see g_object_set_data()).
* @param key name of the key for that association
* @returns the data if found, or %NULL if no such data exists.
*/
get_data(key: string): any | null;
/**
* Gets a property of an object.
*
* The value can be:
* - an empty GObject.Value initialized by G_VALUE_INIT, which will be automatically initialized with the expected type of the property (since GLib 2.60)
* - a GObject.Value initialized with the expected type of the property
* - a GObject.Value initialized with a type to which the expected type of the property can be transformed
*
* In general, a copy is made of the property contents and the caller is responsible for freeing the memory by calling GObject.Value.unset.
*
* Note that GObject.Object.get_property is really intended for language bindings, GObject.Object.get is much more convenient for C programming.
* @param property_name The name of the property to get
* @param value Return location for the property value. Can be an empty GObject.Value initialized by G_VALUE_INIT (auto-initialized with expected type since GLib 2.60), a GObject.Value initialized with the expected property type, or a GObject.Value initialized with a transformable type
*/
get_property(property_name: string, value: GObject.Value | any): any;
/**
* This function gets back user data pointers stored via
* g_object_set_qdata().
* @param quark A #GQuark, naming the user data pointer
* @returns The user data pointer set, or %NULL
*/
get_qdata(quark: GLib.Quark): any | null;
/**
* Gets `n_properties` properties for an `object`.
* Obtained properties will be set to `values`. All properties must be valid.
* Warnings will be emitted and undefined behaviour may result if invalid
* properties are passed in.
* @param names the names of each property to get
* @param values the values of each property to get
*/
getv(names: string[], values: (GObject.Value | any)[]): void;
/**
* Checks whether `object` has a [floating][floating-ref] reference.
* @returns %TRUE if @object has a floating reference
*/
is_floating(): boolean;
/**
* Emits a "notify" signal for the property `property_name` on `object`.
*
* When possible, eg. when signaling a property change from within the class
* that registered the property, you should use g_object_notify_by_pspec()
* instead.
*
* Note that emission of the notify signal may be blocked with
* g_object_freeze_notify(). In this case, the signal emissions are queued
* and will be emitted (in reverse order) when g_object_thaw_notify() is
* called.
* @param property_name the name of a property installed on the class of @object.
*/
notify(property_name: string): void;
/**
* Emits a "notify" signal for the property specified by `pspec` on `object`.
*
* This function omits the property name lookup, hence it is faster than
* g_object_notify().
*
* One way to avoid using g_object_notify() from within the
* class that registered the properties, and using g_object_notify_by_pspec()
* instead, is to store the GParamSpec used with
* g_object_class_install_property() inside a static array, e.g.:
*
*
* ```c
* typedef enum
* {
* PROP_FOO = 1,
* PROP_LAST
* } MyObjectProperty;
*
* static GParamSpec *properties[PROP_LAST];
*
* static void
* my_object_class_init (MyObjectClass *klass)
* {
* properties[PROP_FOO] = g_param_spec_int ("foo", NULL, NULL,
* 0, 100,
* 50,
* G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
* g_object_class_install_property (gobject_class,
* PROP_FOO,
* properties[PROP_FOO]);
* }
* ```
*
*
* and then notify a change on the "foo" property with:
*
*
* ```c
* g_object_notify_by_pspec (self, properties[PROP_FOO]);
* ```
*
* @param pspec the #GParamSpec of a property installed on the class of @object.
*/
notify_by_pspec(pspec: GObject.ParamSpec): void;
/**
* Increases the reference count of `object`.
*
* Since GLib 2.56, if `GLIB_VERSION_MAX_ALLOWED` is 2.56 or greater, the type
* of `object` will be propagated to the return type (using the GCC typeof()
* extension), so any casting the caller needs to do on the return type must be
* explicit.
* @returns the same @object
*/
ref(): GObject.Object;
/**
* Increase the reference count of `object,` and possibly remove the
* [floating][floating-ref] reference, if `object` has a floating reference.
*
* In other words, if the object is floating, then this call "assumes
* ownership" of the floating reference, converting it to a normal
* reference by clearing the floating flag while leaving the reference
* count unchanged. If the object is not floating, then this call
* adds a new normal reference increasing the reference count by one.
*
* Since GLib 2.56, the type of `object` will be propagated to the return type
* under the same conditions as for g_object_ref().
* @returns @object
*/
ref_sink(): GObject.Object;
/**
* Releases all references to other objects. This can be used to break
* reference cycles.
*
* This function should only be called from object system implementations.
*/
run_dispose(): void;
/**
* Each object carries around a table of associations from
* strings to pointers. This function lets you set an association.
*
* If the object already had an association with that name,
* the old association will be destroyed.
*
* Internally, the `key` is converted to a #GQuark using g_quark_from_string().
* This means a copy of `key` is kept permanently (even after `object` has been
* finalized) — so it is recommended to only use a small, bounded set of values
* for `key` in your program, to avoid the #GQuark storage growing unbounded.
* @param key name of the key
* @param data data to associate with that key
*/
set_data(key: string, data?: any | null): void;
/**
* Sets a property on an object.
* @param property_name The name of the property to set
* @param value The value to set the property to
*/
set_property(property_name: string, value: GObject.Value | any): void;
/**
* Remove a specified datum from the object's data associations,
* without invoking the association's destroy handler.
* @param key name of the key
* @returns the data if found, or %NULL if no such data exists.
*/
steal_data(key: string): any | null;
/**
* This function gets back user data pointers stored via
* g_object_set_qdata() and removes the `data` from object
* without invoking its destroy() function (if any was
* set).
* Usually, calling this function is only required to update
* user data pointers with a destroy notifier, for example:
*
* ```c
* void
* object_add_to_user_list (GObject *object,
* const gchar *new_string)
* {
* // the quark, naming the object data
* GQuark quark_string_list = g_quark_from_static_string ("my-string-list");
* // retrieve the old string list
* GList *list = g_object_steal_qdata (object, quark_string_list);
*
* // prepend new string
* list = g_list_prepend (list, g_strdup (new_string));
* // this changed 'list', so we need to set it again
* g_object_set_qdata_full (object, quark_string_list, list, free_string_list);
* }
* static void
* free_string_list (gpointer data)
* {
* GList *node, *list = data;
*
* for (node = list; node; node = node->next)
* g_free (node->data);
* g_list_free (list);
* }
* ```
*
* Using g_object_get_qdata() in the above example, instead of
* g_object_steal_qdata() would have left the destroy function set,
* and thus the partial string list would have been freed upon
* g_object_set_qdata_full().
* @param quark A #GQuark, naming the user data pointer
* @returns The user data pointer set, or %NULL
*/
steal_qdata(quark: GLib.Quark): any | null;
/**
* Reverts the effect of a previous call to
* g_object_freeze_notify(). The freeze count is decreased on `object`
* and when it reaches zero, queued "notify" signals are emitted.
*
* Duplicate notifications for each property are squashed so that at most one
* #GObject::notify signal is emitted for each property, in the reverse order
* in which they have been queued.
*
* It is an error to call this function when the freeze count is zero.
*/
thaw_notify(): void;
/**
* Decreases the reference count of `object`. When its reference count
* drops to 0, the object is finalized (i.e. its memory is freed).
*
* If the pointer to the #GObject may be reused in future (for example, if it is
* an instance variable of another object), it is recommended to clear the
* pointer to %NULL rather than retain a dangling pointer to a potentially
* invalid #GObject instance. Use g_clear_object() for this.
*/
unref(): void;
/**
* This function essentially limits the life time of the `closure` to
* the life time of the object. That is, when the object is finalized,
* the `closure` is invalidated by calling g_closure_invalidate() on
* it, in order to prevent invocations of the closure with a finalized
* (nonexisting) object. Also, g_object_ref() and g_object_unref() are
* added as marshal guards to the `closure,` to ensure that an extra
* reference count is held on `object` during invocation of the
* `closure`. Usually, this function will be called on closures that
* use this `object` as closure data.
* @param closure #GClosure to watch
*/
watch_closure(closure: GObject.Closure): void;
/**
* the `constructed` function is called by g_object_new() as the
* final step of the object creation process. At the point of the call, all
* construction properties have been set on the object. The purpose of this
* call is to allow for object initialisation steps that can only be performed
* after construction properties have been set. `constructed` implementors
* should chain up to the `constructed` call of their parent class to allow it
* to complete its initialisation.
*/
vfunc_constructed(): void;
/**
* emits property change notification for a bunch
* of properties. Overriding `dispatch_properties_changed` should be rarely
* needed.
* @param n_pspecs
* @param pspecs
*/
vfunc_dispatch_properties_changed(n_pspecs: number, pspecs: GObject.ParamSpec): void;
/**
* the `dispose` function is supposed to drop all references to other
* objects, but keep the instance otherwise intact, so that client method
* invocations still work. It may be run multiple times (due to reference
* loops). Before returning, `dispose` should chain up to the `dispose` method
* of the parent class.
*/
vfunc_dispose(): void;
/**
* instance finalization function, should finish the finalization of
* the instance begun in `dispose` and chain up to the `finalize` method of the
* parent class.
*/
vfunc_finalize(): void;
/**
* the generic getter for all properties of this type. Should be
* overridden for every type with properties.
* @param property_id
* @param value
* @param pspec
*/
vfunc_get_property(property_id: number, value: GObject.Value | any, pspec: GObject.ParamSpec): void;
/**
* Emits a "notify" signal for the property `property_name` on `object`.
*
* When possible, eg. when signaling a property change from within the class
* that registered the property, you should use g_object_notify_by_pspec()
* instead.
*
* Note that emission of the notify signal may be blocked with
* g_object_freeze_notify(). In this case, the signal emissions are queued
* and will be emitted (in reverse order) when g_object_thaw_notify() is
* called.
* @param pspec
*/
vfunc_notify(pspec: GObject.ParamSpec): void;
/**
* the generic setter for all properties of this type. Should be
* overridden for every type with properties. If implementations of
* `set_property` don't emit property change notification explicitly, this will
* be done implicitly by the type system. However, if the notify signal is
* emitted explicitly, the type system will not emit it a second time.
* @param property_id
* @param value
* @param pspec
*/
vfunc_set_property(property_id: number, value: GObject.Value | any, pspec: GObject.ParamSpec): void;
/**
* Disconnects a handler from an instance so it will not be called during any future or currently ongoing emissions of the signal it has been connected to.
* @param id Handler ID of the handler to be disconnected
*/
disconnect(id: number): void;
/**
* Sets multiple properties of an object at once. The properties argument should be a dictionary mapping property names to values.
* @param properties Object containing the properties to set
*/
set(properties: { [key: string]: any }): void;
/**
* Blocks a handler of an instance so it will not be called during any signal emissions
* @param id Handler ID of the handler to be blocked
*/
block_signal_handler(id: number): void;
/**
* Unblocks a handler so it will be called again during any signal emissions
* @param id Handler ID of the handler to be unblocked
*/
unblock_signal_handler(id: number): void;
/**
* Stops a signal's emission by the given signal name. This will prevent the default handler and any subsequent signal handlers from being invoked.
* @param detailedName Name of the signal to stop emission of
*/
stop_emission_by_name(detailedName: string): void;
}
namespace CompletionWords {
// Constructor properties interface
interface ConstructorProps extends GObject.Object.ConstructorProps, CompletionProvider.ConstructorProps {
activation: CompletionActivation;
icon: GdkPixbuf.Pixbuf;
interactive_delay: number;
interactiveDelay: number;
minimum_word_size: number;
minimumWordSize: number;
name: string;
priority: number;
proposals_batch_size: number;
proposalsBatchSize: number;
scan_batch_size: number;
scanBatchSize: number;
}
}
class CompletionWords extends GObject.Object implements CompletionProvider {
static $gtype: GObject.GType;
// Properties
/**
* The type of activation.
*/
get activation(): CompletionActivation;
set activation(val: CompletionActivation);
get icon(): GdkPixbuf.Pixbuf;
set icon(val: GdkPixbuf.Pixbuf);
get interactive_delay(): number;
set interactive_delay(val: number);
get interactiveDelay(): number;
set interactiveDelay(val: number);
get minimum_word_size(): number;
set minimum_word_size(val: number);
get minimumWordSize(): number;
set minimumWordSize(val: number);
get name(): string;
set name(val: string);
get priority(): number;
set priority(val: number);
get proposals_batch_size(): number;
set proposals_batch_size(val: number);
get proposalsBatchSize(): number;
set proposalsBatchSize(val: number);
get scan_batch_size(): number;
set scan_batch_size(val: number);
get scanBatchSize(): number;
set scanBatchSize(val: number);
// Constructors
constructor(properties?: Partial, ...args: any[]);
_init(...args: any[]): void;
static ['new'](name?: string | null, icon?: GdkPixbuf.Pixbuf | null): CompletionWords;
// Methods
/**
* Registers `buffer` in the `words` provider.
* @param buffer a #GtkTextBuffer
*/
register(buffer: Gtk.TextBuffer): void;
/**
* Unregisters `buffer` from the `words` provider.
* @param buffer a #GtkTextBuffer
*/
unregister(buffer: Gtk.TextBuffer): void;
// Inherited methods
/**
* 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.
* @param proposal a #GtkSourceCompletionProposal.
* @param iter a #GtkTextIter.
* @returns %TRUE to indicate that the proposal activation has been handled, %FALSE otherwise.
*/
activate_proposal(proposal: CompletionProposal, iter: Gtk.TextIter): boolean;
/**
* Get with what kind of activation the provider should be activated.
* @returns a combination of #GtkSourceCompletionActivation.
*/
get_activation(): CompletionActivation;
/**
* Gets the #GIcon for the icon of `provider`.
* @returns The icon to be used for the provider, or %NULL if the provider does not have a special icon.
*/
get_gicon(): Gio.Icon | null;
/**
* Get the #GdkPixbuf for the icon of the `provider`.
* @returns The icon to be used for the provider, or %NULL if the provider does not have a special icon.
*/
get_icon(): GdkPixbuf.Pixbuf | null;
/**
* Gets the icon name of `provider`.
* @returns The icon name to be used for the provider, or %NULL if the provider does not have a special icon.
*/
get_icon_name(): string | null;
/**
* 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 #GtkLabel. The
* return value of gtk_source_completion_proposal_get_info() is used as the
* content of the #GtkLabel.
*
*
*
* If implemented, gtk_source_completion_provider_update_info()
* must also be implemented.
*
*
* @param proposal a currently selected #GtkSourceCompletionProposal.
* @returns a custom #GtkWidget to show extra information about @proposal, or %NULL if the provider does not have a special info widget.
*/
get_info_widget(proposal: CompletionProposal): Gtk.Widget | null;
/**
* 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 #GtkSourceCompletion:auto-complete-delay property.
* @returns the interactive delay in milliseconds.
*/
get_interactive_delay(): number;
/**
* 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().
* @returns a new string containing the name of the provider.
*/
get_name(): string;
/**
* 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.
* @returns the provider priority.
*/
get_priority(): number;
/**
* Get the #GtkTextIter 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.
* @param context a #GtkSourceCompletionContext.
* @param proposal a #GtkSourceCompletionProposal.
* @returns %TRUE if @iter was set for @proposal, %FALSE otherwise.
*/
get_start_iter(context: CompletionContext, proposal: CompletionProposal): [boolean, Gtk.TextIter];
/**
* Get whether the provider match the context of completion detailed in
* `context`.
* @param context a #GtkSourceCompletionContext.
* @returns %TRUE if @provider matches the completion context, %FALSE otherwise.
*/
match(context: CompletionContext): boolean;
/**
* Populate `context` with proposals from `provider` added with the
* gtk_source_completion_context_add_proposals() function.
* @param context a #GtkSourceCompletionContext.
*/
populate(context: CompletionContext): void;
/**
* Update extra information shown in `info` for `proposal`.
*
*
*
* This function must be implemented when
* gtk_source_completion_provider_get_info_widget() is implemented.
*
*
* @param proposal a #GtkSourceCompletionProposal.
* @param info a #GtkSourceCompletionInfo.
*/
update_info(proposal: CompletionProposal, info: CompletionInfo): void;
/**
* 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.
* @param proposal a #GtkSourceCompletionProposal.
* @param iter a #GtkTextIter.
*/
vfunc_activate_proposal(proposal: CompletionProposal, iter: Gtk.TextIter): boolean;
/**
* Get with what kind of activation the provider should be activated.
*/
vfunc_get_activation(): CompletionActivation;
/**
* Gets the #GIcon for the icon of `provider`.
*/
vfunc_get_gicon(): Gio.Icon | null;
/**
* Get the #GdkPixbuf for the icon of the `provider`.
*/
vfunc_get_icon(): GdkPixbuf.Pixbuf | null;
/**
* Gets the icon name of `provider`.
*/
vfunc_get_icon_name(): string | null;
/**
* 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 #GtkLabel. The
* return value of gtk_source_completion_proposal_get_info() is used as the
* content of the #GtkLabel.
*
*
*
* If implemented, gtk_source_completion_provider_update_info()
* must also be implemented.
*
*
* @param proposal a currently selected #GtkSourceCompletionProposal.
*/
vfunc_get_info_widget(proposal: CompletionProposal): Gtk.Widget | null;
/**
* 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 #GtkSourceCompletion:auto-complete-delay property.
*/
vfunc_get_interactive_delay(): number;
/**
* 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().
*/
vfunc_get_name(): string;
/**
* 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.
*/
vfunc_get_priority(): number;
/**
* Get the #GtkTextIter 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.
* @param context a #GtkSourceCompletionContext.
* @param proposal a #GtkSourceCompletionProposal.
*/
vfunc_get_start_iter(context: CompletionContext, proposal: CompletionProposal): [boolean, Gtk.TextIter];
/**
* Get whether the provider match the context of completion detailed in
* `context`.
* @param context a #GtkSourceCompletionContext.
*/
vfunc_match(context: CompletionContext): boolean;
/**
* Populate `context` with proposals from `provider` added with the
* gtk_source_completion_context_add_proposals() function.
* @param context a #GtkSourceCompletionContext.
*/
vfunc_populate(context: CompletionContext): void;
/**
* Update extra information shown in `info` for `proposal`.
*
*
*
* This function must be implemented when
* gtk_source_completion_provider_get_info_widget() is implemented.
*
*
* @param proposal a #GtkSourceCompletionProposal.
* @param info a #GtkSourceCompletionInfo.
*/
vfunc_update_info(proposal: CompletionProposal, info: CompletionInfo): void;
/**
* Creates a binding between `source_property` on `source` and `target_property`
* on `target`.
*
* Whenever the `source_property` is changed the `target_property` is
* updated using the same value. For instance:
*
*
* ```c
* g_object_bind_property (action, "active", widget, "sensitive", 0);
* ```
*
*
* Will result in the "sensitive" property of the widget #GObject instance to be
* updated with the same value of the "active" property of the action #GObject
* instance.
*
* If `flags` contains %G_BINDING_BIDIRECTIONAL then the binding will be mutual:
* if `target_property` on `target` changes then the `source_property` on `source`
* will be updated as well.
*
* The binding will automatically be removed when either the `source` or the
* `target` instances are finalized. To remove the binding without affecting the
* `source` and the `target` you can just call g_object_unref() on the returned
* #GBinding instance.
*
* Removing the binding by calling g_object_unref() on it must only be done if
* the binding, `source` and `target` are only used from a single thread and it
* is clear that both `source` and `target` outlive the binding. Especially it
* is not safe to rely on this if the binding, `source` or `target` can be
* finalized from different threads. Keep another reference to the binding and
* use g_binding_unbind() instead to be on the safe side.
*
* A #GObject can have multiple bindings.
* @param source_property the property on @source to bind
* @param target the target #GObject
* @param target_property the property on @target to bind
* @param flags flags to pass to #GBinding
* @returns the #GBinding instance representing the binding between the two #GObject instances. The binding is released whenever the #GBinding reference count reaches zero.
*/
bind_property(
source_property: string,
target: GObject.Object,
target_property: string,
flags: GObject.BindingFlags | null,
): GObject.Binding;
/**
* Complete version of g_object_bind_property().
*
* Creates a binding between `source_property` on `source` and `target_property`
* on `target,` allowing you to set the transformation functions to be used by
* the binding.
*
* If `flags` contains %G_BINDING_BIDIRECTIONAL then the binding will be mutual:
* if `target_property` on `target` changes then the `source_property` on `source`
* will be updated as well. The `transform_from` function is only used in case
* of bidirectional bindings, otherwise it will be ignored
*
* The binding will automatically be removed when either the `source` or the
* `target` instances are finalized. This will release the reference that is
* being held on the #GBinding instance; if you want to hold on to the
* #GBinding instance, you will need to hold a reference to it.
*
* To remove the binding, call g_binding_unbind().
*
* A #GObject can have multiple bindings.
*
* The same `user_data` parameter will be used for both `transform_to`
* and `transform_from` transformation functions; the `notify` function will
* be called once, when the binding is removed. If you need different data
* for each transformation function, please use
* g_object_bind_property_with_closures() instead.
* @param source_property the property on @source to bind
* @param target the target #GObject
* @param target_property the property on @target to bind
* @param flags flags to pass to #GBinding
* @param transform_to the transformation function from the @source to the @target, or %NULL to use the default
* @param transform_from the transformation function from the @target to the @source, or %NULL to use the default
* @param notify a function to call when disposing the binding, to free resources used by the transformation functions, or %NULL if not required
* @returns the #GBinding instance representing the binding between the two #GObject instances. The binding is released whenever the #GBinding reference count reaches zero.
*/
bind_property_full(
source_property: string,
target: GObject.Object,
target_property: string,
flags: GObject.BindingFlags | null,
transform_to?: GObject.BindingTransformFunc | null,
transform_from?: GObject.BindingTransformFunc | null,
notify?: GLib.DestroyNotify | null,
): GObject.Binding;
// Conflicted with GObject.Object.bind_property_full
bind_property_full(...args: never[]): any;
/**
* This function is intended for #GObject implementations to re-enforce
* a [floating][floating-ref] object reference. Doing this is seldom
* required: all #GInitiallyUnowneds are created with a floating reference
* which usually just needs to be sunken by calling g_object_ref_sink().
*/
force_floating(): void;
/**
* Increases the freeze count on `object`. If the freeze count is
* non-zero, the emission of "notify" signals on `object` is
* stopped. The signals are queued until the freeze count is decreased
* to zero. Duplicate notifications are squashed so that at most one
* #GObject::notify signal is emitted for each property modified while the
* object is frozen.
*
* This is necessary for accessors that modify multiple properties to prevent
* premature notification while the object is still being modified.
*/
freeze_notify(): void;
/**
* Gets a named field from the objects table of associations (see g_object_set_data()).
* @param key name of the key for that association
* @returns the data if found, or %NULL if no such data exists.
*/
get_data(key: string): any | null;
/**
* Gets a property of an object.
*
* The value can be:
* - an empty GObject.Value initialized by G_VALUE_INIT, which will be automatically initialized with the expected type of the property (since GLib 2.60)
* - a GObject.Value initialized with the expected type of the property
* - a GObject.Value initialized with a type to which the expected type of the property can be transformed
*
* In general, a copy is made of the property contents and the caller is responsible for freeing the memory by calling GObject.Value.unset.
*
* Note that GObject.Object.get_property is really intended for language bindings, GObject.Object.get is much more convenient for C programming.
* @param property_name The name of the property to get
* @param value Return location for the property value. Can be an empty GObject.Value initialized by G_VALUE_INIT (auto-initialized with expected type since GLib 2.60), a GObject.Value initialized with the expected property type, or a GObject.Value initialized with a transformable type
*/
get_property(property_name: string, value: GObject.Value | any): any;
/**
* This function gets back user data pointers stored via
* g_object_set_qdata().
* @param quark A #GQuark, naming the user data pointer
* @returns The user data pointer set, or %NULL
*/
get_qdata(quark: GLib.Quark): any | null;
/**
* Gets `n_properties` properties for an `object`.
* Obtained properties will be set to `values`. All properties must be valid.
* Warnings will be emitted and undefined behaviour may result if invalid
* properties are passed in.
* @param names the names of each property to get
* @param values the values of each property to get
*/
getv(names: string[], values: (GObject.Value | any)[]): void;
/**
* Checks whether `object` has a [floating][floating-ref] reference.
* @returns %TRUE if @object has a floating reference
*/
is_floating(): boolean;
/**
* Emits a "notify" signal for the property `property_name` on `object`.
*
* When possible, eg. when signaling a property change from within the class
* that registered the property, you should use g_object_notify_by_pspec()
* instead.
*
* Note that emission of the notify signal may be blocked with
* g_object_freeze_notify(). In this case, the signal emissions are queued
* and will be emitted (in reverse order) when g_object_thaw_notify() is
* called.
* @param property_name the name of a property installed on the class of @object.
*/
notify(property_name: string): void;
/**
* Emits a "notify" signal for the property specified by `pspec` on `object`.
*
* This function omits the property name lookup, hence it is faster than
* g_object_notify().
*
* One way to avoid using g_object_notify() from within the
* class that registered the properties, and using g_object_notify_by_pspec()
* instead, is to store the GParamSpec used with
* g_object_class_install_property() inside a static array, e.g.:
*
*
* ```c
* typedef enum
* {
* PROP_FOO = 1,
* PROP_LAST
* } MyObjectProperty;
*
* static GParamSpec *properties[PROP_LAST];
*
* static void
* my_object_class_init (MyObjectClass *klass)
* {
* properties[PROP_FOO] = g_param_spec_int ("foo", NULL, NULL,
* 0, 100,
* 50,
* G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
* g_object_class_install_property (gobject_class,
* PROP_FOO,
* properties[PROP_FOO]);
* }
* ```
*
*
* and then notify a change on the "foo" property with:
*
*
* ```c
* g_object_notify_by_pspec (self, properties[PROP_FOO]);
* ```
*
* @param pspec the #GParamSpec of a property installed on the class of @object.
*/
notify_by_pspec(pspec: GObject.ParamSpec): void;
/**
* Increases the reference count of `object`.
*
* Since GLib 2.56, if `GLIB_VERSION_MAX_ALLOWED` is 2.56 or greater, the type
* of `object` will be propagated to the return type (using the GCC typeof()
* extension), so any casting the caller needs to do on the return type must be
* explicit.
* @returns the same @object
*/
ref(): GObject.Object;
/**
* Increase the reference count of `object,` and possibly remove the
* [floating][floating-ref] reference, if `object` has a floating reference.
*
* In other words, if the object is floating, then this call "assumes
* ownership" of the floating reference, converting it to a normal
* reference by clearing the floating flag while leaving the reference
* count unchanged. If the object is not floating, then this call
* adds a new normal reference increasing the reference count by one.
*
* Since GLib 2.56, the type of `object` will be propagated to the return type
* under the same conditions as for g_object_ref().
* @returns @object
*/
ref_sink(): GObject.Object;
/**
* Releases all references to other objects. This can be used to break
* reference cycles.
*
* This function should only be called from object system implementations.
*/
run_dispose(): void;
/**
* Each object carries around a table of associations from
* strings to pointers. This function lets you set an association.
*
* If the object already had an association with that name,
* the old association will be destroyed.
*
* Internally, the `key` is converted to a #GQuark using g_quark_from_string().
* This means a copy of `key` is kept permanently (even after `object` has been
* finalized) — so it is recommended to only use a small, bounded set of values
* for `key` in your program, to avoid the #GQuark storage growing unbounded.
* @param key name of the key
* @param data data to associate with that key
*/
set_data(key: string, data?: any | null): void;
/**
* Sets a property on an object.
* @param property_name The name of the property to set
* @param value The value to set the property to
*/
set_property(property_name: string, value: GObject.Value | any): void;
/**
* Remove a specified datum from the object's data associations,
* without invoking the association's destroy handler.
* @param key name of the key
* @returns the data if found, or %NULL if no such data exists.
*/
steal_data(key: string): any | null;
/**
* This function gets back user data pointers stored via
* g_object_set_qdata() and removes the `data` from object
* without invoking its destroy() function (if any was
* set).
* Usually, calling this function is only required to update
* user data pointers with a destroy notifier, for example:
*
* ```c
* void
* object_add_to_user_list (GObject *object,
* const gchar *new_string)
* {
* // the quark, naming the object data
* GQuark quark_string_list = g_quark_from_static_string ("my-string-list");
* // retrieve the old string list
* GList *list = g_object_steal_qdata (object, quark_string_list);
*
* // prepend new string
* list = g_list_prepend (list, g_strdup (new_string));
* // this changed 'list', so we need to set it again
* g_object_set_qdata_full (object, quark_string_list, list, free_string_list);
* }
* static void
* free_string_list (gpointer data)
* {
* GList *node, *list = data;
*
* for (node = list; node; node = node->next)
* g_free (node->data);
* g_list_free (list);
* }
* ```
*
* Using g_object_get_qdata() in the above example, instead of
* g_object_steal_qdata() would have left the destroy function set,
* and thus the partial string list would have been freed upon
* g_object_set_qdata_full().
* @param quark A #GQuark, naming the user data pointer
* @returns The user data pointer set, or %NULL
*/
steal_qdata(quark: GLib.Quark): any | null;
/**
* Reverts the effect of a previous call to
* g_object_freeze_notify(). The freeze count is decreased on `object`
* and when it reaches zero, queued "notify" signals are emitted.
*
* Duplicate notifications for each property are squashed so that at most one
* #GObject::notify signal is emitted for each property, in the reverse order
* in which they have been queued.
*
* It is an error to call this function when the freeze count is zero.
*/
thaw_notify(): void;
/**
* Decreases the reference count of `object`. When its reference count
* drops to 0, the object is finalized (i.e. its memory is freed).
*
* If the pointer to the #GObject may be reused in future (for example, if it is
* an instance variable of another object), it is recommended to clear the
* pointer to %NULL rather than retain a dangling pointer to a potentially
* invalid #GObject instance. Use g_clear_object() for this.
*/
unref(): void;
/**
* This function essentially limits the life time of the `closure` to
* the life time of the object. That is, when the object is finalized,
* the `closure` is invalidated by calling g_closure_invalidate() on
* it, in order to prevent invocations of the closure with a finalized
* (nonexisting) object. Also, g_object_ref() and g_object_unref() are
* added as marshal guards to the `closure,` to ensure that an extra
* reference count is held on `object` during invocation of the
* `closure`. Usually, this function will be called on closures that
* use this `object` as closure data.
* @param closure #GClosure to watch
*/
watch_closure(closure: GObject.Closure): void;
/**
* the `constructed` function is called by g_object_new() as the
* final step of the object creation process. At the point of the call, all
* construction properties have been set on the object. The purpose of this
* call is to allow for object initialisation steps that can only be performed
* after construction properties have been set. `constructed` implementors
* should chain up to the `constructed` call of their parent class to allow it
* to complete its initialisation.
*/
vfunc_constructed(): void;
/**
* emits property change notification for a bunch
* of properties. Overriding `dispatch_properties_changed` should be rarely
* needed.
* @param n_pspecs
* @param pspecs
*/
vfunc_dispatch_properties_changed(n_pspecs: number, pspecs: GObject.ParamSpec): void;
/**
* the `dispose` function is supposed to drop all references to other
* objects, but keep the instance otherwise intact, so that client method
* invocations still work. It may be run multiple times (due to reference
* loops). Before returning, `dispose` should chain up to the `dispose` method
* of the parent class.
*/
vfunc_dispose(): void;
/**
* instance finalization function, should finish the finalization of
* the instance begun in `dispose` and chain up to the `finalize` method of the
* parent class.
*/
vfunc_finalize(): void;
/**
* the generic getter for all properties of this type. Should be
* overridden for every type with properties.
* @param property_id
* @param value
* @param pspec
*/
vfunc_get_property(property_id: number, value: GObject.Value | any, pspec: GObject.ParamSpec): void;
/**
* Emits a "notify" signal for the property `property_name` on `object`.
*
* When possible, eg. when signaling a property change from within the class
* that registered the property, you should use g_object_notify_by_pspec()
* instead.
*
* Note that emission of the notify signal may be blocked with
* g_object_freeze_notify(). In this case, the signal emissions are queued
* and will be emitted (in reverse order) when g_object_thaw_notify() is
* called.
* @param pspec
*/
vfunc_notify(pspec: GObject.ParamSpec): void;
/**
* the generic setter for all properties of this type. Should be
* overridden for every type with properties. If implementations of
* `set_property` don't emit property change notification explicitly, this will
* be done implicitly by the type system. However, if the notify signal is
* emitted explicitly, the type system will not emit it a second time.
* @param property_id
* @param value
* @param pspec
*/
vfunc_set_property(property_id: number, value: GObject.Value | any, pspec: GObject.ParamSpec): void;
/**
* Disconnects a handler from an instance so it will not be called during any future or currently ongoing emissions of the signal it has been connected to.
* @param id Handler ID of the handler to be disconnected
*/
disconnect(id: number): void;
/**
* Sets multiple properties of an object at once. The properties argument should be a dictionary mapping property names to values.
* @param properties Object containing the properties to set
*/
set(properties: { [key: string]: any }): void;
/**
* Blocks a handler of an instance so it will not be called during any signal emissions
* @param id Handler ID of the handler to be blocked
*/
block_signal_handler(id: number): void;
/**
* Unblocks a handler so it will be called again during any signal emissions
* @param id Handler ID of the handler to be unblocked
*/
unblock_signal_handler(id: number): void;
/**
* Stops a signal's emission by the given signal name. This will prevent the default handler and any subsequent signal handlers from being invoked.
* @param detailedName Name of the signal to stop emission of
*/
stop_emission_by_name(detailedName: string): void;
}
namespace File {
// Constructor properties interface
interface ConstructorProps extends GObject.Object.ConstructorProps {
compression_type: CompressionType;
compressionType: CompressionType;
encoding: Encoding;
location: Gio.File;
newline_type: NewlineType;
newlineType: NewlineType;
read_only: boolean;
readOnly: boolean;
}
}
class File extends GObject.Object {
static $gtype: GObject.GType;
// Properties
/**
* The compression type.
*/
get compression_type(): CompressionType;
/**
* The compression type.
*/
get compressionType(): CompressionType;
/**
* The character encoding, initially %NULL. After a successful file
* loading or saving operation, the encoding is non-%NULL.
*/
get encoding(): Encoding;
/**
* The location.
*/
get location(): Gio.File;
set location(val: Gio.File);
/**
* The line ending type.
*/
get newline_type(): NewlineType;
/**
* The line ending type.
*/
get newlineType(): NewlineType;
/**
* Whether the file is read-only or not. The value of this property is
* not updated automatically (there is no file monitors).
*/
get read_only(): boolean;
/**
* Whether the file is read-only or not. The value of this property is
* not updated automatically (there is no file monitors).
*/
get readOnly(): boolean;
// Constructors
constructor(properties?: Partial, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): File;
// Methods
/**
* 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.
*
* #GtkSourceFile doesn't create a #GFileMonitor to track those properties, so
* this function needs to be called instead. Creating lots of #GFileMonitor'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().
*/
check_file_on_disk(): void;
get_compression_type(): CompressionType;
/**
* The encoding is initially %NULL. After a successful file loading or saving
* operation, the encoding is non-%NULL.
* @returns the character encoding.
*/
get_encoding(): Encoding;
get_location(): Gio.File;
get_newline_type(): NewlineType;
/**
* Returns whether the file has been deleted. If the
* #GtkSourceFile:location is %NULL, returns %FALSE.
*
* To have an up-to-date value, you must first call
* gtk_source_file_check_file_on_disk().
* @returns whether the file has been deleted.
*/
is_deleted(): boolean;
/**
* Returns whether the file is externally modified. If the
* #GtkSourceFile:location is %NULL, returns %FALSE.
*
* To have an up-to-date value, you must first call
* gtk_source_file_check_file_on_disk().
* @returns whether the file is externally modified.
*/
is_externally_modified(): boolean;
/**
* Returns whether the file is local. If the #GtkSourceFile:location is %NULL,
* returns %FALSE.
* @returns whether the file is local.
*/
is_local(): boolean;
/**
* Returns whether the file is read-only. If the
* #GtkSourceFile:location is %NULL, returns %FALSE.
*
* To have an up-to-date value, you must first call
* gtk_source_file_check_file_on_disk().
* @returns whether the file is read-only.
*/
is_readonly(): boolean;
/**
* Sets the location.
* @param location the new #GFile, or %NULL.
*/
set_location(location?: Gio.File | null): void;
}
namespace FileLoader {
// Constructor properties interface
interface ConstructorProps extends GObject.Object.ConstructorProps {
buffer: Buffer;
file: File;
input_stream: Gio.InputStream;
inputStream: Gio.InputStream;
location: Gio.File;
}
}
class FileLoader extends GObject.Object {
static $gtype: GObject.GType;
// Properties
/**
* The #GtkSourceBuffer to load the contents into. The
* #GtkSourceFileLoader object has a weak reference to the buffer.
*/
get buffer(): Buffer;
/**
* The #GtkSourceFile. The #GtkSourceFileLoader object has a weak
* reference to the file.
*/
get file(): File;
/**
* The #GInputStream to load. Useful for reading stdin. If this property
* is set, the #GtkSourceFileLoader:location property is ignored.
*/
get input_stream(): Gio.InputStream;
/**
* The #GInputStream to load. Useful for reading stdin. If this property
* is set, the #GtkSourceFileLoader:location property is ignored.
*/
get inputStream(): Gio.InputStream;
/**
* The #GFile to load. If the #GtkSourceFileLoader:input-stream is
* %NULL, by default the location is taken from the #GtkSourceFile at
* construction time.
*/
get location(): Gio.File;
// Constructors
constructor(properties?: Partial, ...args: any[]);
_init(...args: any[]): void;
static ['new'](buffer: Buffer, file: File): FileLoader;
static new_from_stream(buffer: Buffer, file: File, stream: Gio.InputStream): FileLoader;
// Methods
get_buffer(): Buffer;
get_compression_type(): CompressionType;
get_encoding(): Encoding;
get_file(): File;
get_input_stream(): Gio.InputStream | null;
get_location(): Gio.File | null;
get_newline_type(): NewlineType;
/**
* Loads asynchronously the file or input stream contents into the
* #GtkSourceBuffer. See the #GAsyncResult documentation to know how to use this
* function.
* @param io_priority the I/O priority of the request. E.g. %G_PRIORITY_LOW, %G_PRIORITY_DEFAULT or %G_PRIORITY_HIGH.
* @param cancellable optional #GCancellable object, %NULL to ignore.
* @param progress_callback function to call back with progress information, or %NULL if progress information is not needed.
* @param progress_callback_notify function to call on @progress_callback_data when the @progress_callback is no longer needed, or %NULL.
*/
load_async(
io_priority: number,
cancellable?: Gio.Cancellable | null,
progress_callback?: Gio.FileProgressCallback | null,
progress_callback_notify?: GLib.DestroyNotify | null,
): Promise;
/**
* Loads asynchronously the file or input stream contents into the
* #GtkSourceBuffer. See the #GAsyncResult documentation to know how to use this
* function.
* @param io_priority the I/O priority of the request. E.g. %G_PRIORITY_LOW, %G_PRIORITY_DEFAULT or %G_PRIORITY_HIGH.
* @param cancellable optional #GCancellable object, %NULL to ignore.
* @param progress_callback function to call back with progress information, or %NULL if progress information is not needed.
* @param progress_callback_notify function to call on @progress_callback_data when the @progress_callback is no longer needed, or %NULL.
* @param callback a #GAsyncReadyCallback to call when the request is satisfied.
*/
load_async(
io_priority: number,
cancellable: Gio.Cancellable | null,
progress_callback: Gio.FileProgressCallback | null,
progress_callback_notify: GLib.DestroyNotify | null,
callback: Gio.AsyncReadyCallback | null,
): void;
/**
* Loads asynchronously the file or input stream contents into the
* #GtkSourceBuffer. See the #GAsyncResult documentation to know how to use this
* function.
* @param io_priority the I/O priority of the request. E.g. %G_PRIORITY_LOW, %G_PRIORITY_DEFAULT or %G_PRIORITY_HIGH.
* @param cancellable optional #GCancellable object, %NULL to ignore.
* @param progress_callback function to call back with progress information, or %NULL if progress information is not needed.
* @param progress_callback_notify function to call on @progress_callback_data when the @progress_callback is no longer needed, or %NULL.
* @param callback a #GAsyncReadyCallback to call when the request is satisfied.
*/
load_async(
io_priority: number,
cancellable?: Gio.Cancellable | null,
progress_callback?: Gio.FileProgressCallback | null,
progress_callback_notify?: GLib.DestroyNotify | null,
callback?: Gio.AsyncReadyCallback | null,
): Promise | void;
/**
* Finishes a file loading started with gtk_source_file_loader_load_async().
*
* If the contents has been loaded, the following #GtkSourceFile properties will
* be updated: the location, the encoding, the newline type and the compression
* type.
* @param result a #GAsyncResult.
* @returns whether the contents has been loaded successfully.
*/
load_finish(result: Gio.AsyncResult): boolean;
/**
* 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 #GtkSourceFile's encoding as returned by
* gtk_source_file_get_encoding().
* 2. The default candidates as returned by
* gtk_source_encoding_get_default_candidates().
* @param candidate_encodings a list of #GtkSourceEncodings.
*/
set_candidate_encodings(candidate_encodings: Encoding[]): void;
}
namespace FileSaver {
// Constructor properties interface
interface ConstructorProps extends GObject.Object.ConstructorProps {
buffer: Buffer;
compression_type: CompressionType;
compressionType: CompressionType;
encoding: Encoding;
file: File;
flags: FileSaverFlags;
location: Gio.File;
newline_type: NewlineType;
newlineType: NewlineType;
}
}
class FileSaver extends GObject.Object {
static $gtype: GObject.GType;
// Properties
/**
* The #GtkSourceBuffer to save. The #GtkSourceFileSaver object has a
* weak reference to the buffer.
*/
get buffer(): Buffer;
/**
* The compression type.
*/
get compression_type(): CompressionType;
set compression_type(val: CompressionType);
/**
* The compression type.
*/
get compressionType(): CompressionType;
set compressionType(val: CompressionType);
/**
* The file's encoding.
*/
get encoding(): Encoding;
set encoding(val: Encoding);
/**
* The #GtkSourceFile. The #GtkSourceFileSaver object has a weak
* reference to the file.
*/
get file(): File;
/**
* File saving flags.
*/
get flags(): FileSaverFlags;
set flags(val: FileSaverFlags);
/**
* The #GFile where to save the buffer. By default the location is taken
* from the #GtkSourceFile at construction time.
*/
get location(): Gio.File;
/**
* The newline type.
*/
get newline_type(): NewlineType;
set newline_type(val: NewlineType);
/**
* The newline type.
*/
get newlineType(): NewlineType;
set newlineType(val: NewlineType);
// Fields
object: GObject.Object;
// Constructors
constructor(properties?: Partial, ...args: any[]);
_init(...args: any[]): void;
static ['new'](buffer: Buffer, file: File): FileSaver;
static new_with_target(buffer: Buffer, file: File, target_location: Gio.File): FileSaver;
// Methods
get_buffer(): Buffer;
get_compression_type(): CompressionType;
get_encoding(): Encoding;
get_file(): File;
get_flags(): FileSaverFlags;
get_location(): Gio.File;
get_newline_type(): NewlineType;
/**
* Saves asynchronously the buffer into the file. See the #GAsyncResult
* documentation to know how to use this function.
* @param io_priority the I/O priority of the request. E.g. %G_PRIORITY_LOW, %G_PRIORITY_DEFAULT or %G_PRIORITY_HIGH.
* @param cancellable optional #GCancellable object, %NULL to ignore.
* @param progress_callback function to call back with progress information, or %NULL if progress information is not needed.
* @param progress_callback_notify function to call on @progress_callback_data when the @progress_callback is no longer needed, or %NULL.
*/
save_async(
io_priority: number,
cancellable?: Gio.Cancellable | null,
progress_callback?: Gio.FileProgressCallback | null,
progress_callback_notify?: GLib.DestroyNotify | null,
): Promise;
/**
* Saves asynchronously the buffer into the file. See the #GAsyncResult
* documentation to know how to use this function.
* @param io_priority the I/O priority of the request. E.g. %G_PRIORITY_LOW, %G_PRIORITY_DEFAULT or %G_PRIORITY_HIGH.
* @param cancellable optional #GCancellable object, %NULL to ignore.
* @param progress_callback function to call back with progress information, or %NULL if progress information is not needed.
* @param progress_callback_notify function to call on @progress_callback_data when the @progress_callback is no longer needed, or %NULL.
* @param callback a #GAsyncReadyCallback to call when the request is satisfied.
*/
save_async(
io_priority: number,
cancellable: Gio.Cancellable | null,
progress_callback: Gio.FileProgressCallback | null,
progress_callback_notify: GLib.DestroyNotify | null,
callback: Gio.AsyncReadyCallback | null,
): void;
/**
* Saves asynchronously the buffer into the file. See the #GAsyncResult
* documentation to know how to use this function.
* @param io_priority the I/O priority of the request. E.g. %G_PRIORITY_LOW, %G_PRIORITY_DEFAULT or %G_PRIORITY_HIGH.
* @param cancellable optional #GCancellable object, %NULL to ignore.
* @param progress_callback function to call back with progress information, or %NULL if progress information is not needed.
* @param progress_callback_notify function to call on @progress_callback_data when the @progress_callback is no longer needed, or %NULL.
* @param callback a #GAsyncReadyCallback to call when the request is satisfied.
*/
save_async(
io_priority: number,
cancellable?: Gio.Cancellable | null,
progress_callback?: Gio.FileProgressCallback | null,
progress_callback_notify?: GLib.DestroyNotify | null,
callback?: Gio.AsyncReadyCallback | null,
): Promise | void;
/**
* Finishes a file saving started with gtk_source_file_saver_save_async().
*
* If the file has been saved successfully, the following #GtkSourceFile
* 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.
* @param result a #GAsyncResult.
* @returns whether the file was saved successfully.
*/
save_finish(result: Gio.AsyncResult): boolean;
/**
* Sets the compression type. By default the compression type is taken from the
* #GtkSourceFile.
* @param compression_type the new compression type.
*/
set_compression_type(compression_type: CompressionType | null): void;
/**
* Sets the encoding. If `encoding` is %NULL, the UTF-8 encoding will be set.
* By default the encoding is taken from the #GtkSourceFile.
* @param encoding the new encoding, or %NULL for UTF-8.
*/
set_encoding(encoding?: Encoding | null): void;
set_flags(flags: FileSaverFlags | null): void;
/**
* Sets the newline type. By default the newline type is taken from the
* #GtkSourceFile.
* @param newline_type the new newline type.
*/
set_newline_type(newline_type: NewlineType | null): void;
}
namespace Gutter {
// Constructor properties interface
interface ConstructorProps extends GObject.Object.ConstructorProps {
view: View;
window_type: Gtk.TextWindowType;
windowType: Gtk.TextWindowType;
}
}
class Gutter extends GObject.Object {
static $gtype: GObject.GType;
// Properties
/**
* The #GtkSourceView of the gutter.
*/
get view(): View;
/**
* The text window type on which the window is placed.
*/
get window_type(): Gtk.TextWindowType;
/**
* The text window type on which the window is placed.
*/
get windowType(): Gtk.TextWindowType;
// Constructors
constructor(properties?: Partial, ...args: any[]);
_init(...args: any[]): void;
// Methods
/**
* Finds the #GtkSourceGutterRenderer at (x, y).
* @param x The x position to get identified.
* @param y The y position to get identified.
* @returns the renderer at (x, y) or %NULL.
*/
get_renderer_at_pos(x: number, y: number): GutterRenderer | null;
get_view(): View;
get_window_type(): Gtk.TextWindowType;
/**
* 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.
* @param renderer a gutter renderer (must inherit from #GtkSourceGutterRenderer).
* @param position the renderer position.
* @returns %TRUE if operation succeeded. Otherwise %FALSE.
*/
insert(renderer: GutterRenderer, position: number): boolean;
/**
* 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.
*/
queue_draw(): void;
/**
* Removes `renderer` from `gutter`.
* @param renderer a #GtkSourceGutterRenderer.
*/
remove(renderer: GutterRenderer): void;
/**
* Reorders `renderer` in `gutter` to new `position`.
* @param renderer a #GtkCellRenderer.
* @param position the new renderer position.
*/
reorder(renderer: GutterRenderer, position: number): void;
}
namespace GutterRenderer {
// Signal callback interfaces
interface Activate {
(iter: Gtk.TextIter, area: Gdk.Rectangle, event: Gdk.Event): void;
}
interface QueryActivatable {
(iter: Gtk.TextIter, area: Gdk.Rectangle, event: Gdk.Event): boolean;
}
interface QueryData {
(start: Gtk.TextIter, end: Gtk.TextIter, state: GutterRendererState): void;
}
interface QueryTooltip {
(iter: Gtk.TextIter, area: Gdk.Rectangle, x: number, y: number, tooltip: Gtk.Tooltip): boolean;
}
interface QueueDraw {
(): void;
}
// Constructor properties interface
interface ConstructorProps extends GObject.InitiallyUnowned.ConstructorProps {
alignment_mode: GutterRendererAlignmentMode;
alignmentMode: GutterRendererAlignmentMode;
background_rgba: Gdk.RGBA;
backgroundRgba: Gdk.RGBA;
background_set: boolean;
backgroundSet: boolean;
size: number;
view: Gtk.TextView;
visible: boolean;
window_type: Gtk.TextWindowType;
windowType: Gtk.TextWindowType;
xalign: number;
xpad: number;
yalign: number;
ypad: number;
}
}
abstract class GutterRenderer extends GObject.InitiallyUnowned {
static $gtype: GObject.GType;
// Properties
/**
* The alignment mode of the renderer. This can be used to indicate
* that in the case a cell spans multiple lines (due to text wrapping)
* the alignment should work on either the full cell, the first line
* or the last line.
*/
get alignment_mode(): GutterRendererAlignmentMode;
set alignment_mode(val: GutterRendererAlignmentMode);
/**
* The alignment mode of the renderer. This can be used to indicate
* that in the case a cell spans multiple lines (due to text wrapping)
* the alignment should work on either the full cell, the first line
* or the last line.
*/
get alignmentMode(): GutterRendererAlignmentMode;
set alignmentMode(val: GutterRendererAlignmentMode);
get background_rgba(): Gdk.RGBA;
set background_rgba(val: Gdk.RGBA);
get backgroundRgba(): Gdk.RGBA;
set backgroundRgba(val: Gdk.RGBA);
get background_set(): boolean;
set background_set(val: boolean);
get backgroundSet(): boolean;
set backgroundSet(val: boolean);
get size(): number;
set size(val: number);
/**
* The view on which the renderer is placed.
*/
get view(): Gtk.TextView;
/**
* The visibility of the renderer.
*/
get visible(): boolean;
set visible(val: boolean);
/**
* The window type of the view on which the renderer is placed (left,
* or right).
*/
get window_type(): Gtk.TextWindowType;
/**
* The window type of the view on which the renderer is placed (left,
* or right).
*/
get windowType(): Gtk.TextWindowType;
/**
* The horizontal alignment of the renderer. Set to 0 for a left
* alignment. 1 for a right alignment. And 0.5 for centering the cells.
* A value lower than 0 doesn't modify the alignment.
*/
get xalign(): number;
set xalign(val: number);
/**
* The left and right padding of the renderer.
*/
get xpad(): number;
set xpad(val: number);
/**
* The vertical alignment of the renderer. Set to 0 for a top
* alignment. 1 for a bottom alignment. And 0.5 for centering the cells.
* A value lower than 0 doesn't modify the alignment.
*/
get yalign(): number;
set yalign(val: number);
/**
* The top and bottom padding of the renderer.
*/
get ypad(): number;
set ypad(val: number);
// Constructors
constructor(properties?: Partial, ...args: any[]);
_init(...args: any[]): void;
// Signals
connect(id: string, callback: (...args: any[]) => any): number;
connect_after(id: string, callback: (...args: any[]) => any): number;
emit(id: string, ...args: any[]): void;
connect(
signal: 'activate',
callback: (_source: this, iter: Gtk.TextIter, area: Gdk.Rectangle, event: Gdk.Event) => void,
): number;
connect_after(
signal: 'activate',
callback: (_source: this, iter: Gtk.TextIter, area: Gdk.Rectangle, event: Gdk.Event) => void,
): number;
emit(signal: 'activate', iter: Gtk.TextIter, area: Gdk.Rectangle, event: Gdk.Event): void;
connect(
signal: 'query-activatable',
callback: (_source: this, iter: Gtk.TextIter, area: Gdk.Rectangle, event: Gdk.Event) => boolean,
): number;
connect_after(
signal: 'query-activatable',
callback: (_source: this, iter: Gtk.TextIter, area: Gdk.Rectangle, event: Gdk.Event) => boolean,
): number;
emit(signal: 'query-activatable', iter: Gtk.TextIter, area: Gdk.Rectangle, event: Gdk.Event): void;
connect(
signal: 'query-data',
callback: (_source: this, start: Gtk.TextIter, end: Gtk.TextIter, state: GutterRendererState) => void,
): number;
connect_after(
signal: 'query-data',
callback: (_source: this, start: Gtk.TextIter, end: Gtk.TextIter, state: GutterRendererState) => void,
): number;
emit(signal: 'query-data', start: Gtk.TextIter, end: Gtk.TextIter, state: GutterRendererState): void;
connect(
signal: 'query-tooltip',
callback: (
_source: this,
iter: Gtk.TextIter,
area: Gdk.Rectangle,
x: number,
y: number,
tooltip: Gtk.Tooltip,
) => boolean,
): number;
connect_after(
signal: 'query-tooltip',
callback: (
_source: this,
iter: Gtk.TextIter,
area: Gdk.Rectangle,
x: number,
y: number,
tooltip: Gtk.Tooltip,
) => boolean,
): number;
emit(
signal: 'query-tooltip',
iter: Gtk.TextIter,
area: Gdk.Rectangle,
x: number,
y: number,
tooltip: Gtk.Tooltip,
): void;
connect(signal: 'queue-draw', callback: (_source: this) => void): number;
connect_after(signal: 'queue-draw', callback: (_source: this) => void): number;
emit(signal: 'queue-draw'): void;
// Virtual methods
/**
* Emits the #GtkSourceGutterRenderer::activate signal of the renderer. This is
* called from #GtkSourceGutter and should never have to be called manually.
* @param iter a #GtkTextIter at the start of the line where the renderer is activated
* @param area a #GdkRectangle of the cell area where the renderer is activated
* @param event the event that triggered the activation
*/
vfunc_activate(iter: Gtk.TextIter, area: Gdk.Rectangle, event: Gdk.Event): void;
/**
* 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.
* @param cr a #cairo_t
* @param background_area a #GdkRectangle
* @param cell_area a #GdkRectangle
* @param start a #GtkTextIter
* @param end a #GtkTextIter
*/
vfunc_begin(
cr: cairo.Context,
background_area: Gdk.Rectangle,
cell_area: Gdk.Rectangle,
start: Gtk.TextIter,
end: Gtk.TextIter,
): void;
/**
* This is called when the text buffer changes for `renderer`.
* @param old_buffer the old #GtkTextBuffer.
*/
vfunc_change_buffer(old_buffer?: Gtk.TextBuffer | null): void;
/**
* This is called when the text view changes for `renderer`.
* @param old_view the old #GtkTextView.
*/
vfunc_change_view(old_view?: Gtk.TextView | null): void;
/**
* 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 #GtkSourceGutterRenderer:xpad horizontally and two times the
* #GtkSourceGutterRenderer: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.
* @param cr the cairo render context
* @param background_area a #GdkRectangle indicating the total area to be drawn
* @param cell_area a #GdkRectangle indicating the area to draw content
* @param start a #GtkTextIter
* @param end a #GtkTextIter
* @param state a #GtkSourceGutterRendererState
*/
vfunc_draw(
cr: cairo.Context,
background_area: Gdk.Rectangle,
cell_area: Gdk.Rectangle,
start: Gtk.TextIter,
end: Gtk.TextIter,
state: GutterRendererState,
): void;
/**
* Called when drawing a region of lines has ended.
*/
vfunc_end(): void;
/**
* Get whether the renderer is activatable at the location in `event`. This is
* called from #GtkSourceGutter to determine whether a renderer is activatable
* using the mouse pointer.
* @param iter a #GtkTextIter at the start of the line to be activated
* @param area a #GdkRectangle of the cell area to be activated
* @param event the event that triggered the query
*/
vfunc_query_activatable(iter: Gtk.TextIter, area: Gdk.Rectangle, event: Gdk.Event): boolean;
/**
* Emit the #GtkSourceGutterRenderer::query-data signal. This function is called
* to query for data just before rendering a cell. This is called from the
* #GtkSourceGutter. Implementations can override the default signal handler or
* can connect a signal handler externally to the
* #GtkSourceGutterRenderer::query-data signal.
* @param start a #GtkTextIter.
* @param end a #GtkTextIter.
* @param state a #GtkSourceGutterRendererState.
*/
vfunc_query_data(start: Gtk.TextIter, end: Gtk.TextIter, state: GutterRendererState): void;
/**
* Emits the #GtkSourceGutterRenderer::query-tooltip signal. This function is
* called from #GtkSourceGutter. Implementations can override the default signal
* handler or can connect to the signal externally.
* @param iter a #GtkTextIter.
* @param area a #GdkRectangle.
* @param x The x position of the tooltip.
* @param y The y position of the tooltip.
* @param tooltip a #GtkTooltip.
*/
vfunc_query_tooltip(
iter: Gtk.TextIter,
area: Gdk.Rectangle,
x: number,
y: number,
tooltip: Gtk.Tooltip,
): boolean;
/**
* Emits the #GtkSourceGutterRenderer::queue-draw signal of the renderer. Call
* this from an implementation to inform that the renderer has changed such that
* it needs to redraw.
*/
vfunc_queue_draw(): void;
// Methods
/**
* Emits the #GtkSourceGutterRenderer::activate signal of the renderer. This is
* called from #GtkSourceGutter and should never have to be called manually.
* @param iter a #GtkTextIter at the start of the line where the renderer is activated
* @param area a #GdkRectangle of the cell area where the renderer is activated
* @param event the event that triggered the activation
*/
activate(iter: Gtk.TextIter, area: Gdk.Rectangle, event: Gdk.Event): void;
/**
* 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.
* @param cr a #cairo_t
* @param background_area a #GdkRectangle
* @param cell_area a #GdkRectangle
* @param start a #GtkTextIter
* @param end a #GtkTextIter
*/
begin(
cr: cairo.Context,
background_area: Gdk.Rectangle,
cell_area: Gdk.Rectangle,
start: Gtk.TextIter,
end: Gtk.TextIter,
): void;
/**
* 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 #GtkSourceGutterRenderer:xpad horizontally and two times the
* #GtkSourceGutterRenderer: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.
* @param cr the cairo render context
* @param background_area a #GdkRectangle indicating the total area to be drawn
* @param cell_area a #GdkRectangle indicating the area to draw content
* @param start a #GtkTextIter
* @param end a #GtkTextIter
* @param state a #GtkSourceGutterRendererState
*/
draw(
cr: cairo.Context,
background_area: Gdk.Rectangle,
cell_area: Gdk.Rectangle,
start: Gtk.TextIter,
end: Gtk.TextIter,
state: GutterRendererState | null,
): void;
/**
* Called when drawing a region of lines has ended.
*/
end(): void;
/**
* Get the x-alignment and y-alignment of the gutter renderer.
*/
get_alignment(): [number, number];
/**
* Get the alignment mode. The alignment mode describes the manner in which the
* renderer is aligned (see :xalign and :yalign).
* @returns a #GtkSourceGutterRendererAlignmentMode
*/
get_alignment_mode(): GutterRendererAlignmentMode;
/**
* Get the background color of the renderer.
* @returns %TRUE if the background color is set, %FALSE otherwise
*/
get_background(): [boolean, Gdk.RGBA | null];
/**
* Get the x-padding and y-padding of the gutter renderer.
*/
get_padding(): [number, number];
/**
* Get the size of the renderer.
* @returns the size of the renderer.
*/
get_size(): number;
/**
* Get the view associated to the gutter renderer
* @returns a #GtkTextView
*/
get_view(): Gtk.TextView;
/**
* Get whether the gutter renderer is visible.
* @returns %TRUE if the renderer is visible, %FALSE otherwise
*/
get_visible(): boolean;
/**
* Get the #GtkTextWindowType associated with the gutter renderer.
* @returns a #GtkTextWindowType
*/
get_window_type(): Gtk.TextWindowType;
/**
* Get whether the renderer is activatable at the location in `event`. This is
* called from #GtkSourceGutter to determine whether a renderer is activatable
* using the mouse pointer.
* @param iter a #GtkTextIter at the start of the line to be activated
* @param area a #GdkRectangle of the cell area to be activated
* @param event the event that triggered the query
* @returns %TRUE if the renderer can be activated, %FALSE otherwise
*/
query_activatable(iter: Gtk.TextIter, area: Gdk.Rectangle, event: Gdk.Event): boolean;
/**
* Emit the #GtkSourceGutterRenderer::query-data signal. This function is called
* to query for data just before rendering a cell. This is called from the
* #GtkSourceGutter. Implementations can override the default signal handler or
* can connect a signal handler externally to the
* #GtkSourceGutterRenderer::query-data signal.
* @param start a #GtkTextIter.
* @param end a #GtkTextIter.
* @param state a #GtkSourceGutterRendererState.
*/
query_data(start: Gtk.TextIter, end: Gtk.TextIter, state: GutterRendererState | null): void;
/**
* Emits the #GtkSourceGutterRenderer::query-tooltip signal. This function is
* called from #GtkSourceGutter. Implementations can override the default signal
* handler or can connect to the signal externally.
* @param iter a #GtkTextIter.
* @param area a #GdkRectangle.
* @param x The x position of the tooltip.
* @param y The y position of the tooltip.
* @param tooltip a #GtkTooltip.
* @returns %TRUE if the tooltip has been set, %FALSE otherwise
*/
query_tooltip(iter: Gtk.TextIter, area: Gdk.Rectangle, x: number, y: number, tooltip: Gtk.Tooltip): boolean;
/**
* Emits the #GtkSourceGutterRenderer::queue-draw signal of the renderer. Call
* this from an implementation to inform that the renderer has changed such that
* it needs to redraw.
*/
queue_draw(): void;
/**
* 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.
* @param xalign the x-alignment
* @param yalign the y-alignment
*/
set_alignment(xalign: number, yalign: number): void;
/**
* Set the alignment mode. The alignment mode describes the manner in which the
* renderer is aligned (see :xalign and :yalign).
* @param mode a #GtkSourceGutterRendererAlignmentMode
*/
set_alignment_mode(mode: GutterRendererAlignmentMode | null): void;
/**
* Set the background color of the renderer. If `color` is set to %NULL, the
* renderer will not have a background color.
* @param color a #GdkRGBA or %NULL
*/
set_background(color?: Gdk.RGBA | null): void;
/**
* 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.
* @param xpad the x-padding
* @param ypad the y-padding
*/
set_padding(xpad: number, ypad: number): void;
/**
* Sets the size of the renderer. A value of -1 specifies that the size
* is to be determined dynamically.
* @param size the size
*/
set_size(size: number): void;
/**
* Set whether the gutter renderer is visible.
* @param visible the visibility
*/
set_visible(visible: boolean): void;
}
namespace GutterRendererPixbuf {
// Constructor properties interface
interface ConstructorProps extends GutterRenderer.ConstructorProps {
gicon: Gio.Icon;
icon_name: string;
iconName: string;
pixbuf: GdkPixbuf.Pixbuf;
}
}
class GutterRendererPixbuf extends GutterRenderer {
static $gtype: GObject.GType;
// Properties
get gicon(): Gio.Icon;
set gicon(val: Gio.Icon);
get icon_name(): string;
set icon_name(val: string);
get iconName(): string;
set iconName(val: string);
get pixbuf(): GdkPixbuf.Pixbuf;
set pixbuf(val: GdkPixbuf.Pixbuf);
// Constructors
constructor(properties?: Partial, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): GutterRendererPixbuf;
// Methods
/**
* Get the gicon of the renderer
* @returns a #GIcon
*/
get_gicon(): Gio.Icon;
get_icon_name(): string;
/**
* Get the pixbuf of the renderer.
* @returns a #GdkPixbuf
*/
get_pixbuf(): GdkPixbuf.Pixbuf;
set_gicon(icon?: Gio.Icon | null): void;
set_icon_name(icon_name?: string | null): void;
set_pixbuf(pixbuf?: GdkPixbuf.Pixbuf | null): void;
}
namespace GutterRendererText {
// Constructor properties interface
interface ConstructorProps extends GutterRenderer.ConstructorProps {
markup: string;
text: string;
}
}
class GutterRendererText extends GutterRenderer {
static $gtype: GObject.GType;
// Properties
get markup(): string;
set markup(val: string);
get text(): string;
set text(val: string);
// Constructors
constructor(properties?: Partial, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): GutterRendererText;
// Methods
/**
* Measures the text provided using the pango layout used by the
* #GtkSourceGutterRendererText.
* @param text the text to measure.
*/
measure(text: string): [number, number];
/**
* Measures the pango markup provided using the pango layout used by the
* #GtkSourceGutterRendererText.
* @param markup the pango markup to measure.
*/
measure_markup(markup: string): [number, number];
set_markup(markup: string, length: number): void;
set_text(text: string, length: number): void;
}
namespace Language {
// Constructor properties interface
interface ConstructorProps extends GObject.Object.ConstructorProps {
hidden: boolean;
id: string;
name: string;
section: string;
}
}
class Language extends GObject.Object {
static $gtype: GObject.GType;
// Properties
get hidden(): boolean;
get id(): string;
get name(): string;
get section(): string;
// Constructors
constructor(properties?: Partial, ...args: any[]);
_init(...args: any[]): void;
// Methods
/**
* 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.
* @returns 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().
*/
get_globs(): string[] | null;
/**
* Returns whether the language should be hidden from the user.
* @returns %TRUE if the language should be hidden, %FALSE otherwise.
*/
get_hidden(): boolean;
/**
* 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.
* @returns the ID of @language.
*/
get_id(): string;
get_metadata(name: string): string | null;
/**
* 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.
* @returns 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().
*/
get_mime_types(): string[] | null;
/**
* Returns the localized name of the language.
* The returned string is owned by `language` and should not be freed
* or modified.
* @returns the name of @language.
*/
get_name(): string;
/**
* 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.
* @returns the section of @language.
*/
get_section(): string;
/**
* Returns the ID of the style to use if the specified `style_id`
* is not present in the current style scheme.
* @param style_id a style ID.
* @returns the 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.
*/
get_style_fallback(style_id: string): string | null;
/**
* Returns the ids of the styles defined by this `language`.
* @returns 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().
*/
get_style_ids(): string[] | null;
/**
* Returns the name of the style with ID `style_id` defined by this `language`.
* @param style_id a style ID.
* @returns the 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.
*/
get_style_name(style_id: string): string | null;
}
namespace LanguageManager {
// Constructor properties interface
interface ConstructorProps extends GObject.Object.ConstructorProps {
language_ids: string[];
languageIds: string[];
search_path: string[];
searchPath: string[];
}
}
class LanguageManager extends GObject.Object {
static $gtype: GObject.GType;
// Properties
get language_ids(): string[];
get languageIds(): string[];
get search_path(): string[];
set search_path(val: string[]);
get searchPath(): string[];
set searchPath(val: string[]);
// Constructors
constructor(properties?: Partial, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): LanguageManager;
// Static methods
/**
* Returns the default #GtkSourceLanguageManager instance.
*/
static get_default(): LanguageManager;
// Methods
/**
* Gets the #GtkSourceLanguage identified by the given `id` in the language
* manager.
* @param id a language id.
* @returns a #GtkSourceLanguage, or %NULL if there is no language identified by the given @id. Return value is owned by @lm and should not be freed.
*/
get_language(id: string): Language | null;
/**
* Returns the ids of the available languages.
* @returns 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.
*/
get_language_ids(): string[] | null;
/**
* Gets the list directories where `lm` looks for language files.
* @returns %NULL-terminated array containg a list of language files directories. The array is owned by @lm and must not be modified.
*/
get_search_path(): string[];
/**
* Picks a #GtkSourceLanguage 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:
*
*
* GtkSourceLanguage *lang;
* lang = gtk_source_language_manager_guess_language (filename, NULL);
* gtk_source_buffer_set_language (buffer, lang);
*
*
* or
*
*
* 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);
*
*
* etc. Use gtk_source_language_get_mime_types() and gtk_source_language_get_globs()
* if you need full control over file -> language mapping.
* @param filename a filename in Glib filename encoding, or %NULL.
* @param content_type a content type (as in GIO API), or %NULL.
* @returns a #GtkSourceLanguage, 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.
*/
guess_language(filename?: string | null, content_type?: string | null): Language | null;
/**
* Sets the list of directories where the `lm` looks for
* language files.
* If `dirs` is %NULL, the search path is reset to default.
*
*
*
* 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 #GtkSourceLanguageManager,
* you have to call this function right after creating it.
*
*
* @param dirs a %NULL-terminated array of strings or %NULL.
*/
set_search_path(dirs?: string[] | null): void;
}
namespace Map {
// Constructor properties interface
interface ConstructorProps
extends View.ConstructorProps,
Atk.ImplementorIface.ConstructorProps,
Gtk.Buildable.ConstructorProps,
Gtk.Scrollable.ConstructorProps {
font_desc: Pango.FontDescription;
fontDesc: Pango.FontDescription;
view: View;
}
}
class Map extends View implements Atk.ImplementorIface, Gtk.Buildable, Gtk.Scrollable {
static $gtype: GObject.GType